| @@ 16-36 (lines=21) @@ | ||
| 13 | use Lan\Ebs\Sdk\Client; |
|
| 14 | use Lan\Ebs\Sdk\Model\Book; |
|
| 15 | ||
| 16 | class BookCollection extends Collection |
|
| 17 | { |
|
| 18 | /** |
|
| 19 | * BookCollection constructor. |
|
| 20 | * @param Client $client |
|
| 21 | * @param array $fields |
|
| 22 | * @param int $limit |
|
| 23 | * @param int $offset |
|
| 24 | * @throws Exception |
|
| 25 | */ |
|
| 26 | public function __construct(Client $client, array $fields = [], $limit = 10, $offset = 0) |
|
| 27 | { |
|
| 28 | parent::__construct($client, $fields, Book::class, $limit, $offset); |
|
| 29 | } |
|
| 30 | ||
| 31 | /** |
|
| 32 | * @param $method |
|
| 33 | * @param array $params |
|
| 34 | * @return array |
|
| 35 | * @throws Exception |
|
| 36 | */ |
|
| 37 | public function getUrl($method, array $params = []) |
|
| 38 | { |
|
| 39 | switch ($method) { |
|
| @@ 16-36 (lines=21) @@ | ||
| 13 | use Lan\Ebs\Sdk\Client; |
|
| 14 | use Lan\Ebs\Sdk\Model\User; |
|
| 15 | ||
| 16 | class UserCollection extends Collection |
|
| 17 | { |
|
| 18 | /** |
|
| 19 | * UserCollection constructor. |
|
| 20 | * @param Client $client |
|
| 21 | * @param array $fields |
|
| 22 | * @param int $limit |
|
| 23 | * @param int $offset |
|
| 24 | * @throws Exception |
|
| 25 | */ |
|
| 26 | public function __construct(Client $client, array $fields = [], $limit = 10, $offset = 0) |
|
| 27 | { |
|
| 28 | parent::__construct($client, $fields, User::class, $limit, $offset); |
|
| 29 | } |
|
| 30 | ||
| 31 | /** |
|
| 32 | * @param $method |
|
| 33 | * @param array $params |
|
| 34 | * @return array |
|
| 35 | * @throws Exception |
|
| 36 | */ |
|
| 37 | public function getUrl($method, array $params = []) |
|
| 38 | { |
|
| 39 | switch ($method) { |
|
| @@ 21-47 (lines=27) @@ | ||
| 18 | * @property mixed fio |
|
| 19 | * @property mixed registered_at |
|
| 20 | */ |
|
| 21 | class Book extends Model |
|
| 22 | { |
|
| 23 | const FIELD_NAME = 'name'; |
|
| 24 | ||
| 25 | public static $defaultFields = [ |
|
| 26 | Book::FIELD_NAME, |
|
| 27 | ]; |
|
| 28 | ||
| 29 | /** |
|
| 30 | * Book constructor. |
|
| 31 | * @param Client $client |
|
| 32 | * @param array $fields |
|
| 33 | * @throws Exception |
|
| 34 | */ |
|
| 35 | public function __construct(Client $client, array $fields = []) |
|
| 36 | { |
|
| 37 | parent::__construct($client, $fields); |
|
| 38 | } |
|
| 39 | ||
| 40 | /** |
|
| 41 | * @param $method |
|
| 42 | * @param array $params |
|
| 43 | * @return array |
|
| 44 | * @throws Exception |
|
| 45 | */ |
|
| 46 | public function getUrl($method, array $params = []) |
|
| 47 | { |
|
| 48 | switch ($method) { |
|
| 49 | case 'get': |
|
| 50 | return [ |
|