@@ -47,7 +47,7 @@ |
||
47 | 47 | return; |
48 | 48 | } |
49 | 49 | if ($type === PhpDomainBuilder::SECTION_BEFORE_DESCRIPTION) { |
50 | - if($element instanceof Class_) { |
|
50 | + if ($element instanceof Class_) { |
|
51 | 51 | $modifiers = $element->isAbstract() ? 'abstract' : ''; |
52 | 52 | $modifiers = $element->isFinal() ? ' final' : $modifiers; |
53 | 53 | $builder->addLine(':php:`' . $modifiers . ' class ' . RstBuilder::escape($builder->getElement()->getName()) . ' {}`'); |
@@ -52,7 +52,7 @@ |
||
52 | 52 | /** @var Interface_ $interface */ |
53 | 53 | $interface = $builder->getElement(); |
54 | 54 | |
55 | - if(count($interface->getMethods()) > 0) { |
|
55 | + if (count($interface->getMethods()) > 0) { |
|
56 | 56 | $builder->addH3('Methods'); |
57 | 57 | foreach ($interface->getMethods() as $method) { |
58 | 58 | $args = ''; |
@@ -71,17 +71,17 @@ |
||
71 | 71 | $apiDocBuilder->setVerboseOutput(true); |
72 | 72 | $apiDocBuilder->setDebugOutput(true); |
73 | 73 | } |
74 | - if($input->getOption('public-only')) { |
|
74 | + if ($input->getOption('public-only')) { |
|
75 | 75 | $apiDocBuilder->addExtension(PublicOnlyExtension::class); |
76 | 76 | } |
77 | - if(!$input->getOption('show-private')) { |
|
77 | + if (!$input->getOption('show-private')) { |
|
78 | 78 | $apiDocBuilder->addExtension(NoPrivateExtension::class); |
79 | 79 | } |
80 | - if($input->getOption('element-toc')) { |
|
80 | + if ($input->getOption('element-toc')) { |
|
81 | 81 | $apiDocBuilder->addExtension(TocExtension::class); |
82 | 82 | } |
83 | 83 | |
84 | - if($input->getOption('repo-github') && $input->getOption('repo-base')) { |
|
84 | + if ($input->getOption('repo-github') && $input->getOption('repo-base')) { |
|
85 | 85 | $apiDocBuilder->addExtension(GithubLocationExtension::class, [ |
86 | 86 | $input->getOption('repo-base'), |
87 | 87 | $input->getOption('repo-github') |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * @param string $class name of the extension class |
203 | 203 | * @throws \Exception |
204 | 204 | */ |
205 | - public function addExtension($class, $arguments=[]) { |
|
205 | + public function addExtension($class, $arguments = []) { |
|
206 | 206 | $this->extensionNames[] = $class; |
207 | 207 | $this->extensionArguments[$class] = $arguments; |
208 | 208 | |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | $this->log('Build indexes.'); |
303 | 303 | $namespaces = $this->project->getNamespaces(); |
304 | 304 | $namespaces['\\'] = $this->project->getRootNamespace(); |
305 | - usort($namespaces, function (Namespace_ $a, Namespace_ $b) { |
|
305 | + usort($namespaces, function(Namespace_ $a, Namespace_ $b) { |
|
306 | 306 | return strcmp($a->getFqsen(), $b->getFqsen()); |
307 | 307 | }); |
308 | 308 | /** @var Namespace_ $namespace */ |
@@ -37,7 +37,7 @@ |
||
37 | 37 | /** @var array */ |
38 | 38 | protected $arguments; |
39 | 39 | |
40 | - public function __construct(Project $project, $arguments=[]) { |
|
40 | + public function __construct(Project $project, $arguments = []) { |
|
41 | 41 | $this->project = $project; |
42 | 42 | $this->arguments = $arguments; |
43 | 43 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @return mixed |
71 | 71 | */ |
72 | 72 | public static function getNamespace(Element $element) { |
73 | - return substr($element->getFqsen(), 0, strlen($element->getFqsen())-strlen('\\'. $element->getName())); |
|
73 | + return substr($element->getFqsen(), 0, strlen($element->getFqsen()) - strlen('\\' . $element->getName())); |
|
74 | 74 | //return str_replace('\\' . $element->getName(), '', $element->getFqsen()); |
75 | 75 | } |
76 | 76 | |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | * @param Property $property |
165 | 165 | */ |
166 | 166 | private function addProperty(Property $property) { |
167 | - $modifiers = $property->isStatic() ? '' : ' static' ; |
|
167 | + $modifiers = $property->isStatic() ? '' : ' static'; |
|
168 | 168 | $this->beginPhpDomain('attr', $property->getVisibility() . $modifiers . ' ' . $property->getName()); |
169 | 169 | $docBlock = $property->getDocBlock(); |
170 | 170 | $this->addDocBlockDescription($property); |
@@ -239,10 +239,10 @@ discard block |
||
239 | 239 | $args .= self::escape($type) . '|'; |
240 | 240 | } |
241 | 241 | $args = substr($args, 0, -1) . ' '; |
242 | - if($argument->isVariadic()) { |
|
242 | + if ($argument->isVariadic()) { |
|
243 | 243 | $args .= '...'; |
244 | 244 | } |
245 | - if($argument->isByReference()) { |
|
245 | + if ($argument->isByReference()) { |
|
246 | 246 | $args .= '&'; |
247 | 247 | } |
248 | 248 | $args .= '$' . $argument->getName(); |
@@ -292,8 +292,8 @@ discard block |
||
292 | 292 | * @param $fqsen string |
293 | 293 | * @return string |
294 | 294 | */ |
295 | - public static function getLink($type, $fqsen, $description='') { |
|
296 | - if($description !== '') { |
|
295 | + public static function getLink($type, $fqsen, $description = '') { |
|
296 | + if ($description !== '') { |
|
297 | 297 | return ':php:' . $type . ':`' . RstBuilder::escape($description) . '<' . RstBuilder::escape(substr($fqsen, 1)) . '>`'; |
298 | 298 | } |
299 | 299 | return ':php:' . $type . ':`' . RstBuilder::escape(substr($fqsen, 1)) . '`'; |
@@ -361,44 +361,58 @@ discard block |
||
361 | 361 | $tags = $docBlock->getTagsByName($tagName); |
362 | 362 | switch ($tagName) { |
363 | 363 | case 'return': |
364 | - if (count($tags) === 0) continue; |
|
364 | + if (count($tags) === 0) { |
|
365 | + continue; |
|
366 | + } |
|
365 | 367 | /** @var Return_ $return */ |
366 | 368 | $return = $tags[0]; |
367 | 369 | $this->addMultilineWithoutRendering(':Returns: ' . self::typesToRst($return->getType()) . ' ' . RstBuilder::escape($return->getDescription())); |
368 | 370 | break; |
369 | 371 | case 'var': |
370 | - if (count($tags) === 0) continue; |
|
372 | + if (count($tags) === 0) { |
|
373 | + continue; |
|
374 | + } |
|
371 | 375 | /** @var DocBlock\Tags\Var_ $return */ |
372 | 376 | $return = $tags[0]; |
373 | 377 | $this->addMultiline(':Type: ' . self::typesToRst($return->getType()) . ' ' . RstBuilder::escape($return->getDescription()), true); |
374 | 378 | break; |
375 | 379 | case 'throws': |
376 | - if (count($tags) === 0) continue; |
|
380 | + if (count($tags) === 0) { |
|
381 | + continue; |
|
382 | + } |
|
377 | 383 | /** @var Throws $tag */ |
378 | 384 | foreach ($tags as $tag) { |
379 | 385 | $this->addMultiline(':Throws: ' . self::typesToRst($tag->getType()) . ' ' . RstBuilder::escape($tag->getDescription()), true); |
380 | 386 | } |
381 | 387 | break; |
382 | 388 | case 'since': |
383 | - if (count($tags) === 0) continue; |
|
389 | + if (count($tags) === 0) { |
|
390 | + continue; |
|
391 | + } |
|
384 | 392 | /** @var Since $return */ |
385 | 393 | $return = $tags[0]; |
386 | 394 | $this->addMultiline(':Since: ' . $return->getVersion() . ' ' . RstBuilder::escape($return->getDescription()), true); |
387 | 395 | break; |
388 | 396 | case 'deprecated': |
389 | - if (count($tags) === 0) continue; |
|
397 | + if (count($tags) === 0) { |
|
398 | + continue; |
|
399 | + } |
|
390 | 400 | /** @var Deprecated $return */ |
391 | 401 | $return = $tags[0]; |
392 | 402 | $this->addMultiline(':Deprecated: ' . $return->getVersion() . ' ' . RstBuilder::escape($return->getDescription()), true); |
393 | 403 | break; |
394 | 404 | case 'see': |
395 | - if (count($tags) === 0) continue; |
|
405 | + if (count($tags) === 0) { |
|
406 | + continue; |
|
407 | + } |
|
396 | 408 | /** @var See $return */ |
397 | 409 | $return = $tags[0]; |
398 | 410 | $this->addMultiline(':See: ' . self::typesToRst($return->getReference()) . ' ' . RstBuilder::escape($return->getDescription()), true); |
399 | 411 | break; |
400 | 412 | case 'license': |
401 | - if (count($tags) === 0) continue; |
|
413 | + if (count($tags) === 0) { |
|
414 | + continue; |
|
415 | + } |
|
402 | 416 | /** @var DocBlock\Tags\BaseTag $return */ |
403 | 417 | $return = $tags[0]; |
404 | 418 | $this->addMultiline(':License: ' . RstBuilder::escape($return->getDescription()), true); |
@@ -432,8 +446,9 @@ discard block |
||
432 | 446 | $result .= $typeFull . ' | '; |
433 | 447 | continue; |
434 | 448 | } |
435 | - if (0 === strpos($type, '\\')) |
|
436 | - $type = substr($type, 1); |
|
449 | + if (0 === strpos($type, '\\')) { |
|
450 | + $type = substr($type, 1); |
|
451 | + } |
|
437 | 452 | $result .= ':any:`' . RstBuilder::escape($typeFull) . ' <' . RstBuilder::escape($type) . '>` | '; |
438 | 453 | } |
439 | 454 | return substr($result, 0, -3); |
@@ -71,12 +71,12 @@ |
||
71 | 71 | $filePath = preg_replace('/^' . preg_quote($this->basePath, '/') . '/', '', $filePath); |
72 | 72 | $lineNumber = $element->getLocation()->getLineNumber(); |
73 | 73 | $url = $this->getGithubLink($filePath, $lineNumber, $this->branch); |
74 | - $builder->addFieldList('Source', '`' . $filePath. '#' . $lineNumber . ' <'.$url.'>`_'); |
|
74 | + $builder->addFieldList('Source', '`' . $filePath . '#' . $lineNumber . ' <' . $url . '>`_'); |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 | |
78 | - private function getGithubLink($file, $line=1, $branch='master') { |
|
79 | - return $this->githubRepo . '/blob/'.$branch.'/'.$file.'#L' . $line; |
|
78 | + private function getGithubLink($file, $line = 1, $branch = 'master') { |
|
79 | + return $this->githubRepo . '/blob/' . $branch . '/' . $file . '#L' . $line; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | } |
83 | 83 | \ No newline at end of file |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | |
36 | 36 | private $indentLevel = 0; |
37 | 37 | /** @var string */ |
38 | - protected $content = '.. rst-class:: phpdoctorst' . PHP_EOL . PHP_EOL ; |
|
38 | + protected $content = '.. rst-class:: phpdoctorst' . PHP_EOL . PHP_EOL; |
|
39 | 39 | |
40 | 40 | public function getContent() { |
41 | 41 | return $this->content; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | } |
60 | 60 | |
61 | 61 | public function addFieldList($key, $value) { |
62 | - $this->addLine(':'.self::escape($key).':'); |
|
62 | + $this->addLine(':' . self::escape($key) . ':'); |
|
63 | 63 | $this->indent()->addMultiline($value, false)->unindent(); |
64 | 64 | return $this; |
65 | 65 | } |