@@ 24-62 (lines=39) @@ | ||
21 | * @subpackage Sdk |
|
22 | * @category Collection |
|
23 | */ |
|
24 | class ArticleCollection extends Collection |
|
25 | { |
|
26 | /** |
|
27 | * Идентификатор выпуска |
|
28 | * |
|
29 | * @var int |
|
30 | */ |
|
31 | private $issueId = null; |
|
32 | ||
33 | /** |
|
34 | * BookCollection constructor. |
|
35 | * @param $issueId |
|
36 | * @param Client $client |
|
37 | * @param array $fields |
|
38 | * @param int $limit |
|
39 | * @param int $offset |
|
40 | * @throws Exception |
|
41 | */ |
|
42 | public function __construct($issueId, Client $client, array $fields = array(), $limit = 10, $offset = 0) |
|
43 | { |
|
44 | parent::__construct($client, $fields, Article::class, $limit, $offset); |
|
45 | ||
46 | $this->issueId = $issueId; |
|
47 | } |
|
48 | ||
49 | /** |
|
50 | * Получение данных для запроса через API |
|
51 | * |
|
52 | * @param string $method Http-метод запроса |
|
53 | * @param array $params Параметры для формирования урла |
|
54 | * |
|
55 | * @return array |
|
56 | * |
|
57 | * @throws Exception |
|
58 | */ |
|
59 | public function getUrl($method, array $params = array()) |
|
60 | { |
|
61 | switch ($method) { |
|
62 | case 'load': |
|
63 | return array( |
|
64 | 'url' => '/1.0/resource/journal/issue/' . ((int)$this->issueId), |
|
65 | 'method' => 'GET', |
@@ 24-63 (lines=40) @@ | ||
21 | * @subpackage Sdk |
|
22 | * @category Collection |
|
23 | */ |
|
24 | class IssueCollection extends Collection |
|
25 | { |
|
26 | /** |
|
27 | * Идентификатор журнала |
|
28 | * |
|
29 | * @var int |
|
30 | */ |
|
31 | private $journalId = null; |
|
32 | ||
33 | /** |
|
34 | * BookCollection constructor. |
|
35 | * @param $journalId |
|
36 | * @param Client $client |
|
37 | * @param array $fields |
|
38 | * @param int $limit |
|
39 | * @param int $offset |
|
40 | * @throws Exception |
|
41 | */ |
|
42 | public function __construct($journalId, Client $client, array $fields = array(), $limit = 10, $offset = 0) |
|
43 | { |
|
44 | parent::__construct($client, $fields, Issue::class, $limit, $offset); |
|
45 | ||
46 | $this->journalId = $journalId; |
|
47 | } |
|
48 | ||
49 | /** |
|
50 | * Получение данных для запроса через API |
|
51 | * |
|
52 | * @param string $method Http-метод запроса |
|
53 | * @param array $params Параметры для формирования урла |
|
54 | * |
|
55 | * @return array |
|
56 | * |
|
57 | * @throws Exception |
|
58 | */ |
|
59 | public function getUrl($method, array $params = array()) |
|
60 | { |
|
61 | switch ($method) { |
|
62 | case 'load': |
|
63 | return array( |
|
64 | 'url' => '/1.0/resource/journal/' . ((int)$this->journalId), |
|
65 | 'method' => 'GET', |
|
66 | 'code' => '200' |