Skip to content

Commit

Permalink
[CS] Refactor (#99)
Browse files Browse the repository at this point in the history
Co-authored-by: DACHCOM Bot <[email protected]>
  • Loading branch information
github-actions[bot] and DACHCOM Bot authored Jan 6, 2025
1 parent eb894bb commit 737f56f
Show file tree
Hide file tree
Showing 202 changed files with 2,352 additions and 143 deletions.
12 changes: 11 additions & 1 deletion src/Builder/ContextDefinitionBuilder.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 DynamicSearchBundle\Builder;

use DynamicSearchBundle\Context\ContextDefinitionInterface;
Expand All @@ -20,5 +31,4 @@ public function buildContextDefinitionStack(string $dispatchType, array $runtime
{
return $this->contextDefinitionFactory->createStack($dispatchType, $runtimeValues);
}

}
11 changes: 11 additions & 0 deletions src/Builder/ContextDefinitionBuilderInterface.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 DynamicSearchBundle\Builder;

use DynamicSearchBundle\Context\ContextDefinitionInterface;
Expand Down
13 changes: 11 additions & 2 deletions src/Command/SearchCommand.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 DynamicSearchBundle\Command;

use DynamicSearchBundle\Command\Traits\SignalWatchTrait;
Expand All @@ -23,7 +34,6 @@ public function __construct(
protected LockServiceInterface $lockService
) {
parent::__construct();

}

protected function configure(): void
Expand All @@ -38,7 +48,6 @@ protected function configure(): void
);
}


protected function execute(InputInterface $input, OutputInterface $output): int
{
// should we skip context indexing if queue index is running?
Expand Down
11 changes: 11 additions & 0 deletions src/Command/Traits/SignalWatchTrait.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 DynamicSearchBundle\Command\Traits;

trait SignalWatchTrait
Expand Down
11 changes: 11 additions & 0 deletions src/Configuration/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 DynamicSearchBundle\Configuration;

class Configuration implements ConfigurationInterface
Expand Down
11 changes: 11 additions & 0 deletions src/Configuration/ConfigurationInterface.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 DynamicSearchBundle\Configuration;

interface ConfigurationInterface
Expand Down
11 changes: 11 additions & 0 deletions src/Context/ContextDefinition.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 DynamicSearchBundle\Context;

class ContextDefinition implements ContextDefinitionInterface
Expand Down
11 changes: 11 additions & 0 deletions src/Context/ContextDefinitionInterface.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 DynamicSearchBundle\Context;

use DynamicSearchBundle\Exception\ContextConfigurationException;
Expand Down
18 changes: 13 additions & 5 deletions src/Controller/Admin/SettingsController.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 DynamicSearchBundle\Controller\Admin;

use DynamicSearchBundle\Manager\QueueManagerInterface;
Expand All @@ -16,15 +27,13 @@ class SettingsController extends AdminAbstractController
{
public function __construct(
private array $contextFullConfiguration
)
{
) {
}

public function healthStateAction(HealthStateRegistryInterface $healthStateRegistry): JsonResponse
{
$stateLines = [];
foreach ($healthStateRegistry->all() as $healthStateService) {

$stateIcon = 'pimcore_icon_save';
if ($healthStateService->getState() === HealthStateInterface::STATE_WARNING) {
$stateIcon = 'pimcore_icon_info';
Expand All @@ -40,7 +49,6 @@ public function healthStateAction(HealthStateRegistryInterface $healthStateRegis
'comment' => $healthStateService->getComment(),
'icon' => $stateIcon,
];

}

return $this->json([
Expand All @@ -59,7 +67,7 @@ public function indexQueueInfoAction(QueueManagerInterface $queueManager): JsonR
{
return $this->json([
'tableName' => $queueManager->getQueueTableName(),
'count' => $queueManager->getTotalQueuedItems()
'count' => $queueManager->getTotalQueuedItems()
]);
}

Expand Down
11 changes: 11 additions & 0 deletions src/Controller/SearchController.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 DynamicSearchBundle\Controller;

use DynamicSearchBundle\Configuration\ConfigurationInterface;
Expand Down
23 changes: 19 additions & 4 deletions src/Controller/SearchFrontendController.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 DynamicSearchBundle\Controller;

use DynamicSearchBundle\Configuration\ConfigurationInterface;
Expand Down Expand Up @@ -69,8 +80,12 @@ protected function renderFrontendSearch(Request $request, string $outputChannelN
$outputChannelResult = $this->outputChannelWorkflowProcessor->dispatchOutputChannelQuery($contextName, $outputChannelName);
} catch (\Throwable $e) {
$hasError = true;
$errorMessage = sprintf('Error while loading search output channel "%s" for "%s" context. Error was: %s', $outputChannelName, $contextName,
$e->getMessage());
$errorMessage = sprintf(
'Error while loading search output channel "%s" for "%s" context. Error was: %s',
$outputChannelName,
$contextName,
$e->getMessage()
);
}
}

Expand Down Expand Up @@ -163,7 +178,7 @@ protected function prepareQueryVars(OutputChannelResultInterface $outputChannelR
];
}

protected function outputChannelExists(string $contextName, string $outputChannelName, bool $multiSearchOnly = false) :bool
protected function outputChannelExists(string $contextName, string $outputChannelName, bool $multiSearchOnly = false): bool
{
$channelConfig = $this->getOutputChannelConfig($contextName, $outputChannelName);

Expand All @@ -186,7 +201,7 @@ protected function outputChannelExists(string $contextName, string $outputChanne
return $channelConfig['use_frontend_controller'] === true;
}

protected function getOutputChannelView(string $contextName, string $outputChannelName, string $default) :string
protected function getOutputChannelView(string $contextName, string $outputChannelName, string $default): string
{
$channelConfig = $this->getOutputChannelConfig($contextName, $outputChannelName);

Expand Down
11 changes: 11 additions & 0 deletions src/DependencyInjection/Compiler/ContextGuardPass.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 DynamicSearchBundle\DependencyInjection\Compiler;

use DynamicSearchBundle\Registry\ContextGuardRegistry;
Expand Down
17 changes: 13 additions & 4 deletions src/DependencyInjection/Compiler/DataProviderPass.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 DynamicSearchBundle\DependencyInjection\Compiler;

use DynamicSearchBundle\DependencyInjection\Compiler\Helper\OptionsResolverValidator;
Expand All @@ -20,7 +31,6 @@ public function process(ContainerBuilder $container): void

foreach ($container->findTaggedServiceIds(self::DATA_PROVIDER_TAG, true) as $id => $tags) {
foreach ($tags as $attributes) {

$alias = $attributes['identifier'] ?? null;
$serviceName = $alias ?? $id;

Expand All @@ -32,9 +42,9 @@ public function process(ContainerBuilder $container): void
$this->validateOptions($container, $serviceDefinitionStack);
}

protected function validateOptions(ContainerBuilder $container, array $serviceDefinitionStack): void
private function validateOptions(ContainerBuilder $container, array $serviceDefinitionStack): void
{
/** @phpstan-ignore-next-line */
/* @phpstan-ignore-next-line */
if (!$container->hasParameter('dynamic_search.context.full_configuration')) {
return;
}
Expand All @@ -44,7 +54,6 @@ protected function validateOptions(ContainerBuilder $container, array $serviceDe
$contextConfiguration = $container->getParameter('dynamic_search.context.full_configuration');

foreach ($contextConfiguration as $contextName => &$contextConfig) {

$contextService = [
'serviceName' => $contextConfig['data_provider']['service'] ?? null,
'options' => $contextConfig['data_provider']['options'] ?? null
Expand Down
11 changes: 11 additions & 0 deletions src/DependencyInjection/Compiler/DefinitionBuilderPass.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 DynamicSearchBundle\DependencyInjection\Compiler;

use DynamicSearchBundle\Registry\DefinitionBuilderRegistry;
Expand Down
11 changes: 11 additions & 0 deletions src/DependencyInjection/Compiler/HealthStatePass.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 DynamicSearchBundle\DependencyInjection\Compiler;

use DynamicSearchBundle\Registry\HealthStateRegistry;
Expand Down
Loading

0 comments on commit 737f56f

Please sign in to comment.