IsString   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A check() 0 7 3
1
<?php
2
/**
3
 * @author    Nurlan Mukhanov <[email protected]>
4
 * @copyright 2022 Nurlan Mukhanov
5
 * @license   https://en.wikipedia.org/wiki/MIT_License MIT License
6
 * @link      https://github.com/Falseclock/service-layer
7
 */
8
9
declare(strict_types=1);
10
11
namespace Falseclock\Service\Validation\Validators;
12
13
use Falseclock\Service\Validation\ValidatorImpl;
14
15
class IsString extends ValidatorImpl
16
{
17
    /**
18
     * @param $value
19
     * @return bool
20
     */
21
    public function check($value = null): bool
22
    {
23
        if (is_null($value) && $this->nullable) {
24
            return true;
25
        }
26
27
        return is_string($value);
28
    }
29
}
30