Completed
Push — master ( 6d01ad...9b4680 )
by
unknown
10:02 queued 06:58
created

DataCollection::getType()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Blast Project package.
5
 *
6
 * Copyright (C) 2015-2017 Libre Informatique
7
 *
8
 * This file is licenced under the GNU LGPL v3.
9
 * For the full copyright and license information, please view the LICENSE.md
10
 * file that was distributed with this source code.
11
 */
12
13
namespace Blast\CoreBundle\Profiler;
14
15
class DataCollection
16
{
17
    const DESTINATION_TOOLBAR = 'toolbar';
18
    const DESTINATION_PROFILER = 'profiler';
19
    const DESTINATION_BOTH = 'both';
20
21
    /**
22
     * @var string
23
     */
24
    private $name;
25
26
    /**
27
     * @var mixed
28
     */
29
    private $data;
30
31
    /**
32
     * @var string
33
     */
34
    private $type;
35
36
    /**
37
     * @var string
38
     */
39
    private $destination;
40
41
    public function __construct($name, $data, $destination = self::DESTINATION_PROFILER, $type = null)
42
    {
43
        $this->name = $name;
44
        $this->data = $data;
45
        $this->type = ($type !== null ? $type : (is_array($data) ? 'Array' : get_class($data)));
46
        $this->destination = $destination;
47
    }
48
49
    /**
50
     * @return string
51
     */
52
    public function getName()
53
    {
54
        return $this->name;
55
    }
56
57
    /**
58
     * @param string name
59
     *
60
     * @return self
61
     */
62
    public function setName($name)
63
    {
64
        $this->name = $name;
65
66
        return $this;
67
    }
68
69
    /**
70
     * @return mixed
71
     */
72
    public function getData()
73
    {
74
        return $this->data;
75
    }
76
77
    /**
78
     * @param mixed data
79
     *
80
     * @return self
81
     */
82
    public function setData($data)
83
    {
84
        $this->data = $data;
85
86
        return $this;
87
    }
88
89
    /**
90
     * @return string
91
     */
92
    public function getType()
93
    {
94
        return $this->type;
95
    }
96
97
    /**
98
     * @param string type
99
     *
100
     * @return self
101
     */
102
    public function setType($type)
103
    {
104
        $this->type = $type;
105
106
        return $this;
107
    }
108
109
    /**
110
     * @return string
111
     */
112
    public function getDestination()
113
    {
114
        return $this->destination;
115
    }
116
117
    /**
118
     * @param string destination
119
     *
120
     * @return self
121
     */
122
    public function setDestination($destination)
123
    {
124
        $this->destination = $destination;
125
126
        return $this;
127
    }
128
}
129