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