Completed
Push — master ( 270997...67aaa2 )
by Mohamed
10s
created

Objects::isArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace __\Traits;
4
5
trait Objects
6
{
7
    /**
8
     * check if give value is array or not
9
     *
10
     * @param null $value
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $value is correct as it would always require null to be passed?
Loading history...
11
     *
12
     * @return bool
13
     *
14
     */
15 11
    public static function isArray($value = null)
16
    {
17 11
        return \is_array($value);
18
    }
19
20
    /**
21
     * check if give value is function or not
22
     *
23
     * @param null $value
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $value is correct as it would always require null to be passed?
Loading history...
24
     *
25
     * @return bool
26
     *
27
     */
28 1
    public static function isFunction($value = null)
29
    {
30 1
        return \is_callable($value);
31
    }
32
33
    /**
34
     * check if give value is null or not
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $value is correct as it would always require null to be passed?
Loading history...
35
     *
36
     * @param null $value
37
     *
38
     * @return bool
39
     *
40
     */
41 16
    public static function isNull($value = null)
42
    {
43 16
        return \is_null($value);
44
    }
45
46
47
    /**
48
     * check if give value is number or not
49
     *
50
     * @param null $value
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $value is correct as it would always require null to be passed?
Loading history...
51
     *
52
     * @return bool
53
     *
54
     */
55 1
    public static function isNumber($value = null)
56
    {
57 1
        return \is_numeric($value);
58
    }
59
60
    /**
61
     * check if give value is object or not
62
     *
63
     * @param null $value
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $value is correct as it would always require null to be passed?
Loading history...
64
     *
65
     * @return bool
66
     *
67
     */
68 21
    public static function isObject($value = null)
69
    {
70 21
        return \is_object($value);
71
    }
72
73
    /**
74
     * check if give value is string or not
75
     *
76
     * @param null $value
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $value is correct as it would always require null to be passed?
Loading history...
77
     *
78
     * @return bool
79
     *
80
     */
81 1
    public static function isString($value = null)
82
    {
83 1
        return \is_string($value);
84
    }
85
86
    /**
87
     * Check if the object is a collection.
88
     * A collection is either an array or an object.
89
     *
90
     * @param null $object
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $object is correct as it would always require null to be passed?
Loading history...
91
     *
92
     * @return bool
93
     */
94 4
    public static function isCollection($object)
95
    {
96 4
        return \__::isArray($object) || \__::isObject($object);
97
    }
98
}