Primitives::includes()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php declare(strict_types=1);
2
3
namespace Stratadox\PhpGenerics;
4
5
use function array_key_exists;
6
7
class Primitives
8
{
9
    private const TYPES = [
10
        'string' => 'is_string',
11
        'bool' => 'is_bool',
12
        'int' => 'is_int',
13
        'float' => 'is_float',
14
        'object' => 'is_object',
15
        'array' => 'is_array',
16
        'resource' => 'is_resource',
17
        'void' => 'is_null',
18
    ];
19
20
    public function includes(string $type): bool
21
    {
22
        return array_key_exists($type, self::TYPES);
23
    }
24
25
    public function checkFor(string $type): string
26
    {
27
        return self::TYPES[$type];
28
    }
29
}
30