/usr/share/icingaweb2/modules/monitoring/library/Monitoring/Timeline/TimeEntry.php is in icingaweb2-module-monitoring 2.1.0-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | <?php
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
namespace Icinga\Module\Monitoring\Timeline;
use DateTime;
use Icinga\Web\Url;
use Icinga\Exception\ProgrammingError;
/**
* An event group that is part of a timeline
*/
class TimeEntry
{
/**
* The name of this group
*
* @var string
*/
protected $name;
/**
* The amount of events that are part of this group
*
* @var int
*/
protected $value;
/**
* The date and time of this group
*
* @var DateTime
*/
protected $dateTime;
/**
* The url to this group's detail view
*
* @var Url
*/
protected $detailUrl;
/**
* The weight of this group
*
* @var float
*/
protected $weight = 1.0;
/**
* The label of this group
*
* @var string
*/
protected $label;
/**
* The color of this group
*
* @var string
*/
protected $color;
/**
* Return a new TimeEntry object with the given attributes being set
*
* @param array $attributes The attributes to set
* @return TimeEntry The resulting TimeEntry object
* @throws ProgrammingError If one of the given attributes cannot be set
*/
public static function fromArray(array $attributes)
{
$entry = new TimeEntry();
foreach ($attributes as $name => $value) {
$methodName = 'set' . ucfirst($name);
if (method_exists($entry, $methodName)) {
$entry->{$methodName}($value);
} else {
throw new ProgrammingError(
'Method "%s" does not exist on object of type "%s"',
$methodName,
__CLASS__
);
}
}
return $entry;
}
/**
* Set this group's name
*
* @param string $name The name to set
*/
public function setName($name)
{
$this->name = $name;
}
/**
* Return the name of this group
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set this group's amount of events
*
* @param int $value The value to set
*/
public function setValue($value)
{
$this->value = intval($value);
}
/**
* Return the amount of events in this group
*
* @return int
*/
public function getValue()
{
return $this->value;
}
/**
* Set this group's date and time
*
* @param DateTime $dateTime The date and time to set
*/
public function setDateTime(DateTime $dateTime)
{
$this->dateTime = $dateTime;
}
/**
* Return the date and time of this group
*
* @return DateTime
*/
public function getDateTime()
{
return $this->dateTime;
}
/**
* Set the url to this group's detail view
*
* @param Url $detailUrl The url to set
*/
public function setDetailUrl(Url $detailUrl)
{
$this->detailUrl = $detailUrl;
}
/**
* Return the url to this group's detail view
*
* @return Url
*/
public function getDetailUrl()
{
return $this->detailUrl;
}
/**
* Set this group's weight
*
* @param float $weight The weight for this group
*/
public function setWeight($weight)
{
$this->weight = floatval($weight);
}
/**
* Return the weight of this group
*
* @return float
*/
public function getWeight()
{
return $this->weight;
}
/**
* Set this group's label
*
* @param string $label The label to set
*/
public function setLabel($label)
{
$this->label = $label;
}
/**
* Return the label of this group
*
* @return string
*/
public function getLabel()
{
return $this->label;
}
/**
* Set this group's color
*
* @param string $color The color to set. (The css name or hex-code)
*/
public function setColor($color)
{
$this->color = $color;
}
/**
* Get the color of this group
*
* @return string
*/
public function getColor()
{
return $this->color;
}
}
|