From 072e5d0fe052fda9f85fa8ec131c7bd7957ee902 Mon Sep 17 00:00:00 2001 From: Takaaki Mizuno Date: Sat, 7 Apr 2018 10:19:21 +0800 Subject: [PATCH] :+1: Add Method Getter on PathInfo --- src/Objects/V20/PathItem.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Objects/V20/PathItem.php b/src/Objects/V20/PathItem.php index ad81695..254a575 100644 --- a/src/Objects/V20/PathItem.php +++ b/src/Objects/V20/PathItem.php @@ -49,6 +49,18 @@ class PathItem extends Base Base::KEY_IS_OBJECT => false, Base::KEY_ITEM_TYPE => Parameter::class, ], - ]; + + public function getMethods() + { + $ret = []; + $methods = ['get', 'post', 'put', 'delete', 'options', 'head', 'patch']; + foreach ($methods as $method) { + if (array_key_exists($method, $this->data)) { + $ret[] = $this->data[$method]; + } + } + + return $ret; + } }