# Source for file Plugin.php

Documentation is available at Plugin.php

1. <?php
2. /*
3. * $Id$
4. *
5. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
6. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
7. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
8. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
9. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
10. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
11. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
12. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
13. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
14. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
15. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
16. *
17. * This software consists of voluntary contributions made by many individuals
18. * and is licensed under the LGPL. For more information, see
19. * <http://www.phpdoctrine.com>.
20. */
22. /**
23. * Doctrine_Plugin
24. *
25. * @author Konsta Vesterinen <kvesteri@cc.hut.fi>
26. * @package Doctrine
27. * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
28. * @version $Revision$
29. * @category Object Relational Mapping
30. * @link www.phpdoctrine.com
31. * @since 1.0
32. */
33. class Doctrine_Plugin
34. {
35. /**
36. * @var array $_options an array of plugin specific options
37. */
38. protected $_options = array();
39. /**
40. * returns the value of an option
41. *
42. * @param $option the name of the option to retrieve
43. * @return mixed the value of the option
44. */
45. public function getOption($name)
46. {
47. if ( ! isset($this->_options[$name])) {
48. throw new Doctrine_Plugin_Exception('Unknown option ' . $name);
49. }
51. return $this->_options[$name];
52. }
53. /**
54. * sets given value to an option
55. *
56. * @param $option the name of the option to be changed
57. * @param $value the value of the option
58. * @return Doctrine_Plugin this object
59. */
60. public function setOption($name, $value)
61. {
62. if ( ! isset($this->_options[$name])) {
63. throw new Doctrine_Plugin_Exception('Unknown option ' . $name);
64. }
66. $this->_options[$name] = $value;
68. return $this;
69. }
70. /**
71. * returns all options and their associated values
72. *
73. * @return array all options as an associative array
74. */
75. public function getOptions()
76. {
77. return $this->_options;
78. }
79. }