Merge "[TASK] Backported FLOW3 Debugger"
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Classes / Object / Container / ClassInfo.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2010 Extbase Team
6 * All rights reserved
7 *
8 * This class is a backport of the corresponding class of FLOW3.
9 * All credits go to the v5 team.
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 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27 /**
28 * Value object containing the relevant informations for a class,
29 * this object is build by the classInfoFactory - or could also be restored from a cache
30 *
31 * @author Daniel Pötzinger
32 */
33 class Tx_Extbase_Object_Container_ClassInfo {
34
35 /**
36 * The classname of the class where the infos belong to
37 * @var string
38 */
39 private $className;
40
41 /**
42 * The constructor Dependencies for the class in the format:
43 * array(
44 * 0 => array( <-- parameters for argument 1
45 * 'name' => <arg name>, <-- name of argument
46 * 'dependency' => <classname>, <-- if the argument is a class, the type of the argument
47 * 'defaultvalue' => <mixed>) <-- if the argument is optional, its default value
48 * ),
49 * 1 => ...
50 * )
51 *
52 * @var array
53 */
54 private $constructorArguments;
55
56 /**
57 * All setter injections in the format
58 * array (<nameOfMethod> => <classNameToInject> )
59 *
60 * @var array
61 */
62 private $injectMethods;
63
64 /**
65 * Indicates if the class is a singleton or not.
66 *
67 * @var boolean
68 */
69 private $isSingleton = FALSE;
70
71 /**
72 * Indicates if the class has the method initializeObject
73 *
74 * @var boolean
75 */
76 private $isInitializeable = FALSE;
77
78 /**
79 *
80 * @param string $className
81 * @param array $constructorArguments
82 * @param array $injectMethods
83 * @param boolean $isSingleton
84 * @param boolean $isInitializeable
85 */
86 public function __construct($className, array $constructorArguments, array $injectMethods, $isSingleton = FALSE, $isInitializeable = FALSE) {
87 $this->className = $className;
88 $this->constructorArguments = $constructorArguments;
89 $this->injectMethods = $injectMethods;
90 $this->isSingleton = $isSingleton;
91 $this->isInitializeable = $isInitializeable;
92 }
93
94 /**
95 * Gets the class name passed to constructor
96 *
97 * @return string
98 */
99 public function getClassName() {
100 return $this->className;
101 }
102
103 /**
104 * Get arguments passed to constructor
105 *
106 * @return array
107 */
108 public function getConstructorArguments() {
109 return $this->constructorArguments;
110 }
111
112 /**
113 * Returns an array with the inject methods.
114 *
115 * @return array
116 */
117 public function getInjectMethods() {
118 return $this->injectMethods;
119 }
120
121 /**
122 * Asserts if the class is a singleton or not.
123 *
124 * @return boolean
125 */
126 public function getIsSingleton() {
127 return $this->isSingleton;
128 }
129
130 /**
131 * Asserts if the class is initializeable with initializeObject.
132 *
133 * @return boolean
134 */
135 public function getIsInitializeable() {
136 return $this->isInitializeable;
137 }
138
139 /**
140 * Asserts if the class has Dependency Injection methods
141 *
142 * @return boolean
143 */
144 public function hasInjectMethods() {
145 return (count($this->injectMethods) > 0);
146 }
147 }