Skip to content

Commit

Permalink
Merge pull request #1 from VGrigoryev/master
Browse files Browse the repository at this point in the history
Add converter for `Raw` rule
  • Loading branch information
acelot authored Oct 26, 2018
2 parents 685271e + 0dfa0c2 commit a57ef05
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Rule/Raw.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@

use Acelot\SearchSchema\Criterion;
use Acelot\SearchSchema\ParamGeneratorInterface;
use Acelot\SearchSchema\Rule\Traits\ValueConverter;
use Acelot\SearchSchema\RuleInterface;

final class Raw implements RuleInterface
{
use ValueConverter;

/**
* @var string
*/
Expand Down Expand Up @@ -55,6 +58,8 @@ public function makeCriterion($value, ParamGeneratorInterface $paramGenerator):
$spread = $matches[1] === '...';
$paramKey = $paramGenerator->generate($this->paramPrefix);

$value = $this->convert($value);

if (is_iterable($value) && $spread) {
if (count($value) === 0) {
return null;
Expand Down

0 comments on commit a57ef05

Please sign in to comment.