mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-02 21:13:57 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -15,11 +15,6 @@ use Chill\MainBundle\Search\SearchApiInterface;
|
||||
use Chill\MainBundle\Search\SearchApiQuery;
|
||||
use Chill\ThirdPartyBundle\Repository\ThirdPartyRepository;
|
||||
|
||||
use function array_merge;
|
||||
use function explode;
|
||||
use function implode;
|
||||
use function in_array;
|
||||
|
||||
/*
|
||||
* Internal note: test query for parametrizing / testing:
|
||||
*
|
||||
@@ -68,7 +63,7 @@ class ThirdPartyApiSearch implements SearchApiInterface
|
||||
LEFT JOIN chill_main_address cma ON cma.id = COALESCE(parent.address_id, tparty.address_id)
|
||||
LEFT JOIN chill_main_postal_code cmpc ON cma.postcode_id = cmpc.id');
|
||||
|
||||
$strs = explode(' ', $pattern);
|
||||
$strs = \explode(' ', $pattern);
|
||||
$wheres = [];
|
||||
$whereArgs = [];
|
||||
$pertinence = [];
|
||||
@@ -86,11 +81,11 @@ class ThirdPartyApiSearch implements SearchApiInterface
|
||||
$pertinence[] = 'GREATEST(
|
||||
STRICT_WORD_SIMILARITY(LOWER(UNACCENT(?)), tparty.canonicalized),
|
||||
STRICT_WORD_SIMILARITY(LOWER(UNACCENT(?)), parent.canonicalized)
|
||||
) + ' .
|
||||
) + '.
|
||||
"GREATEST(
|
||||
(tparty.canonicalized LIKE '%s' || LOWER(UNACCENT(?)) || '%')::int,
|
||||
(parent.canonicalized LIKE '%s' || LOWER(UNACCENT(?)) || '%')::int
|
||||
) + " .
|
||||
) + ".
|
||||
// take postcode label into account, but lower than the canonicalized field
|
||||
"COALESCE((LOWER(UNACCENT(cmpc.label)) LIKE '%' || LOWER(UNACCENT(?)) || '%')::int * 0.3, 0)";
|
||||
$pertinenceArgs[] = [$str, $str, $str, $str, $str];
|
||||
@@ -98,12 +93,12 @@ class ThirdPartyApiSearch implements SearchApiInterface
|
||||
}
|
||||
|
||||
$query
|
||||
->setSelectPertinence(implode(' + ', $pertinence) . ' + 1', array_merge(
|
||||
->setSelectPertinence(\implode(' + ', $pertinence).' + 1', \array_merge(
|
||||
[],
|
||||
...$pertinenceArgs
|
||||
))
|
||||
->andWhereClause(implode(' AND ', $wheres)
|
||||
. ' AND tparty.active IS TRUE and (parent.active IS TRUE OR parent IS NULL)', array_merge(
|
||||
->andWhereClause(\implode(' AND ', $wheres)
|
||||
.' AND tparty.active IS TRUE and (parent.active IS TRUE OR parent IS NULL)', \array_merge(
|
||||
[],
|
||||
...$whereArgs
|
||||
));
|
||||
@@ -118,6 +113,6 @@ class ThirdPartyApiSearch implements SearchApiInterface
|
||||
|
||||
public function supportsTypes(string $pattern, array $types, array $parameters): bool
|
||||
{
|
||||
return in_array('thirdparty', $types, true);
|
||||
return \in_array('thirdparty', $types, true);
|
||||
}
|
||||
}
|
||||
|
@@ -14,12 +14,10 @@ namespace Chill\ThirdPartyBundle\Search;
|
||||
use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||
use Chill\MainBundle\Search\SearchInterface;
|
||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||
use Chill\ThirdPartyBundle\Repository\ThirdPartyRepository;
|
||||
use Chill\ThirdPartyBundle\Security\Voter\ThirdPartyVoter;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
|
||||
/**
|
||||
* Allow to search amongst parties.
|
||||
@@ -98,7 +96,7 @@ class ThirdPartySearch implements SearchInterface
|
||||
];
|
||||
}
|
||||
// format "html"
|
||||
throw new \UnexpectedValueException("format html not supported");
|
||||
throw new \UnexpectedValueException('format html not supported');
|
||||
}
|
||||
|
||||
public function supports($domain, $format): bool
|
||||
|
Reference in New Issue
Block a user