mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-10-09 06:49:41 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -18,12 +18,6 @@ use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\Query\ResultSetMappingBuilder;
|
||||
|
||||
use function array_map;
|
||||
use function array_merge;
|
||||
use function count;
|
||||
use function implode;
|
||||
use function strtr;
|
||||
|
||||
class SearchApi
|
||||
{
|
||||
public function __construct(private readonly EntityManagerInterface $em, private readonly iterable $providers, private readonly PaginatorFactory $paginator) {}
|
||||
@@ -32,7 +26,7 @@ class SearchApi
|
||||
{
|
||||
$queries = $this->findQueries($pattern, $types, $parameters);
|
||||
|
||||
if (0 === count($queries)) {
|
||||
if (0 === \count($queries)) {
|
||||
throw new SearchApiNoQueryException($pattern, $types, $parameters);
|
||||
}
|
||||
|
||||
@@ -55,13 +49,13 @@ class SearchApi
|
||||
|
||||
foreach ($queries as $q) {
|
||||
$unions[] = $q->buildQuery(true);
|
||||
$parameters = array_merge($parameters, $q->buildParameters(true));
|
||||
$parameters = \array_merge($parameters, $q->buildParameters(true));
|
||||
}
|
||||
|
||||
$unionUnordered = implode(' UNION ', $unions);
|
||||
$unionUnordered = \implode(' UNION ', $unions);
|
||||
|
||||
return [
|
||||
strtr($query, ['{union_unordered}' => $unionUnordered]),
|
||||
\strtr($query, ['{union_unordered}' => $unionUnordered]),
|
||||
$parameters,
|
||||
];
|
||||
}
|
||||
@@ -94,17 +88,17 @@ class SearchApi
|
||||
|
||||
foreach ($queries as $q) {
|
||||
$unions[] = $q->buildQuery();
|
||||
$parameters = array_merge($parameters, $q->buildParameters());
|
||||
$parameters = \array_merge($parameters, $q->buildParameters());
|
||||
}
|
||||
|
||||
// add pagination limit
|
||||
$parameters[] = $paginator->getItemsPerPage();
|
||||
$parameters[] = $paginator->getCurrentPageFirstItemNumber();
|
||||
|
||||
$union = implode(' UNION ', $unions);
|
||||
$union = \implode(' UNION ', $unions);
|
||||
|
||||
return [
|
||||
strtr($query, ['{unions}' => $union]),
|
||||
\strtr($query, ['{unions}' => $union]),
|
||||
$parameters,
|
||||
];
|
||||
}
|
||||
@@ -149,7 +143,7 @@ class SearchApi
|
||||
|
||||
private function findQueries($pattern, array $types, array $parameters): array
|
||||
{
|
||||
return array_map(
|
||||
return \array_map(
|
||||
static fn ($p) => $p->provideQuery($pattern, $parameters),
|
||||
$this->findProviders($pattern, $types, $parameters),
|
||||
);
|
||||
|
Reference in New Issue
Block a user