1 | <?php |
||
14 | class Client |
||
15 | { |
||
16 | /** @var string[] a list of default providers */ |
||
17 | private $providers = [ |
||
18 | \Sourceout\LastFm\Providers\LastFm\LastFm::class |
||
19 | ]; |
||
20 | |||
21 | /** @var array a list of provider interfaces */ |
||
22 | private $providerInterfaces = [ |
||
23 | \Sourceout\LastFm\Providers\ProviderInterface::class, |
||
24 | ]; |
||
25 | |||
26 | /** @var HttpInterface|null an instance of http used to fetch data */ |
||
27 | private $http; |
||
28 | |||
29 | |||
30 | 7 | public function __construct(HttpInterface $http = null) |
|
34 | |||
35 | /** |
||
36 | * Returns a list of registered providers |
||
37 | * |
||
38 | * @return string[] |
||
39 | */ |
||
40 | 4 | public function getRegisteredProviders() : array |
|
44 | |||
45 | /** |
||
46 | * Add ability to add new custom providers |
||
47 | * |
||
48 | * @param array $providers |
||
49 | * |
||
50 | * @return void |
||
51 | * @throws ProviderDoesNotExistsException |
||
52 | * @throws IncomptabileProviderTypeException |
||
53 | */ |
||
54 | 3 | public function registerCustomProviders(array $providers) : void |
|
75 | |||
76 | /** |
||
77 | * Returns an instance of ServiceFactory |
||
78 | * |
||
79 | * @param ProviderInterface $provider |
||
80 | * |
||
81 | * @return ServiceFactory |
||
82 | * @throws UnregisteredProviderException |
||
83 | */ |
||
84 | 2 | public function getServiceFactory( |
|
98 | |||
99 | /** |
||
100 | * Setter Method |
||
101 | * |
||
102 | * @param HttpInterface $http |
||
103 | * @return void |
||
104 | */ |
||
105 | 1 | public function setHttpClient(HttpInterface $http) : void |
|
109 | |||
110 | /** |
||
111 | * Getter Method |
||
112 | * |
||
113 | * @return HttpInterface|null |
||
114 | */ |
||
115 | 1 | public function getHttpClient() : ?HttpInterface |
|
119 | } |