/usr/share/php/Horde/Imap/Client/Data/Namespace.php is in php-horde-imap-client 2.25.2-1.
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 | <?php
/**
* Copyright 2013-2014 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.
*
* @category Horde
* @copyright 2013-2014 Horde LLC
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @package Imap_Client
*/
/**
* Namespace data.
*
* @author Michael Slusarz <slusarz@horde.org>
* @category Horde
* @copyright 2013-2014 Horde LLC
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @package Imap_Client
* @since 2.21.0
*
* @property-read string $base The namespace base ($name without trailing
* delimiter) (UTF-8).
* @property string $delimiter The namespace delimiter.
* @property boolean $hidden Is this a hidden namespace?
* @property string $name The namespace name (UTF-8).
* @property string $translation Returns the translated name of the namespace
* (UTF-8).
* @property integer $type The namespace type. Either self::NS_PERSONAL,
* self::NS_OTHER, or self::NS_SHARED.
*/
class Horde_Imap_Client_Data_Namespace implements Serializable
{
/* Namespace type constants. */
const NS_PERSONAL = 1;
const NS_OTHER = 2;
const NS_SHARED = 3;
/**
* Data object.
*
* @var array
*/
protected $_data = array();
/**
* Strips namespace information from the given mailbox name.
*
* @param string $mbox Mailbox name.
*
* @return string Mailbox name with namespace prefix stripped.
*/
public function stripNamespace($mbox)
{
$mbox = strval($mbox);
$name = $this->name;
return (strlen($name) && (strpos($mbox, $name) === 0))
? substr($mbox, strlen($name))
: $mbox;
}
/**
*/
public function __get($name)
{
if (isset($this->_data[$name])) {
return $this->_data[$name];
}
switch ($name) {
case 'base':
return rtrim($this->name, $this->delimiter);
case 'delimiter':
case 'name':
case 'translation':
return '';
case 'hidden':
return false;
case 'type':
return self::NS_PERSONAL;
}
return null;
}
/**
*/
public function __set($name, $value)
{
switch ($name) {
case 'delimiter':
case 'name':
case 'translation':
$this->_data[$name] = strval($value);
break;
case 'hidden':
$this->_data[$name] = (bool)$value;
break;
case 'type':
$this->_data[$name] = intval($value);
break;
}
}
/**
*/
public function __isset($name)
{
return isset($this->_data[$name]);
}
/**
*/
public function __toString()
{
return $this->name;
}
/* Serializable methods. */
/**
*/
public function serialize()
{
return json_encode($this->_data);
}
/**
*/
public function unserialize($data)
{
$this->_data = json_decode($data, true);
}
}
|