| Total Complexity | 12 |
| Total Lines | 85 |
| Duplicated Lines | 0 % |
| Coverage | 70.37% |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 12 | class ViewPathDetector |
||
| 13 | { |
||
| 14 | use SingletonTrait; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @var array |
||
| 18 | */ |
||
| 19 | protected $paths = []; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * ViewPathDetector constructor. |
||
| 23 | */ |
||
| 24 | public function __construct() |
||
| 25 | { |
||
| 26 | $this->initFromCache(); |
||
| 27 | } |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @param $controller |
||
| 31 | * @return bool |
||
| 32 | */ |
||
| 33 | 3 | public static function for($controller) |
|
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @param $controller |
||
| 40 | * @return bool |
||
| 41 | */ |
||
| 42 | 3 | protected function detectForController($controller) |
|
| 43 | { |
||
| 44 | 3 | $key = $this->keyForController($controller); |
|
| 45 | 3 | if (!isset($this->paths[$key])) { |
|
| 46 | 2 | $this->paths[$key] = $this->generateForController($controller); |
|
| 47 | } |
||
| 48 | |||
| 49 | 3 | return $this->paths[$key]; |
|
| 50 | } |
||
| 51 | |||
| 52 | /** |
||
| 53 | * @param $controller |
||
| 54 | * @return false|string |
||
| 55 | */ |
||
| 56 | 3 | protected function keyForController($controller) |
|
| 59 | } |
||
| 60 | |||
| 61 | /** |
||
| 62 | * @param $controller |
||
| 63 | * @return bool|string |
||
| 64 | */ |
||
| 65 | 2 | protected function generateForController($controller) |
|
| 79 | } |
||
| 80 | |||
| 81 | /** |
||
| 82 | * @param $controller |
||
| 83 | * @return bool|string |
||
| 84 | */ |
||
| 85 | 1 | protected function generateForControllerAutodetect($controller) |
|
| 93 | } |
||
| 94 | |||
| 95 | protected function initFromCache() |
||
| 97 | // $this->paths; |
||
| 98 | } |
||
| 100 |