Completed
Push — master ( 1f9c9a...dbd6f1 )
by Nate
04:38
created

PhpType::createFromVariable()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 2
eloc 2
nc 2
nop 1
crap 2
1
<?php
2
/*
3
 * Copyright (c) Nate Brunette.
4
 * Distributed under the MIT License (http://opensource.org/licenses/MIT)
5
 */
6
namespace Tebru\Gson;
7
8
9
/**
10
 * Class PhpType
11
 *
12
 * Represents a core php type and includes methods to get information about
13
 * the type
14
 *
15
 * @author Nate Brunette <[email protected]>
16
 */
17
interface PhpType
18
{
19
    /**
20
     * Returns an array of generic types
21
     *
22
     * @return array
23
     */
24
    public function getGenerics(): array;
25
26
    /**
27
     * Returns the class if an object, or the type as a string
28
     *
29
     * @return string
30
     */
31
    public function getType(): ?string;
32
33
    /**
34
     * Returns true if this is a string
35
     *
36
     * @return bool
37
     */
38
    public function isString(): bool;
39
40
    /**
41
     * Returns true if this is an integer
42
     *
43
     * @return bool
44
     */
45
    public function isInteger(): bool;
46
47
    /**
48
     * Returns true if this is a float
49
     *
50
     * @return bool
51
     */
52
    public function isFloat(): bool;
53
54
    /**
55
     * Returns true if this is a boolean
56
     *
57
     * @return bool
58
     */
59
    public function isBoolean(): bool;
60
61
    /**
62
     * Returns true if this is an array
63
     *
64
     * @return bool
65
     */
66
    public function isArray(): bool;
67
68
    /**
69
     * Returns true if this is an object
70
     *
71
     * @return bool
72
     */
73
    public function isObject(): bool;
74
75
    /**
76
     * Returns true if this is null
77
     *
78
     * @return bool
79
     */
80
    public function isNull(): bool;
81
82
    /**
83
     * Returns true if this is a resource
84
     *
85
     * @return bool
86
     */
87
    public function isResource(): bool;
88
89
    /**
90
     * Returns true if the type could be anything
91
     *
92
     * @return bool
93
     */
94
    public function isWildcard(): bool;
95
96
    /**
97
     * Returns an array of extra options
98
     *
99
     * @return array
100
     */
101
    public function getOptions(): array;
102
103
    /**
104
     * Returns a unique identifying key for this type based on
105
     * the full type and options
106
     *
107
     * @return string
108
     */
109
    public function getUniqueKey(): string;
110
111
    /**
112
     * Return the initial type including generics
113
     *
114
     * @return string
115
     */
116
    public function __toString(): string;
117
}
118