| @@ 103-116 (lines=14) @@ | ||
| 100 | * @param string $field |
|
| 101 | * @return null|ReflectionMethod |
|
| 102 | */ |
|
| 103 | protected function findGetterMethod(ReflectionClass $reflectionClass, string $field) |
|
| 104 | { |
|
| 105 | foreach ($reflectionClass->getMethods($this->ignoreProtected ? ReflectionMethod::IS_PUBLIC|ReflectionMethod::IS_PROTECTED|ReflectionMethod::IS_PRIVATE : ReflectionMethod::IS_PUBLIC) as $reflectionMethod) { |
|
| 106 | if (!$reflectionMethod->isStatic() |
|
| 107 | && $reflectionMethod->getNumberOfRequiredParameters() == 0 |
|
| 108 | && strcasecmp($reflectionMethod->getName(), "get$field") == 0) { |
|
| 109 | if (!$reflectionMethod->isPublic()) { |
|
| 110 | $reflectionMethod->setAccessible(true); |
|
| 111 | } |
|
| 112 | return $reflectionMethod; |
|
| 113 | } |
|
| 114 | } |
|
| 115 | return null; |
|
| 116 | } |
|
| 117 | ||
| 118 | /** |
|
| 119 | * @param ReflectionClass $reflectionClass |
|
| @@ 86-99 (lines=14) @@ | ||
| 83 | * @param string $field |
|
| 84 | * @return null|ReflectionMethod |
|
| 85 | */ |
|
| 86 | protected function findSetterMethod(ReflectionClass $reflectionClass, string $field) |
|
| 87 | { |
|
| 88 | foreach ($reflectionClass->getMethods($this->ignoreProtected ? ReflectionMethod::IS_PUBLIC|ReflectionMethod::IS_PROTECTED|ReflectionMethod::IS_PRIVATE : ReflectionMethod::IS_PUBLIC) as $reflectionMethod) { |
|
| 89 | if (!$reflectionMethod->isStatic() |
|
| 90 | && $reflectionMethod->getNumberOfRequiredParameters() == 1 |
|
| 91 | && strcasecmp($reflectionMethod->getName(), "set$field") == 0) { |
|
| 92 | if (!$reflectionMethod->isPublic()) { |
|
| 93 | $reflectionMethod->setAccessible(true); |
|
| 94 | } |
|
| 95 | return $reflectionMethod; |
|
| 96 | } |
|
| 97 | } |
|
| 98 | return null; |
|
| 99 | } |
|
| 100 | ||
| 101 | /** |
|
| 102 | * @param ReflectionClass $reflectionClass |
|