PersianAlphabetNumber   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
eloc 3
c 1
b 0
f 1
dl 0
loc 17
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A rule() 0 3 1
1
<?php
2
3
namespace Iamfarhad\Validation\Rules;
4
5
use Iamfarhad\Validation\Contracts\AbstractValidationRule;
6
7
class PersianAlphabetNumber extends AbstractValidationRule
8
{
9
    /**
10
     * @var string
11
     */
12
    public $validationRule = 'persian_alphabet_number';
13
14
    /**
15
     * @param $attribute
16
     * @param $value
17
     * @param $parameters
18
     * @param $validator
19
     * @return bool
20
     */
21
    public function rule($attribute, $value, $parameters, $validator): bool
22
    {
23
        return (bool) preg_match('/^[\x{600}-\x{6FF}\x{200c}\x{064b}\x{064d}\x{064c}\x{064e}\x{064f}\x{0650}\x{0651}\s]+$/u', $value);
24
    }
25
}
26