@@ -17,26 +17,26 @@ |
||
| 17 | 17 | |
| 18 | 18 | protected function parseDefinition($definition) |
| 19 | 19 | { |
| 20 | - $definition = self::trim($definition); |
|
| 21 | - |
|
| 22 | - $match = array(); |
|
| 23 | - if (preg_match(self::REGEX_START . self::REGEX_FORMAT . self::REGEX_CONTENT . self::REGEX_RANGE . self::REGEX_DEFAULT . self::REGEX_END, $definition, $match) !== 1) { |
|
| 24 | - throw new \SwaggerGen\Exception("Unparseable string definition: '{$definition}'"); |
|
| 25 | - } |
|
| 26 | - |
|
| 27 | - $type = strtolower($match[1]); |
|
| 28 | - |
|
| 29 | - $reference = null; |
|
| 30 | - if ($type === 'refobject') { |
|
| 31 | - if (isset($match[2])) |
|
| 32 | - $reference = $match[2]; |
|
| 33 | - } else { |
|
| 34 | - $reference = $match[1]; |
|
| 35 | - } |
|
| 36 | - |
|
| 37 | - if (empty($reference)) { |
|
| 38 | - throw new \SwaggerGen\Exception("Referenced object name missing: '{$definition}'"); |
|
| 39 | - } |
|
| 20 | + $definition = self::trim($definition); |
|
| 21 | + |
|
| 22 | + $match = array(); |
|
| 23 | + if (preg_match(self::REGEX_START . self::REGEX_FORMAT . self::REGEX_CONTENT . self::REGEX_RANGE . self::REGEX_DEFAULT . self::REGEX_END, $definition, $match) !== 1) { |
|
| 24 | + throw new \SwaggerGen\Exception("Unparseable string definition: '{$definition}'"); |
|
| 25 | + } |
|
| 26 | + |
|
| 27 | + $type = strtolower($match[1]); |
|
| 28 | + |
|
| 29 | + $reference = null; |
|
| 30 | + if ($type === 'refobject') { |
|
| 31 | + if (isset($match[2])) |
|
| 32 | + $reference = $match[2]; |
|
| 33 | + } else { |
|
| 34 | + $reference = $match[1]; |
|
| 35 | + } |
|
| 36 | + |
|
| 37 | + if (empty($reference)) { |
|
| 38 | + throw new \SwaggerGen\Exception("Referenced object name missing: '{$definition}'"); |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | 41 | $this->reference = $reference; |
| 42 | 42 | } |
@@ -35,6 +35,9 @@ |
||
| 35 | 35 | return $this->consumes; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | + /** |
|
| 39 | + * @param string $summary |
|
| 40 | + */ |
|
| 38 | 41 | public function __construct(AbstractObject $parent, $summary = null, Tag $tag = null) |
| 39 | 42 | { |
| 40 | 43 | parent::__construct($parent); |
@@ -69,6 +69,10 @@ discard block |
||
| 69 | 69 | $this->parseRange($definition, $match); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | + /** |
|
| 73 | + * @param string $definition |
|
| 74 | + * @param string[] $match |
|
| 75 | + */ |
|
| 72 | 76 | private function parseFormat($definition, $match) |
| 73 | 77 | { |
| 74 | 78 | $type = strtolower($match[1]); |
@@ -86,6 +90,10 @@ discard block |
||
| 86 | 90 | $this->collectionFormat = self::$collectionFormats[$type]; |
| 87 | 91 | } |
| 88 | 92 | |
| 93 | + /** |
|
| 94 | + * @param string $definition |
|
| 95 | + * @param string[] $match |
|
| 96 | + */ |
|
| 89 | 97 | private function parseItems($definition, $match) |
| 90 | 98 | { |
| 91 | 99 | if (!empty($match[2])) { |
@@ -93,6 +101,10 @@ discard block |
||
| 93 | 101 | } |
| 94 | 102 | } |
| 95 | 103 | |
| 104 | + /** |
|
| 105 | + * @param string $definition |
|
| 106 | + * @param string[] $match |
|
| 107 | + */ |
|
| 96 | 108 | private function parseRange($definition, $match) |
| 97 | 109 | { |
| 98 | 110 | if (!empty($match[3])) { |
@@ -42,6 +42,10 @@ discard block |
||
| 42 | 42 | $this->parseDefault($definition, $match); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | + /** |
|
| 46 | + * @param string $definition |
|
| 47 | + * @param string[] $match |
|
| 48 | + */ |
|
| 45 | 49 | private function parseFormat($definition, $match) |
| 46 | 50 | { |
| 47 | 51 | $type = strtolower($match[1]); |
@@ -51,6 +55,10 @@ discard block |
||
| 51 | 55 | $this->format = self::$formats[$type]; |
| 52 | 56 | } |
| 53 | 57 | |
| 58 | + /** |
|
| 59 | + * @param string $definition |
|
| 60 | + * @param string[] $match |
|
| 61 | + */ |
|
| 54 | 62 | private function parseContent($definition, $match) |
| 55 | 63 | { |
| 56 | 64 | if (strtolower($match[1]) === 'enum') { |
@@ -60,6 +68,10 @@ discard block |
||
| 60 | 68 | } |
| 61 | 69 | } |
| 62 | 70 | |
| 71 | + /** |
|
| 72 | + * @param string $definition |
|
| 73 | + * @param string[] $match |
|
| 74 | + */ |
|
| 63 | 75 | private function parseRange($definition, $match) |
| 64 | 76 | { |
| 65 | 77 | |
@@ -83,6 +95,10 @@ discard block |
||
| 83 | 95 | } |
| 84 | 96 | } |
| 85 | 97 | |
| 98 | + /** |
|
| 99 | + * @param string $definition |
|
| 100 | + * @param string[] $match |
|
| 101 | + */ |
|
| 86 | 102 | private function parseDefault($definition, $match) |
| 87 | 103 | { |
| 88 | 104 | $this->default = isset($match[7]) && $match[7] !== '' ? $this->validateDefault($match[7]) : null; |
@@ -69,6 +69,10 @@ discard block |
||
| 69 | 69 | $this->parseRange($definition, $match); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | + /** |
|
| 73 | + * @param string $definition |
|
| 74 | + * @param string[] $match |
|
| 75 | + */ |
|
| 72 | 76 | private function parseFormat($definition, $match) |
| 73 | 77 | { |
| 74 | 78 | $type = strtolower($match[1]); |
@@ -86,6 +90,10 @@ discard block |
||
| 86 | 90 | $this->collectionFormat = self::$collectionFormats[$type]; |
| 87 | 91 | } |
| 88 | 92 | |
| 93 | + /** |
|
| 94 | + * @param string $definition |
|
| 95 | + * @param string[] $match |
|
| 96 | + */ |
|
| 89 | 97 | private function parseItems($definition, $match) |
| 90 | 98 | { |
| 91 | 99 | if (!empty($match[2])) { |
@@ -93,6 +101,10 @@ discard block |
||
| 93 | 101 | } |
| 94 | 102 | } |
| 95 | 103 | |
| 104 | + /** |
|
| 105 | + * @param string $definition |
|
| 106 | + * @param string[] $match |
|
| 107 | + */ |
|
| 96 | 108 | private function parseRange($definition, $match) |
| 97 | 109 | { |
| 98 | 110 | if (!empty($match[3])) { |
@@ -41,6 +41,9 @@ discard block |
||
| 41 | 41 | $this->parseDefault($definition, $match); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | + /** |
|
| 45 | + * @param string[] $match |
|
| 46 | + */ |
|
| 44 | 47 | private function parseFormat($definition, $match) |
| 45 | 48 | { |
| 46 | 49 | if (!isset(self::$formats[strtolower($match[1])])) { |
@@ -49,6 +52,9 @@ discard block |
||
| 49 | 52 | $this->format = self::$formats[strtolower($match[1])]; |
| 50 | 53 | } |
| 51 | 54 | |
| 55 | + /** |
|
| 56 | + * @param string[] $match |
|
| 57 | + */ |
|
| 52 | 58 | private function parseRange($definition, $match) |
| 53 | 59 | { |
| 54 | 60 | if (!empty($match[2])) { |
@@ -67,6 +73,9 @@ discard block |
||
| 67 | 73 | } |
| 68 | 74 | } |
| 69 | 75 | |
| 76 | + /** |
|
| 77 | + * @param string[] $match |
|
| 78 | + */ |
|
| 70 | 79 | private function parseDefault($definition, $match) |
| 71 | 80 | { |
| 72 | 81 | $this->default = isset($match[6]) && $match[6] !== '' ? $this->validateDefault($match[6]) : null; |