@@ -37,23 +37,23 @@ discard block |
||
| 37 | 37 | const OPTION_PATHMODE = 'pathmode'; |
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | - * @var string |
|
| 41 | - */ |
|
| 40 | + * @var string |
|
| 41 | + */ |
|
| 42 | 42 | protected $path; |
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * @var string[] |
|
| 46 | - */ |
|
| 44 | + /** |
|
| 45 | + * @var string[] |
|
| 46 | + */ |
|
| 47 | 47 | protected $found; |
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * The path must exist when the class is instantiated: its |
|
| 51 | - * real path will be determined to work with. |
|
| 52 | - * |
|
| 53 | - * @param string $path The absolute path to the target folder. |
|
| 54 | - * @throws FileHelper_Exception |
|
| 55 | - * @see FileHelper_FileFinder::ERROR_PATH_DOES_NOT_EXIST |
|
| 56 | - */ |
|
| 49 | + /** |
|
| 50 | + * The path must exist when the class is instantiated: its |
|
| 51 | + * real path will be determined to work with. |
|
| 52 | + * |
|
| 53 | + * @param string $path The absolute path to the target folder. |
|
| 54 | + * @throws FileHelper_Exception |
|
| 55 | + * @see FileHelper_FileFinder::ERROR_PATH_DOES_NOT_EXIST |
|
| 56 | + */ |
|
| 57 | 57 | public function __construct(string $path) |
| 58 | 58 | { |
| 59 | 59 | $real = realpath($path); |
@@ -85,66 +85,66 @@ discard block |
||
| 85 | 85 | ); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - /** |
|
| 89 | - * Enables extension stripping, to return file names without extension. |
|
| 90 | - * |
|
| 91 | - * @return FileHelper_FileFinder |
|
| 92 | - */ |
|
| 88 | + /** |
|
| 89 | + * Enables extension stripping, to return file names without extension. |
|
| 90 | + * |
|
| 91 | + * @return FileHelper_FileFinder |
|
| 92 | + */ |
|
| 93 | 93 | public function stripExtensions() : FileHelper_FileFinder |
| 94 | 94 | { |
| 95 | 95 | return $this->setOption('strip-extensions', true); |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - /** |
|
| 99 | - * Enables recursing into subfolders. |
|
| 100 | - * |
|
| 101 | - * @return FileHelper_FileFinder |
|
| 102 | - */ |
|
| 98 | + /** |
|
| 99 | + * Enables recursing into subfolders. |
|
| 100 | + * |
|
| 101 | + * @return FileHelper_FileFinder |
|
| 102 | + */ |
|
| 103 | 103 | public function makeRecursive() : FileHelper_FileFinder |
| 104 | 104 | { |
| 105 | 105 | return $this->setOption('recursive', true); |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - /** |
|
| 109 | - * Retrieves all extensions that were added to |
|
| 110 | - * the include list. |
|
| 111 | - * |
|
| 112 | - * @return string[] |
|
| 113 | - */ |
|
| 108 | + /** |
|
| 109 | + * Retrieves all extensions that were added to |
|
| 110 | + * the include list. |
|
| 111 | + * |
|
| 112 | + * @return string[] |
|
| 113 | + */ |
|
| 114 | 114 | public function getIncludeExtensions() : array |
| 115 | 115 | { |
| 116 | 116 | return $this->getArrayOption(self::OPTION_INCLUDE_EXTENSIONS); |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - /** |
|
| 120 | - * Includes a single extension in the file search: only |
|
| 121 | - * files with this extension will be used in the results. |
|
| 122 | - * |
|
| 123 | - * NOTE: Included extensions take precedence before excluded |
|
| 124 | - * extensions. If any excluded extensions are specified, they |
|
| 125 | - * will be ignored. |
|
| 126 | - * |
|
| 127 | - * @param string $extension Extension name, without dot (`php` for example). |
|
| 128 | - * @return FileHelper_FileFinder |
|
| 129 | - * @see FileHelper_FileFinder::includeExtensions() |
|
| 130 | - */ |
|
| 119 | + /** |
|
| 120 | + * Includes a single extension in the file search: only |
|
| 121 | + * files with this extension will be used in the results. |
|
| 122 | + * |
|
| 123 | + * NOTE: Included extensions take precedence before excluded |
|
| 124 | + * extensions. If any excluded extensions are specified, they |
|
| 125 | + * will be ignored. |
|
| 126 | + * |
|
| 127 | + * @param string $extension Extension name, without dot (`php` for example). |
|
| 128 | + * @return FileHelper_FileFinder |
|
| 129 | + * @see FileHelper_FileFinder::includeExtensions() |
|
| 130 | + */ |
|
| 131 | 131 | public function includeExtension(string $extension) : FileHelper_FileFinder |
| 132 | 132 | { |
| 133 | 133 | return $this->includeExtensions(array($extension)); |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - /** |
|
| 137 | - * Includes several extensions in the file search: only |
|
| 138 | - * files with these extensions wil be used in the results. |
|
| 139 | - * |
|
| 140 | - * NOTE: Included extensions take precedence before excluded |
|
| 141 | - * extensions. If any excluded extensions are specified, they |
|
| 142 | - * will be ignored. |
|
| 143 | - * |
|
| 144 | - * @param string[] $extensions Extension names, without dot (`php` for example). |
|
| 145 | - * @return FileHelper_FileFinder |
|
| 146 | - * @see FileHelper_FileFinder::includeExtension() |
|
| 147 | - */ |
|
| 136 | + /** |
|
| 137 | + * Includes several extensions in the file search: only |
|
| 138 | + * files with these extensions wil be used in the results. |
|
| 139 | + * |
|
| 140 | + * NOTE: Included extensions take precedence before excluded |
|
| 141 | + * extensions. If any excluded extensions are specified, they |
|
| 142 | + * will be ignored. |
|
| 143 | + * |
|
| 144 | + * @param string[] $extensions Extension names, without dot (`php` for example). |
|
| 145 | + * @return FileHelper_FileFinder |
|
| 146 | + * @see FileHelper_FileFinder::includeExtension() |
|
| 147 | + */ |
|
| 148 | 148 | public function includeExtensions(array $extensions) : FileHelper_FileFinder |
| 149 | 149 | { |
| 150 | 150 | $items = $this->getIncludeExtensions(); |
@@ -155,37 +155,37 @@ discard block |
||
| 155 | 155 | return $this; |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - /** |
|
| 159 | - * Retrieves a list of all extensions currently set as |
|
| 160 | - * excluded from the search. |
|
| 161 | - * |
|
| 162 | - * @return string[] |
|
| 163 | - */ |
|
| 158 | + /** |
|
| 159 | + * Retrieves a list of all extensions currently set as |
|
| 160 | + * excluded from the search. |
|
| 161 | + * |
|
| 162 | + * @return string[] |
|
| 163 | + */ |
|
| 164 | 164 | public function getExcludeExtensions() : array |
| 165 | 165 | { |
| 166 | 166 | return $this->getArrayOption(self::OPTION_EXCLUDE_EXTENSIONS); |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | - /** |
|
| 170 | - * Excludes a single extension from the search. |
|
| 171 | - * |
|
| 172 | - * @param string $extension Extension name, without dot (`php` for example). |
|
| 173 | - * @return FileHelper_FileFinder |
|
| 174 | - * @see FileHelper_FileFinder::excludeExtensions() |
|
| 175 | - */ |
|
| 169 | + /** |
|
| 170 | + * Excludes a single extension from the search. |
|
| 171 | + * |
|
| 172 | + * @param string $extension Extension name, without dot (`php` for example). |
|
| 173 | + * @return FileHelper_FileFinder |
|
| 174 | + * @see FileHelper_FileFinder::excludeExtensions() |
|
| 175 | + */ |
|
| 176 | 176 | public function excludeExtension(string $extension) : FileHelper_FileFinder |
| 177 | 177 | { |
| 178 | 178 | return $this->excludeExtensions(array($extension)); |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - /** |
|
| 182 | - * Add several extensions to the list of extensions to |
|
| 183 | - * exclude from the file search. |
|
| 184 | - * |
|
| 185 | - * @param string[] $extensions Extension names, without dot (`php` for example). |
|
| 186 | - * @return FileHelper_FileFinder |
|
| 187 | - * @see FileHelper_FileFinder::excludeExtension() |
|
| 188 | - */ |
|
| 181 | + /** |
|
| 182 | + * Add several extensions to the list of extensions to |
|
| 183 | + * exclude from the file search. |
|
| 184 | + * |
|
| 185 | + * @param string[] $extensions Extension names, without dot (`php` for example). |
|
| 186 | + * @return FileHelper_FileFinder |
|
| 187 | + * @see FileHelper_FileFinder::excludeExtension() |
|
| 188 | + */ |
|
| 189 | 189 | public function excludeExtensions(array $extensions) : FileHelper_FileFinder |
| 190 | 190 | { |
| 191 | 191 | $items = $this->getExcludeExtensions(); |
@@ -196,52 +196,52 @@ discard block |
||
| 196 | 196 | return $this; |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - /** |
|
| 200 | - * In this mode, the entire path to the file will be stripped, |
|
| 201 | - * leaving only the file name in the files list. |
|
| 202 | - * |
|
| 203 | - * @return FileHelper_FileFinder |
|
| 204 | - */ |
|
| 199 | + /** |
|
| 200 | + * In this mode, the entire path to the file will be stripped, |
|
| 201 | + * leaving only the file name in the files list. |
|
| 202 | + * |
|
| 203 | + * @return FileHelper_FileFinder |
|
| 204 | + */ |
|
| 205 | 205 | public function setPathmodeStrip() : FileHelper_FileFinder |
| 206 | 206 | { |
| 207 | 207 | return $this->setPathmode(self::PATH_MODE_STRIP); |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - /** |
|
| 211 | - * In this mode, only the path relative to the source folder |
|
| 212 | - * will be included in the files list. |
|
| 213 | - * |
|
| 214 | - * @return FileHelper_FileFinder |
|
| 215 | - */ |
|
| 210 | + /** |
|
| 211 | + * In this mode, only the path relative to the source folder |
|
| 212 | + * will be included in the files list. |
|
| 213 | + * |
|
| 214 | + * @return FileHelper_FileFinder |
|
| 215 | + */ |
|
| 216 | 216 | public function setPathmodeRelative() : FileHelper_FileFinder |
| 217 | 217 | { |
| 218 | 218 | return $this->setPathmode(self::PATH_MODE_RELATIVE); |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - /** |
|
| 222 | - * In this mode, the full, absolute paths to the files will |
|
| 223 | - * be included in the files list. |
|
| 224 | - * |
|
| 225 | - * @return FileHelper_FileFinder |
|
| 226 | - */ |
|
| 221 | + /** |
|
| 222 | + * In this mode, the full, absolute paths to the files will |
|
| 223 | + * be included in the files list. |
|
| 224 | + * |
|
| 225 | + * @return FileHelper_FileFinder |
|
| 226 | + */ |
|
| 227 | 227 | public function setPathmodeAbsolute() : FileHelper_FileFinder |
| 228 | 228 | { |
| 229 | 229 | return $this->setPathmode(self::PATH_MODE_ABSOLUTE); |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | - /** |
|
| 233 | - * This sets a character or string to replace the slashes |
|
| 234 | - * in the paths with. |
|
| 235 | - * |
|
| 236 | - * This is used for example in the `getPHPClassNames()` |
|
| 237 | - * method, to return files from subfolders as class names |
|
| 238 | - * using the "_" character: |
|
| 239 | - * |
|
| 240 | - * Subfolder/To/File.php => Subfolder_To_File.php |
|
| 241 | - * |
|
| 242 | - * @param string $character |
|
| 243 | - * @return FileHelper_FileFinder |
|
| 244 | - */ |
|
| 232 | + /** |
|
| 233 | + * This sets a character or string to replace the slashes |
|
| 234 | + * in the paths with. |
|
| 235 | + * |
|
| 236 | + * This is used for example in the `getPHPClassNames()` |
|
| 237 | + * method, to return files from subfolders as class names |
|
| 238 | + * using the "_" character: |
|
| 239 | + * |
|
| 240 | + * Subfolder/To/File.php => Subfolder_To_File.php |
|
| 241 | + * |
|
| 242 | + * @param string $character |
|
| 243 | + * @return FileHelper_FileFinder |
|
| 244 | + */ |
|
| 245 | 245 | public function setSlashReplacement(string $character) : FileHelper_FileFinder |
| 246 | 246 | { |
| 247 | 247 | return $this->setOption('slash-replacement', $character); |
@@ -264,12 +264,12 @@ discard block |
||
| 264 | 264 | return $this->setOption(self::OPTION_PATHMODE, $mode); |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | - /** |
|
| 268 | - * Retrieves a list of all matching file names/paths, |
|
| 269 | - * depending on the selected options. |
|
| 270 | - * |
|
| 271 | - * @return string[] |
|
| 272 | - */ |
|
| 267 | + /** |
|
| 268 | + * Retrieves a list of all matching file names/paths, |
|
| 269 | + * depending on the selected options. |
|
| 270 | + * |
|
| 271 | + * @return string[] |
|
| 272 | + */ |
|
| 273 | 273 | public function getAll() : array |
| 274 | 274 | { |
| 275 | 275 | $this->find($this->path, true); |
@@ -277,24 +277,24 @@ discard block |
||
| 277 | 277 | return $this->found; |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - /** |
|
| 281 | - * Retrieves only PHP files. Can be combined with other |
|
| 282 | - * options like enabling recursion into subfolders. |
|
| 283 | - * |
|
| 284 | - * @return string[] |
|
| 285 | - */ |
|
| 280 | + /** |
|
| 281 | + * Retrieves only PHP files. Can be combined with other |
|
| 282 | + * options like enabling recursion into subfolders. |
|
| 283 | + * |
|
| 284 | + * @return string[] |
|
| 285 | + */ |
|
| 286 | 286 | public function getPHPFiles() : array |
| 287 | 287 | { |
| 288 | 288 | $this->includeExtensions(array('php')); |
| 289 | 289 | return $this->getAll(); |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | - /** |
|
| 293 | - * Generates PHP class names from file paths: it replaces |
|
| 294 | - * slashes with underscores, and removes file extensions. |
|
| 295 | - * |
|
| 296 | - * @return string[] An array of PHP file names without extension. |
|
| 297 | - */ |
|
| 292 | + /** |
|
| 293 | + * Generates PHP class names from file paths: it replaces |
|
| 294 | + * slashes with underscores, and removes file extensions. |
|
| 295 | + * |
|
| 296 | + * @return string[] An array of PHP file names without extension. |
|
| 297 | + */ |
|
| 298 | 298 | public function getPHPClassNames() : array |
| 299 | 299 | { |
| 300 | 300 | $this->includeExtensions(array('php')); |
@@ -365,13 +365,13 @@ discard block |
||
| 365 | 365 | return $path; |
| 366 | 366 | } |
| 367 | 367 | |
| 368 | - /** |
|
| 369 | - * Checks whether the specified extension is allowed |
|
| 370 | - * with the current settings. |
|
| 371 | - * |
|
| 372 | - * @param string $extension |
|
| 373 | - * @return bool |
|
| 374 | - */ |
|
| 368 | + /** |
|
| 369 | + * Checks whether the specified extension is allowed |
|
| 370 | + * with the current settings. |
|
| 371 | + * |
|
| 372 | + * @param string $extension |
|
| 373 | + * @return bool |
|
| 374 | + */ |
|
| 375 | 375 | protected function filterExclusion(string $extension) : bool |
| 376 | 376 | { |
| 377 | 377 | $include = $this->getOption(self::OPTION_INCLUDE_EXTENSIONS); |
@@ -393,12 +393,12 @@ discard block |
||
| 393 | 393 | return true; |
| 394 | 394 | } |
| 395 | 395 | |
| 396 | - /** |
|
| 397 | - * Adjusts the path according to the selected path mode. |
|
| 398 | - * |
|
| 399 | - * @param string $path |
|
| 400 | - * @return string |
|
| 401 | - */ |
|
| 396 | + /** |
|
| 397 | + * Adjusts the path according to the selected path mode. |
|
| 398 | + * |
|
| 399 | + * @param string $path |
|
| 400 | + * @return string |
|
| 401 | + */ |
|
| 402 | 402 | protected function filterPath(string $path) : string |
| 403 | 403 | { |
| 404 | 404 | switch($this->getStringOption(self::OPTION_PATHMODE)) |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | * @see FileHelper_FileFinder |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -declare(strict_types = 1); |
|
| 10 | +declare(strict_types=1); |
|
| 11 | 11 | |
| 12 | 12 | namespace AppUtils; |
| 13 | 13 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | { |
| 59 | 59 | $real = realpath($path); |
| 60 | 60 | |
| 61 | - if($real === false) |
|
| 61 | + if ($real === false) |
|
| 62 | 62 | { |
| 63 | 63 | throw new FileHelper_Exception( |
| 64 | 64 | 'Target path does not exist', |
@@ -305,22 +305,22 @@ discard block |
||
| 305 | 305 | return $this->getAll(); |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | - protected function find(string $path, bool $isRoot=false) : void |
|
| 308 | + protected function find(string $path, bool $isRoot = false) : void |
|
| 309 | 309 | { |
| 310 | - if($isRoot) { |
|
| 310 | + if ($isRoot) { |
|
| 311 | 311 | $this->found = array(); |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | $recursive = $this->getBoolOption('recursive'); |
| 315 | 315 | |
| 316 | 316 | $d = new \DirectoryIterator($path); |
| 317 | - foreach($d as $item) |
|
| 317 | + foreach ($d as $item) |
|
| 318 | 318 | { |
| 319 | 319 | $pathname = $item->getPathname(); |
| 320 | 320 | |
| 321 | - if($item->isDir()) |
|
| 321 | + if ($item->isDir()) |
|
| 322 | 322 | { |
| 323 | - if($recursive && !$item->isDot()) { |
|
| 323 | + if ($recursive && !$item->isDot()) { |
|
| 324 | 324 | $this->find($pathname); |
| 325 | 325 | } |
| 326 | 326 | |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | |
| 330 | 330 | $file = $this->filterFile($pathname); |
| 331 | 331 | |
| 332 | - if($file !== null) |
|
| 332 | + if ($file !== null) |
|
| 333 | 333 | { |
| 334 | 334 | $this->found[] = $file; |
| 335 | 335 | } |
@@ -342,23 +342,23 @@ discard block |
||
| 342 | 342 | |
| 343 | 343 | $extension = FileHelper::getExtension($path); |
| 344 | 344 | |
| 345 | - if(!$this->filterExclusion($extension)) { |
|
| 345 | + if (!$this->filterExclusion($extension)) { |
|
| 346 | 346 | return null; |
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | $path = $this->filterPath($path); |
| 350 | 350 | |
| 351 | - if($this->getOption('strip-extensions') === true) |
|
| 351 | + if ($this->getOption('strip-extensions') === true) |
|
| 352 | 352 | { |
| 353 | 353 | $path = str_replace('.'.$extension, '', $path); |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | - if($path === '') { |
|
| 356 | + if ($path === '') { |
|
| 357 | 357 | return null; |
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | $replace = $this->getOption('slash-replacement'); |
| 361 | - if(!empty($replace)) { |
|
| 361 | + if (!empty($replace)) { |
|
| 362 | 362 | $path = str_replace('/', $replace, $path); |
| 363 | 363 | } |
| 364 | 364 | |
@@ -377,15 +377,15 @@ discard block |
||
| 377 | 377 | $include = $this->getOption(self::OPTION_INCLUDE_EXTENSIONS); |
| 378 | 378 | $exclude = $this->getOption(self::OPTION_EXCLUDE_EXTENSIONS); |
| 379 | 379 | |
| 380 | - if(!empty($include)) |
|
| 380 | + if (!empty($include)) |
|
| 381 | 381 | { |
| 382 | - if(!in_array($extension, $include)) { |
|
| 382 | + if (!in_array($extension, $include)) { |
|
| 383 | 383 | return false; |
| 384 | 384 | } |
| 385 | 385 | } |
| 386 | - else if(!empty($exclude)) |
|
| 386 | + else if (!empty($exclude)) |
|
| 387 | 387 | { |
| 388 | - if(in_array($extension, $exclude)) { |
|
| 388 | + if (in_array($extension, $exclude)) { |
|
| 389 | 389 | return false; |
| 390 | 390 | } |
| 391 | 391 | } |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | */ |
| 402 | 402 | protected function filterPath(string $path) : string |
| 403 | 403 | { |
| 404 | - switch($this->getStringOption(self::OPTION_PATHMODE)) |
|
| 404 | + switch ($this->getStringOption(self::OPTION_PATHMODE)) |
|
| 405 | 405 | { |
| 406 | 406 | case self::PATH_MODE_STRIP: |
| 407 | 407 | return basename($path); |
@@ -22,51 +22,51 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | class FileHelper_PHPClassInfo_Class |
| 24 | 24 | { |
| 25 | - /** |
|
| 26 | - * @var FileHelper_PHPClassInfo |
|
| 27 | - */ |
|
| 25 | + /** |
|
| 26 | + * @var FileHelper_PHPClassInfo |
|
| 27 | + */ |
|
| 28 | 28 | protected $info; |
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * @var bool |
|
| 32 | - */ |
|
| 30 | + /** |
|
| 31 | + * @var bool |
|
| 32 | + */ |
|
| 33 | 33 | protected $abstract = false; |
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * @var bool |
|
| 37 | - */ |
|
| 35 | + /** |
|
| 36 | + * @var bool |
|
| 37 | + */ |
|
| 38 | 38 | protected $final = false; |
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * @var string |
|
| 42 | - */ |
|
| 40 | + /** |
|
| 41 | + * @var string |
|
| 42 | + */ |
|
| 43 | 43 | protected $extends = ''; |
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * @var string[] |
|
| 47 | - */ |
|
| 45 | + /** |
|
| 46 | + * @var string[] |
|
| 47 | + */ |
|
| 48 | 48 | protected $implements = array(); |
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * @var string |
|
| 52 | - */ |
|
| 50 | + /** |
|
| 51 | + * @var string |
|
| 52 | + */ |
|
| 53 | 53 | protected $name; |
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * @var string |
|
| 57 | - */ |
|
| 55 | + /** |
|
| 56 | + * @var string |
|
| 57 | + */ |
|
| 58 | 58 | protected $declaration; |
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * @var string |
|
| 62 | - */ |
|
| 60 | + /** |
|
| 61 | + * @var string |
|
| 62 | + */ |
|
| 63 | 63 | protected $keyword; |
| 64 | 64 | |
| 65 | - /** |
|
| 66 | - * @param FileHelper_PHPClassInfo $info The class info instance. |
|
| 67 | - * @param string $declaration The full class declaration, e.g. "class SomeName extends SomeOtherClass". |
|
| 68 | - * @param string $keyword The class keyword, if any, i.e. "abstract" or "final". |
|
| 69 | - */ |
|
| 65 | + /** |
|
| 66 | + * @param FileHelper_PHPClassInfo $info The class info instance. |
|
| 67 | + * @param string $declaration The full class declaration, e.g. "class SomeName extends SomeOtherClass". |
|
| 68 | + * @param string $keyword The class keyword, if any, i.e. "abstract" or "final". |
|
| 69 | + */ |
|
| 70 | 70 | public function __construct(FileHelper_PHPClassInfo $info, string $declaration, string $keyword) |
| 71 | 71 | { |
| 72 | 72 | $this->info = $info; |
@@ -76,31 +76,31 @@ discard block |
||
| 76 | 76 | $this->analyzeCode(); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - /** |
|
| 80 | - * Check if this class is a subclass of the specified |
|
| 81 | - * class name. |
|
| 82 | - * |
|
| 83 | - * @param string $className |
|
| 84 | - * @return bool |
|
| 85 | - */ |
|
| 79 | + /** |
|
| 80 | + * Check if this class is a subclass of the specified |
|
| 81 | + * class name. |
|
| 82 | + * |
|
| 83 | + * @param string $className |
|
| 84 | + * @return bool |
|
| 85 | + */ |
|
| 86 | 86 | public function isSublassOf(string $className) : bool |
| 87 | 87 | { |
| 88 | 88 | return is_subclass_of($this->getNameNS(), $className); |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - /** |
|
| 92 | - * The class name without namespace. |
|
| 93 | - * @return string |
|
| 94 | - */ |
|
| 91 | + /** |
|
| 92 | + * The class name without namespace. |
|
| 93 | + * @return string |
|
| 94 | + */ |
|
| 95 | 95 | public function getName() : string |
| 96 | 96 | { |
| 97 | 97 | return $this->name; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - /** |
|
| 101 | - * The absolute class name with namespace (if any). |
|
| 102 | - * @return string |
|
| 103 | - */ |
|
| 100 | + /** |
|
| 101 | + * The absolute class name with namespace (if any). |
|
| 102 | + * @return string |
|
| 103 | + */ |
|
| 104 | 104 | public function getNameNS() : string |
| 105 | 105 | { |
| 106 | 106 | $name = $this->getName(); |
@@ -112,48 +112,48 @@ discard block |
||
| 112 | 112 | return $name; |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - /** |
|
| 116 | - * Whether it is an abstract class. |
|
| 117 | - * @return bool |
|
| 118 | - */ |
|
| 115 | + /** |
|
| 116 | + * Whether it is an abstract class. |
|
| 117 | + * @return bool |
|
| 118 | + */ |
|
| 119 | 119 | public function isAbstract() : bool |
| 120 | 120 | { |
| 121 | 121 | return $this->abstract; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - /** |
|
| 125 | - * Whether it is a final class. |
|
| 126 | - * @return bool |
|
| 127 | - */ |
|
| 124 | + /** |
|
| 125 | + * Whether it is a final class. |
|
| 126 | + * @return bool |
|
| 127 | + */ |
|
| 128 | 128 | public function isFinal() : bool |
| 129 | 129 | { |
| 130 | 130 | return $this->final; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - /** |
|
| 134 | - * The name of the class that this class extends (with namespace, if specified). |
|
| 135 | - * @return string |
|
| 136 | - */ |
|
| 133 | + /** |
|
| 134 | + * The name of the class that this class extends (with namespace, if specified). |
|
| 135 | + * @return string |
|
| 136 | + */ |
|
| 137 | 137 | public function getExtends() : string |
| 138 | 138 | { |
| 139 | 139 | return $this->extends; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - /** |
|
| 143 | - * A list of interfaces the class implements, if any. |
|
| 144 | - * @return string[] |
|
| 145 | - */ |
|
| 142 | + /** |
|
| 143 | + * A list of interfaces the class implements, if any. |
|
| 144 | + * @return string[] |
|
| 145 | + */ |
|
| 146 | 146 | public function getImplements() : array |
| 147 | 147 | { |
| 148 | 148 | return $this->implements; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | - /** |
|
| 152 | - * The class declaration string, with normalized spaces and sorted interface names. |
|
| 153 | - * NOTE: does not include the keyword "abstract" or "final". |
|
| 154 | - * |
|
| 155 | - * @return string |
|
| 156 | - */ |
|
| 151 | + /** |
|
| 152 | + * The class declaration string, with normalized spaces and sorted interface names. |
|
| 153 | + * NOTE: does not include the keyword "abstract" or "final". |
|
| 154 | + * |
|
| 155 | + * @return string |
|
| 156 | + */ |
|
| 157 | 157 | public function getDeclaration() : string |
| 158 | 158 | { |
| 159 | 159 | $parts = array(); |
@@ -173,10 +173,10 @@ discard block |
||
| 173 | 173 | return implode(' ', $parts); |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | - /** |
|
| 177 | - * The keyword before "class", e.g. "abstract". |
|
| 178 | - * @return string |
|
| 179 | - */ |
|
| 176 | + /** |
|
| 177 | + * The keyword before "class", e.g. "abstract". |
|
| 178 | + * @return string |
|
| 179 | + */ |
|
| 180 | 180 | public function getKeyword() : string |
| 181 | 181 | { |
| 182 | 182 | return $this->keyword; |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | { |
| 106 | 106 | $name = $this->getName(); |
| 107 | 107 | |
| 108 | - if($this->info->hasNamespace()) { |
|
| 108 | + if ($this->info->hasNamespace()) { |
|
| 109 | 109 | $name = $this->info->getNamespace().'\\'.$this->name; |
| 110 | 110 | } |
| 111 | 111 | |
@@ -160,12 +160,12 @@ discard block |
||
| 160 | 160 | $parts[] = 'class'; |
| 161 | 161 | $parts[] = $this->getName(); |
| 162 | 162 | |
| 163 | - if(!empty($this->extends)) { |
|
| 163 | + if (!empty($this->extends)) { |
|
| 164 | 164 | $parts[] = 'extends'; |
| 165 | 165 | $parts[] = $this->extends; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - if(!empty($this->implements)) { |
|
| 168 | + if (!empty($this->implements)) { |
|
| 169 | 169 | $parts[] = 'implements'; |
| 170 | 170 | $parts[] = implode(', ', $this->implements); |
| 171 | 171 | } |
@@ -184,9 +184,9 @@ discard block |
||
| 184 | 184 | |
| 185 | 185 | protected function analyzeCode() : void |
| 186 | 186 | { |
| 187 | - if($this->keyword == 'abstract') { |
|
| 187 | + if ($this->keyword == 'abstract') { |
|
| 188 | 188 | $this->abstract = true; |
| 189 | - } else if($this->keyword == 'final') { |
|
| 189 | + } else if ($this->keyword == 'final') { |
|
| 190 | 190 | $this->final = true; |
| 191 | 191 | } |
| 192 | 192 | |
@@ -203,16 +203,16 @@ discard block |
||
| 203 | 203 | |
| 204 | 204 | $tokenName = 'none'; |
| 205 | 205 | |
| 206 | - foreach($parts as $part) |
|
| 206 | + foreach ($parts as $part) |
|
| 207 | 207 | { |
| 208 | 208 | $part = str_replace(',', '', $part); |
| 209 | 209 | $part = trim($part); |
| 210 | - if(empty($part)) { |
|
| 210 | + if (empty($part)) { |
|
| 211 | 211 | continue; |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | $name = strtolower($part); |
| 215 | - if($name == 'extends' || $name == 'implements') { |
|
| 215 | + if ($name == 'extends' || $name == 'implements') { |
|
| 216 | 216 | $tokenName = $name; |
| 217 | 217 | continue; |
| 218 | 218 | } |
@@ -222,13 +222,13 @@ discard block |
||
| 222 | 222 | |
| 223 | 223 | $this->implements = $tokens['implements']; |
| 224 | 224 | |
| 225 | - if(!empty($this->implements)) { |
|
| 225 | + if (!empty($this->implements)) { |
|
| 226 | 226 | usort($this->implements, function(string $a, string $b) { |
| 227 | 227 | return strnatcasecmp($a, $b); |
| 228 | 228 | }); |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | - if(!empty($tokens['extends'])) { |
|
| 231 | + if (!empty($tokens['extends'])) { |
|
| 232 | 232 | $this->extends = $tokens['extends'][0]; |
| 233 | 233 | } |
| 234 | 234 | } |
@@ -40,17 +40,17 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | protected $classes = array(); |
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * The namespace detected in the file, if any. |
|
| 45 | - * @var string |
|
| 46 | - */ |
|
| 43 | + /** |
|
| 44 | + * The namespace detected in the file, if any. |
|
| 45 | + * @var string |
|
| 46 | + */ |
|
| 47 | 47 | protected $namespace = ''; |
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * @param string $path The path to the PHP file to parse. |
|
| 51 | - * @throws FileHelper_Exception |
|
| 52 | - * @see FileHelper::findPHPClasses() |
|
| 53 | - */ |
|
| 49 | + /** |
|
| 50 | + * @param string $path The path to the PHP file to parse. |
|
| 51 | + * @throws FileHelper_Exception |
|
| 52 | + * @see FileHelper::findPHPClasses() |
|
| 53 | + */ |
|
| 54 | 54 | public function __construct(string $path) |
| 55 | 55 | { |
| 56 | 56 | $this->path = realpath($path); |
@@ -70,66 +70,66 @@ discard block |
||
| 70 | 70 | $this->parseFile(); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * The name of the namespace of the classes in the file, if any. |
|
| 75 | - * @return string |
|
| 76 | - */ |
|
| 73 | + /** |
|
| 74 | + * The name of the namespace of the classes in the file, if any. |
|
| 75 | + * @return string |
|
| 76 | + */ |
|
| 77 | 77 | public function getNamespace() : string |
| 78 | 78 | { |
| 79 | 79 | return $this->namespace; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - /** |
|
| 83 | - * Whether the file contains a namespace. |
|
| 84 | - * @return bool |
|
| 85 | - */ |
|
| 82 | + /** |
|
| 83 | + * Whether the file contains a namespace. |
|
| 84 | + * @return bool |
|
| 85 | + */ |
|
| 86 | 86 | public function hasNamespace() : bool |
| 87 | 87 | { |
| 88 | 88 | return !empty($this->namespace); |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - /** |
|
| 92 | - * The absolute path to the file. |
|
| 93 | - * @return string |
|
| 94 | - */ |
|
| 91 | + /** |
|
| 92 | + * The absolute path to the file. |
|
| 93 | + * @return string |
|
| 94 | + */ |
|
| 95 | 95 | public function getPath() : string |
| 96 | 96 | { |
| 97 | 97 | return $this->path; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - /** |
|
| 101 | - * Whether any classes were found in the file. |
|
| 102 | - * @return bool |
|
| 103 | - */ |
|
| 100 | + /** |
|
| 101 | + * Whether any classes were found in the file. |
|
| 102 | + * @return bool |
|
| 103 | + */ |
|
| 104 | 104 | public function hasClasses() : bool |
| 105 | 105 | { |
| 106 | 106 | return !empty($this->classes); |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - /** |
|
| 110 | - * The names of the classes that were found in the file (with namespace if any). |
|
| 111 | - * @return string[] |
|
| 112 | - */ |
|
| 109 | + /** |
|
| 110 | + * The names of the classes that were found in the file (with namespace if any). |
|
| 111 | + * @return string[] |
|
| 112 | + */ |
|
| 113 | 113 | public function getClassNames() : array |
| 114 | 114 | { |
| 115 | 115 | return array_keys($this->classes); |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - /** |
|
| 119 | - * Retrieves all classes that were detected in the file, |
|
| 120 | - * which can be used to retrieve more information about |
|
| 121 | - * them. |
|
| 122 | - * |
|
| 123 | - * @return FileHelper_PHPClassInfo_Class[] |
|
| 124 | - */ |
|
| 118 | + /** |
|
| 119 | + * Retrieves all classes that were detected in the file, |
|
| 120 | + * which can be used to retrieve more information about |
|
| 121 | + * them. |
|
| 122 | + * |
|
| 123 | + * @return FileHelper_PHPClassInfo_Class[] |
|
| 124 | + */ |
|
| 125 | 125 | public function getClasses() : array |
| 126 | 126 | { |
| 127 | 127 | return array_values($this->classes); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - /** |
|
| 131 | - * @throws FileHelper_Exception |
|
| 132 | - */ |
|
| 130 | + /** |
|
| 131 | + * @throws FileHelper_Exception |
|
| 132 | + */ |
|
| 133 | 133 | protected function parseFile() : void |
| 134 | 134 | { |
| 135 | 135 | $code = file_get_contents($this->path); |
@@ -184,13 +184,13 @@ discard block |
||
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - /** |
|
| 188 | - * Strips all whitespace from the string, replacing it with |
|
| 189 | - * regular spaces (newlines, tabs, etc.). |
|
| 190 | - * |
|
| 191 | - * @param string $string |
|
| 192 | - * @return string |
|
| 193 | - */ |
|
| 187 | + /** |
|
| 188 | + * Strips all whitespace from the string, replacing it with |
|
| 189 | + * regular spaces (newlines, tabs, etc.). |
|
| 190 | + * |
|
| 191 | + * @param string $string |
|
| 192 | + * @return string |
|
| 193 | + */ |
|
| 194 | 194 | protected function stripWhitespace(string $string) : string |
| 195 | 195 | { |
| 196 | 196 | return preg_replace('/[\s]/', ' ', $string); |
@@ -104,11 +104,11 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | public static function fromClosure(Closure $closure, $origin) : NamedClosure |
| 106 | 106 | { |
| 107 | - if(is_object($origin)) |
|
| 107 | + if (is_object($origin)) |
|
| 108 | 108 | { |
| 109 | 109 | $description = get_class($origin); |
| 110 | 110 | } |
| 111 | - else if(is_array($origin)) |
|
| 111 | + else if (is_array($origin)) |
|
| 112 | 112 | { |
| 113 | 113 | $description = ConvertHelper::callback2string($origin); |
| 114 | 114 | } |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | * @param string|object $origin Optional origin. If not specified, the object and method name are used instead. |
| 127 | 127 | * @return NamedClosure |
| 128 | 128 | */ |
| 129 | - public static function fromObject(object $object, string $method, $origin='') : NamedClosure |
|
| 129 | + public static function fromObject(object $object, string $method, $origin = '') : NamedClosure |
|
| 130 | 130 | { |
| 131 | 131 | return self::fromArray(array($object, $method), $origin); |
| 132 | 132 | } |
@@ -136,11 +136,11 @@ discard block |
||
| 136 | 136 | * @param string|object $origin |
| 137 | 137 | * @return NamedClosure |
| 138 | 138 | */ |
| 139 | - public static function fromArray(array $callback, $origin='') : NamedClosure |
|
| 139 | + public static function fromArray(array $callback, $origin = '') : NamedClosure |
|
| 140 | 140 | { |
| 141 | - if(empty($origin)) { |
|
| 141 | + if (empty($origin)) { |
|
| 142 | 142 | $origin = ConvertHelper::callback2string($callback); |
| 143 | - } else if(is_object($origin)) { |
|
| 143 | + } else if (is_object($origin)) { |
|
| 144 | 144 | $origin = get_class($origin); |
| 145 | 145 | } |
| 146 | 146 | |
@@ -107,12 +107,10 @@ |
||
| 107 | 107 | if(is_object($origin)) |
| 108 | 108 | { |
| 109 | 109 | $description = get_class($origin); |
| 110 | - } |
|
| 111 | - else if(is_array($origin)) |
|
| 110 | + } else if(is_array($origin)) |
|
| 112 | 111 | { |
| 113 | 112 | $description = ConvertHelper::callback2string($origin); |
| 114 | - } |
|
| 115 | - else |
|
| 113 | + } else |
|
| 116 | 114 | { |
| 117 | 115 | $description = $origin; |
| 118 | 116 | } |
@@ -41,71 +41,71 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | class Highlighter |
| 43 | 43 | { |
| 44 | - /** |
|
| 45 | - * Creates a new GeSHi instance from a source code string. |
|
| 46 | - * |
|
| 47 | - * @param string $sourceCode |
|
| 48 | - * @param string $format |
|
| 49 | - * @return GeSHi |
|
| 50 | - */ |
|
| 44 | + /** |
|
| 45 | + * Creates a new GeSHi instance from a source code string. |
|
| 46 | + * |
|
| 47 | + * @param string $sourceCode |
|
| 48 | + * @param string $format |
|
| 49 | + * @return GeSHi |
|
| 50 | + */ |
|
| 51 | 51 | public static function fromString(string $sourceCode, string $format) : GeSHi |
| 52 | 52 | { |
| 53 | 53 | return new GeSHi($sourceCode, $format); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * Creates a new GeSHi instance from the contents of a file. |
|
| 58 | - * |
|
| 59 | - * @param string $path |
|
| 60 | - * @param string $format |
|
| 61 | - * @return GeSHi |
|
| 62 | - */ |
|
| 56 | + /** |
|
| 57 | + * Creates a new GeSHi instance from the contents of a file. |
|
| 58 | + * |
|
| 59 | + * @param string $path |
|
| 60 | + * @param string $format |
|
| 61 | + * @return GeSHi |
|
| 62 | + */ |
|
| 63 | 63 | public static function fromFile(string $path, string $format) : GeSHi |
| 64 | 64 | { |
| 65 | 65 | return self::fromString(FileHelper::readContents($path), $format); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * Parses and highlights the target string. |
|
| 70 | - * |
|
| 71 | - * @param string $sourceCode |
|
| 72 | - * @param string $format |
|
| 73 | - * @return string |
|
| 74 | - */ |
|
| 68 | + /** |
|
| 69 | + * Parses and highlights the target string. |
|
| 70 | + * |
|
| 71 | + * @param string $sourceCode |
|
| 72 | + * @param string $format |
|
| 73 | + * @return string |
|
| 74 | + */ |
|
| 75 | 75 | public static function parseString(string $sourceCode, string $format) : string |
| 76 | 76 | { |
| 77 | 77 | return self::fromString($sourceCode, $format)->parse_code(); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * Parses and highlights the contents of the target file. |
|
| 82 | - * |
|
| 83 | - * @param string $path |
|
| 84 | - * @param string $format |
|
| 85 | - * @return string |
|
| 86 | - */ |
|
| 80 | + /** |
|
| 81 | + * Parses and highlights the contents of the target file. |
|
| 82 | + * |
|
| 83 | + * @param string $path |
|
| 84 | + * @param string $format |
|
| 85 | + * @return string |
|
| 86 | + */ |
|
| 87 | 87 | public static function parseFile(string $path, string $format) : string |
| 88 | 88 | { |
| 89 | 89 | return self::fromFile($path, $format)->parse_code(); |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - /** |
|
| 93 | - * Adds HTML syntax highlighting to the specified SQL string. |
|
| 94 | - * |
|
| 95 | - * @param string $sql |
|
| 96 | - * @return string |
|
| 97 | - */ |
|
| 92 | + /** |
|
| 93 | + * Adds HTML syntax highlighting to the specified SQL string. |
|
| 94 | + * |
|
| 95 | + * @param string $sql |
|
| 96 | + * @return string |
|
| 97 | + */ |
|
| 98 | 98 | public static function sql(string $sql) : string |
| 99 | 99 | { |
| 100 | 100 | return self::parseString($sql, 'sql'); |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - /** |
|
| 104 | - * Adds HTML syntax highlighting to a JSON string, or a data array/object. |
|
| 105 | - * |
|
| 106 | - * @param array<int|string,mixed>|object|string $subject A JSON string, or data array/object to convert to JSON to highlight. |
|
| 107 | - * @return string |
|
| 108 | - */ |
|
| 103 | + /** |
|
| 104 | + * Adds HTML syntax highlighting to a JSON string, or a data array/object. |
|
| 105 | + * |
|
| 106 | + * @param array<int|string,mixed>|object|string $subject A JSON string, or data array/object to convert to JSON to highlight. |
|
| 107 | + * @return string |
|
| 108 | + */ |
|
| 109 | 109 | public static function json($subject) : string |
| 110 | 110 | { |
| 111 | 111 | if(!is_string($subject)) |
@@ -118,13 +118,13 @@ discard block |
||
| 118 | 118 | return self::parseString($subject, 'javascript'); |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - /** |
|
| 122 | - * Adds HTML syntax highlighting to the specified XML code. |
|
| 123 | - * |
|
| 124 | - * @param string $xml The XML to highlight. |
|
| 125 | - * @param bool $formatSource Whether to format the source with indentation to make it readable. |
|
| 126 | - * @return string |
|
| 127 | - */ |
|
| 121 | + /** |
|
| 122 | + * Adds HTML syntax highlighting to the specified XML code. |
|
| 123 | + * |
|
| 124 | + * @param string $xml The XML to highlight. |
|
| 125 | + * @param bool $formatSource Whether to format the source with indentation to make it readable. |
|
| 126 | + * @return string |
|
| 127 | + */ |
|
| 128 | 128 | public static function xml(string $xml, bool $formatSource=false) : string |
| 129 | 129 | { |
| 130 | 130 | if($formatSource) |
@@ -141,13 +141,13 @@ discard block |
||
| 141 | 141 | return self::parseString($xml, 'xml'); |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - /** |
|
| 145 | - * Adds HTML syntax highlighting to the specified HTML code. |
|
| 146 | - * |
|
| 147 | - * @param string $html |
|
| 148 | - * @param bool $formatSource |
|
| 149 | - * @return string |
|
| 150 | - */ |
|
| 144 | + /** |
|
| 145 | + * Adds HTML syntax highlighting to the specified HTML code. |
|
| 146 | + * |
|
| 147 | + * @param string $html |
|
| 148 | + * @param bool $formatSource |
|
| 149 | + * @return string |
|
| 150 | + */ |
|
| 151 | 151 | public static function html(string $html, bool $formatSource=false) : string |
| 152 | 152 | { |
| 153 | 153 | if($formatSource) |
@@ -164,27 +164,27 @@ discard block |
||
| 164 | 164 | return self::parseString($html, 'xml'); |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - /** |
|
| 168 | - * Adds HTML syntax highlighting to a bit of PHP code. |
|
| 169 | - * |
|
| 170 | - * @param string $phpCode |
|
| 171 | - * @return string |
|
| 172 | - */ |
|
| 167 | + /** |
|
| 168 | + * Adds HTML syntax highlighting to a bit of PHP code. |
|
| 169 | + * |
|
| 170 | + * @param string $phpCode |
|
| 171 | + * @return string |
|
| 172 | + */ |
|
| 173 | 173 | public static function php(string $phpCode) : string |
| 174 | 174 | { |
| 175 | 175 | return self::parseString($phpCode, 'php'); |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - /** |
|
| 179 | - * Adds HTML syntax highlighting to an URL. |
|
| 180 | - * |
|
| 181 | - * NOTE: Includes the necessary CSS styles. When |
|
| 182 | - * highlighting several URLs in the same page, |
|
| 183 | - * prefer using the `parseURL` function instead. |
|
| 184 | - * |
|
| 185 | - * @param string $url |
|
| 186 | - * @return string |
|
| 187 | - */ |
|
| 178 | + /** |
|
| 179 | + * Adds HTML syntax highlighting to an URL. |
|
| 180 | + * |
|
| 181 | + * NOTE: Includes the necessary CSS styles. When |
|
| 182 | + * highlighting several URLs in the same page, |
|
| 183 | + * prefer using the `parseURL` function instead. |
|
| 184 | + * |
|
| 185 | + * @param string $url |
|
| 186 | + * @return string |
|
| 187 | + */ |
|
| 188 | 188 | public static function url(string $url) : string |
| 189 | 189 | { |
| 190 | 190 | $info = parseURL($url); |