| 1 | <?php |
||
| 14 | trait InitializationTrait |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * Is internal reflection is initialized or not |
||
| 18 | * |
||
| 19 | * @var boolean |
||
| 20 | */ |
||
| 21 | private $isInitialized = false; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Initializes internal reflection for calling misc runtime methods |
||
| 25 | */ |
||
| 26 | 143 | public function initializeInternalReflection() |
|
| 27 | { |
||
| 28 | 143 | if (!$this->isInitialized) { |
|
| 29 | 79 | $this->__initialize(); |
|
| 30 | 79 | $this->isInitialized = true; |
|
| 31 | } |
||
| 32 | 143 | } |
|
| 33 | |||
| 34 | /** |
||
| 35 | * Returns the status of initialization status for internal object |
||
| 36 | * |
||
| 37 | * @return bool |
||
| 38 | */ |
||
| 39 | 30 | public function __isInitialized() |
|
| 40 | { |
||
| 41 | 30 | return $this->isInitialized; |
|
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * Implementation of internal reflection initialization |
||
| 46 | * |
||
| 47 | * @return void |
||
| 48 | */ |
||
| 49 | abstract protected function __initialize(); |
||
| 50 | } |
||
| 51 |