mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-12 17:55:00 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -19,12 +19,6 @@ use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\Query\ResultSetMapping;
|
||||
use Doctrine\ORM\Query\ResultSetMappingBuilder;
|
||||
use Doctrine\Persistence\ObjectRepository;
|
||||
use RuntimeException;
|
||||
|
||||
use function explode;
|
||||
use function implode;
|
||||
use function strtr;
|
||||
use function trim;
|
||||
|
||||
final class AddressReferenceRepository implements ObjectRepository
|
||||
{
|
||||
@@ -77,7 +71,7 @@ final class AddressReferenceRepository implements ObjectRepository
|
||||
*
|
||||
* @return AddressReference[]
|
||||
*/
|
||||
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array
|
||||
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array
|
||||
{
|
||||
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
|
||||
}
|
||||
@@ -94,11 +88,11 @@ final class AddressReferenceRepository implements ObjectRepository
|
||||
$rsm->addRootEntityFromClassMetadata(AddressReference::class, 'cma');
|
||||
$query->addSelectClause($rsm->generateSelectClause());
|
||||
} else {
|
||||
throw new RuntimeException('not implemented');
|
||||
throw new \RuntimeException('not implemented');
|
||||
}
|
||||
|
||||
$sql = strtr(
|
||||
$query->buildQuery() . 'ORDER BY pertinence DESC, lpad(streetnumber, 10, \'0\') ASC OFFSET ? LIMIT ? ',
|
||||
$sql = \strtr(
|
||||
$query->buildQuery().'ORDER BY pertinence DESC, lpad(streetnumber, 10, \'0\') ASC OFFSET ? LIMIT ? ',
|
||||
// little hack for adding sql method to point
|
||||
['cma.point AS point' => 'ST_AsGeojson(cma.point) AS point']
|
||||
);
|
||||
@@ -109,7 +103,7 @@ final class AddressReferenceRepository implements ObjectRepository
|
||||
->getResult();
|
||||
}
|
||||
|
||||
public function findOneBy(array $criteria, ?array $orderBy = null): ?AddressReference
|
||||
public function findOneBy(array $criteria, array $orderBy = null): ?AddressReference
|
||||
{
|
||||
return $this->repository->findOneBy($criteria, $orderBy);
|
||||
}
|
||||
@@ -121,10 +115,10 @@ final class AddressReferenceRepository implements ObjectRepository
|
||||
|
||||
private function buildQueryByPostalCodePattern(PostalCode $postalCode, string $pattern): SearchApiQuery
|
||||
{
|
||||
$pattern = trim($pattern);
|
||||
$pattern = \trim($pattern);
|
||||
|
||||
if ('' === $pattern) {
|
||||
throw new RuntimeException('the search pattern must not be empty');
|
||||
throw new \RuntimeException('the search pattern must not be empty');
|
||||
}
|
||||
$query = new SearchApiQuery();
|
||||
|
||||
@@ -138,8 +132,8 @@ final class AddressReferenceRepository implements ObjectRepository
|
||||
$andWhere = [];
|
||||
$andWhereArgs = [];
|
||||
|
||||
foreach (explode(' ', $pattern) as $part) {
|
||||
$part = trim($part);
|
||||
foreach (\explode(' ', $pattern) as $part) {
|
||||
$part = \trim($part);
|
||||
|
||||
if ('' === $part) {
|
||||
continue;
|
||||
@@ -154,8 +148,8 @@ final class AddressReferenceRepository implements ObjectRepository
|
||||
array_push($pertinenceArgs, $part, $part);
|
||||
}
|
||||
$query
|
||||
->setSelectPertinence(implode(' + ', $pertinenceClause), $pertinenceArgs)
|
||||
->andWhereClause(implode(' AND ', $andWhere), $andWhereArgs);
|
||||
->setSelectPertinence(\implode(' + ', $pertinenceClause), $pertinenceArgs)
|
||||
->andWhereClause(\implode(' AND ', $andWhere), $andWhereArgs);
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
Reference in New Issue
Block a user