Completed
Branch BUG/PHP8-getClass-deprecated (fc461c)
by
unknown
16:32 queued 07:40
created
core/services/container/Mirror.php 2 patches
Indentation   +222 added lines, -222 removed lines patch added patch discarded remove patch
@@ -21,226 +21,226 @@
 block discarded – undo
21 21
 class Mirror
22 22
 {
23 23
 
24
-    /**
25
-     * @var ReflectionClass[] $classes
26
-     */
27
-    private $classes = array();
28
-
29
-    /**
30
-     * @var ReflectionMethod[] $constructors
31
-     */
32
-    private $constructors = array();
33
-
34
-    /**
35
-     * @var ReflectionParameter[][] $parameters
36
-     */
37
-    private $parameters = array();
38
-
39
-    /**
40
-     * @var ReflectionParameter[][] $parameters
41
-     */
42
-    private $parameter_classes = array();
43
-
44
-    /**
45
-     * @var ReflectionProperty[][] $properties
46
-     */
47
-    private $properties = array();
48
-
49
-    /**
50
-     * @var ReflectionMethod[][] $methods
51
-     */
52
-    private $methods = array();
53
-
54
-
55
-    /**
56
-     * @param string $class_name
57
-     * @return ReflectionClass
58
-     * @throws ReflectionException
59
-     * @throws InvalidDataTypeException
60
-     */
61
-    public function getReflectionClass($class_name)
62
-    {
63
-        if (! is_string($class_name)) {
64
-            throw new InvalidDataTypeException($class_name, '$class_name', 'string (fully qualified class name)');
65
-        }
66
-        if (! isset($this->classes[ $class_name ])) {
67
-            $this->classes[ $class_name ] = new ReflectionClass($class_name);
68
-        }
69
-        return $this->classes[ $class_name ];
70
-    }
71
-
72
-
73
-    /**
74
-     * @param string $class_name
75
-     * @return ReflectionMethod
76
-     * @throws InvalidDataTypeException
77
-     * @throws ReflectionException
78
-     */
79
-    public function getConstructor($class_name)
80
-    {
81
-        if (! is_string($class_name)) {
82
-            throw new InvalidDataTypeException($class_name, '$class_name', 'string (fully qualified class name)');
83
-        }
84
-        if (! isset($this->constructors[ $class_name ])) {
85
-            $reflection_class                  = $this->getReflectionClass($class_name);
86
-            $this->constructors[ $class_name ] = $reflection_class->getConstructor();
87
-        }
88
-        return $this->constructors[ $class_name ];
89
-    }
90
-
91
-
92
-    /**
93
-     * @param ReflectionClass $reflection_class
94
-     * @return ReflectionMethod
95
-     * @throws InvalidDataTypeException
96
-     * @throws ReflectionException
97
-     */
98
-    public function getConstructorFromReflection(ReflectionClass $reflection_class)
99
-    {
100
-        return $this->getConstructor($reflection_class->getName());
101
-    }
102
-
103
-
104
-    /**
105
-     * @param string $class_name
106
-     * @return ReflectionParameter[]
107
-     * @throws InvalidDataTypeException
108
-     * @throws ReflectionException
109
-     */
110
-    public function getParameters($class_name)
111
-    {
112
-        if (! isset($this->parameters[ $class_name ])) {
113
-            $constructor                     = $this->getConstructor($class_name);
114
-            $this->parameters[ $class_name ] = $constructor->getParameters();
115
-        }
116
-        return $this->parameters[ $class_name ];
117
-    }
118
-
119
-
120
-    /**
121
-     * @param ReflectionClass $reflection_class
122
-     * @return ReflectionParameter[]
123
-     * @throws InvalidDataTypeException
124
-     * @throws ReflectionException
125
-     */
126
-    public function getParametersFromReflection(ReflectionClass $reflection_class)
127
-    {
128
-        return $this->getParameters($reflection_class->getName());
129
-    }
130
-
131
-
132
-    /**
133
-     * @param ReflectionMethod $constructor
134
-     * @return ReflectionParameter[]
135
-     * @throws InvalidDataTypeException
136
-     * @throws ReflectionException
137
-     */
138
-    public function getParametersFromReflectionConstructor(ReflectionMethod $constructor)
139
-    {
140
-        return $this->getParameters($constructor->getDeclaringClass());
141
-    }
142
-
143
-
144
-    /**
145
-     * @param ReflectionParameter $param
146
-     * @param string              $class_name
147
-     * @param string              $index
148
-     * @return string|null
149
-     */
150
-    public function getParameterClassName(ReflectionParameter $param, $class_name, $index)
151
-    {
152
-        if (isset($this->parameter_classes[ $class_name ][ $index ]['param_class_name'])) {
153
-            return $this->parameter_classes[ $class_name ][ $index ]['param_class_name'];
154
-        }
155
-        if (! isset($this->parameter_classes[ $class_name ])) {
156
-            $this->parameter_classes[ $class_name ] = array();
157
-        }
158
-        if (! isset($this->parameter_classes[ $class_name ][ $index ])) {
159
-            $this->parameter_classes[ $class_name ][ $index ] = array();
160
-        }
161
-        $this->parameter_classes[ $class_name ][ $index ]['param_class_name'] = $param->getType()
162
-            ? $param->getType()->getName()
163
-            : null;
164
-        return $this->parameter_classes[ $class_name ][ $index ]['param_class_name'];
165
-    }
166
-
167
-
168
-    /**
169
-     * @param ReflectionParameter $param
170
-     * @param string              $class_name
171
-     * @param string              $index
172
-     * @return string|null
173
-     */
174
-    public function getParameterDefaultValue(ReflectionParameter $param, $class_name, $index)
175
-    {
176
-        if (isset($this->parameter_classes[ $class_name ][ $index ]['param_class_default'])) {
177
-            return $this->parameter_classes[ $class_name ][ $index ]['param_class_default'];
178
-        }
179
-        if (! isset($this->parameter_classes[ $class_name ])) {
180
-            $this->parameter_classes[ $class_name ] = array();
181
-        }
182
-        if (! isset($this->parameter_classes[ $class_name ][ $index ])) {
183
-            $this->parameter_classes[ $class_name ][ $index ] = array();
184
-        }
185
-        $this->parameter_classes[ $class_name ][ $index ]['param_class_default'] = $param->isDefaultValueAvailable()
186
-            ? $param->getDefaultValue()
187
-            : null;
188
-        return $this->parameter_classes[ $class_name ][ $index ]['param_class_default'];
189
-    }
190
-
191
-
192
-    /**
193
-     * @param string $class_name
194
-     * @return ReflectionProperty[]
195
-     * @throws InvalidDataTypeException
196
-     * @throws ReflectionException
197
-     */
198
-    public function getProperties($class_name)
199
-    {
200
-        if (! isset($this->properties[ $class_name ])) {
201
-            $reflection_class                = $this->getReflectionClass($class_name);
202
-            $this->properties[ $class_name ] = $reflection_class->getProperties();
203
-        }
204
-        return $this->properties[ $class_name ];
205
-    }
206
-
207
-
208
-    /**
209
-     * @param ReflectionClass $reflection_class
210
-     * @return ReflectionProperty[]
211
-     * @throws InvalidDataTypeException
212
-     * @throws ReflectionException
213
-     */
214
-    public function getPropertiesFromReflection(ReflectionClass $reflection_class)
215
-    {
216
-        return $this->getProperties($reflection_class->getName());
217
-    }
218
-
219
-
220
-    /**
221
-     * @param string $class_name
222
-     * @return ReflectionMethod[]
223
-     * @throws InvalidDataTypeException
224
-     * @throws ReflectionException
225
-     */
226
-    public function getMethods($class_name)
227
-    {
228
-        if (! isset($this->methods[ $class_name ])) {
229
-            $reflection_class             = $this->getReflectionClass($class_name);
230
-            $this->methods[ $class_name ] = $reflection_class->getMethods();
231
-        }
232
-        return $this->methods[ $class_name ];
233
-    }
234
-
235
-
236
-    /**
237
-     * @param ReflectionClass $reflection_class )
238
-     * @return ReflectionMethod[]
239
-     * @throws InvalidDataTypeException
240
-     * @throws ReflectionException
241
-     */
242
-    public function getMethodsFromReflection(ReflectionClass $reflection_class)
243
-    {
244
-        return $this->getMethods($reflection_class->getName());
245
-    }
24
+	/**
25
+	 * @var ReflectionClass[] $classes
26
+	 */
27
+	private $classes = array();
28
+
29
+	/**
30
+	 * @var ReflectionMethod[] $constructors
31
+	 */
32
+	private $constructors = array();
33
+
34
+	/**
35
+	 * @var ReflectionParameter[][] $parameters
36
+	 */
37
+	private $parameters = array();
38
+
39
+	/**
40
+	 * @var ReflectionParameter[][] $parameters
41
+	 */
42
+	private $parameter_classes = array();
43
+
44
+	/**
45
+	 * @var ReflectionProperty[][] $properties
46
+	 */
47
+	private $properties = array();
48
+
49
+	/**
50
+	 * @var ReflectionMethod[][] $methods
51
+	 */
52
+	private $methods = array();
53
+
54
+
55
+	/**
56
+	 * @param string $class_name
57
+	 * @return ReflectionClass
58
+	 * @throws ReflectionException
59
+	 * @throws InvalidDataTypeException
60
+	 */
61
+	public function getReflectionClass($class_name)
62
+	{
63
+		if (! is_string($class_name)) {
64
+			throw new InvalidDataTypeException($class_name, '$class_name', 'string (fully qualified class name)');
65
+		}
66
+		if (! isset($this->classes[ $class_name ])) {
67
+			$this->classes[ $class_name ] = new ReflectionClass($class_name);
68
+		}
69
+		return $this->classes[ $class_name ];
70
+	}
71
+
72
+
73
+	/**
74
+	 * @param string $class_name
75
+	 * @return ReflectionMethod
76
+	 * @throws InvalidDataTypeException
77
+	 * @throws ReflectionException
78
+	 */
79
+	public function getConstructor($class_name)
80
+	{
81
+		if (! is_string($class_name)) {
82
+			throw new InvalidDataTypeException($class_name, '$class_name', 'string (fully qualified class name)');
83
+		}
84
+		if (! isset($this->constructors[ $class_name ])) {
85
+			$reflection_class                  = $this->getReflectionClass($class_name);
86
+			$this->constructors[ $class_name ] = $reflection_class->getConstructor();
87
+		}
88
+		return $this->constructors[ $class_name ];
89
+	}
90
+
91
+
92
+	/**
93
+	 * @param ReflectionClass $reflection_class
94
+	 * @return ReflectionMethod
95
+	 * @throws InvalidDataTypeException
96
+	 * @throws ReflectionException
97
+	 */
98
+	public function getConstructorFromReflection(ReflectionClass $reflection_class)
99
+	{
100
+		return $this->getConstructor($reflection_class->getName());
101
+	}
102
+
103
+
104
+	/**
105
+	 * @param string $class_name
106
+	 * @return ReflectionParameter[]
107
+	 * @throws InvalidDataTypeException
108
+	 * @throws ReflectionException
109
+	 */
110
+	public function getParameters($class_name)
111
+	{
112
+		if (! isset($this->parameters[ $class_name ])) {
113
+			$constructor                     = $this->getConstructor($class_name);
114
+			$this->parameters[ $class_name ] = $constructor->getParameters();
115
+		}
116
+		return $this->parameters[ $class_name ];
117
+	}
118
+
119
+
120
+	/**
121
+	 * @param ReflectionClass $reflection_class
122
+	 * @return ReflectionParameter[]
123
+	 * @throws InvalidDataTypeException
124
+	 * @throws ReflectionException
125
+	 */
126
+	public function getParametersFromReflection(ReflectionClass $reflection_class)
127
+	{
128
+		return $this->getParameters($reflection_class->getName());
129
+	}
130
+
131
+
132
+	/**
133
+	 * @param ReflectionMethod $constructor
134
+	 * @return ReflectionParameter[]
135
+	 * @throws InvalidDataTypeException
136
+	 * @throws ReflectionException
137
+	 */
138
+	public function getParametersFromReflectionConstructor(ReflectionMethod $constructor)
139
+	{
140
+		return $this->getParameters($constructor->getDeclaringClass());
141
+	}
142
+
143
+
144
+	/**
145
+	 * @param ReflectionParameter $param
146
+	 * @param string              $class_name
147
+	 * @param string              $index
148
+	 * @return string|null
149
+	 */
150
+	public function getParameterClassName(ReflectionParameter $param, $class_name, $index)
151
+	{
152
+		if (isset($this->parameter_classes[ $class_name ][ $index ]['param_class_name'])) {
153
+			return $this->parameter_classes[ $class_name ][ $index ]['param_class_name'];
154
+		}
155
+		if (! isset($this->parameter_classes[ $class_name ])) {
156
+			$this->parameter_classes[ $class_name ] = array();
157
+		}
158
+		if (! isset($this->parameter_classes[ $class_name ][ $index ])) {
159
+			$this->parameter_classes[ $class_name ][ $index ] = array();
160
+		}
161
+		$this->parameter_classes[ $class_name ][ $index ]['param_class_name'] = $param->getType()
162
+			? $param->getType()->getName()
163
+			: null;
164
+		return $this->parameter_classes[ $class_name ][ $index ]['param_class_name'];
165
+	}
166
+
167
+
168
+	/**
169
+	 * @param ReflectionParameter $param
170
+	 * @param string              $class_name
171
+	 * @param string              $index
172
+	 * @return string|null
173
+	 */
174
+	public function getParameterDefaultValue(ReflectionParameter $param, $class_name, $index)
175
+	{
176
+		if (isset($this->parameter_classes[ $class_name ][ $index ]['param_class_default'])) {
177
+			return $this->parameter_classes[ $class_name ][ $index ]['param_class_default'];
178
+		}
179
+		if (! isset($this->parameter_classes[ $class_name ])) {
180
+			$this->parameter_classes[ $class_name ] = array();
181
+		}
182
+		if (! isset($this->parameter_classes[ $class_name ][ $index ])) {
183
+			$this->parameter_classes[ $class_name ][ $index ] = array();
184
+		}
185
+		$this->parameter_classes[ $class_name ][ $index ]['param_class_default'] = $param->isDefaultValueAvailable()
186
+			? $param->getDefaultValue()
187
+			: null;
188
+		return $this->parameter_classes[ $class_name ][ $index ]['param_class_default'];
189
+	}
190
+
191
+
192
+	/**
193
+	 * @param string $class_name
194
+	 * @return ReflectionProperty[]
195
+	 * @throws InvalidDataTypeException
196
+	 * @throws ReflectionException
197
+	 */
198
+	public function getProperties($class_name)
199
+	{
200
+		if (! isset($this->properties[ $class_name ])) {
201
+			$reflection_class                = $this->getReflectionClass($class_name);
202
+			$this->properties[ $class_name ] = $reflection_class->getProperties();
203
+		}
204
+		return $this->properties[ $class_name ];
205
+	}
206
+
207
+
208
+	/**
209
+	 * @param ReflectionClass $reflection_class
210
+	 * @return ReflectionProperty[]
211
+	 * @throws InvalidDataTypeException
212
+	 * @throws ReflectionException
213
+	 */
214
+	public function getPropertiesFromReflection(ReflectionClass $reflection_class)
215
+	{
216
+		return $this->getProperties($reflection_class->getName());
217
+	}
218
+
219
+
220
+	/**
221
+	 * @param string $class_name
222
+	 * @return ReflectionMethod[]
223
+	 * @throws InvalidDataTypeException
224
+	 * @throws ReflectionException
225
+	 */
226
+	public function getMethods($class_name)
227
+	{
228
+		if (! isset($this->methods[ $class_name ])) {
229
+			$reflection_class             = $this->getReflectionClass($class_name);
230
+			$this->methods[ $class_name ] = $reflection_class->getMethods();
231
+		}
232
+		return $this->methods[ $class_name ];
233
+	}
234
+
235
+
236
+	/**
237
+	 * @param ReflectionClass $reflection_class )
238
+	 * @return ReflectionMethod[]
239
+	 * @throws InvalidDataTypeException
240
+	 * @throws ReflectionException
241
+	 */
242
+	public function getMethodsFromReflection(ReflectionClass $reflection_class)
243
+	{
244
+		return $this->getMethods($reflection_class->getName());
245
+	}
246 246
 }
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -60,13 +60,13 @@  discard block
 block discarded – undo
60 60
      */
61 61
     public function getReflectionClass($class_name)
62 62
     {
63
-        if (! is_string($class_name)) {
63
+        if ( ! is_string($class_name)) {
64 64
             throw new InvalidDataTypeException($class_name, '$class_name', 'string (fully qualified class name)');
65 65
         }
66
-        if (! isset($this->classes[ $class_name ])) {
67
-            $this->classes[ $class_name ] = new ReflectionClass($class_name);
66
+        if ( ! isset($this->classes[$class_name])) {
67
+            $this->classes[$class_name] = new ReflectionClass($class_name);
68 68
         }
69
-        return $this->classes[ $class_name ];
69
+        return $this->classes[$class_name];
70 70
     }
71 71
 
72 72
 
@@ -78,14 +78,14 @@  discard block
 block discarded – undo
78 78
      */
79 79
     public function getConstructor($class_name)
80 80
     {
81
-        if (! is_string($class_name)) {
81
+        if ( ! is_string($class_name)) {
82 82
             throw new InvalidDataTypeException($class_name, '$class_name', 'string (fully qualified class name)');
83 83
         }
84
-        if (! isset($this->constructors[ $class_name ])) {
84
+        if ( ! isset($this->constructors[$class_name])) {
85 85
             $reflection_class                  = $this->getReflectionClass($class_name);
86
-            $this->constructors[ $class_name ] = $reflection_class->getConstructor();
86
+            $this->constructors[$class_name] = $reflection_class->getConstructor();
87 87
         }
88
-        return $this->constructors[ $class_name ];
88
+        return $this->constructors[$class_name];
89 89
     }
90 90
 
91 91
 
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
      */
110 110
     public function getParameters($class_name)
111 111
     {
112
-        if (! isset($this->parameters[ $class_name ])) {
112
+        if ( ! isset($this->parameters[$class_name])) {
113 113
             $constructor                     = $this->getConstructor($class_name);
114
-            $this->parameters[ $class_name ] = $constructor->getParameters();
114
+            $this->parameters[$class_name] = $constructor->getParameters();
115 115
         }
116
-        return $this->parameters[ $class_name ];
116
+        return $this->parameters[$class_name];
117 117
     }
118 118
 
119 119
 
@@ -149,19 +149,19 @@  discard block
 block discarded – undo
149 149
      */
150 150
     public function getParameterClassName(ReflectionParameter $param, $class_name, $index)
151 151
     {
152
-        if (isset($this->parameter_classes[ $class_name ][ $index ]['param_class_name'])) {
153
-            return $this->parameter_classes[ $class_name ][ $index ]['param_class_name'];
152
+        if (isset($this->parameter_classes[$class_name][$index]['param_class_name'])) {
153
+            return $this->parameter_classes[$class_name][$index]['param_class_name'];
154 154
         }
155
-        if (! isset($this->parameter_classes[ $class_name ])) {
156
-            $this->parameter_classes[ $class_name ] = array();
155
+        if ( ! isset($this->parameter_classes[$class_name])) {
156
+            $this->parameter_classes[$class_name] = array();
157 157
         }
158
-        if (! isset($this->parameter_classes[ $class_name ][ $index ])) {
159
-            $this->parameter_classes[ $class_name ][ $index ] = array();
158
+        if ( ! isset($this->parameter_classes[$class_name][$index])) {
159
+            $this->parameter_classes[$class_name][$index] = array();
160 160
         }
161
-        $this->parameter_classes[ $class_name ][ $index ]['param_class_name'] = $param->getType()
161
+        $this->parameter_classes[$class_name][$index]['param_class_name'] = $param->getType()
162 162
             ? $param->getType()->getName()
163 163
             : null;
164
-        return $this->parameter_classes[ $class_name ][ $index ]['param_class_name'];
164
+        return $this->parameter_classes[$class_name][$index]['param_class_name'];
165 165
     }
166 166
 
167 167
 
@@ -173,19 +173,19 @@  discard block
 block discarded – undo
173 173
      */
174 174
     public function getParameterDefaultValue(ReflectionParameter $param, $class_name, $index)
175 175
     {
176
-        if (isset($this->parameter_classes[ $class_name ][ $index ]['param_class_default'])) {
177
-            return $this->parameter_classes[ $class_name ][ $index ]['param_class_default'];
176
+        if (isset($this->parameter_classes[$class_name][$index]['param_class_default'])) {
177
+            return $this->parameter_classes[$class_name][$index]['param_class_default'];
178 178
         }
179
-        if (! isset($this->parameter_classes[ $class_name ])) {
180
-            $this->parameter_classes[ $class_name ] = array();
179
+        if ( ! isset($this->parameter_classes[$class_name])) {
180
+            $this->parameter_classes[$class_name] = array();
181 181
         }
182
-        if (! isset($this->parameter_classes[ $class_name ][ $index ])) {
183
-            $this->parameter_classes[ $class_name ][ $index ] = array();
182
+        if ( ! isset($this->parameter_classes[$class_name][$index])) {
183
+            $this->parameter_classes[$class_name][$index] = array();
184 184
         }
185
-        $this->parameter_classes[ $class_name ][ $index ]['param_class_default'] = $param->isDefaultValueAvailable()
185
+        $this->parameter_classes[$class_name][$index]['param_class_default'] = $param->isDefaultValueAvailable()
186 186
             ? $param->getDefaultValue()
187 187
             : null;
188
-        return $this->parameter_classes[ $class_name ][ $index ]['param_class_default'];
188
+        return $this->parameter_classes[$class_name][$index]['param_class_default'];
189 189
     }
190 190
 
191 191
 
@@ -197,11 +197,11 @@  discard block
 block discarded – undo
197 197
      */
198 198
     public function getProperties($class_name)
199 199
     {
200
-        if (! isset($this->properties[ $class_name ])) {
200
+        if ( ! isset($this->properties[$class_name])) {
201 201
             $reflection_class                = $this->getReflectionClass($class_name);
202
-            $this->properties[ $class_name ] = $reflection_class->getProperties();
202
+            $this->properties[$class_name] = $reflection_class->getProperties();
203 203
         }
204
-        return $this->properties[ $class_name ];
204
+        return $this->properties[$class_name];
205 205
     }
206 206
 
207 207
 
@@ -225,11 +225,11 @@  discard block
 block discarded – undo
225 225
      */
226 226
     public function getMethods($class_name)
227 227
     {
228
-        if (! isset($this->methods[ $class_name ])) {
228
+        if ( ! isset($this->methods[$class_name])) {
229 229
             $reflection_class             = $this->getReflectionClass($class_name);
230
-            $this->methods[ $class_name ] = $reflection_class->getMethods();
230
+            $this->methods[$class_name] = $reflection_class->getMethods();
231 231
         }
232
-        return $this->methods[ $class_name ];
232
+        return $this->methods[$class_name];
233 233
     }
234 234
 
235 235
 
Please login to merge, or discard this patch.