EndsWithFilter   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 2
Bugs 1 Features 1
Metric Value
wmc 1
eloc 5
c 2
b 1
f 1
dl 0
loc 14
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A match() 0 7 1
1
<?php
2
/**
3
 * This file is part of the ArrayQuery package.
4
 *
5
 * (c) Mauro Cassani<https://github.com/mauretto78>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace ArrayQuery\Filters\Criterion;
12
13
class EndsWithFilter implements FilterInterface
14
{
15
    /**
16
     * @param $value
17
     * @param $valueToCompare
18
     * @return bool
19
     */
20
    public function match($value, $valueToCompare, $dateFormat = null)
21
    {
22
        $valueToCompareLenght = strlen($valueToCompare);
23
        $valueLenght = strlen($value);
24
        $valueFoot = substr($value, ($valueLenght-$valueToCompareLenght), $valueToCompareLenght);
25
26
        return $valueToCompare === $valueFoot;
27
    }
28
}
29