Total Complexity | 10 |
Total Lines | 61 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | trait CanInitializeTrait |
||
12 | { |
||
13 | |||
14 | /** |
||
15 | * Is the form prepared ? |
||
16 | * |
||
17 | * @var bool |
||
18 | */ |
||
19 | protected $initialized = false; |
||
20 | |||
21 | |||
22 | public function initializeIfNotInitialized() |
||
23 | { |
||
24 | if ($this->initialized !== false) { |
||
25 | return; |
||
26 | } |
||
27 | |||
28 | if (method_exists($this, 'init')) { |
||
29 | $this->init(); |
||
|
|||
30 | } else { |
||
31 | $this->initialize(); |
||
32 | } |
||
33 | |||
34 | if (method_exists($this, 'postInit')) { |
||
35 | $this->postInit(); |
||
36 | } else { |
||
37 | $this->initialized(); |
||
38 | } |
||
39 | |||
40 | $this->initialized = true; |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * @deprecated use initialize() |
||
45 | */ |
||
46 | public function init() |
||
47 | { |
||
48 | $this->initialize(); |
||
49 | } |
||
50 | |||
51 | public function initialize() |
||
52 | { |
||
53 | $this->initAction(); |
||
54 | } |
||
55 | |||
56 | /** |
||
57 | * @deprecated use initialize() |
||
58 | */ |
||
59 | public function postInit() |
||
60 | { |
||
61 | $this->initialized(); |
||
62 | } |
||
63 | |||
64 | protected function initialized() |
||
65 | { |
||
66 | } |
||
67 | |||
68 | protected function initAction() |
||
72 | } |
||
73 | } |
||
74 | } |
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.