ClosureObject::getSize()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 0
nc 1
nop 0
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * The MIT License (MIT)
5
 *
6
 * Copyright (c) 2013 Jonathan Vollebregt ([email protected]), Rokas Šleinius ([email protected])
7
 *
8
 * Permission is hereby granted, free of charge, to any person obtaining a copy of
9
 * this software and associated documentation files (the "Software"), to deal in
10
 * the Software without restriction, including without limitation the rights to
11
 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
12
 * the Software, and to permit persons to whom the Software is furnished to do so,
13
 * subject to the following conditions:
14
 *
15
 * The above copyright notice and this permission notice shall be included in all
16
 * copies or substantial portions of the Software.
17
 *
18
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
20
 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
21
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
22
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
 */
25
26
namespace Kint\Object;
27
28
class ClosureObject extends InstanceObject
29
{
30
    public $parameters = array();
31
    public $hints = array('object', 'callable', 'closure');
32
33
    private $paramcache;
34
35
    public function getAccessPath()
36
    {
37
        if (null !== $this->access_path) {
38
            return parent::getAccessPath().'('.$this->getParams().')';
39
        }
40
    }
41
42
    public function getSize()
43
    {
44
    }
45
46
    public function getParams()
47
    {
48
        if (null !== $this->paramcache) {
49
            return $this->paramcache;
50
        }
51
52
        $out = array();
53
54
        foreach ($this->parameters as $p) {
55
            $type = $p->getType();
56
57
            $ref = $p->reference ? '&' : '';
58
59
            if ($type) {
60
                $out[] = $type.' '.$ref.$p->getName();
61
            } else {
62
                $out[] = $ref.$p->getName();
63
            }
64
        }
65
66
        return $this->paramcache = \implode(', ', $out);
67
    }
68
}
69