Skip to content

Commit

Permalink
Merge pull request #17 from dachcom-digital/coding-standard/refactor-…
Browse files Browse the repository at this point in the history
…master

[CS] Refactor
  • Loading branch information
solverat authored Dec 5, 2024
2 parents f5da86b + 32f3143 commit 5f4adc1
Show file tree
Hide file tree
Showing 85 changed files with 994 additions and 64 deletions.
20 changes: 14 additions & 6 deletions src/Builder/ExtJsDataBuilder.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
<?php

/*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - DACHCOM Commercial License (DCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) DACHCOM.DIGITAL AG (https://www.dachcom-digital.com)
* @license GPLv3 and DCL
*/

namespace SocialDataBundle\Builder;

use Pimcore\Translation\Translator;
use SocialDataBundle\Connector\ConnectorDefinitionInterface;
use SocialDataBundle\Connector\ConnectorEngineConfigurationInterface;
use SocialDataBundle\Connector\ConnectorFeedConfigurationInterface;
use SocialDataBundle\Manager\ConnectorManagerInterface;
use SocialDataBundle\Manager\WallManagerInterface;
use SocialDataBundle\Model\ConnectorEngineInterface;
use SocialDataBundle\Model\WallInterface;
use Pimcore\Translation\Translator;
use SocialDataBundle\Service\StatisticServiceInterface;
use Symfony\Component\Form\FormError;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
Expand All @@ -33,7 +43,6 @@ public function generateConnectorListData(): array
$allConnectorDefinitions = $this->connectorManager->getAllConnectorDefinitions(true);

foreach ($allConnectorDefinitions as $connectorDefinitionName => $connectorDefinition) {

$engineConfiguration = [];
$isInstalled = $connectorDefinition->engineIsLoaded();

Expand Down Expand Up @@ -168,8 +177,8 @@ protected function generateFeedStore(): array
$feedStore = [];
foreach ($this->connectorManager->getAllActiveConnectorDefinitions() as $connectorDefinitionName => $connectorDefinition) {
$feedStore[] = [
'label' => ucFirst($connectorDefinitionName),
'connectorName' => ucFirst($connectorDefinitionName),
'label' => ucfirst($connectorDefinitionName),
'connectorName' => ucfirst($connectorDefinitionName),
'connectorEngine' => $connectorDefinition->getConnectorEngine()->getId(),
'iconCls' => sprintf('pimcore_icon_social_data_connector_%s', strtolower($connectorDefinitionName))
];
Expand All @@ -196,7 +205,6 @@ protected function getExtJSSerializerContext(): array
return $data instanceof ConnectorEngineInterface ? $data->getId() : null;
},
'configuration' => function ($data) {

if ($data instanceof ConnectorFeedConfigurationInterface) {
return $this->serializer->normalize($data);
}
Expand Down
11 changes: 11 additions & 0 deletions src/Command/FetchSocialPostsCommand.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
<?php

/*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - DACHCOM Commercial License (DCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) DACHCOM.DIGITAL AG (https://www.dachcom-digital.com)
* @license GPLv3 and DCL
*/

namespace SocialDataBundle\Command;

use SocialDataBundle\Processor\SocialPostBuilderProcessor;
Expand Down
11 changes: 11 additions & 0 deletions src/Connector/ConnectorDefinitionInterface.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
<?php

/*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - DACHCOM Commercial License (DCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) DACHCOM.DIGITAL AG (https://www.dachcom-digital.com)
* @license GPLv3 and DCL
*/

namespace SocialDataBundle\Connector;

use SocialDataBundle\Model\ConnectorEngineInterface;
Expand Down
11 changes: 11 additions & 0 deletions src/Connector/ConnectorEngineConfigurationInterface.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
<?php

/*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - DACHCOM Commercial License (DCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) DACHCOM.DIGITAL AG (https://www.dachcom-digital.com)
* @license GPLv3 and DCL
*/

namespace SocialDataBundle\Connector;

interface ConnectorEngineConfigurationInterface
Expand Down
11 changes: 11 additions & 0 deletions src/Connector/ConnectorFeedConfigurationInterface.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
<?php

/*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - DACHCOM Commercial License (DCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) DACHCOM.DIGITAL AG (https://www.dachcom-digital.com)
* @license GPLv3 and DCL
*/

namespace SocialDataBundle\Connector;

interface ConnectorFeedConfigurationInterface
Expand Down
11 changes: 11 additions & 0 deletions src/Connector/SocialPostBuilderInterface.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
<?php

/*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - DACHCOM Commercial License (DCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) DACHCOM.DIGITAL AG (https://www.dachcom-digital.com)
* @license GPLv3 and DCL
*/

namespace SocialDataBundle\Connector;

use SocialDataBundle\Dto\BuildConfig;
Expand Down
15 changes: 13 additions & 2 deletions src/Controller/Admin/LogController.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
<?php

/*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - DACHCOM Commercial License (DCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) DACHCOM.DIGITAL AG (https://www.dachcom-digital.com)
* @license GPLv3 and DCL
*/

namespace SocialDataBundle\Controller\Admin;

use Pimcore\Bundle\AdminBundle\Controller\AdminAbstractController;
use SocialDataBundle\Manager\LogManagerInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use SocialDataBundle\Manager\LogManagerInterface;
use Pimcore\Bundle\AdminBundle\Controller\AdminAbstractController;

class LogController extends AdminAbstractController
{
Expand Down
23 changes: 18 additions & 5 deletions src/Controller/Admin/SettingsController.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
<?php

/*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - DACHCOM Commercial License (DCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) DACHCOM.DIGITAL AG (https://www.dachcom-digital.com)
* @license GPLv3 and DCL
*/

namespace SocialDataBundle\Controller\Admin;

use Pimcore\Bundle\AdminBundle\Controller\AdminAbstractController;
use SocialDataBundle\Builder\ExtJsDataBuilder;
use SocialDataBundle\Connector\ConnectorEngineConfigurationInterface;
use SocialDataBundle\Service\ConnectorServiceInterface;
use SocialDataBundle\Service\EnvironmentServiceInterface;
use SocialDataBundle\Manager\ConnectorManagerInterface;
use SocialDataBundle\Model\SocialPostInterface;
use SocialDataBundle\Registry\ConnectorDefinitionRegistryInterface;
use SocialDataBundle\Service\ConnectorServiceInterface;
use SocialDataBundle\Service\EnvironmentServiceInterface;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Pimcore\Bundle\AdminBundle\Controller\AdminAbstractController;

class SettingsController extends AdminAbstractController
{
Expand Down Expand Up @@ -177,8 +188,10 @@ public function saveConnectorConfigurationAction(Request $request, string $conne
if (!$form->isValid()) {
return $this->adminJson([
'success' => false,
'message' => sprintf('Error while processing backend configuration for %s":<br>%s',
$connectorName, join('<br>', $this->extJsDataBuilder->generateFormErrorList($form))
'message' => sprintf(
'Error while processing backend configuration for %s":<br>%s',
$connectorName,
join('<br>', $this->extJsDataBuilder->generateFormErrorList($form))
)
]);
}
Expand Down
11 changes: 11 additions & 0 deletions src/Controller/Admin/Traits/ConnectResponseTrait.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
<?php

/*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - DACHCOM Commercial License (DCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) DACHCOM.DIGITAL AG (https://www.dachcom-digital.com)
* @license GPLv3 and DCL
*/

namespace SocialDataBundle\Controller\Admin\Traits;

use SocialDataBundle\Exception\ConnectException;
Expand Down
16 changes: 13 additions & 3 deletions src/Controller/Admin/WallsController.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
<?php

/*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - DACHCOM Commercial License (DCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) DACHCOM.DIGITAL AG (https://www.dachcom-digital.com)
* @license GPLv3 and DCL
*/

namespace SocialDataBundle\Controller\Admin;

use Pimcore\Bundle\AdminBundle\Controller\AdminAbstractController;
use Pimcore\Model\User;
use Pimcore\Tool\Console;
use SocialDataBundle\Builder\ExtJsDataBuilder;
use SocialDataBundle\Form\Admin\Type\Wall\WallType;
use SocialDataBundle\Logger\LoggerInterface;
use SocialDataBundle\Manager\WallManagerInterface;
use SocialDataBundle\Model\WallInterface;
use SocialDataBundle\Service\LockServiceInterface;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Pimcore\Bundle\AdminBundle\Controller\AdminAbstractController;
use SocialDataBundle\Model\WallInterface;

class WallsController extends AdminAbstractController
{
Expand Down Expand Up @@ -207,5 +218,4 @@ public function triggerWallBuildProcessAction(Request $request, int $wallId): Js

return $this->adminJson($response);
}

}
12 changes: 11 additions & 1 deletion src/DependencyInjection/Compiler/ConnectorDefinitionPass.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
<?php

/*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - DACHCOM Commercial License (DCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) DACHCOM.DIGITAL AG (https://www.dachcom-digital.com)
* @license GPLv3 and DCL
*/

namespace SocialDataBundle\DependencyInjection\Compiler;

use SocialDataBundle\Registry\ConnectorDefinitionRegistry;
Expand All @@ -16,7 +27,6 @@ public function process(ContainerBuilder $container): void
foreach ($container->findTaggedServiceIds('social_data.connector_definition', true) as $id => $tags) {
$connectorDefinition = $container->getDefinition($id);
foreach ($tags as $attributes) {

if (!isset($attributes['identifier'])) {
throw new InvalidConfigurationException(sprintf('You need to define a valid identifier for connector "%s"', $id));
} elseif (!isset($attributes['socialPostBuilder'])) {
Expand Down
11 changes: 11 additions & 0 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
<?php

/*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - DACHCOM Commercial License (DCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) DACHCOM.DIGITAL AG (https://www.dachcom-digital.com)
* @license GPLv3 and DCL
*/

namespace SocialDataBundle\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\NodeDefinition;
Expand Down
15 changes: 13 additions & 2 deletions src/DependencyInjection/SocialDataExtension.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
<?php

/*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - DACHCOM Commercial License (DCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) DACHCOM.DIGITAL AG (https://www.dachcom-digital.com)
* @license GPLv3 and DCL
*/

namespace SocialDataBundle\DependencyInjection;

use SocialDataBundle\Service\EnvironmentService;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;

class SocialDataExtension extends Extension
{
Expand Down
11 changes: 11 additions & 0 deletions src/Dto/AbstractData.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
<?php

/*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - DACHCOM Commercial License (DCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) DACHCOM.DIGITAL AG (https://www.dachcom-digital.com)
* @license GPLv3 and DCL
*/

namespace SocialDataBundle\Dto;

abstract class AbstractData
Expand Down
11 changes: 11 additions & 0 deletions src/Dto/BuildConfig.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
<?php

/*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - DACHCOM Commercial License (DCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) DACHCOM.DIGITAL AG (https://www.dachcom-digital.com)
* @license GPLv3 and DCL
*/

namespace SocialDataBundle\Dto;

use SocialDataBundle\Connector\ConnectorEngineConfigurationInterface;
Expand Down
11 changes: 11 additions & 0 deletions src/Dto/FetchData.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
<?php

/*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - DACHCOM Commercial License (DCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) DACHCOM.DIGITAL AG (https://www.dachcom-digital.com)
* @license GPLv3 and DCL
*/

namespace SocialDataBundle\Dto;

class FetchData extends AbstractData
Expand Down
Loading

0 comments on commit 5f4adc1

Please sign in to comment.