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
10 namespace Zend\Ldap\Node\Schema
;
14 use Zend\Ldap\Exception
;
17 * This class provides a base implementation for managing schema
18 * items like objectClass and attributeType.
20 abstract class AbstractItem
implements ArrayAccess
, Countable
34 public function __construct(array $data)
36 $this->setData($data);
43 * @return AbstractItem Provides a fluid interface
45 public function setData(array $data)
56 public function getData()
62 * Gets a specific attribute from this item
67 public function __get($name)
69 if (array_key_exists($name, $this->data
)) {
70 return $this->data
[$name];
77 * Checks whether a specific attribute exists.
82 public function __isset($name)
84 return (array_key_exists($name, $this->data
));
88 * Always throws Zend\Ldap\Exception\BadMethodCallException
89 * Implements ArrayAccess.
91 * This method is needed for a full implementation of ArrayAccess
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
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
133 public function offsetExists($name)
135 return $this->__isset($name);
139 * Returns the number of attributes.
140 * Implements Countable
144 public function count()
146 return count($this->data
);