@@ -57,7 +57,6 @@ |
||
| 57 | 57 | * Sets the field. |
| 58 | 58 | * |
| 59 | 59 | * @param string name |
| 60 | - * @param Schema $schame |
|
| 61 | 60 | */ |
| 62 | 61 | public function set($name, Schema $schema) |
| 63 | 62 | { |
@@ -9,117 +9,117 @@ |
||
| 9 | 9 | |
| 10 | 10 | class Definitions implements Arrayable, \Iterator |
| 11 | 11 | { |
| 12 | - /** @var Map */ |
|
| 13 | - private $definitions; |
|
| 14 | - |
|
| 15 | - public function __construct($contents = []) |
|
| 16 | - { |
|
| 17 | - $this->parse($contents === null ? [] : $contents); |
|
| 18 | - } |
|
| 19 | - |
|
| 20 | - private function parse($contents) |
|
| 21 | - { |
|
| 22 | - $data = CollectionUtils::toMap($contents); |
|
| 23 | - |
|
| 24 | - $this->definitions = new Map(); |
|
| 25 | - foreach ($data as $name => $prop) { |
|
| 26 | - $this->definitions->set($name, new Schema($prop)); |
|
| 27 | - } |
|
| 28 | - } |
|
| 29 | - |
|
| 30 | - public function toArray() |
|
| 31 | - { |
|
| 32 | - return $this->definitions->toArray(); |
|
| 33 | - } |
|
| 34 | - |
|
| 35 | - public function size() |
|
| 36 | - { |
|
| 37 | - return $this->definitions->size(); |
|
| 38 | - } |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * Returns the schema for the given field. |
|
| 42 | - * |
|
| 43 | - * @param string $name |
|
| 44 | - * |
|
| 45 | - * @return Schema |
|
| 46 | - */ |
|
| 47 | - public function get($name) |
|
| 48 | - { |
|
| 49 | - if (!$this->definitions->has($name)) { |
|
| 50 | - $this->definitions->set($name, new Schema()); |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - return $this->definitions->get($name); |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - /** |
|
| 57 | - * Sets the field. |
|
| 58 | - * |
|
| 59 | - * @param string name |
|
| 60 | - * @param Schema $schame |
|
| 61 | - */ |
|
| 62 | - public function set($name, Schema $schema) |
|
| 63 | - { |
|
| 64 | - $this->definitions->set($name, $schema); |
|
| 65 | - } |
|
| 66 | - |
|
| 67 | - /** |
|
| 68 | - * Removes the given field. |
|
| 69 | - * |
|
| 70 | - * @param string $name |
|
| 71 | - */ |
|
| 72 | - public function remove($name) |
|
| 73 | - { |
|
| 74 | - $this->definitions->remove($name); |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - /** |
|
| 78 | - * Returns definitions has a schema with the given name. |
|
| 79 | - * |
|
| 80 | - * @param string $name |
|
| 81 | - * |
|
| 82 | - * @return bool |
|
| 83 | - */ |
|
| 84 | - public function has($name) |
|
| 85 | - { |
|
| 86 | - return $this->definitions->has($name); |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - /** |
|
| 90 | - * Returns whether the given schema exists. |
|
| 91 | - * |
|
| 92 | - * @param Schema $schema |
|
| 93 | - * |
|
| 94 | - * @return bool |
|
| 95 | - */ |
|
| 96 | - public function contains(Schema $schema) |
|
| 97 | - { |
|
| 98 | - return $this->definitions->contains($schema); |
|
| 99 | - } |
|
| 100 | - |
|
| 101 | - public function current() |
|
| 102 | - { |
|
| 103 | - return $this->definitions->current(); |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - public function key() |
|
| 107 | - { |
|
| 108 | - return $this->definitions->key(); |
|
| 109 | - } |
|
| 110 | - |
|
| 111 | - public function next() |
|
| 112 | - { |
|
| 113 | - return $this->definitions->next(); |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - public function rewind() |
|
| 117 | - { |
|
| 118 | - return $this->definitions->rewind(); |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - public function valid() |
|
| 122 | - { |
|
| 123 | - return $this->definitions->valid(); |
|
| 124 | - } |
|
| 12 | + /** @var Map */ |
|
| 13 | + private $definitions; |
|
| 14 | + |
|
| 15 | + public function __construct($contents = []) |
|
| 16 | + { |
|
| 17 | + $this->parse($contents === null ? [] : $contents); |
|
| 18 | + } |
|
| 19 | + |
|
| 20 | + private function parse($contents) |
|
| 21 | + { |
|
| 22 | + $data = CollectionUtils::toMap($contents); |
|
| 23 | + |
|
| 24 | + $this->definitions = new Map(); |
|
| 25 | + foreach ($data as $name => $prop) { |
|
| 26 | + $this->definitions->set($name, new Schema($prop)); |
|
| 27 | + } |
|
| 28 | + } |
|
| 29 | + |
|
| 30 | + public function toArray() |
|
| 31 | + { |
|
| 32 | + return $this->definitions->toArray(); |
|
| 33 | + } |
|
| 34 | + |
|
| 35 | + public function size() |
|
| 36 | + { |
|
| 37 | + return $this->definitions->size(); |
|
| 38 | + } |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * Returns the schema for the given field. |
|
| 42 | + * |
|
| 43 | + * @param string $name |
|
| 44 | + * |
|
| 45 | + * @return Schema |
|
| 46 | + */ |
|
| 47 | + public function get($name) |
|
| 48 | + { |
|
| 49 | + if (!$this->definitions->has($name)) { |
|
| 50 | + $this->definitions->set($name, new Schema()); |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + return $this->definitions->get($name); |
|
| 54 | + } |
|
| 55 | + |
|
| 56 | + /** |
|
| 57 | + * Sets the field. |
|
| 58 | + * |
|
| 59 | + * @param string name |
|
| 60 | + * @param Schema $schame |
|
| 61 | + */ |
|
| 62 | + public function set($name, Schema $schema) |
|
| 63 | + { |
|
| 64 | + $this->definitions->set($name, $schema); |
|
| 65 | + } |
|
| 66 | + |
|
| 67 | + /** |
|
| 68 | + * Removes the given field. |
|
| 69 | + * |
|
| 70 | + * @param string $name |
|
| 71 | + */ |
|
| 72 | + public function remove($name) |
|
| 73 | + { |
|
| 74 | + $this->definitions->remove($name); |
|
| 75 | + } |
|
| 76 | + |
|
| 77 | + /** |
|
| 78 | + * Returns definitions has a schema with the given name. |
|
| 79 | + * |
|
| 80 | + * @param string $name |
|
| 81 | + * |
|
| 82 | + * @return bool |
|
| 83 | + */ |
|
| 84 | + public function has($name) |
|
| 85 | + { |
|
| 86 | + return $this->definitions->has($name); |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + /** |
|
| 90 | + * Returns whether the given schema exists. |
|
| 91 | + * |
|
| 92 | + * @param Schema $schema |
|
| 93 | + * |
|
| 94 | + * @return bool |
|
| 95 | + */ |
|
| 96 | + public function contains(Schema $schema) |
|
| 97 | + { |
|
| 98 | + return $this->definitions->contains($schema); |
|
| 99 | + } |
|
| 100 | + |
|
| 101 | + public function current() |
|
| 102 | + { |
|
| 103 | + return $this->definitions->current(); |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + public function key() |
|
| 107 | + { |
|
| 108 | + return $this->definitions->key(); |
|
| 109 | + } |
|
| 110 | + |
|
| 111 | + public function next() |
|
| 112 | + { |
|
| 113 | + return $this->definitions->next(); |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + public function rewind() |
|
| 117 | + { |
|
| 118 | + return $this->definitions->rewind(); |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + public function valid() |
|
| 122 | + { |
|
| 123 | + return $this->definitions->valid(); |
|
| 124 | + } |
|
| 125 | 125 | } |
@@ -12,13 +12,11 @@ discard block |
||
| 12 | 12 | /** @var Map */ |
| 13 | 13 | private $definitions; |
| 14 | 14 | |
| 15 | - public function __construct($contents = []) |
|
| 16 | - { |
|
| 15 | + public function __construct($contents = []) { |
|
| 17 | 16 | $this->parse($contents === null ? [] : $contents); |
| 18 | 17 | } |
| 19 | 18 | |
| 20 | - private function parse($contents) |
|
| 21 | - { |
|
| 19 | + private function parse($contents) { |
|
| 22 | 20 | $data = CollectionUtils::toMap($contents); |
| 23 | 21 | |
| 24 | 22 | $this->definitions = new Map(); |
@@ -27,13 +25,11 @@ discard block |
||
| 27 | 25 | } |
| 28 | 26 | } |
| 29 | 27 | |
| 30 | - public function toArray() |
|
| 31 | - { |
|
| 28 | + public function toArray() { |
|
| 32 | 29 | return $this->definitions->toArray(); |
| 33 | 30 | } |
| 34 | 31 | |
| 35 | - public function size() |
|
| 36 | - { |
|
| 32 | + public function size() { |
|
| 37 | 33 | return $this->definitions->size(); |
| 38 | 34 | } |
| 39 | 35 | |
@@ -44,8 +40,7 @@ discard block |
||
| 44 | 40 | * |
| 45 | 41 | * @return Schema |
| 46 | 42 | */ |
| 47 | - public function get($name) |
|
| 48 | - { |
|
| 43 | + public function get($name) { |
|
| 49 | 44 | if (!$this->definitions->has($name)) { |
| 50 | 45 | $this->definitions->set($name, new Schema()); |
| 51 | 46 | } |
@@ -59,8 +54,7 @@ discard block |
||
| 59 | 54 | * @param string name |
| 60 | 55 | * @param Schema $schame |
| 61 | 56 | */ |
| 62 | - public function set($name, Schema $schema) |
|
| 63 | - { |
|
| 57 | + public function set($name, Schema $schema) { |
|
| 64 | 58 | $this->definitions->set($name, $schema); |
| 65 | 59 | } |
| 66 | 60 | |
@@ -69,8 +63,7 @@ discard block |
||
| 69 | 63 | * |
| 70 | 64 | * @param string $name |
| 71 | 65 | */ |
| 72 | - public function remove($name) |
|
| 73 | - { |
|
| 66 | + public function remove($name) { |
|
| 74 | 67 | $this->definitions->remove($name); |
| 75 | 68 | } |
| 76 | 69 | |
@@ -81,8 +74,7 @@ discard block |
||
| 81 | 74 | * |
| 82 | 75 | * @return bool |
| 83 | 76 | */ |
| 84 | - public function has($name) |
|
| 85 | - { |
|
| 77 | + public function has($name) { |
|
| 86 | 78 | return $this->definitions->has($name); |
| 87 | 79 | } |
| 88 | 80 | |
@@ -93,33 +85,27 @@ discard block |
||
| 93 | 85 | * |
| 94 | 86 | * @return bool |
| 95 | 87 | */ |
| 96 | - public function contains(Schema $schema) |
|
| 97 | - { |
|
| 88 | + public function contains(Schema $schema) { |
|
| 98 | 89 | return $this->definitions->contains($schema); |
| 99 | 90 | } |
| 100 | 91 | |
| 101 | - public function current() |
|
| 102 | - { |
|
| 92 | + public function current() { |
|
| 103 | 93 | return $this->definitions->current(); |
| 104 | 94 | } |
| 105 | 95 | |
| 106 | - public function key() |
|
| 107 | - { |
|
| 96 | + public function key() { |
|
| 108 | 97 | return $this->definitions->key(); |
| 109 | 98 | } |
| 110 | 99 | |
| 111 | - public function next() |
|
| 112 | - { |
|
| 100 | + public function next() { |
|
| 113 | 101 | return $this->definitions->next(); |
| 114 | 102 | } |
| 115 | 103 | |
| 116 | - public function rewind() |
|
| 117 | - { |
|
| 104 | + public function rewind() { |
|
| 118 | 105 | return $this->definitions->rewind(); |
| 119 | 106 | } |
| 120 | 107 | |
| 121 | - public function valid() |
|
| 122 | - { |
|
| 108 | + public function valid() { |
|
| 123 | 109 | return $this->definitions->valid(); |
| 124 | 110 | } |
| 125 | 111 | } |
@@ -93,7 +93,6 @@ |
||
| 93 | 93 | /** |
| 94 | 94 | * Sets the response. |
| 95 | 95 | * |
| 96 | - * @param Response $code |
|
| 97 | 96 | */ |
| 98 | 97 | public function add(Response $response) |
| 99 | 98 | { |
@@ -11,127 +11,127 @@ |
||
| 11 | 11 | |
| 12 | 12 | class Responses implements Arrayable, \Iterator |
| 13 | 13 | { |
| 14 | - use ExtensionPart; |
|
| 15 | - |
|
| 16 | - /** @var Map */ |
|
| 17 | - private $responses; |
|
| 18 | - |
|
| 19 | - public function __construct($contents = []) |
|
| 20 | - { |
|
| 21 | - $this->parse($contents === null ? [] : $contents); |
|
| 22 | - } |
|
| 23 | - |
|
| 24 | - private function parse($contents) |
|
| 25 | - { |
|
| 26 | - $data = CollectionUtils::toMap($contents); |
|
| 27 | - |
|
| 28 | - // responses |
|
| 29 | - $this->responses = new Map(); |
|
| 30 | - foreach ($data as $r => $response) { |
|
| 31 | - if (!Text::create($r)->startsWith('x-')) { |
|
| 32 | - $this->responses->set($r, new Response($r, $response)); |
|
| 33 | - } |
|
| 34 | - } |
|
| 35 | - |
|
| 36 | - // extensions |
|
| 37 | - $this->parseExtensions($data); |
|
| 38 | - } |
|
| 39 | - |
|
| 40 | - public function toArray() |
|
| 41 | - { |
|
| 42 | - $responses = clone $this->responses; |
|
| 43 | - $responses->setAll($this->getExtensions()); |
|
| 44 | - |
|
| 45 | - return $responses->toArray(); |
|
| 46 | - } |
|
| 47 | - |
|
| 48 | - public function size() |
|
| 49 | - { |
|
| 50 | - return $this->responses->size(); |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - /** |
|
| 54 | - * Returns whether the given response exists. |
|
| 55 | - * |
|
| 56 | - * @param string $code |
|
| 57 | - * |
|
| 58 | - * @return bool |
|
| 59 | - */ |
|
| 60 | - public function has($code) |
|
| 61 | - { |
|
| 62 | - return $this->responses->has($code); |
|
| 63 | - } |
|
| 64 | - |
|
| 65 | - /** |
|
| 66 | - * Returns whether the given response exists. |
|
| 67 | - * |
|
| 68 | - * @param Response $response |
|
| 69 | - * |
|
| 70 | - * @return bool |
|
| 71 | - */ |
|
| 72 | - public function contains(Response $response) |
|
| 73 | - { |
|
| 74 | - return $this->responses->contains($response); |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - /** |
|
| 78 | - * Returns the reponse info for the given code. |
|
| 79 | - * |
|
| 80 | - * @param string $code |
|
| 81 | - * |
|
| 82 | - * @return Response |
|
| 83 | - */ |
|
| 84 | - public function get($code) |
|
| 85 | - { |
|
| 86 | - if (!$this->responses->has($code)) { |
|
| 87 | - $this->responses->set($code, new Response($code)); |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - return $this->responses->get($code); |
|
| 91 | - } |
|
| 92 | - |
|
| 93 | - /** |
|
| 94 | - * Sets the response. |
|
| 95 | - * |
|
| 96 | - * @param Response $code |
|
| 97 | - */ |
|
| 98 | - public function add(Response $response) |
|
| 99 | - { |
|
| 100 | - $this->responses->set($response->getCode(), $response); |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - /** |
|
| 104 | - * Removes the given repsonse. |
|
| 105 | - * |
|
| 106 | - * @param string $code |
|
| 107 | - */ |
|
| 108 | - public function remove($code) |
|
| 109 | - { |
|
| 110 | - $this->responses->remove($code); |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - public function current() |
|
| 114 | - { |
|
| 115 | - return $this->responses->current(); |
|
| 116 | - } |
|
| 117 | - |
|
| 118 | - public function key() |
|
| 119 | - { |
|
| 120 | - return $this->responses->key(); |
|
| 121 | - } |
|
| 122 | - |
|
| 123 | - public function next() |
|
| 124 | - { |
|
| 125 | - return $this->responses->next(); |
|
| 126 | - } |
|
| 127 | - |
|
| 128 | - public function rewind() |
|
| 129 | - { |
|
| 130 | - return $this->responses->rewind(); |
|
| 131 | - } |
|
| 132 | - |
|
| 133 | - public function valid() |
|
| 134 | - { |
|
| 135 | - return $this->responses->valid(); |
|
| 136 | - } |
|
| 14 | + use ExtensionPart; |
|
| 15 | + |
|
| 16 | + /** @var Map */ |
|
| 17 | + private $responses; |
|
| 18 | + |
|
| 19 | + public function __construct($contents = []) |
|
| 20 | + { |
|
| 21 | + $this->parse($contents === null ? [] : $contents); |
|
| 22 | + } |
|
| 23 | + |
|
| 24 | + private function parse($contents) |
|
| 25 | + { |
|
| 26 | + $data = CollectionUtils::toMap($contents); |
|
| 27 | + |
|
| 28 | + // responses |
|
| 29 | + $this->responses = new Map(); |
|
| 30 | + foreach ($data as $r => $response) { |
|
| 31 | + if (!Text::create($r)->startsWith('x-')) { |
|
| 32 | + $this->responses->set($r, new Response($r, $response)); |
|
| 33 | + } |
|
| 34 | + } |
|
| 35 | + |
|
| 36 | + // extensions |
|
| 37 | + $this->parseExtensions($data); |
|
| 38 | + } |
|
| 39 | + |
|
| 40 | + public function toArray() |
|
| 41 | + { |
|
| 42 | + $responses = clone $this->responses; |
|
| 43 | + $responses->setAll($this->getExtensions()); |
|
| 44 | + |
|
| 45 | + return $responses->toArray(); |
|
| 46 | + } |
|
| 47 | + |
|
| 48 | + public function size() |
|
| 49 | + { |
|
| 50 | + return $this->responses->size(); |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + /** |
|
| 54 | + * Returns whether the given response exists. |
|
| 55 | + * |
|
| 56 | + * @param string $code |
|
| 57 | + * |
|
| 58 | + * @return bool |
|
| 59 | + */ |
|
| 60 | + public function has($code) |
|
| 61 | + { |
|
| 62 | + return $this->responses->has($code); |
|
| 63 | + } |
|
| 64 | + |
|
| 65 | + /** |
|
| 66 | + * Returns whether the given response exists. |
|
| 67 | + * |
|
| 68 | + * @param Response $response |
|
| 69 | + * |
|
| 70 | + * @return bool |
|
| 71 | + */ |
|
| 72 | + public function contains(Response $response) |
|
| 73 | + { |
|
| 74 | + return $this->responses->contains($response); |
|
| 75 | + } |
|
| 76 | + |
|
| 77 | + /** |
|
| 78 | + * Returns the reponse info for the given code. |
|
| 79 | + * |
|
| 80 | + * @param string $code |
|
| 81 | + * |
|
| 82 | + * @return Response |
|
| 83 | + */ |
|
| 84 | + public function get($code) |
|
| 85 | + { |
|
| 86 | + if (!$this->responses->has($code)) { |
|
| 87 | + $this->responses->set($code, new Response($code)); |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + return $this->responses->get($code); |
|
| 91 | + } |
|
| 92 | + |
|
| 93 | + /** |
|
| 94 | + * Sets the response. |
|
| 95 | + * |
|
| 96 | + * @param Response $code |
|
| 97 | + */ |
|
| 98 | + public function add(Response $response) |
|
| 99 | + { |
|
| 100 | + $this->responses->set($response->getCode(), $response); |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + /** |
|
| 104 | + * Removes the given repsonse. |
|
| 105 | + * |
|
| 106 | + * @param string $code |
|
| 107 | + */ |
|
| 108 | + public function remove($code) |
|
| 109 | + { |
|
| 110 | + $this->responses->remove($code); |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + public function current() |
|
| 114 | + { |
|
| 115 | + return $this->responses->current(); |
|
| 116 | + } |
|
| 117 | + |
|
| 118 | + public function key() |
|
| 119 | + { |
|
| 120 | + return $this->responses->key(); |
|
| 121 | + } |
|
| 122 | + |
|
| 123 | + public function next() |
|
| 124 | + { |
|
| 125 | + return $this->responses->next(); |
|
| 126 | + } |
|
| 127 | + |
|
| 128 | + public function rewind() |
|
| 129 | + { |
|
| 130 | + return $this->responses->rewind(); |
|
| 131 | + } |
|
| 132 | + |
|
| 133 | + public function valid() |
|
| 134 | + { |
|
| 135 | + return $this->responses->valid(); |
|
| 136 | + } |
|
| 137 | 137 | } |
@@ -16,13 +16,11 @@ discard block |
||
| 16 | 16 | /** @var Map */ |
| 17 | 17 | private $responses; |
| 18 | 18 | |
| 19 | - public function __construct($contents = []) |
|
| 20 | - { |
|
| 19 | + public function __construct($contents = []) { |
|
| 21 | 20 | $this->parse($contents === null ? [] : $contents); |
| 22 | 21 | } |
| 23 | 22 | |
| 24 | - private function parse($contents) |
|
| 25 | - { |
|
| 23 | + private function parse($contents) { |
|
| 26 | 24 | $data = CollectionUtils::toMap($contents); |
| 27 | 25 | |
| 28 | 26 | // responses |
@@ -37,16 +35,14 @@ discard block |
||
| 37 | 35 | $this->parseExtensions($data); |
| 38 | 36 | } |
| 39 | 37 | |
| 40 | - public function toArray() |
|
| 41 | - { |
|
| 38 | + public function toArray() { |
|
| 42 | 39 | $responses = clone $this->responses; |
| 43 | 40 | $responses->setAll($this->getExtensions()); |
| 44 | 41 | |
| 45 | 42 | return $responses->toArray(); |
| 46 | 43 | } |
| 47 | 44 | |
| 48 | - public function size() |
|
| 49 | - { |
|
| 45 | + public function size() { |
|
| 50 | 46 | return $this->responses->size(); |
| 51 | 47 | } |
| 52 | 48 | |
@@ -57,8 +53,7 @@ discard block |
||
| 57 | 53 | * |
| 58 | 54 | * @return bool |
| 59 | 55 | */ |
| 60 | - public function has($code) |
|
| 61 | - { |
|
| 56 | + public function has($code) { |
|
| 62 | 57 | return $this->responses->has($code); |
| 63 | 58 | } |
| 64 | 59 | |
@@ -69,8 +64,7 @@ discard block |
||
| 69 | 64 | * |
| 70 | 65 | * @return bool |
| 71 | 66 | */ |
| 72 | - public function contains(Response $response) |
|
| 73 | - { |
|
| 67 | + public function contains(Response $response) { |
|
| 74 | 68 | return $this->responses->contains($response); |
| 75 | 69 | } |
| 76 | 70 | |
@@ -81,8 +75,7 @@ discard block |
||
| 81 | 75 | * |
| 82 | 76 | * @return Response |
| 83 | 77 | */ |
| 84 | - public function get($code) |
|
| 85 | - { |
|
| 78 | + public function get($code) { |
|
| 86 | 79 | if (!$this->responses->has($code)) { |
| 87 | 80 | $this->responses->set($code, new Response($code)); |
| 88 | 81 | } |
@@ -95,8 +88,7 @@ discard block |
||
| 95 | 88 | * |
| 96 | 89 | * @param Response $code |
| 97 | 90 | */ |
| 98 | - public function add(Response $response) |
|
| 99 | - { |
|
| 91 | + public function add(Response $response) { |
|
| 100 | 92 | $this->responses->set($response->getCode(), $response); |
| 101 | 93 | } |
| 102 | 94 | |
@@ -105,33 +97,27 @@ discard block |
||
| 105 | 97 | * |
| 106 | 98 | * @param string $code |
| 107 | 99 | */ |
| 108 | - public function remove($code) |
|
| 109 | - { |
|
| 100 | + public function remove($code) { |
|
| 110 | 101 | $this->responses->remove($code); |
| 111 | 102 | } |
| 112 | 103 | |
| 113 | - public function current() |
|
| 114 | - { |
|
| 104 | + public function current() { |
|
| 115 | 105 | return $this->responses->current(); |
| 116 | 106 | } |
| 117 | 107 | |
| 118 | - public function key() |
|
| 119 | - { |
|
| 108 | + public function key() { |
|
| 120 | 109 | return $this->responses->key(); |
| 121 | 110 | } |
| 122 | 111 | |
| 123 | - public function next() |
|
| 124 | - { |
|
| 112 | + public function next() { |
|
| 125 | 113 | return $this->responses->next(); |
| 126 | 114 | } |
| 127 | 115 | |
| 128 | - public function rewind() |
|
| 129 | - { |
|
| 116 | + public function rewind() { |
|
| 130 | 117 | return $this->responses->rewind(); |
| 131 | 118 | } |
| 132 | 119 | |
| 133 | - public function valid() |
|
| 134 | - { |
|
| 120 | + public function valid() { |
|
| 135 | 121 | return $this->responses->valid(); |
| 136 | 122 | } |
| 137 | 123 | } |
@@ -16,200 +16,200 @@ |
||
| 16 | 16 | |
| 17 | 17 | class Schema extends AbstractModel implements Arrayable |
| 18 | 18 | { |
| 19 | - use RefPart; |
|
| 20 | - use TypePart; |
|
| 21 | - use DescriptionPart; |
|
| 22 | - use ItemsPart; |
|
| 23 | - use ExternalDocsPart; |
|
| 24 | - use ExtensionPart; |
|
| 25 | - |
|
| 26 | - /** @var string */ |
|
| 27 | - private $discriminator; |
|
| 28 | - |
|
| 29 | - /** @var bool */ |
|
| 30 | - private $readOnly = false; |
|
| 31 | - |
|
| 32 | - /** @var string */ |
|
| 33 | - private $title; |
|
| 34 | - |
|
| 35 | - private $xml; |
|
| 36 | - |
|
| 37 | - /** @var string */ |
|
| 38 | - private $example; |
|
| 39 | - |
|
| 40 | - /** @var ArrayList|bool */ |
|
| 41 | - private $required; |
|
| 42 | - |
|
| 43 | - /** @var Definitions */ |
|
| 44 | - private $properties; |
|
| 45 | - |
|
| 46 | - /** @var ArrayList */ |
|
| 47 | - private $allOf; |
|
| 48 | - |
|
| 49 | - /** @var Schema */ |
|
| 50 | - private $additionalProperties; |
|
| 51 | - |
|
| 52 | - public function __construct($contents = null) |
|
| 53 | - { |
|
| 54 | - $this->parse($contents === null ? new Map() : $contents); |
|
| 55 | - } |
|
| 56 | - |
|
| 57 | - private function parse($contents = []) |
|
| 58 | - { |
|
| 59 | - $data = CollectionUtils::toMap($contents); |
|
| 60 | - |
|
| 61 | - $this->title = $data->get('title'); |
|
| 62 | - $this->discriminator = $data->get('discriminator'); |
|
| 63 | - $this->readOnly = $data->has('readOnly') && $data->get('readOnly'); |
|
| 64 | - $this->example = $data->get('example'); |
|
| 65 | - $this->required = $data->get('required'); |
|
| 66 | - $this->properties = new Definitions($data->get('properties')); |
|
| 67 | - if ($data->has('additionalProperties')) { |
|
| 68 | - $this->additionalProperties = new self($data->get('additionalProperties')); |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - $this->allOf = new ArrayList(); |
|
| 72 | - if ($data->has('allOf')) { |
|
| 73 | - foreach ($data->get('allOf') as $schema) { |
|
| 74 | - $this->allOf->add(new self($schema)); |
|
| 75 | - } |
|
| 76 | - } |
|
| 77 | - |
|
| 78 | - // parts |
|
| 79 | - $this->parseRef($data); |
|
| 80 | - $this->parseType($data); |
|
| 81 | - $this->parseDescription($data); |
|
| 82 | - $this->parseItems($data); |
|
| 83 | - $this->parseExternalDocs($data); |
|
| 84 | - $this->parseExtensions($data); |
|
| 85 | - } |
|
| 86 | - |
|
| 87 | - public function toArray() |
|
| 88 | - { |
|
| 89 | - return $this->export('title', 'discriminator', 'description', 'readOnly', 'example', |
|
| 90 | - 'externalDocs', $this->getTypeExportFields(), 'items', 'required', |
|
| 91 | - 'properties', 'additionalProperties', 'allOf'); |
|
| 92 | - } |
|
| 93 | - |
|
| 94 | - /** |
|
| 95 | - * @return bool|array |
|
| 96 | - */ |
|
| 97 | - public function getRequired() |
|
| 98 | - { |
|
| 99 | - return $this->required; |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - /** |
|
| 103 | - * @param bool|array $required |
|
| 104 | - * |
|
| 105 | - * @return $this |
|
| 106 | - */ |
|
| 107 | - public function setRequired($required) |
|
| 108 | - { |
|
| 109 | - $this->required = $required; |
|
| 110 | - |
|
| 111 | - return $this; |
|
| 112 | - } |
|
| 113 | - |
|
| 114 | - /** |
|
| 115 | - * @return string |
|
| 116 | - */ |
|
| 117 | - public function getDiscriminator() |
|
| 118 | - { |
|
| 119 | - return $this->discriminator; |
|
| 120 | - } |
|
| 121 | - |
|
| 122 | - /** |
|
| 123 | - * @param string $discriminator |
|
| 124 | - */ |
|
| 125 | - public function setDiscriminator($discriminator) |
|
| 126 | - { |
|
| 127 | - $this->discriminator = $discriminator; |
|
| 128 | - |
|
| 129 | - return $this; |
|
| 130 | - } |
|
| 131 | - |
|
| 132 | - /** |
|
| 133 | - * @return bool |
|
| 134 | - */ |
|
| 135 | - public function isReadOnly() |
|
| 136 | - { |
|
| 137 | - return $this->readOnly; |
|
| 138 | - } |
|
| 139 | - |
|
| 140 | - /** |
|
| 141 | - * @param bool $readOnly |
|
| 142 | - */ |
|
| 143 | - public function setReadOnly($readOnly) |
|
| 144 | - { |
|
| 145 | - $this->readOnly = $readOnly; |
|
| 146 | - |
|
| 147 | - return $this; |
|
| 148 | - } |
|
| 149 | - |
|
| 150 | - /** |
|
| 151 | - * @return string |
|
| 152 | - */ |
|
| 153 | - public function getExample() |
|
| 154 | - { |
|
| 155 | - return $this->example; |
|
| 156 | - } |
|
| 157 | - |
|
| 158 | - /** |
|
| 159 | - * @param string $example |
|
| 160 | - */ |
|
| 161 | - public function setExample($example) |
|
| 162 | - { |
|
| 163 | - $this->example = $example; |
|
| 164 | - |
|
| 165 | - return $this; |
|
| 166 | - } |
|
| 167 | - |
|
| 168 | - /** |
|
| 169 | - * @return string |
|
| 170 | - */ |
|
| 171 | - public function getTitle() |
|
| 172 | - { |
|
| 173 | - return $this->title; |
|
| 174 | - } |
|
| 175 | - |
|
| 176 | - /** |
|
| 177 | - * @param string $title |
|
| 178 | - * |
|
| 179 | - * @return $this |
|
| 180 | - */ |
|
| 181 | - public function setTitle($title) |
|
| 182 | - { |
|
| 183 | - $this->title = $title; |
|
| 184 | - |
|
| 185 | - return $this; |
|
| 186 | - } |
|
| 187 | - |
|
| 188 | - /** |
|
| 189 | - * @return Definitions |
|
| 190 | - */ |
|
| 191 | - public function getProperties() |
|
| 192 | - { |
|
| 193 | - return $this->properties; |
|
| 194 | - } |
|
| 195 | - |
|
| 196 | - /** |
|
| 197 | - * @return ArrayList |
|
| 198 | - */ |
|
| 199 | - public function getAllOf() |
|
| 200 | - { |
|
| 201 | - return $this->allOf; |
|
| 202 | - } |
|
| 203 | - |
|
| 204 | - /** |
|
| 205 | - * @return Schema |
|
| 206 | - */ |
|
| 207 | - public function getAdditionalProperties() |
|
| 208 | - { |
|
| 209 | - if ($this->additionalProperties === null) { |
|
| 210 | - $this->additionalProperties = new self(); |
|
| 211 | - } |
|
| 212 | - |
|
| 213 | - return $this->additionalProperties; |
|
| 214 | - } |
|
| 19 | + use RefPart; |
|
| 20 | + use TypePart; |
|
| 21 | + use DescriptionPart; |
|
| 22 | + use ItemsPart; |
|
| 23 | + use ExternalDocsPart; |
|
| 24 | + use ExtensionPart; |
|
| 25 | + |
|
| 26 | + /** @var string */ |
|
| 27 | + private $discriminator; |
|
| 28 | + |
|
| 29 | + /** @var bool */ |
|
| 30 | + private $readOnly = false; |
|
| 31 | + |
|
| 32 | + /** @var string */ |
|
| 33 | + private $title; |
|
| 34 | + |
|
| 35 | + private $xml; |
|
| 36 | + |
|
| 37 | + /** @var string */ |
|
| 38 | + private $example; |
|
| 39 | + |
|
| 40 | + /** @var ArrayList|bool */ |
|
| 41 | + private $required; |
|
| 42 | + |
|
| 43 | + /** @var Definitions */ |
|
| 44 | + private $properties; |
|
| 45 | + |
|
| 46 | + /** @var ArrayList */ |
|
| 47 | + private $allOf; |
|
| 48 | + |
|
| 49 | + /** @var Schema */ |
|
| 50 | + private $additionalProperties; |
|
| 51 | + |
|
| 52 | + public function __construct($contents = null) |
|
| 53 | + { |
|
| 54 | + $this->parse($contents === null ? new Map() : $contents); |
|
| 55 | + } |
|
| 56 | + |
|
| 57 | + private function parse($contents = []) |
|
| 58 | + { |
|
| 59 | + $data = CollectionUtils::toMap($contents); |
|
| 60 | + |
|
| 61 | + $this->title = $data->get('title'); |
|
| 62 | + $this->discriminator = $data->get('discriminator'); |
|
| 63 | + $this->readOnly = $data->has('readOnly') && $data->get('readOnly'); |
|
| 64 | + $this->example = $data->get('example'); |
|
| 65 | + $this->required = $data->get('required'); |
|
| 66 | + $this->properties = new Definitions($data->get('properties')); |
|
| 67 | + if ($data->has('additionalProperties')) { |
|
| 68 | + $this->additionalProperties = new self($data->get('additionalProperties')); |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + $this->allOf = new ArrayList(); |
|
| 72 | + if ($data->has('allOf')) { |
|
| 73 | + foreach ($data->get('allOf') as $schema) { |
|
| 74 | + $this->allOf->add(new self($schema)); |
|
| 75 | + } |
|
| 76 | + } |
|
| 77 | + |
|
| 78 | + // parts |
|
| 79 | + $this->parseRef($data); |
|
| 80 | + $this->parseType($data); |
|
| 81 | + $this->parseDescription($data); |
|
| 82 | + $this->parseItems($data); |
|
| 83 | + $this->parseExternalDocs($data); |
|
| 84 | + $this->parseExtensions($data); |
|
| 85 | + } |
|
| 86 | + |
|
| 87 | + public function toArray() |
|
| 88 | + { |
|
| 89 | + return $this->export('title', 'discriminator', 'description', 'readOnly', 'example', |
|
| 90 | + 'externalDocs', $this->getTypeExportFields(), 'items', 'required', |
|
| 91 | + 'properties', 'additionalProperties', 'allOf'); |
|
| 92 | + } |
|
| 93 | + |
|
| 94 | + /** |
|
| 95 | + * @return bool|array |
|
| 96 | + */ |
|
| 97 | + public function getRequired() |
|
| 98 | + { |
|
| 99 | + return $this->required; |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + /** |
|
| 103 | + * @param bool|array $required |
|
| 104 | + * |
|
| 105 | + * @return $this |
|
| 106 | + */ |
|
| 107 | + public function setRequired($required) |
|
| 108 | + { |
|
| 109 | + $this->required = $required; |
|
| 110 | + |
|
| 111 | + return $this; |
|
| 112 | + } |
|
| 113 | + |
|
| 114 | + /** |
|
| 115 | + * @return string |
|
| 116 | + */ |
|
| 117 | + public function getDiscriminator() |
|
| 118 | + { |
|
| 119 | + return $this->discriminator; |
|
| 120 | + } |
|
| 121 | + |
|
| 122 | + /** |
|
| 123 | + * @param string $discriminator |
|
| 124 | + */ |
|
| 125 | + public function setDiscriminator($discriminator) |
|
| 126 | + { |
|
| 127 | + $this->discriminator = $discriminator; |
|
| 128 | + |
|
| 129 | + return $this; |
|
| 130 | + } |
|
| 131 | + |
|
| 132 | + /** |
|
| 133 | + * @return bool |
|
| 134 | + */ |
|
| 135 | + public function isReadOnly() |
|
| 136 | + { |
|
| 137 | + return $this->readOnly; |
|
| 138 | + } |
|
| 139 | + |
|
| 140 | + /** |
|
| 141 | + * @param bool $readOnly |
|
| 142 | + */ |
|
| 143 | + public function setReadOnly($readOnly) |
|
| 144 | + { |
|
| 145 | + $this->readOnly = $readOnly; |
|
| 146 | + |
|
| 147 | + return $this; |
|
| 148 | + } |
|
| 149 | + |
|
| 150 | + /** |
|
| 151 | + * @return string |
|
| 152 | + */ |
|
| 153 | + public function getExample() |
|
| 154 | + { |
|
| 155 | + return $this->example; |
|
| 156 | + } |
|
| 157 | + |
|
| 158 | + /** |
|
| 159 | + * @param string $example |
|
| 160 | + */ |
|
| 161 | + public function setExample($example) |
|
| 162 | + { |
|
| 163 | + $this->example = $example; |
|
| 164 | + |
|
| 165 | + return $this; |
|
| 166 | + } |
|
| 167 | + |
|
| 168 | + /** |
|
| 169 | + * @return string |
|
| 170 | + */ |
|
| 171 | + public function getTitle() |
|
| 172 | + { |
|
| 173 | + return $this->title; |
|
| 174 | + } |
|
| 175 | + |
|
| 176 | + /** |
|
| 177 | + * @param string $title |
|
| 178 | + * |
|
| 179 | + * @return $this |
|
| 180 | + */ |
|
| 181 | + public function setTitle($title) |
|
| 182 | + { |
|
| 183 | + $this->title = $title; |
|
| 184 | + |
|
| 185 | + return $this; |
|
| 186 | + } |
|
| 187 | + |
|
| 188 | + /** |
|
| 189 | + * @return Definitions |
|
| 190 | + */ |
|
| 191 | + public function getProperties() |
|
| 192 | + { |
|
| 193 | + return $this->properties; |
|
| 194 | + } |
|
| 195 | + |
|
| 196 | + /** |
|
| 197 | + * @return ArrayList |
|
| 198 | + */ |
|
| 199 | + public function getAllOf() |
|
| 200 | + { |
|
| 201 | + return $this->allOf; |
|
| 202 | + } |
|
| 203 | + |
|
| 204 | + /** |
|
| 205 | + * @return Schema |
|
| 206 | + */ |
|
| 207 | + public function getAdditionalProperties() |
|
| 208 | + { |
|
| 209 | + if ($this->additionalProperties === null) { |
|
| 210 | + $this->additionalProperties = new self(); |
|
| 211 | + } |
|
| 212 | + |
|
| 213 | + return $this->additionalProperties; |
|
| 214 | + } |
|
| 215 | 215 | } |
@@ -14,8 +14,7 @@ discard block |
||
| 14 | 14 | use phootwork\lang\Arrayable; |
| 15 | 15 | use phootwork\collection\Map; |
| 16 | 16 | |
| 17 | -class Schema extends AbstractModel implements Arrayable |
|
| 18 | -{ |
|
| 17 | +class Schema extends AbstractModel implements Arrayable { |
|
| 19 | 18 | use RefPart; |
| 20 | 19 | use TypePart; |
| 21 | 20 | use DescriptionPart; |
@@ -49,13 +48,11 @@ discard block |
||
| 49 | 48 | /** @var Schema */ |
| 50 | 49 | private $additionalProperties; |
| 51 | 50 | |
| 52 | - public function __construct($contents = null) |
|
| 53 | - { |
|
| 51 | + public function __construct($contents = null) { |
|
| 54 | 52 | $this->parse($contents === null ? new Map() : $contents); |
| 55 | 53 | } |
| 56 | 54 | |
| 57 | - private function parse($contents = []) |
|
| 58 | - { |
|
| 55 | + private function parse($contents = []) { |
|
| 59 | 56 | $data = CollectionUtils::toMap($contents); |
| 60 | 57 | |
| 61 | 58 | $this->title = $data->get('title'); |
@@ -84,8 +81,7 @@ discard block |
||
| 84 | 81 | $this->parseExtensions($data); |
| 85 | 82 | } |
| 86 | 83 | |
| 87 | - public function toArray() |
|
| 88 | - { |
|
| 84 | + public function toArray() { |
|
| 89 | 85 | return $this->export('title', 'discriminator', 'description', 'readOnly', 'example', |
| 90 | 86 | 'externalDocs', $this->getTypeExportFields(), 'items', 'required', |
| 91 | 87 | 'properties', 'additionalProperties', 'allOf'); |
@@ -94,8 +90,7 @@ discard block |
||
| 94 | 90 | /** |
| 95 | 91 | * @return bool|array |
| 96 | 92 | */ |
| 97 | - public function getRequired() |
|
| 98 | - { |
|
| 93 | + public function getRequired() { |
|
| 99 | 94 | return $this->required; |
| 100 | 95 | } |
| 101 | 96 | |
@@ -104,8 +99,7 @@ discard block |
||
| 104 | 99 | * |
| 105 | 100 | * @return $this |
| 106 | 101 | */ |
| 107 | - public function setRequired($required) |
|
| 108 | - { |
|
| 102 | + public function setRequired($required) { |
|
| 109 | 103 | $this->required = $required; |
| 110 | 104 | |
| 111 | 105 | return $this; |
@@ -114,16 +108,14 @@ discard block |
||
| 114 | 108 | /** |
| 115 | 109 | * @return string |
| 116 | 110 | */ |
| 117 | - public function getDiscriminator() |
|
| 118 | - { |
|
| 111 | + public function getDiscriminator() { |
|
| 119 | 112 | return $this->discriminator; |
| 120 | 113 | } |
| 121 | 114 | |
| 122 | 115 | /** |
| 123 | 116 | * @param string $discriminator |
| 124 | 117 | */ |
| 125 | - public function setDiscriminator($discriminator) |
|
| 126 | - { |
|
| 118 | + public function setDiscriminator($discriminator) { |
|
| 127 | 119 | $this->discriminator = $discriminator; |
| 128 | 120 | |
| 129 | 121 | return $this; |
@@ -132,16 +124,14 @@ discard block |
||
| 132 | 124 | /** |
| 133 | 125 | * @return bool |
| 134 | 126 | */ |
| 135 | - public function isReadOnly() |
|
| 136 | - { |
|
| 127 | + public function isReadOnly() { |
|
| 137 | 128 | return $this->readOnly; |
| 138 | 129 | } |
| 139 | 130 | |
| 140 | 131 | /** |
| 141 | 132 | * @param bool $readOnly |
| 142 | 133 | */ |
| 143 | - public function setReadOnly($readOnly) |
|
| 144 | - { |
|
| 134 | + public function setReadOnly($readOnly) { |
|
| 145 | 135 | $this->readOnly = $readOnly; |
| 146 | 136 | |
| 147 | 137 | return $this; |
@@ -150,16 +140,14 @@ discard block |
||
| 150 | 140 | /** |
| 151 | 141 | * @return string |
| 152 | 142 | */ |
| 153 | - public function getExample() |
|
| 154 | - { |
|
| 143 | + public function getExample() { |
|
| 155 | 144 | return $this->example; |
| 156 | 145 | } |
| 157 | 146 | |
| 158 | 147 | /** |
| 159 | 148 | * @param string $example |
| 160 | 149 | */ |
| 161 | - public function setExample($example) |
|
| 162 | - { |
|
| 150 | + public function setExample($example) { |
|
| 163 | 151 | $this->example = $example; |
| 164 | 152 | |
| 165 | 153 | return $this; |
@@ -168,8 +156,7 @@ discard block |
||
| 168 | 156 | /** |
| 169 | 157 | * @return string |
| 170 | 158 | */ |
| 171 | - public function getTitle() |
|
| 172 | - { |
|
| 159 | + public function getTitle() { |
|
| 173 | 160 | return $this->title; |
| 174 | 161 | } |
| 175 | 162 | |
@@ -178,8 +165,7 @@ discard block |
||
| 178 | 165 | * |
| 179 | 166 | * @return $this |
| 180 | 167 | */ |
| 181 | - public function setTitle($title) |
|
| 182 | - { |
|
| 168 | + public function setTitle($title) { |
|
| 183 | 169 | $this->title = $title; |
| 184 | 170 | |
| 185 | 171 | return $this; |
@@ -188,24 +174,21 @@ discard block |
||
| 188 | 174 | /** |
| 189 | 175 | * @return Definitions |
| 190 | 176 | */ |
| 191 | - public function getProperties() |
|
| 192 | - { |
|
| 177 | + public function getProperties() { |
|
| 193 | 178 | return $this->properties; |
| 194 | 179 | } |
| 195 | 180 | |
| 196 | 181 | /** |
| 197 | 182 | * @return ArrayList |
| 198 | 183 | */ |
| 199 | - public function getAllOf() |
|
| 200 | - { |
|
| 184 | + public function getAllOf() { |
|
| 201 | 185 | return $this->allOf; |
| 202 | 186 | } |
| 203 | 187 | |
| 204 | 188 | /** |
| 205 | 189 | * @return Schema |
| 206 | 190 | */ |
| 207 | - public function getAdditionalProperties() |
|
| 208 | - { |
|
| 191 | + public function getAdditionalProperties() { |
|
| 209 | 192 | if ($this->additionalProperties === null) { |
| 210 | 193 | $this->additionalProperties = new self(); |
| 211 | 194 | } |
@@ -10,68 +10,68 @@ |
||
| 10 | 10 | |
| 11 | 11 | class Tag extends AbstractModel implements Arrayable |
| 12 | 12 | { |
| 13 | - use DescriptionPart; |
|
| 14 | - use ExternalDocsPart; |
|
| 15 | - use ExtensionPart; |
|
| 13 | + use DescriptionPart; |
|
| 14 | + use ExternalDocsPart; |
|
| 15 | + use ExtensionPart; |
|
| 16 | 16 | |
| 17 | - /** @var string */ |
|
| 18 | - private $name; |
|
| 17 | + /** @var string */ |
|
| 18 | + private $name; |
|
| 19 | 19 | |
| 20 | - private $isObject = true; |
|
| 20 | + private $isObject = true; |
|
| 21 | 21 | |
| 22 | - public function __construct($contents = []) |
|
| 23 | - { |
|
| 24 | - $this->parse($contents); |
|
| 25 | - } |
|
| 22 | + public function __construct($contents = []) |
|
| 23 | + { |
|
| 24 | + $this->parse($contents); |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - private function parse($contents = []) |
|
| 28 | - { |
|
| 29 | - if (is_string($contents)) { |
|
| 30 | - $this->isObject = false; |
|
| 31 | - $this->name = $contents; |
|
| 32 | - } else { |
|
| 33 | - $data = CollectionUtils::toMap($contents); |
|
| 27 | + private function parse($contents = []) |
|
| 28 | + { |
|
| 29 | + if (is_string($contents)) { |
|
| 30 | + $this->isObject = false; |
|
| 31 | + $this->name = $contents; |
|
| 32 | + } else { |
|
| 33 | + $data = CollectionUtils::toMap($contents); |
|
| 34 | 34 | |
| 35 | - $this->isObject = true; |
|
| 36 | - $this->name = $data->get('name'); |
|
| 35 | + $this->isObject = true; |
|
| 36 | + $this->name = $data->get('name'); |
|
| 37 | 37 | |
| 38 | - // parts |
|
| 39 | - $this->parseDescription($data); |
|
| 40 | - $this->parseExternalDocs($data); |
|
| 41 | - $this->parseExtensions($data); |
|
| 42 | - } |
|
| 43 | - } |
|
| 38 | + // parts |
|
| 39 | + $this->parseDescription($data); |
|
| 40 | + $this->parseExternalDocs($data); |
|
| 41 | + $this->parseExtensions($data); |
|
| 42 | + } |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - public function toArray() |
|
| 46 | - { |
|
| 47 | - return $this->export('name', 'description', 'externalDocs'); |
|
| 48 | - } |
|
| 45 | + public function toArray() |
|
| 46 | + { |
|
| 47 | + return $this->export('name', 'description', 'externalDocs'); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - public function isObject() |
|
| 51 | - { |
|
| 52 | - return $this->isObject; |
|
| 53 | - } |
|
| 50 | + public function isObject() |
|
| 51 | + { |
|
| 52 | + return $this->isObject; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - public function setObject($object) |
|
| 56 | - { |
|
| 57 | - $this->isObject = $object; |
|
| 58 | - } |
|
| 55 | + public function setObject($object) |
|
| 56 | + { |
|
| 57 | + $this->isObject = $object; |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * @return string |
|
| 62 | - */ |
|
| 63 | - public function getName() |
|
| 64 | - { |
|
| 65 | - return $this->name; |
|
| 66 | - } |
|
| 60 | + /** |
|
| 61 | + * @return string |
|
| 62 | + */ |
|
| 63 | + public function getName() |
|
| 64 | + { |
|
| 65 | + return $this->name; |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * @param string $name |
|
| 70 | - */ |
|
| 71 | - public function setName($name) |
|
| 72 | - { |
|
| 73 | - $this->name = $name; |
|
| 68 | + /** |
|
| 69 | + * @param string $name |
|
| 70 | + */ |
|
| 71 | + public function setName($name) |
|
| 72 | + { |
|
| 73 | + $this->name = $name; |
|
| 74 | 74 | |
| 75 | - return $this; |
|
| 76 | - } |
|
| 75 | + return $this; |
|
| 76 | + } |
|
| 77 | 77 | } |
@@ -8,8 +8,7 @@ discard block |
||
| 8 | 8 | use gossi\swagger\parts\ExternalDocsPart; |
| 9 | 9 | use gossi\swagger\parts\DescriptionPart; |
| 10 | 10 | |
| 11 | -class Tag extends AbstractModel implements Arrayable |
|
| 12 | -{ |
|
| 11 | +class Tag extends AbstractModel implements Arrayable { |
|
| 13 | 12 | use DescriptionPart; |
| 14 | 13 | use ExternalDocsPart; |
| 15 | 14 | use ExtensionPart; |
@@ -19,13 +18,11 @@ discard block |
||
| 19 | 18 | |
| 20 | 19 | private $isObject = true; |
| 21 | 20 | |
| 22 | - public function __construct($contents = []) |
|
| 23 | - { |
|
| 21 | + public function __construct($contents = []) { |
|
| 24 | 22 | $this->parse($contents); |
| 25 | 23 | } |
| 26 | 24 | |
| 27 | - private function parse($contents = []) |
|
| 28 | - { |
|
| 25 | + private function parse($contents = []) { |
|
| 29 | 26 | if (is_string($contents)) { |
| 30 | 27 | $this->isObject = false; |
| 31 | 28 | $this->name = $contents; |
@@ -42,34 +39,29 @@ discard block |
||
| 42 | 39 | } |
| 43 | 40 | } |
| 44 | 41 | |
| 45 | - public function toArray() |
|
| 46 | - { |
|
| 42 | + public function toArray() { |
|
| 47 | 43 | return $this->export('name', 'description', 'externalDocs'); |
| 48 | 44 | } |
| 49 | 45 | |
| 50 | - public function isObject() |
|
| 51 | - { |
|
| 46 | + public function isObject() { |
|
| 52 | 47 | return $this->isObject; |
| 53 | 48 | } |
| 54 | 49 | |
| 55 | - public function setObject($object) |
|
| 56 | - { |
|
| 50 | + public function setObject($object) { |
|
| 57 | 51 | $this->isObject = $object; |
| 58 | 52 | } |
| 59 | 53 | |
| 60 | 54 | /** |
| 61 | 55 | * @return string |
| 62 | 56 | */ |
| 63 | - public function getName() |
|
| 64 | - { |
|
| 57 | + public function getName() { |
|
| 65 | 58 | return $this->name; |
| 66 | 59 | } |
| 67 | 60 | |
| 68 | 61 | /** |
| 69 | 62 | * @param string $name |
| 70 | 63 | */ |
| 71 | - public function setName($name) |
|
| 72 | - { |
|
| 64 | + public function setName($name) { |
|
| 73 | 65 | $this->name = $name; |
| 74 | 66 | |
| 75 | 67 | return $this; |
@@ -21,207 +21,207 @@ |
||
| 21 | 21 | |
| 22 | 22 | class Swagger extends AbstractModel implements Arrayable |
| 23 | 23 | { |
| 24 | - use SchemesPart; |
|
| 25 | - use ConsumesPart; |
|
| 26 | - use ProducesPart; |
|
| 27 | - use TagsPart; |
|
| 28 | - use ParametersPart; |
|
| 29 | - use ResponsesPart; |
|
| 30 | - use ExternalDocsPart; |
|
| 31 | - use ExtensionPart; |
|
| 32 | - |
|
| 33 | - const T_INTEGER = 'integer'; |
|
| 34 | - const T_NUMBER = 'number'; |
|
| 35 | - const T_BOOLEAN = 'boolean'; |
|
| 36 | - const T_STRING = 'string'; |
|
| 37 | - const T_FILE = 'file'; |
|
| 38 | - |
|
| 39 | - const F_INT32 = 'int32'; |
|
| 40 | - const F_INT64 = 'int64'; |
|
| 41 | - const F_FLOAT = 'float'; |
|
| 42 | - const F_DOUBLE = 'double'; |
|
| 43 | - const F_STRING = 'string'; |
|
| 44 | - const F_BYTE = 'byte'; |
|
| 45 | - const F_BINARY = 'binary'; |
|
| 46 | - const F_DATE = 'date'; |
|
| 47 | - const F_DATETIME = 'date-time'; |
|
| 48 | - const F_PASSWORD = 'password'; |
|
| 49 | - |
|
| 50 | - public static $METHODS = ['get', 'post', 'put', 'patch', 'delete', 'options', 'head']; |
|
| 51 | - |
|
| 52 | - /** @var string */ |
|
| 53 | - private $swagger = '2.0'; |
|
| 54 | - |
|
| 55 | - /** @var Info */ |
|
| 56 | - private $info; |
|
| 57 | - |
|
| 58 | - /** @var string */ |
|
| 59 | - private $host; |
|
| 60 | - |
|
| 61 | - /** @var string */ |
|
| 62 | - private $basePath; |
|
| 63 | - |
|
| 64 | - /** @var Paths */ |
|
| 65 | - private $paths; |
|
| 66 | - |
|
| 67 | - /** @var Definitions */ |
|
| 68 | - private $definitions; |
|
| 69 | - |
|
| 70 | - /** @var Map */ |
|
| 71 | - private $securityDefinitions; |
|
| 72 | - |
|
| 73 | - /** |
|
| 74 | - * @param string $filename |
|
| 75 | - * |
|
| 76 | - * @throws FileNotFoundException |
|
| 77 | - * @throws JsonException |
|
| 78 | - * |
|
| 79 | - * @return static |
|
| 80 | - */ |
|
| 81 | - public static function fromFile($filename) |
|
| 82 | - { |
|
| 83 | - $file = new File($filename); |
|
| 84 | - |
|
| 85 | - if (!$file->exists()) { |
|
| 86 | - throw new FileNotFoundException(sprintf('File not found at: %s', $filename)); |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - $json = Json::decode($file->read()); |
|
| 90 | - |
|
| 91 | - return new static($json); |
|
| 92 | - } |
|
| 93 | - |
|
| 94 | - public function __construct($contents = []) |
|
| 95 | - { |
|
| 96 | - $this->parse($contents); |
|
| 97 | - } |
|
| 98 | - |
|
| 99 | - private function parse($contents) |
|
| 100 | - { |
|
| 101 | - $data = CollectionUtils::toMap($contents); |
|
| 102 | - |
|
| 103 | - $this->swagger = $data->get('version', $this->swagger); |
|
| 104 | - $this->host = $data->get('host'); |
|
| 105 | - $this->basePath = $data->get('basePath'); |
|
| 106 | - $this->info = new Info($data->get('info', [])); |
|
| 107 | - $this->paths = new Paths($data->get('paths')); |
|
| 108 | - $this->definitions = new Definitions($data->get('definitions', new Map())); |
|
| 109 | - |
|
| 110 | - // security schemes |
|
| 111 | - $this->securityDefinitions = $data->get('securityDefinitions', new Map()); |
|
| 112 | - foreach ($this->securityDefinitions as $s => $def) { |
|
| 113 | - $this->securityDefinitions->set($s, new SecurityScheme($s, $def)); |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - // parts |
|
| 117 | - $this->parseSchemes($data); |
|
| 118 | - $this->parseConsumes($data); |
|
| 119 | - $this->parseProduces($data); |
|
| 120 | - $this->parseTags($data); |
|
| 121 | - $this->parseParameters($data); |
|
| 122 | - $this->parseResponses($data); |
|
| 123 | - $this->parseExternalDocs($data); |
|
| 124 | - $this->parseExtensions($data); |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - public function toArray() |
|
| 128 | - { |
|
| 129 | - return $this->export('swagger', 'info', 'host', 'basePath', 'schemes', 'consumes', 'produces', |
|
| 130 | - 'paths', 'definitions', 'parameters', 'responses', 'tags', 'externalDocs' |
|
| 131 | - ); |
|
| 132 | - } |
|
| 133 | - |
|
| 134 | - /** |
|
| 135 | - * @return string |
|
| 136 | - */ |
|
| 137 | - public function getVersion() |
|
| 138 | - { |
|
| 139 | - return $this->swagger; |
|
| 140 | - } |
|
| 141 | - |
|
| 142 | - /** |
|
| 143 | - * @param string $version |
|
| 144 | - * |
|
| 145 | - * @return $this |
|
| 146 | - */ |
|
| 147 | - public function setVersion($version) |
|
| 148 | - { |
|
| 149 | - $this->swagger = $version; |
|
| 150 | - |
|
| 151 | - return $this; |
|
| 152 | - } |
|
| 153 | - |
|
| 154 | - /** |
|
| 155 | - * @return Info |
|
| 156 | - */ |
|
| 157 | - public function getInfo() |
|
| 158 | - { |
|
| 159 | - return $this->info; |
|
| 160 | - } |
|
| 161 | - |
|
| 162 | - /** |
|
| 163 | - * @return string |
|
| 164 | - */ |
|
| 165 | - public function getHost() |
|
| 166 | - { |
|
| 167 | - return $this->host; |
|
| 168 | - } |
|
| 169 | - |
|
| 170 | - /** |
|
| 171 | - * @param string $host |
|
| 172 | - * |
|
| 173 | - * @return $this |
|
| 174 | - */ |
|
| 175 | - public function setHost($host) |
|
| 176 | - { |
|
| 177 | - $this->host = $host; |
|
| 178 | - |
|
| 179 | - return $this; |
|
| 180 | - } |
|
| 181 | - |
|
| 182 | - /** |
|
| 183 | - * @return string |
|
| 184 | - */ |
|
| 185 | - public function getBasePath() |
|
| 186 | - { |
|
| 187 | - return $this->basePath; |
|
| 188 | - } |
|
| 189 | - |
|
| 190 | - /** |
|
| 191 | - * @param string $basePath |
|
| 192 | - * |
|
| 193 | - * @return $this |
|
| 194 | - */ |
|
| 195 | - public function setBasePath($basePath) |
|
| 196 | - { |
|
| 197 | - $this->basePath = $basePath; |
|
| 198 | - |
|
| 199 | - return $this; |
|
| 200 | - } |
|
| 201 | - |
|
| 202 | - /** |
|
| 203 | - * @return Paths |
|
| 204 | - */ |
|
| 205 | - public function getPaths() |
|
| 206 | - { |
|
| 207 | - return $this->paths; |
|
| 208 | - } |
|
| 209 | - |
|
| 210 | - /** |
|
| 211 | - * @return Map |
|
| 212 | - */ |
|
| 213 | - public function getDefinitions() |
|
| 214 | - { |
|
| 215 | - return $this->definitions; |
|
| 216 | - } |
|
| 217 | - |
|
| 218 | - /** |
|
| 219 | - * @return Map |
|
| 220 | - */ |
|
| 221 | - public function getSecurityDefinitions() |
|
| 222 | - { |
|
| 223 | - return $this->securityDefinitions; |
|
| 224 | - } |
|
| 24 | + use SchemesPart; |
|
| 25 | + use ConsumesPart; |
|
| 26 | + use ProducesPart; |
|
| 27 | + use TagsPart; |
|
| 28 | + use ParametersPart; |
|
| 29 | + use ResponsesPart; |
|
| 30 | + use ExternalDocsPart; |
|
| 31 | + use ExtensionPart; |
|
| 32 | + |
|
| 33 | + const T_INTEGER = 'integer'; |
|
| 34 | + const T_NUMBER = 'number'; |
|
| 35 | + const T_BOOLEAN = 'boolean'; |
|
| 36 | + const T_STRING = 'string'; |
|
| 37 | + const T_FILE = 'file'; |
|
| 38 | + |
|
| 39 | + const F_INT32 = 'int32'; |
|
| 40 | + const F_INT64 = 'int64'; |
|
| 41 | + const F_FLOAT = 'float'; |
|
| 42 | + const F_DOUBLE = 'double'; |
|
| 43 | + const F_STRING = 'string'; |
|
| 44 | + const F_BYTE = 'byte'; |
|
| 45 | + const F_BINARY = 'binary'; |
|
| 46 | + const F_DATE = 'date'; |
|
| 47 | + const F_DATETIME = 'date-time'; |
|
| 48 | + const F_PASSWORD = 'password'; |
|
| 49 | + |
|
| 50 | + public static $METHODS = ['get', 'post', 'put', 'patch', 'delete', 'options', 'head']; |
|
| 51 | + |
|
| 52 | + /** @var string */ |
|
| 53 | + private $swagger = '2.0'; |
|
| 54 | + |
|
| 55 | + /** @var Info */ |
|
| 56 | + private $info; |
|
| 57 | + |
|
| 58 | + /** @var string */ |
|
| 59 | + private $host; |
|
| 60 | + |
|
| 61 | + /** @var string */ |
|
| 62 | + private $basePath; |
|
| 63 | + |
|
| 64 | + /** @var Paths */ |
|
| 65 | + private $paths; |
|
| 66 | + |
|
| 67 | + /** @var Definitions */ |
|
| 68 | + private $definitions; |
|
| 69 | + |
|
| 70 | + /** @var Map */ |
|
| 71 | + private $securityDefinitions; |
|
| 72 | + |
|
| 73 | + /** |
|
| 74 | + * @param string $filename |
|
| 75 | + * |
|
| 76 | + * @throws FileNotFoundException |
|
| 77 | + * @throws JsonException |
|
| 78 | + * |
|
| 79 | + * @return static |
|
| 80 | + */ |
|
| 81 | + public static function fromFile($filename) |
|
| 82 | + { |
|
| 83 | + $file = new File($filename); |
|
| 84 | + |
|
| 85 | + if (!$file->exists()) { |
|
| 86 | + throw new FileNotFoundException(sprintf('File not found at: %s', $filename)); |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + $json = Json::decode($file->read()); |
|
| 90 | + |
|
| 91 | + return new static($json); |
|
| 92 | + } |
|
| 93 | + |
|
| 94 | + public function __construct($contents = []) |
|
| 95 | + { |
|
| 96 | + $this->parse($contents); |
|
| 97 | + } |
|
| 98 | + |
|
| 99 | + private function parse($contents) |
|
| 100 | + { |
|
| 101 | + $data = CollectionUtils::toMap($contents); |
|
| 102 | + |
|
| 103 | + $this->swagger = $data->get('version', $this->swagger); |
|
| 104 | + $this->host = $data->get('host'); |
|
| 105 | + $this->basePath = $data->get('basePath'); |
|
| 106 | + $this->info = new Info($data->get('info', [])); |
|
| 107 | + $this->paths = new Paths($data->get('paths')); |
|
| 108 | + $this->definitions = new Definitions($data->get('definitions', new Map())); |
|
| 109 | + |
|
| 110 | + // security schemes |
|
| 111 | + $this->securityDefinitions = $data->get('securityDefinitions', new Map()); |
|
| 112 | + foreach ($this->securityDefinitions as $s => $def) { |
|
| 113 | + $this->securityDefinitions->set($s, new SecurityScheme($s, $def)); |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + // parts |
|
| 117 | + $this->parseSchemes($data); |
|
| 118 | + $this->parseConsumes($data); |
|
| 119 | + $this->parseProduces($data); |
|
| 120 | + $this->parseTags($data); |
|
| 121 | + $this->parseParameters($data); |
|
| 122 | + $this->parseResponses($data); |
|
| 123 | + $this->parseExternalDocs($data); |
|
| 124 | + $this->parseExtensions($data); |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + public function toArray() |
|
| 128 | + { |
|
| 129 | + return $this->export('swagger', 'info', 'host', 'basePath', 'schemes', 'consumes', 'produces', |
|
| 130 | + 'paths', 'definitions', 'parameters', 'responses', 'tags', 'externalDocs' |
|
| 131 | + ); |
|
| 132 | + } |
|
| 133 | + |
|
| 134 | + /** |
|
| 135 | + * @return string |
|
| 136 | + */ |
|
| 137 | + public function getVersion() |
|
| 138 | + { |
|
| 139 | + return $this->swagger; |
|
| 140 | + } |
|
| 141 | + |
|
| 142 | + /** |
|
| 143 | + * @param string $version |
|
| 144 | + * |
|
| 145 | + * @return $this |
|
| 146 | + */ |
|
| 147 | + public function setVersion($version) |
|
| 148 | + { |
|
| 149 | + $this->swagger = $version; |
|
| 150 | + |
|
| 151 | + return $this; |
|
| 152 | + } |
|
| 153 | + |
|
| 154 | + /** |
|
| 155 | + * @return Info |
|
| 156 | + */ |
|
| 157 | + public function getInfo() |
|
| 158 | + { |
|
| 159 | + return $this->info; |
|
| 160 | + } |
|
| 161 | + |
|
| 162 | + /** |
|
| 163 | + * @return string |
|
| 164 | + */ |
|
| 165 | + public function getHost() |
|
| 166 | + { |
|
| 167 | + return $this->host; |
|
| 168 | + } |
|
| 169 | + |
|
| 170 | + /** |
|
| 171 | + * @param string $host |
|
| 172 | + * |
|
| 173 | + * @return $this |
|
| 174 | + */ |
|
| 175 | + public function setHost($host) |
|
| 176 | + { |
|
| 177 | + $this->host = $host; |
|
| 178 | + |
|
| 179 | + return $this; |
|
| 180 | + } |
|
| 181 | + |
|
| 182 | + /** |
|
| 183 | + * @return string |
|
| 184 | + */ |
|
| 185 | + public function getBasePath() |
|
| 186 | + { |
|
| 187 | + return $this->basePath; |
|
| 188 | + } |
|
| 189 | + |
|
| 190 | + /** |
|
| 191 | + * @param string $basePath |
|
| 192 | + * |
|
| 193 | + * @return $this |
|
| 194 | + */ |
|
| 195 | + public function setBasePath($basePath) |
|
| 196 | + { |
|
| 197 | + $this->basePath = $basePath; |
|
| 198 | + |
|
| 199 | + return $this; |
|
| 200 | + } |
|
| 201 | + |
|
| 202 | + /** |
|
| 203 | + * @return Paths |
|
| 204 | + */ |
|
| 205 | + public function getPaths() |
|
| 206 | + { |
|
| 207 | + return $this->paths; |
|
| 208 | + } |
|
| 209 | + |
|
| 210 | + /** |
|
| 211 | + * @return Map |
|
| 212 | + */ |
|
| 213 | + public function getDefinitions() |
|
| 214 | + { |
|
| 215 | + return $this->definitions; |
|
| 216 | + } |
|
| 217 | + |
|
| 218 | + /** |
|
| 219 | + * @return Map |
|
| 220 | + */ |
|
| 221 | + public function getSecurityDefinitions() |
|
| 222 | + { |
|
| 223 | + return $this->securityDefinitions; |
|
| 224 | + } |
|
| 225 | 225 | |
| 226 | 226 | // /** |
| 227 | 227 | // * |
@@ -19,8 +19,7 @@ discard block |
||
| 19 | 19 | use gossi\swagger\collections\Paths; |
| 20 | 20 | use gossi\swagger\collections\Definitions; |
| 21 | 21 | |
| 22 | -class Swagger extends AbstractModel implements Arrayable |
|
| 23 | -{ |
|
| 22 | +class Swagger extends AbstractModel implements Arrayable { |
|
| 24 | 23 | use SchemesPart; |
| 25 | 24 | use ConsumesPart; |
| 26 | 25 | use ProducesPart; |
@@ -78,8 +77,7 @@ discard block |
||
| 78 | 77 | * |
| 79 | 78 | * @return static |
| 80 | 79 | */ |
| 81 | - public static function fromFile($filename) |
|
| 82 | - { |
|
| 80 | + public static function fromFile($filename) { |
|
| 83 | 81 | $file = new File($filename); |
| 84 | 82 | |
| 85 | 83 | if (!$file->exists()) { |
@@ -91,13 +89,11 @@ discard block |
||
| 91 | 89 | return new static($json); |
| 92 | 90 | } |
| 93 | 91 | |
| 94 | - public function __construct($contents = []) |
|
| 95 | - { |
|
| 92 | + public function __construct($contents = []) { |
|
| 96 | 93 | $this->parse($contents); |
| 97 | 94 | } |
| 98 | 95 | |
| 99 | - private function parse($contents) |
|
| 100 | - { |
|
| 96 | + private function parse($contents) { |
|
| 101 | 97 | $data = CollectionUtils::toMap($contents); |
| 102 | 98 | |
| 103 | 99 | $this->swagger = $data->get('version', $this->swagger); |
@@ -124,8 +120,7 @@ discard block |
||
| 124 | 120 | $this->parseExtensions($data); |
| 125 | 121 | } |
| 126 | 122 | |
| 127 | - public function toArray() |
|
| 128 | - { |
|
| 123 | + public function toArray() { |
|
| 129 | 124 | return $this->export('swagger', 'info', 'host', 'basePath', 'schemes', 'consumes', 'produces', |
| 130 | 125 | 'paths', 'definitions', 'parameters', 'responses', 'tags', 'externalDocs' |
| 131 | 126 | ); |
@@ -134,8 +129,7 @@ discard block |
||
| 134 | 129 | /** |
| 135 | 130 | * @return string |
| 136 | 131 | */ |
| 137 | - public function getVersion() |
|
| 138 | - { |
|
| 132 | + public function getVersion() { |
|
| 139 | 133 | return $this->swagger; |
| 140 | 134 | } |
| 141 | 135 | |
@@ -144,8 +138,7 @@ discard block |
||
| 144 | 138 | * |
| 145 | 139 | * @return $this |
| 146 | 140 | */ |
| 147 | - public function setVersion($version) |
|
| 148 | - { |
|
| 141 | + public function setVersion($version) { |
|
| 149 | 142 | $this->swagger = $version; |
| 150 | 143 | |
| 151 | 144 | return $this; |
@@ -154,16 +147,14 @@ discard block |
||
| 154 | 147 | /** |
| 155 | 148 | * @return Info |
| 156 | 149 | */ |
| 157 | - public function getInfo() |
|
| 158 | - { |
|
| 150 | + public function getInfo() { |
|
| 159 | 151 | return $this->info; |
| 160 | 152 | } |
| 161 | 153 | |
| 162 | 154 | /** |
| 163 | 155 | * @return string |
| 164 | 156 | */ |
| 165 | - public function getHost() |
|
| 166 | - { |
|
| 157 | + public function getHost() { |
|
| 167 | 158 | return $this->host; |
| 168 | 159 | } |
| 169 | 160 | |
@@ -172,8 +163,7 @@ discard block |
||
| 172 | 163 | * |
| 173 | 164 | * @return $this |
| 174 | 165 | */ |
| 175 | - public function setHost($host) |
|
| 176 | - { |
|
| 166 | + public function setHost($host) { |
|
| 177 | 167 | $this->host = $host; |
| 178 | 168 | |
| 179 | 169 | return $this; |
@@ -182,8 +172,7 @@ discard block |
||
| 182 | 172 | /** |
| 183 | 173 | * @return string |
| 184 | 174 | */ |
| 185 | - public function getBasePath() |
|
| 186 | - { |
|
| 175 | + public function getBasePath() { |
|
| 187 | 176 | return $this->basePath; |
| 188 | 177 | } |
| 189 | 178 | |
@@ -192,8 +181,7 @@ discard block |
||
| 192 | 181 | * |
| 193 | 182 | * @return $this |
| 194 | 183 | */ |
| 195 | - public function setBasePath($basePath) |
|
| 196 | - { |
|
| 184 | + public function setBasePath($basePath) { |
|
| 197 | 185 | $this->basePath = $basePath; |
| 198 | 186 | |
| 199 | 187 | return $this; |
@@ -202,24 +190,21 @@ discard block |
||
| 202 | 190 | /** |
| 203 | 191 | * @return Paths |
| 204 | 192 | */ |
| 205 | - public function getPaths() |
|
| 206 | - { |
|
| 193 | + public function getPaths() { |
|
| 207 | 194 | return $this->paths; |
| 208 | 195 | } |
| 209 | 196 | |
| 210 | 197 | /** |
| 211 | 198 | * @return Map |
| 212 | 199 | */ |
| 213 | - public function getDefinitions() |
|
| 214 | - { |
|
| 200 | + public function getDefinitions() { |
|
| 215 | 201 | return $this->definitions; |
| 216 | 202 | } |
| 217 | 203 | |
| 218 | 204 | /** |
| 219 | 205 | * @return Map |
| 220 | 206 | */ |
| 221 | - public function getSecurityDefinitions() |
|
| 222 | - { |
|
| 207 | + public function getSecurityDefinitions() { |
|
| 223 | 208 | return $this->securityDefinitions; |
| 224 | 209 | } |
| 225 | 210 | |
@@ -9,50 +9,50 @@ |
||
| 9 | 9 | |
| 10 | 10 | class License extends AbstractModel implements Arrayable |
| 11 | 11 | { |
| 12 | - use UrlPart; |
|
| 13 | - use ExtensionPart; |
|
| 14 | - |
|
| 15 | - /** @var string */ |
|
| 16 | - private $name; |
|
| 17 | - |
|
| 18 | - public function __construct($contents = []) |
|
| 19 | - { |
|
| 20 | - $this->parse($contents); |
|
| 21 | - } |
|
| 22 | - |
|
| 23 | - private function parse($contents = []) |
|
| 24 | - { |
|
| 25 | - $data = CollectionUtils::toMap($contents); |
|
| 26 | - |
|
| 27 | - $this->name = $data->get('name'); |
|
| 28 | - |
|
| 29 | - // extensions |
|
| 30 | - $this->parseUrl($data); |
|
| 31 | - $this->parseExtensions($data); |
|
| 32 | - } |
|
| 33 | - |
|
| 34 | - public function toArray() |
|
| 35 | - { |
|
| 36 | - return $this->export('name', 'url'); |
|
| 37 | - } |
|
| 38 | - |
|
| 39 | - /** |
|
| 40 | - * @return string |
|
| 41 | - */ |
|
| 42 | - public function getName() |
|
| 43 | - { |
|
| 44 | - return $this->name; |
|
| 45 | - } |
|
| 46 | - |
|
| 47 | - /** |
|
| 48 | - * @param string $name |
|
| 49 | - * |
|
| 50 | - * @return $this |
|
| 51 | - */ |
|
| 52 | - public function setName($name) |
|
| 53 | - { |
|
| 54 | - $this->name = $name; |
|
| 55 | - |
|
| 56 | - return $this; |
|
| 57 | - } |
|
| 12 | + use UrlPart; |
|
| 13 | + use ExtensionPart; |
|
| 14 | + |
|
| 15 | + /** @var string */ |
|
| 16 | + private $name; |
|
| 17 | + |
|
| 18 | + public function __construct($contents = []) |
|
| 19 | + { |
|
| 20 | + $this->parse($contents); |
|
| 21 | + } |
|
| 22 | + |
|
| 23 | + private function parse($contents = []) |
|
| 24 | + { |
|
| 25 | + $data = CollectionUtils::toMap($contents); |
|
| 26 | + |
|
| 27 | + $this->name = $data->get('name'); |
|
| 28 | + |
|
| 29 | + // extensions |
|
| 30 | + $this->parseUrl($data); |
|
| 31 | + $this->parseExtensions($data); |
|
| 32 | + } |
|
| 33 | + |
|
| 34 | + public function toArray() |
|
| 35 | + { |
|
| 36 | + return $this->export('name', 'url'); |
|
| 37 | + } |
|
| 38 | + |
|
| 39 | + /** |
|
| 40 | + * @return string |
|
| 41 | + */ |
|
| 42 | + public function getName() |
|
| 43 | + { |
|
| 44 | + return $this->name; |
|
| 45 | + } |
|
| 46 | + |
|
| 47 | + /** |
|
| 48 | + * @param string $name |
|
| 49 | + * |
|
| 50 | + * @return $this |
|
| 51 | + */ |
|
| 52 | + public function setName($name) |
|
| 53 | + { |
|
| 54 | + $this->name = $name; |
|
| 55 | + |
|
| 56 | + return $this; |
|
| 57 | + } |
|
| 58 | 58 | } |
@@ -7,21 +7,18 @@ discard block |
||
| 7 | 7 | use phootwork\lang\Arrayable; |
| 8 | 8 | use gossi\swagger\parts\UrlPart; |
| 9 | 9 | |
| 10 | -class License extends AbstractModel implements Arrayable |
|
| 11 | -{ |
|
| 10 | +class License extends AbstractModel implements Arrayable { |
|
| 12 | 11 | use UrlPart; |
| 13 | 12 | use ExtensionPart; |
| 14 | 13 | |
| 15 | 14 | /** @var string */ |
| 16 | 15 | private $name; |
| 17 | 16 | |
| 18 | - public function __construct($contents = []) |
|
| 19 | - { |
|
| 17 | + public function __construct($contents = []) { |
|
| 20 | 18 | $this->parse($contents); |
| 21 | 19 | } |
| 22 | 20 | |
| 23 | - private function parse($contents = []) |
|
| 24 | - { |
|
| 21 | + private function parse($contents = []) { |
|
| 25 | 22 | $data = CollectionUtils::toMap($contents); |
| 26 | 23 | |
| 27 | 24 | $this->name = $data->get('name'); |
@@ -31,16 +28,14 @@ discard block |
||
| 31 | 28 | $this->parseExtensions($data); |
| 32 | 29 | } |
| 33 | 30 | |
| 34 | - public function toArray() |
|
| 35 | - { |
|
| 31 | + public function toArray() { |
|
| 36 | 32 | return $this->export('name', 'url'); |
| 37 | 33 | } |
| 38 | 34 | |
| 39 | 35 | /** |
| 40 | 36 | * @return string |
| 41 | 37 | */ |
| 42 | - public function getName() |
|
| 43 | - { |
|
| 38 | + public function getName() { |
|
| 44 | 39 | return $this->name; |
| 45 | 40 | } |
| 46 | 41 | |
@@ -49,8 +44,7 @@ discard block |
||
| 49 | 44 | * |
| 50 | 45 | * @return $this |
| 51 | 46 | */ |
| 52 | - public function setName($name) |
|
| 53 | - { |
|
| 47 | + public function setName($name) { |
|
| 54 | 48 | $this->name = $name; |
| 55 | 49 | |
| 56 | 50 | return $this; |
@@ -4,44 +4,44 @@ |
||
| 4 | 4 | |
| 5 | 5 | abstract class AbstractModel |
| 6 | 6 | { |
| 7 | - protected function export() |
|
| 8 | - { |
|
| 9 | - $cols = func_get_args(); |
|
| 10 | - |
|
| 11 | - // add cols |
|
| 12 | - if (method_exists($this, 'hasRef') && $this->hasRef()) { |
|
| 13 | - $cols = array_merge(['$ref'], $cols); |
|
| 14 | - } |
|
| 15 | - |
|
| 16 | - // flatten array |
|
| 17 | - $fields = []; |
|
| 18 | - array_walk_recursive($cols, function ($a) use (&$fields) { $fields[] = $a; }); |
|
| 19 | - |
|
| 20 | - $out = []; |
|
| 21 | - $refl = new \ReflectionClass(get_class($this)); |
|
| 22 | - |
|
| 23 | - foreach ($fields as $field) { |
|
| 24 | - if ($field == 'tags') { |
|
| 25 | - $val = $this->exportTags(); |
|
| 26 | - } else { |
|
| 27 | - $prop = $refl->getProperty($field == '$ref' ? 'ref' : $field); |
|
| 28 | - $prop->setAccessible(true); |
|
| 29 | - $val = $prop->getValue($this); |
|
| 30 | - |
|
| 31 | - if (method_exists($val, 'toArray')) { |
|
| 32 | - $val = $val->toArray(); |
|
| 33 | - } |
|
| 34 | - } |
|
| 35 | - |
|
| 36 | - if ($field == 'required' && is_bool($val) || !empty($val)) { |
|
| 37 | - $out[$field] = $val; |
|
| 38 | - } |
|
| 39 | - } |
|
| 40 | - |
|
| 41 | - if (method_exists($this, 'getExtensions')) { |
|
| 42 | - $out = array_merge($out, $this->getExtensions()->toArray()); |
|
| 43 | - } |
|
| 44 | - |
|
| 45 | - return $out; |
|
| 46 | - } |
|
| 7 | + protected function export() |
|
| 8 | + { |
|
| 9 | + $cols = func_get_args(); |
|
| 10 | + |
|
| 11 | + // add cols |
|
| 12 | + if (method_exists($this, 'hasRef') && $this->hasRef()) { |
|
| 13 | + $cols = array_merge(['$ref'], $cols); |
|
| 14 | + } |
|
| 15 | + |
|
| 16 | + // flatten array |
|
| 17 | + $fields = []; |
|
| 18 | + array_walk_recursive($cols, function ($a) use (&$fields) { $fields[] = $a; }); |
|
| 19 | + |
|
| 20 | + $out = []; |
|
| 21 | + $refl = new \ReflectionClass(get_class($this)); |
|
| 22 | + |
|
| 23 | + foreach ($fields as $field) { |
|
| 24 | + if ($field == 'tags') { |
|
| 25 | + $val = $this->exportTags(); |
|
| 26 | + } else { |
|
| 27 | + $prop = $refl->getProperty($field == '$ref' ? 'ref' : $field); |
|
| 28 | + $prop->setAccessible(true); |
|
| 29 | + $val = $prop->getValue($this); |
|
| 30 | + |
|
| 31 | + if (method_exists($val, 'toArray')) { |
|
| 32 | + $val = $val->toArray(); |
|
| 33 | + } |
|
| 34 | + } |
|
| 35 | + |
|
| 36 | + if ($field == 'required' && is_bool($val) || !empty($val)) { |
|
| 37 | + $out[$field] = $val; |
|
| 38 | + } |
|
| 39 | + } |
|
| 40 | + |
|
| 41 | + if (method_exists($this, 'getExtensions')) { |
|
| 42 | + $out = array_merge($out, $this->getExtensions()->toArray()); |
|
| 43 | + } |
|
| 44 | + |
|
| 45 | + return $out; |
|
| 46 | + } |
|
| 47 | 47 | } |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | |
| 16 | 16 | // flatten array |
| 17 | 17 | $fields = []; |
| 18 | - array_walk_recursive($cols, function ($a) use (&$fields) { $fields[] = $a; }); |
|
| 18 | + array_walk_recursive($cols, function($a) use (&$fields) { $fields[] = $a; }); |
|
| 19 | 19 | |
| 20 | 20 | $out = []; |
| 21 | 21 | $refl = new \ReflectionClass(get_class($this)); |
@@ -2,10 +2,8 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace gossi\swagger; |
| 4 | 4 | |
| 5 | -abstract class AbstractModel |
|
| 6 | -{ |
|
| 7 | - protected function export() |
|
| 8 | - { |
|
| 5 | +abstract class AbstractModel { |
|
| 6 | + protected function export() { |
|
| 9 | 7 | $cols = func_get_args(); |
| 10 | 8 | |
| 11 | 9 | // add cols |
@@ -11,29 +11,29 @@ |
||
| 11 | 11 | |
| 12 | 12 | class Items extends AbstractModel implements Arrayable |
| 13 | 13 | { |
| 14 | - use RefPart; |
|
| 15 | - use TypePart; |
|
| 16 | - use ItemsPart; |
|
| 17 | - use ExtensionPart; |
|
| 14 | + use RefPart; |
|
| 15 | + use TypePart; |
|
| 16 | + use ItemsPart; |
|
| 17 | + use ExtensionPart; |
|
| 18 | 18 | |
| 19 | - public function __construct($contents = []) |
|
| 20 | - { |
|
| 21 | - $this->parse($contents); |
|
| 22 | - } |
|
| 19 | + public function __construct($contents = []) |
|
| 20 | + { |
|
| 21 | + $this->parse($contents); |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | - private function parse($contents = []) |
|
| 25 | - { |
|
| 26 | - $data = CollectionUtils::toMap($contents); |
|
| 24 | + private function parse($contents = []) |
|
| 25 | + { |
|
| 26 | + $data = CollectionUtils::toMap($contents); |
|
| 27 | 27 | |
| 28 | - // parts |
|
| 29 | - $this->parseRef($data); |
|
| 30 | - $this->parseType($data); |
|
| 31 | - $this->parseItems($data); |
|
| 32 | - $this->parseExtensions($data); |
|
| 33 | - } |
|
| 28 | + // parts |
|
| 29 | + $this->parseRef($data); |
|
| 30 | + $this->parseType($data); |
|
| 31 | + $this->parseItems($data); |
|
| 32 | + $this->parseExtensions($data); |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - public function toArray() |
|
| 36 | - { |
|
| 37 | - return $this->export($this->getTypeExportFields(), 'items'); |
|
| 38 | - } |
|
| 35 | + public function toArray() |
|
| 36 | + { |
|
| 37 | + return $this->export($this->getTypeExportFields(), 'items'); |
|
| 38 | + } |
|
| 39 | 39 | } |
@@ -9,20 +9,17 @@ discard block |
||
| 9 | 9 | use phootwork\lang\Arrayable; |
| 10 | 10 | use gossi\swagger\parts\RefPart; |
| 11 | 11 | |
| 12 | -class Items extends AbstractModel implements Arrayable |
|
| 13 | -{ |
|
| 12 | +class Items extends AbstractModel implements Arrayable { |
|
| 14 | 13 | use RefPart; |
| 15 | 14 | use TypePart; |
| 16 | 15 | use ItemsPart; |
| 17 | 16 | use ExtensionPart; |
| 18 | 17 | |
| 19 | - public function __construct($contents = []) |
|
| 20 | - { |
|
| 18 | + public function __construct($contents = []) { |
|
| 21 | 19 | $this->parse($contents); |
| 22 | 20 | } |
| 23 | 21 | |
| 24 | - private function parse($contents = []) |
|
| 25 | - { |
|
| 22 | + private function parse($contents = []) { |
|
| 26 | 23 | $data = CollectionUtils::toMap($contents); |
| 27 | 24 | |
| 28 | 25 | // parts |
@@ -32,8 +29,7 @@ discard block |
||
| 32 | 29 | $this->parseExtensions($data); |
| 33 | 30 | } |
| 34 | 31 | |
| 35 | - public function toArray() |
|
| 36 | - { |
|
| 32 | + public function toArray() { |
|
| 37 | 33 | return $this->export($this->getTypeExportFields(), 'items'); |
| 38 | 34 | } |
| 39 | 35 | } |
@@ -9,82 +9,82 @@ |
||
| 9 | 9 | |
| 10 | 10 | class Path extends AbstractModel implements Arrayable |
| 11 | 11 | { |
| 12 | - use ExtensionPart; |
|
| 12 | + use ExtensionPart; |
|
| 13 | 13 | |
| 14 | - private $operations; |
|
| 14 | + private $operations; |
|
| 15 | 15 | |
| 16 | - /** @var string */ |
|
| 17 | - private $path; |
|
| 16 | + /** @var string */ |
|
| 17 | + private $path; |
|
| 18 | 18 | |
| 19 | - public function __construct($path, $contents = []) |
|
| 20 | - { |
|
| 21 | - $this->path = $path; |
|
| 22 | - $this->operations = new Map(); |
|
| 23 | - $this->parse($contents); |
|
| 24 | - } |
|
| 19 | + public function __construct($path, $contents = []) |
|
| 20 | + { |
|
| 21 | + $this->path = $path; |
|
| 22 | + $this->operations = new Map(); |
|
| 23 | + $this->parse($contents); |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | - private function parse($contents) |
|
| 27 | - { |
|
| 28 | - $data = CollectionUtils::toMap($contents); |
|
| 26 | + private function parse($contents) |
|
| 27 | + { |
|
| 28 | + $data = CollectionUtils::toMap($contents); |
|
| 29 | 29 | |
| 30 | - foreach (Swagger::$METHODS as $method) { |
|
| 31 | - if ($data->has($method)) { |
|
| 32 | - $this->operations->set($method, new Operation($data->get($method))); |
|
| 33 | - } |
|
| 34 | - } |
|
| 30 | + foreach (Swagger::$METHODS as $method) { |
|
| 31 | + if ($data->has($method)) { |
|
| 32 | + $this->operations->set($method, new Operation($data->get($method))); |
|
| 33 | + } |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - // parts |
|
| 37 | - $this->parseExtensions($data); |
|
| 38 | - } |
|
| 36 | + // parts |
|
| 37 | + $this->parseExtensions($data); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - public function toArray() |
|
| 41 | - { |
|
| 42 | - return array_merge($this->operations->toArray(), $this->getExtensions()->toArray()); |
|
| 43 | - } |
|
| 40 | + public function toArray() |
|
| 41 | + { |
|
| 42 | + return array_merge($this->operations->toArray(), $this->getExtensions()->toArray()); |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * Returns this path. |
|
| 47 | - * |
|
| 48 | - * @return string |
|
| 49 | - */ |
|
| 50 | - public function getPath() |
|
| 51 | - { |
|
| 52 | - return $this->path; |
|
| 53 | - } |
|
| 45 | + /** |
|
| 46 | + * Returns this path. |
|
| 47 | + * |
|
| 48 | + * @return string |
|
| 49 | + */ |
|
| 50 | + public function getPath() |
|
| 51 | + { |
|
| 52 | + return $this->path; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * Gets the operation for the given method, creates one if none exists. |
|
| 57 | - * |
|
| 58 | - * @param string $method |
|
| 59 | - * |
|
| 60 | - * @return Operation |
|
| 61 | - */ |
|
| 62 | - public function getOperation($method) |
|
| 63 | - { |
|
| 64 | - if (!$this->operations->has($method)) { |
|
| 65 | - $this->operations->set($method, new Operation()); |
|
| 66 | - } |
|
| 55 | + /** |
|
| 56 | + * Gets the operation for the given method, creates one if none exists. |
|
| 57 | + * |
|
| 58 | + * @param string $method |
|
| 59 | + * |
|
| 60 | + * @return Operation |
|
| 61 | + */ |
|
| 62 | + public function getOperation($method) |
|
| 63 | + { |
|
| 64 | + if (!$this->operations->has($method)) { |
|
| 65 | + $this->operations->set($method, new Operation()); |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - return $this->operations->get($method); |
|
| 69 | - } |
|
| 68 | + return $this->operations->get($method); |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * @param string $method |
|
| 73 | - * |
|
| 74 | - * @return bool |
|
| 75 | - */ |
|
| 76 | - public function hasOperation($method) |
|
| 77 | - { |
|
| 78 | - return $this->operations->has($method); |
|
| 79 | - } |
|
| 71 | + /** |
|
| 72 | + * @param string $method |
|
| 73 | + * |
|
| 74 | + * @return bool |
|
| 75 | + */ |
|
| 76 | + public function hasOperation($method) |
|
| 77 | + { |
|
| 78 | + return $this->operations->has($method); |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * Removes an operation for the given method. |
|
| 83 | - * |
|
| 84 | - * @param string $method |
|
| 85 | - */ |
|
| 86 | - public function removeOperation($method) |
|
| 87 | - { |
|
| 88 | - $this->operations->remove($method); |
|
| 89 | - } |
|
| 81 | + /** |
|
| 82 | + * Removes an operation for the given method. |
|
| 83 | + * |
|
| 84 | + * @param string $method |
|
| 85 | + */ |
|
| 86 | + public function removeOperation($method) |
|
| 87 | + { |
|
| 88 | + $this->operations->remove($method); |
|
| 89 | + } |
|
| 90 | 90 | } |
@@ -7,8 +7,7 @@ discard block |
||
| 7 | 7 | use phootwork\collection\Map; |
| 8 | 8 | use phootwork\lang\Arrayable; |
| 9 | 9 | |
| 10 | -class Path extends AbstractModel implements Arrayable |
|
| 11 | -{ |
|
| 10 | +class Path extends AbstractModel implements Arrayable { |
|
| 12 | 11 | use ExtensionPart; |
| 13 | 12 | |
| 14 | 13 | private $operations; |
@@ -16,15 +15,13 @@ discard block |
||
| 16 | 15 | /** @var string */ |
| 17 | 16 | private $path; |
| 18 | 17 | |
| 19 | - public function __construct($path, $contents = []) |
|
| 20 | - { |
|
| 18 | + public function __construct($path, $contents = []) { |
|
| 21 | 19 | $this->path = $path; |
| 22 | 20 | $this->operations = new Map(); |
| 23 | 21 | $this->parse($contents); |
| 24 | 22 | } |
| 25 | 23 | |
| 26 | - private function parse($contents) |
|
| 27 | - { |
|
| 24 | + private function parse($contents) { |
|
| 28 | 25 | $data = CollectionUtils::toMap($contents); |
| 29 | 26 | |
| 30 | 27 | foreach (Swagger::$METHODS as $method) { |
@@ -37,8 +34,7 @@ discard block |
||
| 37 | 34 | $this->parseExtensions($data); |
| 38 | 35 | } |
| 39 | 36 | |
| 40 | - public function toArray() |
|
| 41 | - { |
|
| 37 | + public function toArray() { |
|
| 42 | 38 | return array_merge($this->operations->toArray(), $this->getExtensions()->toArray()); |
| 43 | 39 | } |
| 44 | 40 | |
@@ -47,8 +43,7 @@ discard block |
||
| 47 | 43 | * |
| 48 | 44 | * @return string |
| 49 | 45 | */ |
| 50 | - public function getPath() |
|
| 51 | - { |
|
| 46 | + public function getPath() { |
|
| 52 | 47 | return $this->path; |
| 53 | 48 | } |
| 54 | 49 | |
@@ -59,8 +54,7 @@ discard block |
||
| 59 | 54 | * |
| 60 | 55 | * @return Operation |
| 61 | 56 | */ |
| 62 | - public function getOperation($method) |
|
| 63 | - { |
|
| 57 | + public function getOperation($method) { |
|
| 64 | 58 | if (!$this->operations->has($method)) { |
| 65 | 59 | $this->operations->set($method, new Operation()); |
| 66 | 60 | } |
@@ -73,8 +67,7 @@ discard block |
||
| 73 | 67 | * |
| 74 | 68 | * @return bool |
| 75 | 69 | */ |
| 76 | - public function hasOperation($method) |
|
| 77 | - { |
|
| 70 | + public function hasOperation($method) { |
|
| 78 | 71 | return $this->operations->has($method); |
| 79 | 72 | } |
| 80 | 73 | |
@@ -83,8 +76,7 @@ discard block |
||
| 83 | 76 | * |
| 84 | 77 | * @param string $method |
| 85 | 78 | */ |
| 86 | - public function removeOperation($method) |
|
| 87 | - { |
|
| 79 | + public function removeOperation($method) { |
|
| 88 | 80 | $this->operations->remove($method); |
| 89 | 81 | } |
| 90 | 82 | } |