@@ -64,11 +64,17 @@ |
||
| 64 | 64 | $this->typeRegistry = $typeRegistry; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | + /** |
|
| 68 | + * @param string $name |
|
| 69 | + */ |
|
| 67 | 70 | public function define($name, $value = 1) |
| 68 | 71 | { |
| 69 | 72 | $this->defines[$name] = $value; |
| 70 | 73 | } |
| 71 | 74 | |
| 75 | + /** |
|
| 76 | + * @param string $name |
|
| 77 | + */ |
|
| 72 | 78 | public function undefine($name) |
| 73 | 79 | { |
| 74 | 80 | unset($this->defines[$name]); |
@@ -175,7 +175,7 @@ |
||
| 175 | 175 | return new $class($parent, $definition); |
| 176 | 176 | } elseif (isset(self::$classTypes[$format])) { |
| 177 | 177 | $type = self::$classTypes[$format]; |
| 178 | - $class = "\\SwaggerGen\\Swagger\\Type\\{$type}Type"; |
|
| 178 | + $class = "\\SwaggerGen\\Swagger\\Type\\{$type}type"; |
|
| 179 | 179 | return new $class($parent, $definition); |
| 180 | 180 | } else { |
| 181 | 181 | return new ReferenceObjectType($parent, $definition); |
@@ -111,7 +111,7 @@ |
||
| 111 | 111 | $this->Type = new $class($this, $definition); |
| 112 | 112 | } elseif (isset(self::$classTypes[$format])) { |
| 113 | 113 | $type = self::$classTypes[$format]; |
| 114 | - $class = "\\SwaggerGen\\Swagger\\Type\\{$type}Type"; |
|
| 114 | + $class = "\\SwaggerGen\\Swagger\\Type\\{$type}type"; |
|
| 115 | 115 | $this->Type = new $class($this, $definition); |
| 116 | 116 | } else { |
| 117 | 117 | throw new \SwaggerGen\Exception("Type format not recognized: '{$format}'"); |
@@ -10,8 +10,8 @@ discard block |
||
| 10 | 10 | * @copyright 2014-2017 Martijn van der Lee |
| 11 | 11 | * @license https://opensource.org/licenses/MIT MIT |
| 12 | 12 | */ |
| 13 | -class TypeRegistry |
|
| 14 | -{
|
|
| 13 | +class TypeRegistry |
|
| 14 | +{ |
|
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * Map of format-name => class-name |
@@ -25,10 +25,10 @@ discard block |
||
| 25 | 25 | * |
| 26 | 26 | * @param type $classname |
| 27 | 27 | */ |
| 28 | - public function add($classname) |
|
| 29 | - {
|
|
| 30 | - if (is_subclass_of($classname, '\\SwaggerGen\\Swagger\\Type\\Custom\\ICustomType', true)) {
|
|
| 31 | - foreach ($classname::getFormats() as $format) {
|
|
| 28 | + public function add($classname) |
|
| 29 | + { |
|
| 30 | + if (is_subclass_of($classname, '\\SwaggerGen\\Swagger\\Type\\Custom\\ICustomType', true)) { |
|
| 31 | + foreach ($classname::getFormats() as $format) { |
|
| 32 | 32 | $this->formats[$format] = $classname; |
| 33 | 33 | } |
| 34 | 34 | } |
@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | * |
| 40 | 40 | * @param string $name |
| 41 | 41 | */ |
| 42 | - public function remove($name) |
|
| 43 | - {
|
|
| 42 | + public function remove($name) |
|
| 43 | + { |
|
| 44 | 44 | $this->formats[$name] = null; |
| 45 | 45 | } |
| 46 | 46 | |
@@ -49,8 +49,8 @@ discard block |
||
| 49 | 49 | * |
| 50 | 50 | * @return bool |
| 51 | 51 | */ |
| 52 | - public function has($name) |
|
| 53 | - {
|
|
| 52 | + public function has($name) |
|
| 53 | + { |
|
| 54 | 54 | return !empty($this->formats[$name]); |
| 55 | 55 | } |
| 56 | 56 | |
@@ -59,8 +59,8 @@ discard block |
||
| 59 | 59 | * |
| 60 | 60 | * @return null|string |
| 61 | 61 | */ |
| 62 | - public function get($name) |
|
| 63 | - {
|
|
| 62 | + public function get($name) |
|
| 63 | + { |
|
| 64 | 64 | return !empty($this->formats[$name]) ? $this->formats[$name] : null; |
| 65 | 65 | } |
| 66 | 66 | |