1 | <?php |
||
29 | trait ShareableTrait |
||
30 | { |
||
31 | /** |
||
32 | * Shareables' pool |
||
33 | * |
||
34 | * @var ShareableInstance[] |
||
35 | * @access protected |
||
36 | * @staticvar |
||
37 | */ |
||
38 | protected static $shareables = []; |
||
39 | |||
40 | /** |
||
41 | * Is this shared instance, store its $scope here |
||
42 | * |
||
43 | * @var string |
||
44 | * @access protected |
||
45 | */ |
||
46 | protected $shared_in; |
||
47 | |||
48 | /** |
||
49 | * Scopes of this instance belongs to |
||
50 | * |
||
51 | * @var string[] |
||
52 | * @access protected |
||
53 | */ |
||
54 | protected $scopes = []; |
||
55 | |||
56 | /* |
||
57 | * {@inheritDoc} |
||
58 | */ |
||
59 | public static function getShareable( |
||
67 | |||
68 | /** |
||
69 | * {@inheritDoc} |
||
70 | */ |
||
71 | public static function getScopes()/*# : array */ |
||
79 | |||
80 | /** |
||
81 | * {@inheritDoc} |
||
82 | */ |
||
83 | public function setShareable(/*# string */ $scope = '') |
||
98 | |||
99 | /** |
||
100 | * {@inheritDoc} |
||
101 | */ |
||
102 | public function isShareable() |
||
106 | |||
107 | /** |
||
108 | * {@inheritDoc} |
||
109 | */ |
||
110 | public function addScope(/*# string */ $scope) |
||
119 | |||
120 | /** |
||
121 | * Checking with $scope explicitly |
||
122 | * |
||
123 | * {@inheritDoc} |
||
124 | */ |
||
125 | public function hasScope(/*# string */ $scope = '')/*# : bool */ |
||
129 | |||
130 | /** |
||
131 | * {@inheritDoc} |
||
132 | */ |
||
133 | public function getShareables()/*# : array */ |
||
143 | |||
144 | /** |
||
145 | * Test existense of shareable in $scope |
||
146 | * |
||
147 | * @param string $scope |
||
148 | * @return bool |
||
149 | * @access protected |
||
150 | */ |
||
151 | protected static function hasShareable( |
||
156 | |||
157 | /** |
||
158 | * Get all unique scopes for $this |
||
159 | * |
||
160 | * @return array |
||
161 | * @access protected |
||
162 | */ |
||
163 | protected function getOwnScopes()/*# : array */ |
||
171 | } |
||
172 |