apply more cs rules for php-cs

This commit is contained in:
2023-10-17 13:27:03 +02:00
parent 0b0cbed9db
commit bc2041cbdd
1485 changed files with 8169 additions and 9620 deletions

View File

@@ -13,9 +13,6 @@ namespace Chill\MainBundle\Search;
use DateTime;
use function array_key_exists;
use function strpos;
/**
* This class implements abstract search with most common responses.
*
@@ -29,17 +26,17 @@ abstract class AbstractSearch implements SearchInterface
*
* @param type $string
*
* @throws ParsingException if the date is not parseable
* @return \DateTime
*
* @return DateTime
* @throws ParsingException if the date is not parseable
*/
public function parseDate($string)
{
try {
return new DateTime($string);
return new \DateTime($string);
} catch (ParsingException $ex) {
$exception = new ParsingException('The date is '
. 'not parsable', 0, $ex);
.'not parsable', 0, $ex);
throw $exception;
}
@@ -59,18 +56,18 @@ abstract class AbstractSearch implements SearchInterface
$recomposed = '';
if (null !== $domain) {
$recomposed .= '@' . $domain . ' ';
$recomposed .= '@'.$domain.' ';
}
foreach ($supportedTerms as $term) {
if (array_key_exists($term, $terms) && '_default' !== $term) {
$recomposed .= ' ' . $term . ':';
if (\array_key_exists($term, $terms) && '_default' !== $term) {
$recomposed .= ' '.$term.':';
$containsSpace = str_contains((string) $terms[$term], ' ');
if ($containsSpace) {
$recomposed .= '"';
}
$recomposed .= (mb_stristr(' ', (string) $terms[$term]) === false) ? $terms[$term] : '(' . $terms[$term] . ')';
$recomposed .= (false === mb_stristr(' ', (string) $terms[$term])) ? $terms[$term] : '('.$terms[$term].')';
if ($containsSpace) {
$recomposed .= '"';
@@ -79,11 +76,11 @@ abstract class AbstractSearch implements SearchInterface
}
if ('' !== $terms['_default']) {
$recomposed .= ' ' . $terms['_default'];
$recomposed .= ' '.$terms['_default'];
}
//strip first character if empty
if (mb_strcut($recomposed, 0, 1) === ' ') {
// strip first character if empty
if (' ' === mb_strcut($recomposed, 0, 1)) {
$recomposed = mb_strcut($recomposed, 1);
}