@@ -9,24 +9,24 @@ |
||
| 9 | 9 | class WordPressService |
| 10 | 10 | { |
| 11 | 11 | |
| 12 | - public function __construct(private EntityManagerInterface $manager, private RequestStack $requestStack) {} |
|
| 12 | + public function __construct(private EntityManagerInterface $manager, private RequestStack $requestStack) {} |
|
| 13 | 13 | |
| 14 | - public static function getAllPosts($domain, array $input): array |
|
| 15 | - { |
|
| 14 | + public static function getAllPosts($domain, array $input): array |
|
| 15 | + { |
|
| 16 | 16 | |
| 17 | 17 | try { |
| 18 | - $client = new Client(['verify' => false]); |
|
| 19 | - $response = $client->get($domain . '/wp-json/wp/v2/posts', [ |
|
| 18 | + $client = new Client(['verify' => false]); |
|
| 19 | + $response = $client->get($domain . '/wp-json/wp/v2/posts', [ |
|
| 20 | 20 | 'query' => $input |
| 21 | - ]); |
|
| 21 | + ]); |
|
| 22 | 22 | |
| 23 | - $result = json_decode($response->getBody()); |
|
| 23 | + $result = json_decode($response->getBody()); |
|
| 24 | 24 | |
| 25 | - return $result; |
|
| 25 | + return $result; |
|
| 26 | 26 | } catch (\Exception $e) { |
| 27 | - print_r($e); |
|
| 27 | + print_r($e); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | return null; |
| 31 | - } |
|
| 31 | + } |
|
| 32 | 32 | } |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | 'query' => $input |
| 21 | 21 | ]); |
| 22 | 22 | |
| 23 | - $result = json_decode($response->getBody()); |
|
| 23 | + $result = json_decode($response->getBody()); |
|
| 24 | 24 | |
| 25 | 25 | return $result; |
| 26 | 26 | } catch (\Exception $e) { |