Added the zend framework 2 library, the path is specified in line no.26 in zend_modul...
[openemr.git] / interface / modules / zend_modules / library / Zend / Ldap / Node / Schema / AbstractItem.php
blob384c4d614ed02d5c586bc43784d529a70e2dfd79
1 <?php
2 /**
3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
8 */
10 namespace Zend\Ldap\Node\Schema;
12 use ArrayAccess;
13 use Countable;
14 use Zend\Ldap\Exception;
16 /**
17 * This class provides a base implementation for managing schema
18 * items like objectClass and attributeType.
20 abstract class AbstractItem implements ArrayAccess, Countable
22 /**
23 * The underlying data
25 * @var array
27 protected $data;
29 /**
30 * Constructor.
32 * @param array $data
34 public function __construct(array $data)
36 $this->setData($data);
39 /**
40 * Sets the data
42 * @param array $data
43 * @return AbstractItem Provides a fluid interface
45 public function setData(array $data)
47 $this->data = $data;
48 return $this;
51 /**
52 * Gets the data
54 * @return array
56 public function getData()
58 return $this->data;
61 /**
62 * Gets a specific attribute from this item
64 * @param string $name
65 * @return mixed
67 public function __get($name)
69 if (array_key_exists($name, $this->data)) {
70 return $this->data[$name];
73 return null;
76 /**
77 * Checks whether a specific attribute exists.
79 * @param string $name
80 * @return bool
82 public function __isset($name)
84 return (array_key_exists($name, $this->data));
87 /**
88 * Always throws Zend\Ldap\Exception\BadMethodCallException
89 * Implements ArrayAccess.
91 * This method is needed for a full implementation of ArrayAccess
93 * @param string $name
94 * @param mixed $value
95 * @throws \Zend\Ldap\Exception\BadMethodCallException
97 public function offsetSet($name, $value)
99 throw new Exception\BadMethodCallException();
103 * Gets a specific attribute from this item
105 * @param string $name
106 * @return mixed
108 public function offsetGet($name)
110 return $this->__get($name);
114 * Always throws Zend\Ldap\Exception\BadMethodCallException
115 * Implements ArrayAccess.
117 * This method is needed for a full implementation of ArrayAccess
119 * @param string $name
120 * @throws \Zend\Ldap\Exception\BadMethodCallException
122 public function offsetUnset($name)
124 throw new Exception\BadMethodCallException();
128 * Checks whether a specific attribute exists.
130 * @param string $name
131 * @return bool
133 public function offsetExists($name)
135 return $this->__isset($name);
139 * Returns the number of attributes.
140 * Implements Countable
142 * @return int
144 public function count()
146 return count($this->data);