Skip to content

Commit

Permalink
👍 Add Method Getter on PathInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
takaaki-mizuno committed Apr 7, 2018
1 parent 7d1d71a commit 072e5d0
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Objects/V20/PathItem.php
Expand Up @@ -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;
}
}

0 comments on commit 072e5d0

Please sign in to comment.