Conditions | 6 |
Paths | 9 |
Total Lines | 28 |
Code Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
38 | public function configure(ConfigurableObjectInterface $config) |
||
39 | { |
||
40 | $this->object = $config; |
||
41 | $configurationDir = $this->configurationDir; |
||
42 | if ($configurationDir === null) { |
||
43 | $path = realpath(__DIR__ . '/../'); |
||
44 | $count = 0; |
||
45 | while ($count++ < 10) { |
||
46 | $filename = "{$path}/configuration"; |
||
47 | if (is_dir($filename)) { |
||
48 | $configurationDir = realpath($filename); |
||
49 | break; |
||
50 | } |
||
51 | $path .= '/../'; |
||
52 | $path = realpath($path); // More for debugging clarity. |
||
53 | } |
||
54 | } |
||
55 | |||
56 | if (!$configurationDir) return; |
||
|
|||
57 | |||
58 | $configurationFile = get_class($config) . '.php'; |
||
59 | $configurationFile = $configurationDir . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $configurationFile); |
||
60 | |||
61 | if (file_exists($configurationFile)) { |
||
62 | include $configurationFile; |
||
63 | } |
||
64 | |||
65 | } |
||
66 | |||
67 | } |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: