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.
Completed
Push — master ( 28bdbf...58404d )
by Bram
12:32 queued 09:53
created

Regex::getRules()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 2
1
<?php
2
/**
3
 * Regex
4
 *
5
 * @category  AcsiWidget\Renderer\JqueryValidate\Rule
6
 * @package   AcsiWidget\Renderer\JqueryValidate\Rule
7
 * @copyright 2016 ACSI Holding bv (http://www.acsi.eu)
8
 * @version   SVN: $Id: $
9
 */
10
11
namespace StrokerForm\Renderer\JqueryValidate\Rule;
12
13
use Zend\Form\ElementInterface;
14
use Zend\Validator\ValidatorInterface;
15
use Zend\Validator\Regex as RegexValidator;
16
17
class Regex extends AbstractRule
18
{
19
20
    /**
21
     * Get the validation rules
22
     *
23
     * @param ValidatorInterface $validator
24
     * @param ElementInterface $element
25
     * @return array
26
     */
27
    public function getRules(ValidatorInterface $validator, ElementInterface $element = null)
28
    {
29
        /**@var RegexValidator $validator */
30
        $pattern = $validator->getPattern();
31
        preg_match('/\/(.*)\/[imosxg]{0,}/', $pattern, $matches);
32
        return array('regex' => $matches[1]);
33
    }
34
35
    /**
36
     * Get the validation message
37
     *
38
     * @param  ValidatorInterface $validator
39
     * @return array
40
     */
41
    public function getMessages(ValidatorInterface $validator)
42
    {
43
        return array('regex' => $this->translateMessage('Field does not match expected pattern'));
44
    }
45
46
    /**
47
     * @param ValidatorInterface $validator
48
     * @return bool
49
     */
50
    public function canHandle(ValidatorInterface $validator)
51
    {
52
        return $validator instanceof RegexValidator;
53
    }
54
}