[CLEANUP] Replace wrong/old file copyright comments
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Classes / Object / Container / ClassInfo.php
1 <?php
2 namespace TYPO3\CMS\Extbase\Object\Container;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 2010-2012 Extbase Team (http://forge.typo3.org/projects/typo3v4-mvc)
8 * Extbase is a backport of TYPO3 Flow. All credits go to the TYPO3 Flow team.
9 * All rights reserved
10 *
11 * This script is part of the TYPO3 project. The TYPO3 project is
12 * free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * The GNU General Public License can be found at
18 * http://www.gnu.org/copyleft/gpl.html.
19 * A copy is found in the textfile GPL.txt and important notices to the license
20 * from the author is found in LICENSE.txt distributed with these scripts.
21 *
22 *
23 * This script is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
27 *
28 * This copyright notice MUST APPEAR in all copies of the script!
29 ***************************************************************/
30 /**
31 * Value object containing the relevant informations for a class,
32 * this object is build by the classInfoFactory - or could also be restored from a cache
33 *
34 * @author Daniel Pötzinger
35 */
36 class ClassInfo {
37
38 /**
39 * The classname of the class where the infos belong to
40 *
41 * @var string
42 */
43 private $className;
44
45 /**
46 * The constructor Dependencies for the class in the format:
47 * array(
48 * 0 => array( <-- parameters for argument 1
49 * 'name' => <arg name>, <-- name of argument
50 * 'dependency' => <classname>, <-- if the argument is a class, the type of the argument
51 * 'defaultvalue' => <mixed>) <-- if the argument is optional, its default value
52 * ),
53 * 1 => ...
54 * )
55 *
56 * @var array
57 */
58 private $constructorArguments;
59
60 /**
61 * All setter injections in the format
62 * array (<nameOfMethod> => <classNameToInject> )
63 *
64 * @var array
65 */
66 private $injectMethods;
67
68 /**
69 * All setter injections in the format
70 * array (<nameOfProperty> => <classNameToInject> )
71 *
72 * @var array
73 */
74 private $injectProperties;
75
76 /**
77 * Indicates if the class is a singleton or not.
78 *
79 * @var boolean
80 */
81 private $isSingleton = FALSE;
82
83 /**
84 * Indicates if the class has the method initializeObject
85 *
86 * @var boolean
87 */
88 private $isInitializeable = FALSE;
89
90 /**
91 * @param string $className
92 * @param array $constructorArguments
93 * @param array $injectMethods
94 * @param boolean $isSingleton
95 * @param boolean $isInitializeable
96 * @param array $injectProperties
97 */
98 public function __construct($className, array $constructorArguments, array $injectMethods, $isSingleton = FALSE, $isInitializeable = FALSE, array $injectProperties = array()) {
99 $this->className = $className;
100 $this->constructorArguments = $constructorArguments;
101 $this->injectMethods = $injectMethods;
102 $this->injectProperties = $injectProperties;
103 $this->isSingleton = $isSingleton;
104 $this->isInitializeable = $isInitializeable;
105 }
106
107 /**
108 * Gets the class name passed to constructor
109 *
110 * @return string
111 */
112 public function getClassName() {
113 return $this->className;
114 }
115
116 /**
117 * Get arguments passed to constructor
118 *
119 * @return array
120 */
121 public function getConstructorArguments() {
122 return $this->constructorArguments;
123 }
124
125 /**
126 * Returns an array with the inject methods.
127 *
128 * @return array
129 */
130 public function getInjectMethods() {
131 return $this->injectMethods;
132 }
133
134 /**
135 * Returns an array with the inject properties
136 *
137 * @return array
138 */
139 public function getInjectProperties() {
140 return $this->injectProperties;
141 }
142
143 /**
144 * Asserts if the class is a singleton or not.
145 *
146 * @return boolean
147 */
148 public function getIsSingleton() {
149 return $this->isSingleton;
150 }
151
152 /**
153 * Asserts if the class is initializeable with initializeObject.
154 *
155 * @return boolean
156 */
157 public function getIsInitializeable() {
158 return $this->isInitializeable;
159 }
160
161 /**
162 * Asserts if the class has Dependency Injection methods
163 *
164 * @return boolean
165 */
166 public function hasInjectMethods() {
167 return count($this->injectMethods) > 0;
168 }
169
170 /**
171 * @return boolean
172 */
173 public function hasInjectProperties() {
174 return count($this->injectProperties) > 0;
175 }
176 }
177
178 ?>