BaguettePHP /
objectsystem
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Teto\Object; |
||
| 4 | |||
| 5 | /** |
||
| 6 | * Restrict write to not accessable property. |
||
| 7 | * |
||
| 8 | * @see \Teto\Object\PrivateGetterTest |
||
| 9 | * |
||
| 10 | * @author USAMI Kenta <[email protected]> |
||
| 11 | * @copyright 2016 Baguette HQ |
||
| 12 | * @license http://www.apache.org/licenses/LICENSE-2.0 |
||
| 13 | */ |
||
| 14 | trait ReadOnly |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 15 | { |
||
| 16 | 3 | public function __set($name, $_value) |
|
| 17 | { |
||
| 18 | 3 | $message = sprintf('%s->%s is not writable property.', static::class, $name); |
|
| 19 | 3 | throw new \OutOfRangeException($message); |
|
| 20 | } |
||
| 21 | } |
||
| 22 |