@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | public function __construct($srcDir, $dstDir) |
| 91 | 91 | { |
| 92 | 92 | $this->dstDir = $dstDir; |
| 93 | - $this->srcDir = (array) $srcDir; |
|
| 93 | + $this->srcDir = (array)$srcDir; |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | /** |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | try { |
| 126 | 126 | $interfaceList[] = new LocalFile($file->getPathname()); |
| 127 | 127 | } catch (Exception $e) { |
| 128 | - $this->log('Failed to load '.$file->getPathname().PHP_EOL); |
|
| 128 | + $this->log('Failed to load ' . $file->getPathname() . PHP_EOL); |
|
| 129 | 129 | } |
| 130 | 130 | } |
| 131 | 131 | } |
@@ -151,10 +151,10 @@ discard block |
||
| 151 | 151 | foreach ($this->extensionNames as $extensionName) { |
| 152 | 152 | $extension = new $extensionName($this->project, $this->extensionArguments[$extensionName]); |
| 153 | 153 | if (!is_subclass_of($extension, Extension::class)) { |
| 154 | - $this->log('Failed to load extension '.$extensionName.'.'); |
|
| 154 | + $this->log('Failed to load extension ' . $extensionName . '.'); |
|
| 155 | 155 | } |
| 156 | 156 | $this->extensions[] = $extension; |
| 157 | - $this->log('Extension '.$extensionName.' loaded.'); |
|
| 157 | + $this->log('Extension ' . $extensionName . ' loaded.'); |
|
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | public function log($message) |
| 167 | 167 | { |
| 168 | 168 | if ($this->verboseOutput) { |
| 169 | - echo $message.PHP_EOL; |
|
| 169 | + echo $message . PHP_EOL; |
|
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | |
@@ -178,12 +178,12 @@ discard block |
||
| 178 | 178 | private function createDirectoryStructure() |
| 179 | 179 | { |
| 180 | 180 | foreach ($this->project->getNamespaces() as $namespace) { |
| 181 | - $namespaceDir = $this->dstDir.str_replace('\\', '/', $namespace->getFqsen()); |
|
| 181 | + $namespaceDir = $this->dstDir . str_replace('\\', '/', $namespace->getFqsen()); |
|
| 182 | 182 | if (is_dir($namespaceDir)) { |
| 183 | 183 | continue; |
| 184 | 184 | } |
| 185 | 185 | if (!mkdir($namespaceDir, 0755, true)) { |
| 186 | - throw new WriteException('Could not create directory '.$namespaceDir); |
|
| 186 | + throw new WriteException('Could not create directory ' . $namespaceDir); |
|
| 187 | 187 | } |
| 188 | 188 | } |
| 189 | 189 | } |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | public function debug($message) |
| 220 | 220 | { |
| 221 | 221 | if ($this->debugOutput) { |
| 222 | - echo $message.PHP_EOL; |
|
| 222 | + echo $message . PHP_EOL; |
|
| 223 | 223 | } |
| 224 | 224 | } |
| 225 | 225 | |
@@ -228,13 +228,13 @@ discard block |
||
| 228 | 228 | $this->log('Build indexes.'); |
| 229 | 229 | $namespaces = $this->project->getNamespaces(); |
| 230 | 230 | $namespaces['\\'] = $this->project->getRootNamespace(); |
| 231 | - usort($namespaces, function (Namespace_ $a, Namespace_ $b) { |
|
| 231 | + usort($namespaces, function(Namespace_ $a, Namespace_ $b) { |
|
| 232 | 232 | return strcmp($a->getFqsen(), $b->getFqsen()); |
| 233 | 233 | }); |
| 234 | 234 | /** @var Namespace_ $namespace */ |
| 235 | 235 | foreach ($namespaces as $namespace) { |
| 236 | - $fqsen = (string) $namespace->getFqsen(); |
|
| 237 | - $this->debug('Build namespace index for '.$fqsen); |
|
| 236 | + $fqsen = (string)$namespace->getFqsen(); |
|
| 237 | + $this->debug('Build namespace index for ' . $fqsen); |
|
| 238 | 238 | $functions = []; |
| 239 | 239 | $constants = []; |
| 240 | 240 | if (array_key_exists($fqsen, $this->functions)) { |
@@ -245,14 +245,14 @@ discard block |
||
| 245 | 245 | } |
| 246 | 246 | $builder = new NamespaceIndexBuilder($this->extensions, $namespaces, $namespace, $functions, $constants); |
| 247 | 247 | $builder->render(); |
| 248 | - $path = $this->dstDir.str_replace('\\', '/', $fqsen).'/index.rst'; |
|
| 248 | + $path = $this->dstDir . str_replace('\\', '/', $fqsen) . '/index.rst'; |
|
| 249 | 249 | file_put_contents($path, $builder->getContent()); |
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | $this->log('Build main index files.'); |
| 253 | 253 | $builder = new MainIndexBuilder($namespaces); |
| 254 | 254 | $builder->render(); |
| 255 | - $path = $this->dstDir.'/index-namespaces-all.rst'; |
|
| 255 | + $path = $this->dstDir . '/index-namespaces-all.rst'; |
|
| 256 | 256 | file_put_contents($path, $builder->getContent()); |
| 257 | 257 | } |
| 258 | 258 | |
@@ -295,15 +295,15 @@ discard block |
||
| 295 | 295 | foreach ($file->getInterfaces() as $interface) { |
| 296 | 296 | $fqsen = $interface->getFqsen(); |
| 297 | 297 | $builder = new InterfaceFileBuilder($file, $interface, $this->extensions); |
| 298 | - $filename = $this->dstDir.str_replace('\\', '/', $fqsen).'.rst'; |
|
| 298 | + $filename = $this->dstDir . str_replace('\\', '/', $fqsen) . '.rst'; |
|
| 299 | 299 | file_put_contents($filename, $builder->getContent()); |
| 300 | - $this->docFiles[(string) $interface->getFqsen()] = str_replace('\\', '/', $fqsen); |
|
| 300 | + $this->docFiles[(string)$interface->getFqsen()] = str_replace('\\', '/', $fqsen); |
|
| 301 | 301 | |
| 302 | 302 | // also build root namespace in indexes |
| 303 | - if (strpos((string) substr($fqsen, 1), '\\') === false) { |
|
| 303 | + if (strpos((string)substr($fqsen, 1), '\\') === false) { |
|
| 304 | 304 | $this->project->getRootNamespace()->addInterface($fqsen); |
| 305 | 305 | } |
| 306 | - $this->debug('Written interface documentation to '.$filename); |
|
| 306 | + $this->debug('Written interface documentation to ' . $filename); |
|
| 307 | 307 | } |
| 308 | 308 | } |
| 309 | 309 | |
@@ -315,15 +315,15 @@ discard block |
||
| 315 | 315 | foreach ($file->getClasses() as $class) { |
| 316 | 316 | $fqsen = $class->getFqsen(); |
| 317 | 317 | $builder = new ClassFileBuilder($file, $class, $this->extensions); |
| 318 | - $filename = $this->dstDir.str_replace('\\', '/', $fqsen).'.rst'; |
|
| 318 | + $filename = $this->dstDir . str_replace('\\', '/', $fqsen) . '.rst'; |
|
| 319 | 319 | file_put_contents($filename, $builder->getContent()); |
| 320 | - $this->docFiles[(string) $class->getFqsen()] = str_replace('\\', '/', $fqsen); |
|
| 320 | + $this->docFiles[(string)$class->getFqsen()] = str_replace('\\', '/', $fqsen); |
|
| 321 | 321 | |
| 322 | 322 | // also build root namespace in indexes |
| 323 | - if (strpos((string) substr($class->getFqsen(), 1), '\\') === false) { |
|
| 323 | + if (strpos((string)substr($class->getFqsen(), 1), '\\') === false) { |
|
| 324 | 324 | $this->project->getRootNamespace()->addClass($fqsen); |
| 325 | 325 | } |
| 326 | - $this->debug('Written class documentation to '.$filename); |
|
| 326 | + $this->debug('Written class documentation to ' . $filename); |
|
| 327 | 327 | } |
| 328 | 328 | } |
| 329 | 329 | |
@@ -335,15 +335,15 @@ discard block |
||
| 335 | 335 | foreach ($file->getTraits() as $trait) { |
| 336 | 336 | $fqsen = $trait->getFqsen(); |
| 337 | 337 | $builder = new TraitFileBuilder($file, $trait, $this->extensions); |
| 338 | - $filename = $this->dstDir.str_replace('\\', '/', $fqsen).'.rst'; |
|
| 338 | + $filename = $this->dstDir . str_replace('\\', '/', $fqsen) . '.rst'; |
|
| 339 | 339 | file_put_contents($filename, $builder->getContent()); |
| 340 | - $this->docFiles[(string) $trait->getFqsen()] = str_replace('\\', '/', $fqsen); |
|
| 340 | + $this->docFiles[(string)$trait->getFqsen()] = str_replace('\\', '/', $fqsen); |
|
| 341 | 341 | |
| 342 | 342 | // also build root namespace in indexes |
| 343 | - if (strpos((string) substr($fqsen, 1), '\\') === false) { |
|
| 343 | + if (strpos((string)substr($fqsen, 1), '\\') === false) { |
|
| 344 | 344 | $this->project->getRootNamespace()->addTrait($fqsen); |
| 345 | 345 | } |
| 346 | - $this->debug('Written trait documentation to '.$filename); |
|
| 346 | + $this->debug('Written trait documentation to ' . $filename); |
|
| 347 | 347 | } |
| 348 | 348 | } |
| 349 | 349 | |