Total Complexity | 9 |
Total Lines | 70 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | trait NameWorksTrait |
||
12 | { |
||
13 | protected $fullName = null; |
||
14 | |||
15 | protected $name = null; |
||
16 | |||
17 | use UtilityNameWorksTrait; |
||
18 | |||
19 | // protected function inflectName() |
||
20 | // { |
||
21 | // $name = str_replace("Controller", "", get_class($this)); |
||
22 | // $this->name = inflector()->unclassify($name); |
||
23 | // } |
||
24 | |||
25 | /** |
||
26 | * @return string |
||
27 | */ |
||
28 | public function getClassName() |
||
29 | { |
||
30 | return str_replace("Controller", "", get_class($this)); |
||
31 | } |
||
32 | |||
33 | |||
34 | /** |
||
35 | * @return string |
||
36 | */ |
||
37 | public function getName() |
||
38 | { |
||
39 | if ($this->name === null) { |
||
40 | $this->initName(); |
||
41 | } |
||
42 | |||
43 | return $this->name; |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * @param string $name |
||
48 | */ |
||
49 | public function setName($name) |
||
50 | { |
||
51 | $this->name = $name; |
||
52 | } |
||
53 | |||
54 | public function initName() |
||
57 | } |
||
58 | |||
59 | /** |
||
60 | * @return mixed |
||
61 | */ |
||
62 | protected function generateName() |
||
63 | { |
||
64 | if ($this->hasRequest()) { |
||
|
|||
65 | return $this->getRequest()->getControllerName(); |
||
66 | } |
||
67 | $class = $this->getClassFirstName(); |
||
68 | return str_replace('Controller', '', $class); |
||
69 | } |
||
70 | |||
71 | /** |
||
72 | * @return string |
||
73 | */ |
||
74 | public function getFullName() |
||
81 | } |
||
82 | } |
||
83 |