Completed
Push — wip-platform ( 03cba6...2999ab )
by
unknown
05:53 queued 02:49
created

DataCollection::setDestination()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

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