| @@ 10-40 (lines=31) @@ | ||
| 7 | use Polidog\Chatwork\Client\ClientInterface; |
|
| 8 | use Polidog\Chatwork\Entity\Factory\StatusFactory; |
|
| 9 | ||
| 10 | class Status |
|
| 11 | { |
|
| 12 | /** |
|
| 13 | * @var ClientInterface |
|
| 14 | */ |
|
| 15 | private $client; |
|
| 16 | ||
| 17 | /** |
|
| 18 | * @var StatusFactory |
|
| 19 | */ |
|
| 20 | private $factory; |
|
| 21 | ||
| 22 | /** |
|
| 23 | * Status constructor. |
|
| 24 | * |
|
| 25 | * @param ClientInterface $client |
|
| 26 | * @param StatusFactory $factory |
|
| 27 | */ |
|
| 28 | public function __construct(ClientInterface $client, StatusFactory $factory) |
|
| 29 | { |
|
| 30 | $this->client = $client; |
|
| 31 | $this->factory = $factory; |
|
| 32 | } |
|
| 33 | ||
| 34 | public function show() |
|
| 35 | { |
|
| 36 | return $this->factory->entity( |
|
| 37 | $this->client->get('my/status') |
|
| 38 | ); |
|
| 39 | } |
|
| 40 | } |
|
| 41 | ||
| @@ 11-46 (lines=36) @@ | ||
| 8 | use Polidog\Chatwork\Entity\Collection\CollectionInterface; |
|
| 9 | use Polidog\Chatwork\Entity\Factory\TaskFactory; |
|
| 10 | ||
| 11 | class Tasks |
|
| 12 | { |
|
| 13 | /** |
|
| 14 | * @var ClientInterface |
|
| 15 | */ |
|
| 16 | private $client; |
|
| 17 | ||
| 18 | /** |
|
| 19 | * @var TaskFactory |
|
| 20 | */ |
|
| 21 | private $factory; |
|
| 22 | ||
| 23 | /** |
|
| 24 | * Tasks constructor. |
|
| 25 | * |
|
| 26 | * @param ClientInterface $client |
|
| 27 | * @param TaskFactory $factory |
|
| 28 | */ |
|
| 29 | public function __construct(ClientInterface $client, TaskFactory $factory) |
|
| 30 | { |
|
| 31 | $this->client = $client; |
|
| 32 | $this->factory = $factory; |
|
| 33 | } |
|
| 34 | ||
| 35 | /** |
|
| 36 | * @param array $options |
|
| 37 | * |
|
| 38 | * @return CollectionInterface |
|
| 39 | */ |
|
| 40 | public function show(array $options = []) |
|
| 41 | { |
|
| 42 | return $this->factory->collection( |
|
| 43 | $this->client->get('my/tasks', $options) |
|
| 44 | ); |
|
| 45 | } |
|
| 46 | } |
|
| 47 | ||