Separation of concerns

This commit is contained in:
2021-04-08 15:36:57 +02:00
parent cc2696668c
commit afff03166e
15 changed files with 155 additions and 96 deletions

View File

@@ -0,0 +1,15 @@
<?php
namespace Filter;
class FilterParser
{
public function parse(string $string): DocumentFilter
{
if (preg_match('/^.+=.*$/', $string)) {
[$prop, $term] = explode('=', $string, 2);
return new SpecificFilter(trim($prop), trim($term));
}
return new GenericFilter($string);
}
}