@@ 87-117 (lines=31) @@ | ||
84 | * @param \ReflectionClass $reflectionClass |
|
85 | * @return mixed|null |
|
86 | */ |
|
87 | private function getAnnotatedTargetValue( |
|
88 | $annotationName, |
|
89 | CommandMessageInterface $command, |
|
90 | \ReflectionClass $reflectionClass |
|
91 | ) { |
|
92 | foreach (ReflectionUtils::getProperties($reflectionClass) as $property) { |
|
93 | if (null !== $annotation = $this->reader->getPropertyAnnotation( |
|
94 | $property, |
|
95 | $annotationName |
|
96 | ) |
|
97 | ) { |
|
98 | $property->setAccessible(true); |
|
99 | ||
100 | return $property->getValue($command->getPayload()); |
|
101 | } |
|
102 | } |
|
103 | ||
104 | foreach (ReflectionUtils::getMethods($reflectionClass) as $method) { |
|
105 | if (null !== $annotation = $this->reader->getMethodAnnotation( |
|
106 | $method, |
|
107 | $annotationName |
|
108 | ) |
|
109 | ) { |
|
110 | $method->setAccessible(true); |
|
111 | ||
112 | return $method->invoke($command->getPayload()); |
|
113 | } |
|
114 | } |
|
115 | ||
116 | return null; |
|
117 | } |
|
118 | ||
119 | /** |
|
120 | * @param CommandMessageInterface $command |
@@ 57-87 (lines=31) @@ | ||
54 | * @param \ReflectionClass $reflectionClass |
|
55 | * @return mixed|null |
|
56 | */ |
|
57 | private function getAnnotatedTargetValue( |
|
58 | $annotationName, |
|
59 | CommandMessageInterface $command, |
|
60 | \ReflectionClass $reflectionClass |
|
61 | ) { |
|
62 | foreach (ReflectionUtils::getProperties($reflectionClass) as $property) { |
|
63 | if (null !== $annotation = $this->reader->getPropertyAnnotation( |
|
64 | $property, |
|
65 | $annotationName |
|
66 | ) |
|
67 | ) { |
|
68 | $property->setAccessible(true); |
|
69 | ||
70 | return $property->getValue($command->getPayload()); |
|
71 | } |
|
72 | } |
|
73 | ||
74 | foreach (ReflectionUtils::getMethods($reflectionClass) as $method) { |
|
75 | if (null !== $annotation = $this->reader->getMethodAnnotation( |
|
76 | $method, |
|
77 | $annotationName |
|
78 | ) |
|
79 | ) { |
|
80 | $method->setAccessible(true); |
|
81 | ||
82 | return $method->invoke($command->getPayload()); |
|
83 | } |
|
84 | } |
|
85 | ||
86 | return null; |
|
87 | } |
|
88 | ||
89 | /** |
|
90 | * @param CommandMessageInterface $command |