| 1 | <?php |
||
| 5 | abstract class Model |
||
| 6 | { |
||
| 7 | /* @var Client */ |
||
| 8 | protected $client; |
||
| 9 | |||
| 10 | /* @var \stdClass */ |
||
| 11 | protected $data; |
||
| 12 | |||
| 13 | public function __construct(Client $client, $data = null) |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @param Client $client |
||
| 21 | * @param array ...$params |
||
| 22 | * @return static |
||
| 23 | */ |
||
| 24 | static function make($client, ...$params) { |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Load data onto this object. Chainable method. |
||
| 30 | * |
||
| 31 | * @param \stdClass $data |
||
| 32 | * |
||
| 33 | * @return self |
||
| 34 | */ |
||
| 35 | public function init($data = null) |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Get the raw data object. |
||
| 44 | */ |
||
| 45 | public function getData() |
||
| 49 | |||
| 50 | /** |
||
| 51 | * Magic! |
||
| 52 | * @param string $key |
||
| 53 | * @return mixed |
||
| 54 | */ |
||
| 55 | public function __get($key) |
||
| 72 | } |
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.