1: | <?php |
2: | |
3: | namespace Teto\Object; |
4: | |
5: | /** |
6: | * Private property behaves like read only. |
7: | * |
8: | * NOTICE: You may not be able to imagine the behavior of this trait in the inherited class. |
9: | * |
10: | * @see \Teto\Object\PrivateGetterTest |
11: | * |
12: | * @author USAMI Kenta <tadsan@zonu.me> |
13: | * @copyright 2016 Baguette HQ |
14: | * @license http://www.apache.org/licenses/LICENSE-2.0 |
15: | */ |
16: | trait PrivateGetter |
17: | { |
18: | public function __get($name) |
19: | { |
20: | return $this->$name; |
21: | } |
22: | |
23: | public function __isset($name) |
24: | { |
25: | return isset($this->$name); |
26: | } |
27: | } |
28: |