Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CS] Refactor #17

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[CS] Refactor
  • Loading branch information
DACHCOM Bot authored Dec 5, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 32f314391e481ada46b06cf3c8f33fe139c87659
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;
@@ -33,7 +43,6 @@ public function generateConnectorListData(): array
$allConnectorDefinitions = $this->connectorManager->getAllConnectorDefinitions(true);

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

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

@@ -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))
];
@@ -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);
}
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;
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;
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
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
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;
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
{
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
{
@@ -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))
)
]);
}
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;
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
{
@@ -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;
@@ -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'])) {
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;
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
{
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
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;
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
Loading
Loading