1 | <?php |
||
16 | class PluginDirectory |
||
17 | { |
||
18 | /** |
||
19 | * File path to directory |
||
20 | * |
||
21 | * @var string |
||
22 | */ |
||
23 | protected $path; |
||
24 | |||
25 | /** |
||
26 | * Constructor |
||
27 | * |
||
28 | * @param string $path |
||
29 | */ |
||
30 | 36 | public function __construct(string $path) |
|
35 | |||
36 | /** |
||
37 | * Gets directory path |
||
38 | * |
||
39 | * @return string path |
||
40 | */ |
||
41 | 34 | public function getPath(): string |
|
45 | |||
46 | /** |
||
47 | * Tries to create new a Plugin class from plugin in directory |
||
48 | * |
||
49 | * @param string $pluginKey |
||
50 | * @return AbstractPlugin|null |
||
51 | */ |
||
52 | 32 | public function newPluginInstance(string $pluginKey): ?AbstractPlugin |
|
70 | |||
71 | /** |
||
72 | * Class auto-loader plugin namespace |
||
73 | * |
||
74 | * @param string $className |
||
75 | */ |
||
76 | 31 | public function autoload(string $className) |
|
86 | |||
87 | /** |
||
88 | * Creates file-path to class-file in plugin directory |
||
89 | * |
||
90 | * @param string $className |
||
91 | * @return string the file path |
||
92 | */ |
||
93 | 33 | protected function filenameForClass(string $className): string |
|
106 | } |
||
107 |
PHP provides two ways to mark string literals. Either with single quotes
'literal'
or with double quotes"literal"
. The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (
\'
) and the backslash (\\
). Every other character is displayed as is.Double quoted string literals may contain other variables or more complex escape sequences.
will print an indented:
Single is Value
If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.
For more information on PHP string literals and available escape sequences see the PHP core documentation.