1 | <?php |
||
2 | |||
3 | namespace JeroenG\Flickr; |
||
4 | |||
5 | class Flickr |
||
6 | { |
||
7 | public Api $api; |
||
8 | |||
9 | public function __construct(Api $api) |
||
10 | { |
||
11 | $this->api = $api; |
||
12 | } |
||
13 | |||
14 | public function request(string $method, ?array $parameters = null): Response |
||
15 | { |
||
16 | return $this->api->request($method, $parameters); |
||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
![]() |
|||
17 | } |
||
18 | |||
19 | /** |
||
20 | * Flickr echo request, for testing purposes. |
||
21 | */ |
||
22 | public function echoThis(string $string): Response |
||
23 | { |
||
24 | return $this->request('flickr.test.echo', ['this' => $string]); |
||
25 | } |
||
26 | |||
27 | /** |
||
28 | * Get a list of photosets. |
||
29 | */ |
||
30 | public function listSets(?array $parameters = null): Response |
||
31 | { |
||
32 | return $this->request('flickr.photosets.getList', $parameters); |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * Get all photos in a photoset. |
||
37 | */ |
||
38 | public function photosForSet(string $setId, string $userId, ?array $otherParameters = null): Response |
||
39 | { |
||
40 | $parameters['photoset_id'] = $setId; |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
41 | $parameters['user_id'] = $userId; |
||
42 | |||
43 | if (is_array($otherParameters)) { |
||
44 | $parameters = array_merge($parameters, $otherParameters); |
||
45 | } |
||
46 | |||
47 | return $this->request('flickr.photosets.getPhotos', $parameters); |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * Get all info on a photo. |
||
52 | */ |
||
53 | public function photoInfo(string $photoId, ?string $secretId = null): Response |
||
54 | { |
||
55 | $parameters['photo_id'] = $photoId; |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
56 | |||
57 | if (! is_null($secretId)) { |
||
58 | $parameters['secret'] = $secretId; |
||
59 | } |
||
60 | |||
61 | return $this->request('flickr.photos.getInfo', $parameters); |
||
62 | } |
||
63 | } |
||
64 |