GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Like::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 4
1
<?php
2
3
namespace Rb\Specification\Doctrine\Condition;
4
5
use Rb\Specification\Doctrine\Exception\InvalidArgumentException;
6
7
class Like extends Comparison
8
{
9
    const CONTAINS    = '%%%s%%';
10
    const ENDS_WITH   = '%%%s';
11
    const STARTS_WITH = '%s%%';
12
13
    /**
14
     * @param string      $field
15
     * @param string      $value
16
     * @param string      $format
17
     * @param string|null $dqlAlias
18
     *
19
     * @throws InvalidArgumentException
20
     */
21
    public function __construct($field, $value, $format = self::CONTAINS, $dqlAlias = null)
22
    {
23
        $formattedValue = $this->formatValue($format, $value);
24
        parent::__construct(self::LIKE, $field, $formattedValue, $dqlAlias);
25
    }
26
27
    /**
28
     * @param string $format
29
     * @param string $value
30
     *
31
     * @return string
32
     */
33
    private function formatValue($format, $value)
34
    {
35
        return sprintf($format, $value);
36
    }
37
}
38