| @@ 11-46 (lines=36) @@ | ||
| 8 | use Psr\Http\Message\ResponseInterface; |
|
| 9 | use Traversable; |
|
| 10 | ||
| 11 | class BuildCollection implements EndpointInterface, IteratorAggregate |
|
| 12 | { |
|
| 13 | use ParentHasClientAwareTrait; |
|
| 14 | ||
| 15 | /** |
|
| 16 | * @var Repository |
|
| 17 | */ |
|
| 18 | protected $repository; |
|
| 19 | ||
| 20 | /** |
|
| 21 | * @var array |
|
| 22 | */ |
|
| 23 | protected $builds; |
|
| 24 | ||
| 25 | public function __construct(Repository $repository, array $builds) |
|
| 26 | { |
|
| 27 | $this->setParent($repository); |
|
| 28 | $this->repository = $repository; |
|
| 29 | $this->builds = $builds; |
|
| 30 | } |
|
| 31 | ||
| 32 | public function getRequest(): RequestInterface |
|
| 33 | { |
|
| 34 | // TODO: Implement getRequest() method. |
|
| 35 | } |
|
| 36 | ||
| 37 | public function fromResponse(ResponseInterface $response): EndpointInterface |
|
| 38 | { |
|
| 39 | // TODO: Implement fromResponse() method. |
|
| 40 | } |
|
| 41 | ||
| 42 | public function getIterator() |
|
| 43 | { |
|
| 44 | return new ArrayIterator($this->builds); |
|
| 45 | } |
|
| 46 | } |
|
| 47 | ||
| @@ 8-42 (lines=35) @@ | ||
| 5 | use Psr\Http\Message\RequestInterface; |
|
| 6 | use Psr\Http\Message\ResponseInterface; |
|
| 7 | ||
| 8 | class Repository implements EndpointInterface |
|
| 9 | { |
|
| 10 | use ParentHasClientAwareTrait; |
|
| 11 | ||
| 12 | /** |
|
| 13 | * @var string |
|
| 14 | */ |
|
| 15 | protected $repository; |
|
| 16 | ||
| 17 | public function __construct(Travis $parent, string $repository) |
|
| 18 | { |
|
| 19 | $this->setParent($parent); |
|
| 20 | $this->repository = $repository; |
|
| 21 | } |
|
| 22 | ||
| 23 | public function getRepository(): string |
|
| 24 | { |
|
| 25 | return $this->repository; |
|
| 26 | } |
|
| 27 | ||
| 28 | public function builds(): Builds |
|
| 29 | { |
|
| 30 | return new Builds($this); |
|
| 31 | } |
|
| 32 | ||
| 33 | public function getRequest(): RequestInterface |
|
| 34 | { |
|
| 35 | // TODO: Implement getRequest() method. |
|
| 36 | } |
|
| 37 | ||
| 38 | public function fromResponse(ResponseInterface $response): EndpointInterface |
|
| 39 | { |
|
| 40 | // TODO: Implement fromResponse() method. |
|
| 41 | } |
|
| 42 | } |
|
| 43 | ||