Skip to content
Merged
Show file tree
Hide file tree
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
10 changes: 10 additions & 0 deletions src/Components/Health/HealthCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ public function sortByState(): void
});
}

/**
* @param array<string> $ids
*/
public function removeByIds(array $ids): void
{
$this->elements = array_filter($this->elements, static function (SettingsResult $result) use ($ids) {
return !\in_array($result->id, $ids, true);
});
}

protected function getExpectedClass(): ?string
{
return SettingsResult::class;
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Health/SettingsResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class SettingsResult extends Struct

public ?string $url = null;

protected string $id;
public string $id;

protected string $snippet;

Expand Down
5 changes: 5 additions & 0 deletions src/Controller/HealthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Frosh\Tools\Components\Health\HealthCollection;
use Frosh\Tools\Components\Health\PerformanceCollection;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
use Symfony\Component\DependencyInjection\Attribute\AutowireIterator;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Attribute\Route;
Expand All @@ -27,6 +28,8 @@ public function __construct(
#[AutowireIterator('frosh_tools.performance_checker')]
private readonly iterable $performanceCheckers,
private readonly CacheInterface $cacheObject,
#[Autowire(param: 'frosh_tools.checker.disabled_checks')]
private readonly array $ignoredChecks
) {
}

Expand All @@ -39,6 +42,7 @@ public function status(): JsonResponse
}

$collection->sortByState();
$collection->removeByIds($this->ignoredChecks);

return new JsonResponse($collection);
}
Expand All @@ -52,6 +56,7 @@ public function performanceStatus(): JsonResponse
}

$collection->sortByState();
$collection->removeByIds($this->ignoredChecks);

return new JsonResponse($collection);
}
Expand Down
8 changes: 8 additions & 0 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ public function getConfigTreeBuilder(): TreeBuilder
$rootNode = $treeBuilder->getRootNode();
$rootNode
->children()
->arrayNode('checker')
->children()
->arrayNode('disabled_checks')
->scalarPrototype()
->end()
->end()
->end()
->end()
->arrayNode('file_checker')
->children()
->arrayNode('exclude_files')
Expand Down
4 changes: 2 additions & 2 deletions src/DependencyInjection/FroshToolsExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ private function addConfig(ContainerBuilder $container, string $alias, array $op
$container->setParameter('frosh_tools.file_checker.exclude_files', []);
}

if (!$container->hasParameter('frosh_tools.system_config')) {
$container->setParameter('frosh_tools.system_config', []);
if (!$container->hasParameter('frosh_tools.checker.disabled_checks')) {
$container->setParameter('frosh_tools.checker.disabled_checks', []);
}
}
}
Loading