@@ -142,9 +142,9 @@ discard block |
||
| 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 | $name = self::wordShift($data); |
| 149 | 149 | if (empty($name)) { |
| 150 | 150 | throw new \SwaggerGen\Exception('Missing definition name'); |
@@ -156,8 +156,8 @@ discard block |
||
| 156 | 156 | |
| 157 | 157 | $definition = new Schema($this, $typeDef); |
| 158 | 158 | if(substr($command, -1) === '!') { |
| 159 | - $definition->setReadOnly(); |
|
| 160 | - } |
|
| 159 | + $definition->setReadOnly(); |
|
| 160 | + } |
|
| 161 | 161 | $this->definitions[$name] = $definition; |
| 162 | 162 | return $definition; |
| 163 | 163 | |
@@ -155,7 +155,7 @@ |
||
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | $definition = new Schema($this, $typeDef); |
| 158 | - if(substr($command, -1) === '!') { |
|
| 158 | + if (substr($command, -1) === '!') { |
|
| 159 | 159 | $definition->setReadOnly(); |
| 160 | 160 | } |
| 161 | 161 | $this->definitions[$name] = $definition; |
@@ -120,7 +120,7 @@ |
||
| 120 | 120 | // Internal type if type known and not overwritten by definition |
| 121 | 121 | if (isset(self::$classTypes[$format])) { |
| 122 | 122 | $type = self::$classTypes[$format]; |
| 123 | - $class = "SwaggerGen\\Swagger\\Type\\{$type}Type"; |
|
| 123 | + $class = "SwaggerGen\\Swagger\\Type\\{$type}type"; |
|
| 124 | 124 | return new $class($parent, $definition); |
| 125 | 125 | } else { |
| 126 | 126 | return new ReferenceObjectType($parent, $definition); |
@@ -55,6 +55,10 @@ discard block |
||
| 55 | 55 | $this->parseRange($definition, $match); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | + /** |
|
| 59 | + * @param string $definition |
|
| 60 | + * @param string[] $match |
|
| 61 | + */ |
|
| 58 | 62 | private function parseFormat($definition, $match) |
| 59 | 63 | { |
| 60 | 64 | if (strtolower($match[1]) !== 'object') { |
@@ -62,6 +66,10 @@ discard block |
||
| 62 | 66 | } |
| 63 | 67 | } |
| 64 | 68 | |
| 69 | + /** |
|
| 70 | + * @param string $definition |
|
| 71 | + * @param string[] $match |
|
| 72 | + */ |
|
| 65 | 73 | private function parseProperties($definition, $match) |
| 66 | 74 | { |
| 67 | 75 | if (!empty($match[2])) { |
@@ -80,6 +88,10 @@ discard block |
||
| 80 | 88 | } |
| 81 | 89 | } |
| 82 | 90 | |
| 91 | + /** |
|
| 92 | + * @param string $definition |
|
| 93 | + * @param string[] $match |
|
| 94 | + */ |
|
| 83 | 95 | private function parseRange($definition, $match) |
| 84 | 96 | { |
| 85 | 97 | if (!empty($match[3])) { |
@@ -100,6 +112,9 @@ discard block |
||
| 100 | 112 | } |
| 101 | 113 | } |
| 102 | 114 | |
| 115 | + /** |
|
| 116 | + * @param string|false $discriminator |
|
| 117 | + */ |
|
| 103 | 118 | private function setDiscriminator($discriminator) |
| 104 | 119 | { |
| 105 | 120 | if (!empty($this->discriminator)) { |
@@ -104,13 +104,13 @@ discard block |
||
| 104 | 104 | { |
| 105 | 105 | if (!empty($this->discriminator)) { |
| 106 | 106 | throw new \SwaggerGen\Exception("Discriminator may only be set once, " |
| 107 | - . "trying to change it " |
|
| 108 | - . "from '{$this->discriminator}' " |
|
| 109 | - . "to '{$discriminator}'"); |
|
| 107 | + . "trying to change it " |
|
| 108 | + . "from '{$this->discriminator}' " |
|
| 109 | + . "to '{$discriminator}'"); |
|
| 110 | 110 | } |
| 111 | 111 | if (isset($this->properties[$discriminator]) && empty($this->required[$discriminator])) { |
| 112 | 112 | throw new \SwaggerGen\Exception("Discriminator must be a required property, " |
| 113 | - . "property '{$discriminator}' is not required"); |
|
| 113 | + . "property '{$discriminator}' is not required"); |
|
| 114 | 114 | } |
| 115 | 115 | $this->discriminator = $discriminator; |
| 116 | 116 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | |
| 153 | 153 | if (($name === $this->discriminator) && !$required) { |
| 154 | 154 | throw new \SwaggerGen\Exception("Discriminator must be a required property, " |
| 155 | - . "property '{$name}' is not required"); |
|
| 155 | + . "property '{$name}' is not required"); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | unset($this->required[$name]); |