1 | <?php |
||
28 | trait LoaderAwareTrait |
||
29 | { |
||
30 | /** |
||
31 | * Message loaders pool, [ classname => $loader ] |
||
32 | * |
||
33 | * @var LoaderInterface[] |
||
34 | * @access private |
||
35 | */ |
||
36 | private static $loaders = []; |
||
37 | |||
38 | /** |
||
39 | * loader update indicator |
||
40 | * |
||
41 | * @var bool |
||
42 | * @access private |
||
43 | */ |
||
44 | private static $updated = false; |
||
45 | |||
46 | /** |
||
47 | * Set/replace loader for current message class (static bind) |
||
48 | * |
||
49 | * @param LoaderInterface $loader the mapping loader |
||
50 | * @access public |
||
51 | * @api |
||
52 | */ |
||
53 | public static function setLoader( |
||
62 | |||
63 | /** |
||
64 | * Unset loader for calling message class |
||
65 | * |
||
66 | * if $search is true, search upwards in the inheritance tree |
||
67 | * |
||
68 | * @param bool $search search upwards |
||
69 | * @access public |
||
70 | */ |
||
71 | public static function unsetLoader(/*# bool */ $search = false) |
||
82 | |||
83 | /** |
||
84 | * Get loader for current message class (static bind) |
||
85 | * |
||
86 | * use `hasLoader()` before this method ! |
||
87 | * |
||
88 | * @return LoaderInterface |
||
89 | * @access protected |
||
90 | */ |
||
91 | protected static function getLoader()/*# : LoaderInterface */ |
||
95 | |||
96 | /** |
||
97 | * Check loader for calling message class (static bind) |
||
98 | * |
||
99 | * if $search is true, search upwards in inhertiant tree for loader |
||
100 | * if current class has no loader set |
||
101 | * |
||
102 | * @param bool $search search upwards |
||
103 | * @return false|string false or classname for which has loader |
||
104 | * @access protected |
||
105 | */ |
||
106 | protected static function hasLoader( |
||
122 | |||
123 | /** |
||
124 | * Set updated indicator |
||
125 | * |
||
126 | * @param bool $status updated status |
||
127 | * @access protected |
||
128 | */ |
||
129 | protected static function setStatus( |
||
134 | |||
135 | /** |
||
136 | * Get updated indicator |
||
137 | * |
||
138 | * @return bool |
||
139 | * @access protected |
||
140 | */ |
||
141 | protected static function isStatusUpdated()/*: bool */ |
||
145 | } |
||
146 |