@@ 75-94 (lines=20) @@ | ||
72 | /** |
|
73 | * @throws InvalidConfigurationException |
|
74 | */ |
|
75 | private function setLinkedInParameters(): void |
|
76 | { |
|
77 | $configuration = $this->configuration; |
|
78 | ||
79 | if (!in_array('linkedin', $configuration['publish_on'], true)) { |
|
80 | return; |
|
81 | } |
|
82 | ||
83 | if (!isset($configuration['providers']['linkedin'])) { |
|
84 | throw new InvalidConfigurationException('Found no configuration for the LinkedIn provider'); |
|
85 | } |
|
86 | ||
87 | $linkedinConfiguration = $configuration['providers']['linkedin']; |
|
88 | $linkedinParameters = ['client_id', 'client_secret', 'access_token', 'company_page_id']; |
|
89 | foreach ($linkedinParameters as $parameter) { |
|
90 | $this->container->setParameter('social_post.configuration.linkedin.'.$parameter, $linkedinConfiguration[$parameter]); |
|
91 | } |
|
92 | ||
93 | $this->loader->load('linkedin.yml'); |
|
94 | } |
|
95 | ||
96 | /** |
|
97 | * @throws InvalidConfigurationException |
|
@@ 99-118 (lines=20) @@ | ||
96 | /** |
|
97 | * @throws InvalidConfigurationException |
|
98 | */ |
|
99 | private function setTwitterParameters(): void |
|
100 | { |
|
101 | $configuration = $this->configuration; |
|
102 | ||
103 | if (!in_array('twitter', $configuration['publish_on'], true)) { |
|
104 | return; |
|
105 | } |
|
106 | ||
107 | if (!isset($configuration['providers']['twitter'])) { |
|
108 | throw new InvalidConfigurationException('Found no configuration for the Twitter provider'); |
|
109 | } |
|
110 | ||
111 | $twitterConfiguration = $configuration['providers']['twitter']; |
|
112 | $twitterParameters = ['consumer_key', 'consumer_secret', 'access_token', 'access_token_secret']; |
|
113 | foreach ($twitterParameters as $parameter) { |
|
114 | $this->container->setParameter('social_post.configuration.twitter.'.$parameter, $twitterConfiguration[$parameter]); |
|
115 | } |
|
116 | ||
117 | $this->loader->load('twitter.yml'); |
|
118 | } |
|
119 | } |
|
120 |