Fixed some inspection issues.

This commit is contained in:
Jan Böhmer 2022-08-14 19:32:53 +02:00
parent eef26f7ae6
commit 639829f5c5
97 changed files with 305 additions and 185 deletions

View file

@ -25,6 +25,9 @@ namespace App\Services\Parameters;
use App\Entity\Parameters\AbstractParameter;
use App\Entity\Parameters\PartParameter;
use InvalidArgumentException;
use function preg_match;
class ParameterExtractor
{
@ -41,7 +44,7 @@ class ParameterExtractor
public function extractParameters(string $input, string $class = PartParameter::class): array
{
if (!is_a($class, AbstractParameter::class, true)) {
throw new \InvalidArgumentException('$class must be a child class of AbstractParameter!');
throw new InvalidArgumentException('$class must be a child class of AbstractParameter!');
}
//Restrict search length
@ -67,7 +70,7 @@ class ParameterExtractor
$regex = '/^(.*) *(?:=|:) *(.+)/u';
$matches = [];
\preg_match($regex, $input, $matches);
preg_match($regex, $input, $matches);
if (!empty($matches)) {
[, $name, $value] = $matches;
$value = trim($value);