Skip to content

Commit 87d62cb

Browse files
authored
Merge pull request #7 from dachcom-digital/coding-standard/refactor-master
[CS] Refactor
2 parents c814969 + 17a4e2f commit 87d62cb

11 files changed

+134
-17
lines changed

src/Builder/SocialPostBuilder.php

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
<?php
22

3+
/*
4+
* This source file is available under two different licenses:
5+
* - GNU General Public License version 3 (GPLv3)
6+
* - DACHCOM Commercial License (DCL)
7+
* Full copyright and license information is available in
8+
* LICENSE.md which is distributed with this source code.
9+
*
10+
* @copyright Copyright (c) DACHCOM.DIGITAL AG (https://www.dachcom-digital.com)
11+
* @license GPLv3 and DCL
12+
*/
13+
314
namespace SocialData\Connector\Youtube\Builder;
415

516
use Carbon\Carbon;
@@ -13,10 +24,10 @@
1324
use Google\Service\YouTube\Thumbnail;
1425
use Google\Service\YouTube\ThumbnailDetails;
1526
use SocialData\Connector\Youtube\Client\YoutubeClient;
16-
use SocialDataBundle\Dto\BuildConfig;
1727
use SocialData\Connector\Youtube\Model\EngineConfiguration;
1828
use SocialData\Connector\Youtube\Model\FeedConfiguration;
1929
use SocialDataBundle\Connector\SocialPostBuilderInterface;
30+
use SocialDataBundle\Dto\BuildConfig;
2031
use SocialDataBundle\Dto\FetchData;
2132
use SocialDataBundle\Dto\FilterData;
2233
use SocialDataBundle\Dto\TransformData;
@@ -151,7 +162,6 @@ protected function getChannelItems(Client $client, string $channelId, int $limit
151162

152163
$nextPageToken = 'INIT';
153164
while (!empty($nextPageToken)) {
154-
155165
if ($nextPageToken !== 'INIT') {
156166
$params['pageToken'] = $nextPageToken;
157167
}
@@ -160,7 +170,7 @@ protected function getChannelItems(Client $client, string $channelId, int $limit
160170
$response = $service->search->listSearch('snippet', $params);
161171
} catch (Exception $e) {
162172
throw new BuildException(sprintf('fetch google service error: %s [endpoint: %s]', implode(', ', array_map(static function ($e) {
163-
/** @phpstan-ignore-next-line */
173+
/* @phpstan-ignore-next-line */
164174
return $e['message'];
165175
}, $e->getErrors())), 'listSearch'));
166176
} catch (\Throwable $e) {
@@ -183,7 +193,6 @@ protected function getChannelItems(Client $client, string $channelId, int $limit
183193

184194
/** @var SearchResult $item */
185195
foreach ($items as $item) {
186-
187196
$resource = $item->getId();
188197
$snippet = $item->getSnippet();
189198

@@ -221,7 +230,6 @@ protected function getPlaylistItems(Client $client, string $playlistId, int $lim
221230

222231
$nextPageToken = 'INIT';
223232
while (!empty($nextPageToken)) {
224-
225233
if ($nextPageToken !== 'INIT') {
226234
$params['pageToken'] = $nextPageToken;
227235
}
@@ -230,7 +238,7 @@ protected function getPlaylistItems(Client $client, string $playlistId, int $lim
230238
$response = $service->playlistItems->listPlaylistItems('snippet', $params);
231239
} catch (Exception $e) {
232240
throw new BuildException(sprintf('fetch google service error: %s [endpoint: %s]', implode(', ', array_map(static function ($e) {
233-
/** @phpstan-ignore-next-line */
241+
/* @phpstan-ignore-next-line */
234242
return $e['message'];
235243
}, $e->getErrors())), 'listPlaylistItems'));
236244
} catch (\Throwable $e) {
@@ -253,7 +261,6 @@ protected function getPlaylistItems(Client $client, string $playlistId, int $lim
253261

254262
/** @var PlaylistItem $item */
255263
foreach ($items as $item) {
256-
257264
$snippet = $item->getSnippet();
258265

259266
$thumbnail = null;
@@ -277,22 +284,22 @@ protected function getPlaylistItems(Client $client, string $playlistId, int $lim
277284

278285
protected function getThumbnail(ThumbnailDetails $thumbnailDetails): ?Thumbnail
279286
{
280-
/** @phpstan-ignore-next-line */
287+
/* @phpstan-ignore-next-line */
281288
if ($thumbnailDetails->getMaxres() !== null) {
282289
return $thumbnailDetails->getMaxres();
283290
}
284291

285-
/** @phpstan-ignore-next-line */
292+
/* @phpstan-ignore-next-line */
286293
if ($thumbnailDetails->getHigh() !== null) {
287294
return $thumbnailDetails->getHigh();
288295
}
289296

290-
/** @phpstan-ignore-next-line */
297+
/* @phpstan-ignore-next-line */
291298
if ($thumbnailDetails->getMedium() !== null) {
292299
return $thumbnailDetails->getMedium();
293300
}
294301

295-
/** @phpstan-ignore-next-line */
302+
/* @phpstan-ignore-next-line */
296303
if ($thumbnailDetails->getStandard() !== null) {
297304
return $thumbnailDetails->getStandard();
298305
}

src/Client/YoutubeClient.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
<?php
22

3+
/*
4+
* This source file is available under two different licenses:
5+
* - GNU General Public License version 3 (GPLv3)
6+
* - DACHCOM Commercial License (DCL)
7+
* Full copyright and license information is available in
8+
* LICENSE.md which is distributed with this source code.
9+
*
10+
* @copyright Copyright (c) DACHCOM.DIGITAL AG (https://www.dachcom-digital.com)
11+
* @license GPLv3 and DCL
12+
*/
13+
314
namespace SocialData\Connector\Youtube\Client;
415

516
use SocialData\Connector\Youtube\Model\EngineConfiguration;

src/Definition/ConnectorDefinition.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
<?php
22

3+
/*
4+
* This source file is available under two different licenses:
5+
* - GNU General Public License version 3 (GPLv3)
6+
* - DACHCOM Commercial License (DCL)
7+
* Full copyright and license information is available in
8+
* LICENSE.md which is distributed with this source code.
9+
*
10+
* @copyright Copyright (c) DACHCOM.DIGITAL AG (https://www.dachcom-digital.com)
11+
* @license GPLv3 and DCL
12+
*/
13+
314
namespace SocialData\Connector\Youtube\Definition;
415

516
use SocialData\Connector\Youtube\Model\EngineConfiguration;
617
use SocialData\Connector\Youtube\Model\FeedConfiguration;
7-
use SocialDataBundle\Connector\ConnectorEngineConfigurationInterface;
818
use SocialDataBundle\Connector\ConnectorDefinitionInterface;
19+
use SocialDataBundle\Connector\ConnectorEngineConfigurationInterface;
920
use SocialDataBundle\Connector\SocialPostBuilderInterface;
1021
use SocialDataBundle\Model\ConnectorEngineInterface;
1122
use Symfony\Component\OptionsResolver\OptionsResolver;

src/DependencyInjection/Configuration.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
<?php
22

3+
/*
4+
* This source file is available under two different licenses:
5+
* - GNU General Public License version 3 (GPLv3)
6+
* - DACHCOM Commercial License (DCL)
7+
* Full copyright and license information is available in
8+
* LICENSE.md which is distributed with this source code.
9+
*
10+
* @copyright Copyright (c) DACHCOM.DIGITAL AG (https://www.dachcom-digital.com)
11+
* @license GPLv3 and DCL
12+
*/
13+
314
namespace SocialData\Connector\Youtube\DependencyInjection;
415

516
use Symfony\Component\Config\Definition\Builder\TreeBuilder;

src/DependencyInjection/SocialDataYoutubeConnectorExtension.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
<?php
22

3+
/*
4+
* This source file is available under two different licenses:
5+
* - GNU General Public License version 3 (GPLv3)
6+
* - DACHCOM Commercial License (DCL)
7+
* Full copyright and license information is available in
8+
* LICENSE.md which is distributed with this source code.
9+
*
10+
* @copyright Copyright (c) DACHCOM.DIGITAL AG (https://www.dachcom-digital.com)
11+
* @license GPLv3 and DCL
12+
*/
13+
314
namespace SocialData\Connector\Youtube\DependencyInjection;
415

16+
use Symfony\Component\Config\FileLocator;
17+
use Symfony\Component\DependencyInjection\ContainerBuilder;
518
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
619
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
7-
use Symfony\Component\DependencyInjection\ContainerBuilder;
8-
use Symfony\Component\Config\FileLocator;
920

1021
class SocialDataYoutubeConnectorExtension extends Extension
1122
{

src/EventListener/Admin/AssetListener.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
<?php
22

3+
/*
4+
* This source file is available under two different licenses:
5+
* - GNU General Public License version 3 (GPLv3)
6+
* - DACHCOM Commercial License (DCL)
7+
* Full copyright and license information is available in
8+
* LICENSE.md which is distributed with this source code.
9+
*
10+
* @copyright Copyright (c) DACHCOM.DIGITAL AG (https://www.dachcom-digital.com)
11+
* @license GPLv3 and DCL
12+
*/
13+
314
namespace SocialData\Connector\Youtube\EventListener\Admin;
415

516
use Pimcore\Event\BundleManager\PathsEvent;

src/Form/Admin/Type/YoutubeEngineType.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
<?php
22

3+
/*
4+
* This source file is available under two different licenses:
5+
* - GNU General Public License version 3 (GPLv3)
6+
* - DACHCOM Commercial License (DCL)
7+
* Full copyright and license information is available in
8+
* LICENSE.md which is distributed with this source code.
9+
*
10+
* @copyright Copyright (c) DACHCOM.DIGITAL AG (https://www.dachcom-digital.com)
11+
* @license GPLv3 and DCL
12+
*/
13+
314
namespace SocialData\Connector\Youtube\Form\Admin\Type;
415

516
use SocialData\Connector\Youtube\Model\EngineConfiguration;

src/Form/Admin/Type/YoutubeFeedType.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
<?php
22

3+
/*
4+
* This source file is available under two different licenses:
5+
* - GNU General Public License version 3 (GPLv3)
6+
* - DACHCOM Commercial License (DCL)
7+
* Full copyright and license information is available in
8+
* LICENSE.md which is distributed with this source code.
9+
*
10+
* @copyright Copyright (c) DACHCOM.DIGITAL AG (https://www.dachcom-digital.com)
11+
* @license GPLv3 and DCL
12+
*/
13+
314
namespace SocialData\Connector\Youtube\Form\Admin\Type;
415

516
use SocialData\Connector\Youtube\Model\FeedConfiguration;
@@ -22,7 +33,7 @@ public function configureOptions(OptionsResolver $resolver): void
2233
{
2334
$resolver->setDefaults([
2435
'csrf_protection' => false,
25-
'data_class' => FeedConfiguration::class
36+
'data_class' => FeedConfiguration::class
2637
]);
2738
}
2839
}

src/Model/EngineConfiguration.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
11
<?php
22

3+
/*
4+
* This source file is available under two different licenses:
5+
* - GNU General Public License version 3 (GPLv3)
6+
* - DACHCOM Commercial License (DCL)
7+
* Full copyright and license information is available in
8+
* LICENSE.md which is distributed with this source code.
9+
*
10+
* @copyright Copyright (c) DACHCOM.DIGITAL AG (https://www.dachcom-digital.com)
11+
* @license GPLv3 and DCL
12+
*/
13+
314
namespace SocialData\Connector\Youtube\Model;
415

5-
use SocialDataBundle\Connector\ConnectorEngineConfigurationInterface;
616
use SocialData\Connector\Youtube\Form\Admin\Type\YoutubeEngineType;
17+
use SocialDataBundle\Connector\ConnectorEngineConfigurationInterface;
718

819
class EngineConfiguration implements ConnectorEngineConfigurationInterface
920
{

src/Model/FeedConfiguration.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
11
<?php
22

3+
/*
4+
* This source file is available under two different licenses:
5+
* - GNU General Public License version 3 (GPLv3)
6+
* - DACHCOM Commercial License (DCL)
7+
* Full copyright and license information is available in
8+
* LICENSE.md which is distributed with this source code.
9+
*
10+
* @copyright Copyright (c) DACHCOM.DIGITAL AG (https://www.dachcom-digital.com)
11+
* @license GPLv3 and DCL
12+
*/
13+
314
namespace SocialData\Connector\Youtube\Model;
415

5-
use SocialDataBundle\Connector\ConnectorFeedConfigurationInterface;
616
use SocialData\Connector\Youtube\Form\Admin\Type\YoutubeFeedType;
17+
use SocialDataBundle\Connector\ConnectorFeedConfigurationInterface;
718

819
class FeedConfiguration implements ConnectorFeedConfigurationInterface
920
{

src/SocialDataYoutubeConnectorBundle.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
<?php
22

3+
/*
4+
* This source file is available under two different licenses:
5+
* - GNU General Public License version 3 (GPLv3)
6+
* - DACHCOM Commercial License (DCL)
7+
* Full copyright and license information is available in
8+
* LICENSE.md which is distributed with this source code.
9+
*
10+
* @copyright Copyright (c) DACHCOM.DIGITAL AG (https://www.dachcom-digital.com)
11+
* @license GPLv3 and DCL
12+
*/
13+
314
namespace SocialData\Connector\Youtube;
415

516
use Pimcore\Extension\Bundle\Traits\PackageVersionTrait;

0 commit comments

Comments
 (0)