mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-25 08:05:00 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user