/usr/share/php/Horde/Notification/Event.php is in php-horde-notification 2.0.4-3ubuntu1.
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 | <?php
/**
* The Horde_Notification_Event:: class defines a single notification event.
*
* Copyright 2002-2016 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.horde.org/licenses/lgpl21.
*
* @author Hans Lellelid <hans@velum.net>
* @category Horde
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @package Notification
*/
class Horde_Notification_Event
{
/**
* The message being passed.
*
* @var string
*/
public $message = '';
/**
* The flags for this message.
*
* @var array
*/
public $flags = array();
/**
* The message type.
*
* @var string
*/
public $type;
/**
* Constructor.
*
* @param mixed $data Message: either a string or an Exception or
* PEAR_Error object.
* @param string $type The event type.
* @param array $flags The flag array.
*/
public function __construct($data, $type = null, array $flags = array())
{
$this->flags = $flags;
$this->type = empty($type)
? 'status'
: $type;
if ($data instanceof PEAR_Error) {
// DEPRECATED
if (($userinfo = $data->getUserInfo()) &&
is_array($userinfo)) {
$userinfo_elts = array();
foreach ($userinfo as $userinfo_elt) {
if (is_scalar($userinfo_elt)) {
$userinfo_elts[] = $userinfo_elt;
} elseif (is_object($userinfo_elt)) {
if (is_callable(array($userinfo_elt, '__toString'))) {
$userinfo_elts[] = $userinfo_elt->__toString();
} elseif (is_callable(array($userinfo_elt, 'getMessage'))) {
$userinfo_elts[] = $userinfo_elt->getMessage();
}
}
}
$this->message = $data->getMessage() . ' : ' . implode(', ', $userinfo_elts);
} else {
$this->message = $data->getMessage();
}
} elseif ($data instanceof Exception) {
// Exception
$this->message = $data->getMessage();
} else {
// String or object
$this->message = strval($data);
}
}
/**
* String representation of this object.
*
* @return string String representation.
*/
public function __toString()
{
return $this->message;
}
}
|