PluginProbe
Assistant – Every Day Productivity Apps / trunk
Assistant – Every Day Productivity Apps vtrunk
1.5.5 trunk 0.1.0 0.2.0 0.2.1 0.2.2 0.3.0 0.3.1 0.4 0.4.1 0.4.2 0.5.0 0.5.1 0.6.0 0.7.0 0.7.0.2 0.7.0.3 0.7.0.4 0.7.0.5 0.7.0.6 0.7.0.7 0.7.0.8 0.7.0.9 0.7.1 1.0 All 71 releases
assistant / backend / src / System / Container / StandardReflector.php

StandardReflector.php in Assistant – Every Day Productivity Apps trunk, at backend/src/System/Container/StandardReflector.php

52 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FL\Assistant\System\Container;
4
5 class StandardReflector implements Reflector {
6
7 public function getClass( $class ) {
8 return new \ReflectionClass( $class );
9 }
10
11 public function getCtor( $class ) {
12 $reflectionClass = new \ReflectionClass( $class );
13
14 return $reflectionClass->getConstructor();
15 }
16
17 public function getCtorParams( $class ) {
18 return ( $reflectedCtor = $this->getCtor( $class ) )
19 ? $reflectedCtor->getParameters()
20 : null;
21 }
22
23 public function getParamTypeHint( \ReflectionFunctionAbstract $function, \ReflectionParameter $param ) {
24 if ( version_compare( PHP_VERSION, '8.0.0', '<' ) ) {
25 return ( $reflectionClass = $param->getClass() )
26 ? $reflectionClass->getName()
27 : null;
28 }
29
30 $type = $param->getType();
31
32 if ( 'ReflectionNamedType' === get_class( $type ) ) {
33 $class = new \ReflectionClass( $type->getName() );
34 return $class->getName();
35 }
36
37 return null;
38 }
39
40 public function getFunction( $functionName ) {
41 return new \ReflectionFunction( $functionName );
42 }
43
44 public function getMethod( $classNameOrInstance, $methodName ) {
45 $className = is_string( $classNameOrInstance )
46 ? $classNameOrInstance
47 : get_class( $classNameOrInstance );
48
49 return new \ReflectionMethod( $className, $methodName );
50 }
51 }
52