@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | class RstBuilder |
27 | 27 | { |
28 | 28 | /** @var string */ |
29 | - protected $content = '.. rst-class:: phpdoctorst'.PHP_EOL.PHP_EOL; |
|
29 | + protected $content = '.. rst-class:: phpdoctorst' . PHP_EOL . PHP_EOL; |
|
30 | 30 | private $indentLevel = 0; |
31 | 31 | |
32 | 32 | public function getContent() |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | public function addFieldList($key, $value) |
38 | 38 | { |
39 | - $this->addLine(':'.self::escape($key).':'); |
|
39 | + $this->addLine(':' . self::escape($key) . ':'); |
|
40 | 40 | $this->indent()->addMultiline($value, false)->unindent(); |
41 | 41 | |
42 | 42 | return $this; |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | public function addLine($text = '') |
46 | 46 | { |
47 | - $this->add(str_repeat("\t", $this->indentLevel).$text.PHP_EOL); |
|
47 | + $this->add(str_repeat("\t", $this->indentLevel) . $text . PHP_EOL); |
|
48 | 48 | |
49 | 49 | return $this; |
50 | 50 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | public function addH1(string $text) |
105 | 105 | { |
106 | 106 | $this->addLine($text); |
107 | - $this->addLine(str_repeat('=', strlen((string) $text)))->addLine(); |
|
107 | + $this->addLine(str_repeat('=', strlen((string)$text)))->addLine(); |
|
108 | 108 | |
109 | 109 | return $this; |
110 | 110 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | public function addH2($text) |
113 | 113 | { |
114 | 114 | $this->addLine($text); |
115 | - $this->addLine(str_repeat('-', strlen((string) $text)))->addLine(); |
|
115 | + $this->addLine(str_repeat('-', strlen((string)$text)))->addLine(); |
|
116 | 116 | |
117 | 117 | return $this; |
118 | 118 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | public function addH3($text) |
121 | 121 | { |
122 | 122 | $this->addLine($text); |
123 | - $this->addLine(str_repeat('~', strlen((string) $text)))->addLine(); |
|
123 | + $this->addLine(str_repeat('~', strlen((string)$text)))->addLine(); |
|
124 | 124 | |
125 | 125 | return $this; |
126 | 126 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | { |
130 | 130 | $lines = preg_split('/$\R?^/m', $text); |
131 | 131 | foreach ($lines as $line) { |
132 | - $this->addLine('| '.$line); |
|
132 | + $this->addLine('| ' . $line); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | return $this; |
@@ -44,13 +44,13 @@ |
||
44 | 44 | $this->indent(); |
45 | 45 | $this->addLine(':maxdepth: 1')->addLine(); |
46 | 46 | foreach ($this->namespaces as $namespace) { |
47 | - $namespaceString = (string) $namespace->getFqsen(); |
|
47 | + $namespaceString = (string)$namespace->getFqsen(); |
|
48 | 48 | $subPath = $namespaceString; |
49 | - $path = substr(str_replace('\\', '/', $subPath), 1).'/index'; |
|
49 | + $path = substr(str_replace('\\', '/', $subPath), 1) . '/index'; |
|
50 | 50 | if ($namespaceString === '\\') { |
51 | 51 | $path = 'index'; |
52 | 52 | } |
53 | - $this->addLine($namespace->getFqsen().' <'.$path.'>'); |
|
53 | + $this->addLine($namespace->getFqsen() . ' <' . $path . '>'); |
|
54 | 54 | } |
55 | 55 | $this->addLine(); |
56 | 56 | $this->addLine(); |
@@ -70,19 +70,19 @@ discard block |
||
70 | 70 | */ |
71 | 71 | private function findChildNamespaces() |
72 | 72 | { |
73 | - $currentNamespaceFqsen = (string) $this->currentNamespace->getFqsen(); |
|
73 | + $currentNamespaceFqsen = (string)$this->currentNamespace->getFqsen(); |
|
74 | 74 | /** @var Namespace_ $namespace */ |
75 | 75 | foreach ($this->namespaces as $namespace) { |
76 | 76 | // check if not root and doesn't start with current namespace |
77 | - if ($currentNamespaceFqsen !== '\\' && strpos((string) $namespace->getFqsen(), |
|
78 | - $currentNamespaceFqsen.'\\') !== 0) { |
|
77 | + if ($currentNamespaceFqsen !== '\\' && strpos((string)$namespace->getFqsen(), |
|
78 | + $currentNamespaceFqsen . '\\') !== 0) { |
|
79 | 79 | continue; |
80 | 80 | } |
81 | - if ((string) $namespace->getFqsen() !== $currentNamespaceFqsen && strpos((string) $namespace->getFqsen(), |
|
81 | + if ((string)$namespace->getFqsen() !== $currentNamespaceFqsen && strpos((string)$namespace->getFqsen(), |
|
82 | 82 | $currentNamespaceFqsen) === 0) { |
83 | 83 | // only keep first level children |
84 | - $childrenPath = substr((string) $namespace->getFqsen(), |
|
85 | - strlen((string) $this->currentNamespace->getFqsen()) + 1); |
|
84 | + $childrenPath = substr((string)$namespace->getFqsen(), |
|
85 | + strlen((string)$this->currentNamespace->getFqsen()) + 1); |
|
86 | 86 | if (strpos($childrenPath, '\\') === false) { |
87 | 87 | $this->childNamespaces[] = $namespace; |
88 | 88 | } |
@@ -92,15 +92,15 @@ discard block |
||
92 | 92 | |
93 | 93 | public function render() |
94 | 94 | { |
95 | - $currentNamespaceFqsen = (string) $this->currentNamespace->getFqsen(); |
|
95 | + $currentNamespaceFqsen = (string)$this->currentNamespace->getFqsen(); |
|
96 | 96 | if ($currentNamespaceFqsen !== '\\') { |
97 | 97 | $label = str_replace('\\', '-', $currentNamespaceFqsen); |
98 | - $this->addLine('.. _namespace'.$label.':')->addLine(); |
|
98 | + $this->addLine('.. _namespace' . $label . ':')->addLine(); |
|
99 | 99 | $this->addH1(RstBuilder::escape($this->currentNamespace->getName())); |
100 | 100 | $this->addLine(self::escape($currentNamespaceFqsen))->addLine(); |
101 | 101 | } else { |
102 | 102 | $label = 'root-namespace'; |
103 | - $this->addLine('.. _namespace-'.$label.':')->addLine(); |
|
103 | + $this->addLine('.. _namespace-' . $label . ':')->addLine(); |
|
104 | 104 | $this->addH1(RstBuilder::escape('\\')); |
105 | 105 | } |
106 | 106 | $this->addLine(); |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | continue; |
130 | 130 | } |
131 | 131 | if ($type === self::RENDER_INDEX_NAMESPACE) { |
132 | - $this->addLine($entry->getName().' <'.$entry->getName().'/index>'); |
|
132 | + $this->addLine($entry->getName() . ' <' . $entry->getName() . '/index>'); |
|
133 | 133 | } else { |
134 | 134 | $this->addElementTocEntry($entry); |
135 | 135 | } |
@@ -200,14 +200,14 @@ discard block |
||
200 | 200 | |
201 | 201 | private function addElementTocEntry(Fqsen $entry) |
202 | 202 | { |
203 | - $currentNamespaceFqsen = (string) $this->currentNamespace->getFqsen(); |
|
203 | + $currentNamespaceFqsen = (string)$this->currentNamespace->getFqsen(); |
|
204 | 204 | $subPath = $entry; |
205 | 205 | if ($currentNamespaceFqsen !== '\\' && substr($entry, 0, |
206 | 206 | strlen($currentNamespaceFqsen)) === $currentNamespaceFqsen) { |
207 | 207 | $subPath = substr($entry, strlen($currentNamespaceFqsen)); |
208 | 208 | } |
209 | 209 | $path = substr(str_replace('\\', '/', $subPath), 1); |
210 | - $this->addLine($entry->getName().' <'.$path.'>'); |
|
210 | + $this->addLine($entry->getName() . ' <' . $path . '>'); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | private function addFunctions() |
@@ -233,10 +233,10 @@ discard block |
||
233 | 233 | /** @var Argument $argument */ |
234 | 234 | foreach ($function->getArguments() as $argument) { |
235 | 235 | // TODO: defaults, types |
236 | - $args .= '$'.$argument->getName().', '; |
|
236 | + $args .= '$' . $argument->getName() . ', '; |
|
237 | 237 | } |
238 | 238 | $args = substr($args, 0, -2); |
239 | - $this->beginPhpDomain('function', $function->getName().'('.$args.')'); |
|
239 | + $this->beginPhpDomain('function', $function->getName() . '(' . $args . ')'); |
|
240 | 240 | $this->addDocBlockDescription($function); |
241 | 241 | if (!empty($params)) { |
242 | 242 | foreach ($function->getArguments() as $argument) { |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | /** @var Param $param */ |
245 | 245 | $param = $params[$argument->getName()]; |
246 | 246 | if ($param !== null) { |
247 | - $this->addMultiline(':param '.self::escape($param->getType()).' $'.$argument->getName().': '.$param->getDescription(), |
|
247 | + $this->addMultiline(':param ' . self::escape($param->getType()) . ' $' . $argument->getName() . ': ' . $param->getDescription(), |
|
248 | 248 | true); |
249 | 249 | } |
250 | 250 | } |
@@ -58,7 +58,7 @@ |
||
58 | 58 | { |
59 | 59 | $implementedInterfaces = ''; |
60 | 60 | foreach ($element->getInterfaces() as $int) { |
61 | - $implementedInterfaces .= $this->getLink('interface', $int).' '; |
|
61 | + $implementedInterfaces .= $this->getLink('interface', $int) . ' '; |
|
62 | 62 | } |
63 | 63 | if ($implementedInterfaces !== '') { |
64 | 64 | $this->addFieldList('Implements', $implementedInterfaces); |