*prechod na novsiu verziu ZF
[sport-group.git] / library / Zend / Tool / Framework / Metadata / Dynamic.php
blob80bf461050bad8197145de1df21db5cc3ba09202
1 <?php
2 /**
3 * Zend Framework
5 * LICENSE
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
15 * @category Zend
16 * @package Zend_Tool
17 * @subpackage Framework
18 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 * @version $Id: Dynamic.php 17517 2009-08-10 13:52:31Z ralph $
23 /**
24 * @see Zend_Tool_Framework_Metadata_Interface
26 require_once 'Zend/Tool/Framework/Metadata/Interface.php';
28 /**
29 * @category Zend
30 * @package Zend_Tool
31 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
32 * @license http://framework.zend.com/license/new-bsd New BSD License
34 class Zend_Tool_Framework_Metadata_Dynamic implements Zend_Tool_Framework_Metadata_Interface
37 /**
38 * @var string
40 protected $_type = 'Dynamic';
42 /**
43 * @var string
45 protected $_name = null;
47 /**
48 * @var string
50 protected $_value = null;
52 /**
53 * @var array
55 protected $_dynamicAttributes = array();
57 /**
58 * getType()
60 * The type of metadata this describes
62 * @return string
64 public function getType()
66 return $this->_type;
69 /**
70 * getName()
72 * Metadata name
74 * @return string
76 public function getName()
78 return $this->_name;
81 /**
82 * getValue()
84 * Metadata Value
86 * @return string
88 public function getValue()
90 return $this->_value;
94 /**
95 * __isset()
97 * Check if an attrbute is set
99 * @param string $name
100 * @return bool
102 public function __isset($name)
104 return isset($this->_dynamicAttributes[$name]);
108 * __unset()
110 * @param string $name
111 * @return null
113 public function __unset($name)
115 unset($this->_dynamicAttributes[$name]);
116 return;
120 * __get() - Get a property via property call $metadata->foo
122 * @param string $name
123 * @return mixed
125 public function __get($name)
127 if (method_exists($this, 'get' . $name)) {
128 return $this->{'get' . $name}();
129 } elseif (array_key_exists($name, $this->_dynamicAttributes)) {
130 return ;
131 } else {
132 require_once 'Zend/Tool/Framework/Registry/Exception.php';
133 throw new Zend_Tool_Framework_Registry_Exception('Property ' . $name . ' was not located in this metadata.');
138 * __set() - Set a property via the magic set $metadata->foo = 'foo'
140 * @param string $name
141 * @param mixed $value
143 public function __set($name, $value)
145 if (method_exists($this, 'set' . $name)) {
146 $this->{'set' . $name}($value);
147 return;
148 } else {
149 require_once 'Zend/Tool/Framework/Registry/Exception.php';
150 throw new Zend_Tool_Framework_Registry_Exception('Property ' . $name . ' was not located in this registry.');