@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | $stacktrace = array(); |
159 | 159 | foreach ($stack as $object) { |
160 | - $stacktrace[] = (string)$object; |
|
160 | + $stacktrace[] = (string) $object; |
|
161 | 161 | } |
162 | 162 | $messages[] = join(", \n", $stacktrace); |
163 | 163 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | break; |
175 | 175 | |
176 | 176 | case self::FORMAT_JSON_PRETTY: |
177 | - $flags = (defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 0); // Since PHP 5.4.0 |
|
177 | + $flags = (defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 0); // Since PHP 5.4.0 |
|
178 | 178 | $output = json_encode($output, $flags); |
179 | 179 | break; |
180 | 180 |
@@ -58,7 +58,7 @@ |
||
58 | 58 | if (!$this->handle($match[1], $match[2]) && $this->getState()) { |
59 | 59 | $output .= $line; |
60 | 60 | } else { |
61 | - $output .= str_replace('@'.$this->getPrefix(), '!'.$this->getPrefix(), $line); |
|
61 | + $output .= str_replace('@' . $this->getPrefix(), '!' . $this->getPrefix(), $line); |
|
62 | 62 | } |
63 | 63 | } else { |
64 | 64 | $output .= $line; |
@@ -153,9 +153,9 @@ |
||
153 | 153 | $commandLineNumber = $lineNumber; |
154 | 154 | } elseif ($command) { |
155 | 155 | if ($lineNumber < count($commentLines) - 1) { |
156 | - $data.= ' ' . $line; |
|
156 | + $data .= ' ' . $line; |
|
157 | 157 | } else { |
158 | - $data.= preg_replace('~\s*\**\/\s*$~', '', $line); |
|
158 | + $data .= preg_replace('~\s*\**\/\s*$~', '', $line); |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | } |
@@ -332,7 +332,8 @@ |
||
332 | 332 | |
333 | 333 | $match = null; |
334 | 334 | foreach ($Statements as $Statement) { |
335 | - if ($Statement->command === 'uses' || $Statement->command === 'see') { //@todo either one, not both? |
|
335 | + if ($Statement->command === 'uses' || $Statement->command === 'see') { |
|
336 | +//@todo either one, not both? |
|
336 | 337 | if (preg_match('/^((?:\\w+)|\$this)(?:(::|->)(\\w+))?(?:\\(\\))?$/', strtolower($Statement->data), $match) === 1) { |
337 | 338 | if (count($match) >= 3) { |
338 | 339 | $Class = null; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | protected $common_dirs = array(); |
55 | 55 | |
56 | - public function __construct(Array $dirs = array()) |
|
56 | + public function __construct(array $dirs = array()) |
|
57 | 57 | { |
58 | 58 | foreach ($dirs as $dir) { |
59 | 59 | $this->common_dirs[] = realpath($dir); |
@@ -62,14 +62,14 @@ discard block |
||
62 | 62 | $this->Preprocessor = new Preprocessor(self::COMMENT_TAG); |
63 | 63 | } |
64 | 64 | |
65 | - public function addDirs(Array $dirs) |
|
65 | + public function addDirs(array $dirs) |
|
66 | 66 | { |
67 | 67 | foreach ($dirs as $dir) { |
68 | 68 | $this->common_dirs[] = realpath($dir); |
69 | 69 | } |
70 | 70 | } |
71 | 71 | |
72 | - public function parse($file, Array $dirs = array(), Array $defines = array()) |
|
72 | + public function parse($file, array $dirs = array(), array $defines = array()) |
|
73 | 73 | { |
74 | 74 | $this->dirs = $this->common_dirs; |
75 | 75 | foreach ($dirs as $dir) { |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | * Add to the queue any classes based on the commands. |
198 | 198 | * @param \SwaggerGen\Statement[] $Statements |
199 | 199 | */ |
200 | - public function queueClassesFromComments(Array $Statements) |
|
200 | + public function queueClassesFromComments(array $Statements) |
|
201 | 201 | { |
202 | 202 | foreach ($Statements as $Statement) { |
203 | 203 | if ($Statement->command === 'uses' || $Statement->command === 'see') { |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | } |
212 | 212 | } |
213 | 213 | |
214 | - private function parseFiles(Array $files, Array $defines = array()) |
|
214 | + private function parseFiles(array $files, array $defines = array()) |
|
215 | 215 | { |
216 | 216 | $this->files_queued = $files; |
217 | 217 | |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | * @param \SwaggerGen\Statement[] $Statements |
327 | 327 | * @return \SwaggerGen\Statement[] |
328 | 328 | */ |
329 | - private function expand(Array $Statements, Entity\ParserClass $Self = null) |
|
329 | + private function expand(array $Statements, Entity\ParserClass $Self = null) |
|
330 | 330 | { |
331 | 331 | $output = array(); |
332 | 332 |
@@ -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 | } |
@@ -28,8 +28,9 @@ |
||
28 | 28 | |
29 | 29 | $reference = null; |
30 | 30 | if ($type === 'refobject') { |
31 | - if (isset($match[2])) |
|
32 | - $reference = $match[2]; |
|
31 | + if (isset($match[2])) { |
|
32 | + $reference = $match[2]; |
|
33 | + } |
|
33 | 34 | } else { |
34 | 35 | $reference = $match[1]; |
35 | 36 | } |
@@ -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); |
@@ -13,5 +13,5 @@ |
||
13 | 13 | interface IParser |
14 | 14 | { |
15 | 15 | |
16 | - public function parse($file, Array $dirs = array()); |
|
16 | + public function parse($file, array $dirs = array()); |
|
17 | 17 | } |
@@ -26,7 +26,7 @@ |
||
26 | 26 | $this->defines = array(); |
27 | 27 | } |
28 | 28 | |
29 | - public function addDefines(Array $defines) |
|
29 | + public function addDefines(array $defines) |
|
30 | 30 | { |
31 | 31 | $this->defines = array_merge($this->defines, $defines); |
32 | 32 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * |
34 | 34 | * @param string[] $dirs |
35 | 35 | */ |
36 | - public function __construct(Array $dirs = array()) |
|
36 | + public function __construct(array $dirs = array()) |
|
37 | 37 | { |
38 | 38 | foreach ($dirs as $dir) { |
39 | 39 | $this->common_dirs[] = realpath($dir); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * |
48 | 48 | * @param string[] $dirs |
49 | 49 | */ |
50 | - public function addDirs(Array $dirs) |
|
50 | + public function addDirs(array $dirs) |
|
51 | 51 | { |
52 | 52 | foreach ($dirs as $dir) { |
53 | 53 | $this->common_dirs[] = realpath($dir); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * @param string[] $defines |
63 | 63 | * @return \SwaggerGen\Statement[] |
64 | 64 | */ |
65 | - public function parse($file, Array $dirs = array(), Array $defines = array()) |
|
65 | + public function parse($file, array $dirs = array(), array $defines = array()) |
|
66 | 66 | { |
67 | 67 | return $this->parseText(file_get_contents(realpath($file)), $dirs); |
68 | 68 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * @param string[] $defines |
76 | 76 | * @return \SwaggerGen\Statement |
77 | 77 | */ |
78 | - public function parseText($text, Array $dirs = array(), Array $defines = array()) |
|
78 | + public function parseText($text, array $dirs = array(), array $defines = array()) |
|
79 | 79 | { |
80 | 80 | $this->dirs = $this->common_dirs; |
81 | 81 | foreach ($dirs as $dir) { |
@@ -169,7 +169,8 @@ |
||
169 | 169 | $this->Tags[] = $Tag; |
170 | 170 | } |
171 | 171 | |
172 | - if ($command === 'api') { // backwards compatibility |
|
172 | + if ($command === 'api') { |
|
173 | +// backwards compatibility |
|
173 | 174 | $this->defaultTag = $Tag; |
174 | 175 | } |
175 | 176 | return $Tag; |