From 17921c4226c988a9046358204d0fda9091d8ddae Mon Sep 17 00:00:00 2001 From: DACHCOM Bot Date: Thu, 5 Dec 2024 16:10:15 +0000 Subject: [PATCH] [CS] Refactor --- src/Builder/SocialPostBuilder.php | 15 ++++++- src/Client/LinkedInClient.php | 11 +++++ src/Client/LinkedInSDK.php | 45 ++++++++++--------- src/Controller/Admin/LinkedInController.php | 14 +++++- src/Definition/ConnectorDefinition.php | 13 +++++- src/DependencyInjection/Configuration.php | 11 +++++ .../SocialDataLinkedInConnectorExtension.php | 15 ++++++- src/EventListener/Admin/AssetListener.php | 11 +++++ src/Form/Admin/Type/LinkedInEngineType.php | 11 +++++ src/Form/Admin/Type/LinkedInFeedType.php | 13 +++++- src/Model/EngineConfiguration.php | 13 +++++- src/Model/FeedConfiguration.php | 13 +++++- src/SocialDataLinkedInConnectorBundle.php | 11 +++++ 13 files changed, 166 insertions(+), 30 deletions(-) diff --git a/src/Builder/SocialPostBuilder.php b/src/Builder/SocialPostBuilder.php index 5cda184..9d0dcb4 100644 --- a/src/Builder/SocialPostBuilder.php +++ b/src/Builder/SocialPostBuilder.php @@ -1,13 +1,24 @@ _getCurlHandle(); $options = [ @@ -264,14 +272,12 @@ protected function _makeRequest( if (!empty($payload)) { if (in_array($options[CURLOPT_CUSTOMREQUEST], [self::HTTP_METHOD_POST, self::HTTP_METHOD_PUT], true)) { - $options[CURLOPT_POST] = true; $options[CURLOPT_POSTFIELDS] = http_build_query($payload); $headers[] = 'Content-Length: ' . strlen($options[CURLOPT_POSTFIELDS]); $options[CURLOPT_HTTPHEADER] = $headers; - } else { $query = http_build_query($payload); $options[CURLOPT_URL] = sprintf('%s&%s', $options[CURLOPT_URL], ($useEncodedQuery ? urldecode($query) : $query)); @@ -314,5 +320,4 @@ public function __destruct() curl_close($this->curlHandle); } } - -} \ No newline at end of file +} diff --git a/src/Controller/Admin/LinkedInController.php b/src/Controller/Admin/LinkedInController.php index bd25e6c..7711132 100644 --- a/src/Controller/Admin/LinkedInController.php +++ b/src/Controller/Admin/LinkedInController.php @@ -1,11 +1,22 @@ $connectorEngineConfig->getClientId(), 'client_secret' => $connectorEngineConfig->getClientSecret(), diff --git a/src/Definition/ConnectorDefinition.php b/src/Definition/ConnectorDefinition.php index b1710fc..cce8019 100644 --- a/src/Definition/ConnectorDefinition.php +++ b/src/Definition/ConnectorDefinition.php @@ -1,12 +1,23 @@ setDefaults([ 'csrf_protection' => false, - 'data_class' => FeedConfiguration::class + 'data_class' => FeedConfiguration::class ]); } } diff --git a/src/Model/EngineConfiguration.php b/src/Model/EngineConfiguration.php index e91ac40..532f002 100644 --- a/src/Model/EngineConfiguration.php +++ b/src/Model/EngineConfiguration.php @@ -1,9 +1,20 @@