Primitives   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 11
dl 0
loc 21
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A includes() 0 3 1
A checkFor() 0 3 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