@@ -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])) { |
@@ -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; |
@@ -81,6 +81,10 @@ |
||
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | + /** |
|
| 85 | + * @param string $definition |
|
| 86 | + * @param string[] $match |
|
| 87 | + */ |
|
| 84 | 88 | private function parseDefault($definition, $match) |
| 85 | 89 | { |
| 86 | 90 | $this->default = isset($match[6]) && $match[6] !== '' ? $this->validateDefault($match[6]) : null; |
@@ -42,6 +42,10 @@ discard block |
||
| 42 | 42 | $this->parseRange($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 | if (strtolower($match[1]) !== 'object') { |
@@ -49,6 +53,10 @@ discard block |
||
| 49 | 53 | } |
| 50 | 54 | } |
| 51 | 55 | |
| 56 | + /** |
|
| 57 | + * @param string $definition |
|
| 58 | + * @param string[] $match |
|
| 59 | + */ |
|
| 52 | 60 | private function parseProperties($definition, $match) |
| 53 | 61 | { |
| 54 | 62 | if (!empty($match[2])) { |
@@ -67,6 +75,10 @@ discard block |
||
| 67 | 75 | } |
| 68 | 76 | } |
| 69 | 77 | |
| 78 | + /** |
|
| 79 | + * @param string $definition |
|
| 80 | + * @param string[] $match |
|
| 81 | + */ |
|
| 70 | 82 | private function parseRange($definition, $match) |
| 71 | 83 | { |
| 72 | 84 | if (!empty($match[3])) { |
@@ -58,8 +58,8 @@ discard block |
||
| 58 | 58 | if (preg_match(self::REGEX_PROP_START . self::REGEX_PROP_NAME . self::REGEX_PROP_REQUIRED . self::REGEX_PROP_ASSIGN . self::REGEX_PROP_DEFINITION . self::REGEX_PROP_END, $property, $prop_match) !== 1) { |
| 59 | 59 | throw new \SwaggerGen\Exception("Unparseable property definition: '{$property}'"); |
| 60 | 60 | } |
| 61 | - $this->properties[$prop_match[1]] = new Property($this, $prop_match[3]); |
|
| 62 | - if ($prop_match[2] !== '!' && $prop_match[2] !== '?') { |
|
| 61 | + $this->properties[$prop_match[1]] = new Property($this, $prop_match[3]); |
|
| 62 | + if ($prop_match[2] !== '!' && $prop_match[2] !== '?') { |
|
| 63 | 63 | $this->required[$prop_match[1]] = true; |
| 64 | 64 | } |
| 65 | 65 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | // type name description... |
| 99 | 99 | case 'property': |
| 100 | 100 | case 'property?': |
| 101 | - case 'property!': |
|
| 101 | + case 'property!': |
|
| 102 | 102 | $definition = self::wordShift($data); |
| 103 | 103 | if (empty($definition)) { |
| 104 | 104 | throw new \SwaggerGen\Exception("Missing property definition"); |
@@ -111,17 +111,17 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | |
| 113 | 113 | |
| 114 | - unset($this->required[$name]); |
|
| 114 | + unset($this->required[$name]); |
|
| 115 | 115 | $readOnly = null; |
| 116 | - $propertySuffix = substr($command, -1); |
|
| 117 | - if ($propertySuffix === '!') { |
|
| 118 | - $readOnly = true; |
|
| 119 | - } |
|
| 116 | + $propertySuffix = substr($command, -1); |
|
| 117 | + if ($propertySuffix === '!') { |
|
| 118 | + $readOnly = true; |
|
| 119 | + } |
|
| 120 | 120 | else if ($propertySuffix !== '?') { |
| 121 | 121 | $this->required[$name] = true; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - $this->properties[$name] = new Property($this, $definition, $data, $readOnly); |
|
| 124 | + $this->properties[$name] = new Property($this, $definition, $data, $readOnly); |
|
| 125 | 125 | |
| 126 | 126 | return $this; |
| 127 | 127 | |
@@ -48,10 +48,10 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | private $description; |
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * Whether property is read only |
|
| 53 | - * @var bool |
|
| 54 | - */ |
|
| 51 | + /** |
|
| 52 | + * Whether property is read only |
|
| 53 | + * @var bool |
|
| 54 | + */ |
|
| 55 | 55 | private $readOnly; |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * @param \SwaggerGen\Swagger\AbstractObject $parent |
| 66 | 66 | * @param string $definition Either a built-in type or a definition name |
| 67 | 67 | * @param string $description description of the property |
| 68 | - * @param bool $readOnly Whether the property is read only |
|
| 68 | + * @param bool $readOnly Whether the property is read only |
|
| 69 | 69 | * @throws \SwaggerGen\Exception |
| 70 | 70 | */ |
| 71 | 71 | public function __construct(\SwaggerGen\Swagger\AbstractObject $parent, $definition, $description = null, $readOnly = null) |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | { |
| 110 | 110 | return self::arrayFilterNull(array_merge($this->Type->toArray(), array( |
| 111 | 111 | 'description' => empty($this->description) ? null : $this->description, |
| 112 | - 'readOnly' => $this->readOnly |
|
| 112 | + 'readOnly' => $this->readOnly |
|
| 113 | 113 | ), parent::toArray())); |
| 114 | 114 | } |
| 115 | 115 | |
@@ -142,13 +142,13 @@ |
||
| 142 | 142 | return $this; |
| 143 | 143 | |
| 144 | 144 | case 'model': |
| 145 | - case 'model!': |
|
| 145 | + case 'model!': |
|
| 146 | 146 | case 'definition': |
| 147 | - case 'definition!': |
|
| 147 | + case 'definition!': |
|
| 148 | 148 | $definition = new Schema($this); |
| 149 | 149 | if(substr($command, -1) === '!') { |
| 150 | - $definition->setReadOnly(); |
|
| 151 | - } |
|
| 150 | + $definition->setReadOnly(); |
|
| 151 | + } |
|
| 152 | 152 | $name = self::wordShift($data); |
| 153 | 153 | if (empty($name)) { |
| 154 | 154 | throw new \SwaggerGen\Exception('Missing definition name'); |
@@ -51,10 +51,10 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | private $title = null; |
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * @var bool |
|
| 56 | - */ |
|
| 57 | - private $readOnly = null; |
|
| 54 | + /** |
|
| 55 | + * @var bool |
|
| 56 | + */ |
|
| 57 | + private $readOnly = null; |
|
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | 60 | * @var \SwaggerGen\Swagger\Type\AbstractType |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | return self::arrayFilterNull(array_merge($this->type->toArray(), array( |
| 119 | 119 | 'title' => empty($this->title) ? null : $this->title, |
| 120 | 120 | 'description' => empty($this->description) ? null : $this->description, |
| 121 | - 'readOnly' => $this->readOnly |
|
| 121 | + 'readOnly' => $this->readOnly |
|
| 122 | 122 | ), parent::toArray())); |
| 123 | 123 | } |
| 124 | 124 | |
@@ -127,9 +127,9 @@ discard block |
||
| 127 | 127 | return __CLASS__; |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - public function setReadOnly() |
|
| 131 | - { |
|
| 132 | - $this->readOnly = true; |
|
| 133 | - } |
|
| 130 | + public function setReadOnly() |
|
| 131 | + { |
|
| 132 | + $this->readOnly = true; |
|
| 133 | + } |
|
| 134 | 134 | |
| 135 | 135 | } |