Skip to content

Commit 452d9e3

Browse files
committed
Added PathItem::getOperations() for easier access to operations
1 parent 987c4ed commit 452d9e3

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/spec/PathItem.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,19 @@ protected function performValidation()
6161
{
6262
// no required arguments
6363
}
64+
65+
/**
66+
* Return all operations of this Path.
67+
* @return Operation[]
68+
*/
69+
public function getOperations()
70+
{
71+
$operations = [];
72+
foreach(static::attributes() as $attribute => $type) {
73+
if ($type === Operation::class && isset($this->$attribute)) {
74+
$operations[$attribute] = $this->$attribute;
75+
}
76+
}
77+
return $operations;
78+
}
6479
}

0 commit comments

Comments
 (0)