EntityFieldEqualFilter   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
dl 0
loc 23
c 0
b 0
f 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getSupportedOperator() 0 3 1
A validate() 0 3 1
A getErrorMessage() 0 3 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
}