| @@ 10-30 (lines=21) @@ | ||
| 7 | use Lan\Ebs\Sdk\Client; |
|
| 8 | use Lan\Ebs\Sdk\Model\Book; |
|
| 9 | ||
| 10 | class BookCollection extends Collection |
|
| 11 | { |
|
| 12 | /** |
|
| 13 | * BookCollection constructor. |
|
| 14 | * @param Client $client |
|
| 15 | * @param array $fields |
|
| 16 | * @param int $limit |
|
| 17 | * @param int $offset |
|
| 18 | * @throws Exception |
|
| 19 | */ |
|
| 20 | public function __construct(Client $client, array $fields = [], $limit = 10, $offset = 0) |
|
| 21 | { |
|
| 22 | parent::__construct($client, $fields, Book::class, $limit, $offset); |
|
| 23 | } |
|
| 24 | ||
| 25 | /** |
|
| 26 | * @param $method |
|
| 27 | * @param array $params |
|
| 28 | * @return array |
|
| 29 | * @throws Exception |
|
| 30 | */ |
|
| 31 | public function getUrl($method, array $params = []) |
|
| 32 | { |
|
| 33 | switch ($method) { |
|
| @@ 10-44 (lines=35) @@ | ||
| 7 | use Lan\Ebs\Sdk\Client; |
|
| 8 | use Lan\Ebs\Sdk\Model\Journal; |
|
| 9 | ||
| 10 | class JournalCollection extends Collection |
|
| 11 | { |
|
| 12 | /** |
|
| 13 | * BookCollection constructor. |
|
| 14 | * @param Client $client |
|
| 15 | * @param array $fields |
|
| 16 | * @param int $limit |
|
| 17 | * @param int $offset |
|
| 18 | * @throws Exception |
|
| 19 | */ |
|
| 20 | public function __construct(Client $client, array $fields = [], $limit = 10, $offset = 0) |
|
| 21 | { |
|
| 22 | parent::__construct($client, $fields, Journal::class, $limit, $offset); |
|
| 23 | } |
|
| 24 | ||
| 25 | /** |
|
| 26 | * @param $method |
|
| 27 | * @param array $params |
|
| 28 | * @return array |
|
| 29 | * @throws Exception |
|
| 30 | */ |
|
| 31 | public function getUrl($method, array $params = []) |
|
| 32 | { |
|
| 33 | switch ($method) { |
|
| 34 | case 'load': |
|
| 35 | return [ |
|
| 36 | 'url' => '/1.0/resource/journal', |
|
| 37 | 'method' => 'GET', |
|
| 38 | 'code' => '200' |
|
| 39 | ]; |
|
| 40 | default: |
|
| 41 | throw new Exception('Route for ' . $method . ' not found'); |
|
| 42 | } |
|
| 43 | } |
|
| 44 | } |
|
| @@ 10-30 (lines=21) @@ | ||
| 7 | use Lan\Ebs\Sdk\Client; |
|
| 8 | use Lan\Ebs\Sdk\Model\User; |
|
| 9 | ||
| 10 | class UserCollection extends Collection |
|
| 11 | { |
|
| 12 | /** |
|
| 13 | * UserCollection constructor. |
|
| 14 | * @param Client $client |
|
| 15 | * @param array $fields |
|
| 16 | * @param int $limit |
|
| 17 | * @param int $offset |
|
| 18 | * @throws Exception |
|
| 19 | */ |
|
| 20 | public function __construct(Client $client, array $fields = [], $limit = 10, $offset = 0) |
|
| 21 | { |
|
| 22 | parent::__construct($client, $fields, User::class, $limit, $offset); |
|
| 23 | } |
|
| 24 | ||
| 25 | /** |
|
| 26 | * @param $method |
|
| 27 | * @param array $params |
|
| 28 | * @return array |
|
| 29 | * @throws Exception |
|
| 30 | */ |
|
| 31 | public function getUrl($method, array $params = []) |
|
| 32 | { |
|
| 33 | switch ($method) { |
|