1 | <?php |
||
54 | class HelperFactory |
||
55 | { |
||
56 | /** @var HelperFactory The reference to *HelperFactory* instance of this class */ |
||
57 | private static $instance; |
||
58 | |||
59 | /** @var Response|ResponseInterface $response */ |
||
60 | protected static $response; |
||
61 | |||
62 | /** @var Stream $stream */ |
||
63 | protected static $stream; |
||
64 | |||
65 | /** @var object $content */ |
||
66 | protected static $content; |
||
67 | |||
68 | /** |
||
69 | * Returns the *HelperFactory* instance of this class. |
||
70 | * |
||
71 | * @return HelperFactory The *HelperFactory* instance. |
||
72 | */ |
||
73 | public static function getInstance() |
||
81 | |||
82 | /** |
||
83 | * Protected constructor to prevent creating a new instance of the |
||
84 | * *HelperFactory* via the `new` operator from outside of this class. |
||
85 | */ |
||
86 | protected function __construct() |
||
90 | |||
91 | /** |
||
92 | * Factory Client method to create \GuzzleHttp\Client object |
||
93 | * |
||
94 | * @param string $uri |
||
95 | * |
||
96 | * @return Client |
||
97 | */ |
||
98 | public function client($uri) |
||
104 | |||
105 | /** |
||
106 | * Sends request to Instagram Api Endpoints |
||
107 | * |
||
108 | * @param Client $client |
||
109 | * @param string $endpoint |
||
110 | * @param array|string $options |
||
111 | * @param string $method |
||
112 | * |
||
113 | * @throws InstagramOAuthException|InstagramException |
||
114 | * |
||
115 | * @return Response |
||
116 | */ |
||
117 | public function request(Client $client, $endpoint, $options, $method = 'GET') |
||
127 | |||
128 | /** |
||
129 | * Create body for Guzzle client request |
||
130 | * |
||
131 | * @param array|null|string $options |
||
132 | * @param string $method GET|POST |
||
133 | * |
||
134 | * @return string|mixed |
||
135 | */ |
||
136 | protected static function createBody($options, $method) |
||
140 | |||
141 | /* |
||
142 | * Method to extract all exceptions for Guzzle ClientException |
||
143 | * |
||
144 | * @param ClientException $exception |
||
145 | * |
||
146 | * @return stdClass |
||
147 | * |
||
148 | * @throws InstagramServerException |
||
149 | */ |
||
150 | protected static function extractOriginalExceptionMessage(ClientException $exception) |
||
165 | |||
166 | /** |
||
167 | * Throw required Exception |
||
168 | * |
||
169 | * @param \stdClass $object |
||
170 | * @param ClientException $exMessage |
||
171 | * |
||
172 | * @throws InstagramOAuthException|InstagramException |
||
173 | */ |
||
174 | protected static function throwException(\stdClass $object, ClientException $exMessage) |
||
190 | |||
191 | /** |
||
192 | * Creates Exception Message |
||
193 | * |
||
194 | * @param \stdClass $object |
||
195 | * |
||
196 | * @return array |
||
197 | */ |
||
198 | protected static function createExceptionMessage(\stdClass $object) |
||
207 | |||
208 | /** |
||
209 | * Private clone method to prevent cloning of the instance of the |
||
210 | * *HelperFactory* instance. |
||
211 | */ |
||
212 | private function __clone() |
||
216 | |||
217 | /** |
||
218 | * Private unserialize method to prevent unserializing of the *HelperFactory * |
||
219 | * instance. |
||
220 | */ |
||
221 | private function __wakeup() |
||
224 | } |
||
225 |