EntityFieldEqualFilter::validate()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Mdiyakov\DoctrineSolrBundle\Filter\Field;
4
5
class EntityFieldEqualFilter extends EntityFieldFilter
6
{
7
8
    /**
9
     * @param mixed $value
10
     * @return bool
11
     */
12
    protected function validate($value)
13
    {
14
        return $value === $this->getEntityFieldValue();
15
    }
16
17
    /**
18
     * @return string
19
     */
20
    public function getErrorMessage()
21
    {
22
        return sprintf('The value of %s is not equal to %s', $this->getEntityFieldName(),  (string) $this->getEntityFieldValue());
23
    }
24
25
    public function getSupportedOperator()
26
    {
27
        return '=';
28
    }
29
}