| 1 | <?php |
||
| 17 | abstract class AbstractManager implements ManagerInterface |
||
| 18 | { |
||
| 19 | /** |
||
| 20 | * @var Client |
||
| 21 | */ |
||
| 22 | protected $client; |
||
| 23 | |||
| 24 | public function __construct(Client $client) |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Gets the model class. |
||
| 31 | * |
||
| 32 | * @return string |
||
| 33 | */ |
||
| 34 | abstract public function getModelClass(); |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Gets the resource name. |
||
| 38 | * |
||
| 39 | * @return string |
||
| 40 | */ |
||
| 41 | abstract public function getResourceName(); |
||
| 42 | |||
| 43 | /** |
||
| 44 | * Create the model from an array. |
||
| 45 | * |
||
| 46 | * @param array $data |
||
| 47 | * |
||
| 48 | * @return ModelInterface |
||
| 49 | */ |
||
| 50 | public function fromArray(array $data) |
||
| 54 | |||
| 55 | /** |
||
| 56 | * Create many models from an array. |
||
| 57 | * |
||
| 58 | * @param array $data |
||
| 59 | * |
||
| 60 | * @return ModelInterface[] |
||
| 61 | */ |
||
| 62 | public function createMany(array $data) |
||
| 70 | |||
| 71 | /** |
||
| 72 | * Converts the model to array. |
||
| 73 | * |
||
| 74 | * @param ModelInterface $model |
||
| 75 | * @return array |
||
| 76 | */ |
||
| 77 | public function toArray($model) |
||
| 81 | } |