| @@ 116-126 (lines=11) @@ | ||
| 113 | $elementTypeClass = new \ReflectionClass($elementType); |
|
| 114 | $this->class->addUse($elementType); |
|
| 115 | $getAtMethod = $reflectionClass->getMethod('getAt'); |
|
| 116 | if ($getAtMethod->getDeclaringClass()->getName() != $this->class->getClassName()) { |
|
| 117 | $this->class->addMagicMethod( |
|
| 118 | 'getAt', |
|
| 119 | ['$offset'], |
|
| 120 | $elementTypeClass->getShortName(), |
|
| 121 | null, |
|
| 122 | null, |
|
| 123 | false, |
|
| 124 | true |
|
| 125 | ); |
|
| 126 | } |
|
| 127 | $getByIdMethod = $reflectionClass->getMethod('getById'); |
|
| 128 | if ($getByIdMethod->getDeclaringClass()->getName() != $this->class->getClassName()) { |
|
| 129 | $elementTypeObject = $elementTypeClass->newInstanceWithoutConstructor(); |
|
| @@ 143-153 (lines=11) @@ | ||
| 140 | } |
|
| 141 | } |
|
| 142 | $addMethod = $reflectionClass->getMethod('add'); |
|
| 143 | if ($addMethod->getDeclaringClass()->getName() != $this->class->getClassName()) { |
|
| 144 | $this->class->addMagicMethod( |
|
| 145 | 'add', |
|
| 146 | [$elementTypeClass->getShortName() . ' $element'], |
|
| 147 | $reflectionClass->getShortName(), |
|
| 148 | null, |
|
| 149 | null, |
|
| 150 | false, |
|
| 151 | true |
|
| 152 | ); |
|
| 153 | } |
|
| 154 | $current = $reflectionClass->getMethod('current'); |
|
| 155 | if ($current->getDeclaringClass()->getName() != $this->class->getClassName()) { |
|
| 156 | $this->class->addMagicMethod( |
|
| @@ 155-165 (lines=11) @@ | ||
| 152 | ); |
|
| 153 | } |
|
| 154 | $current = $reflectionClass->getMethod('current'); |
|
| 155 | if ($current->getDeclaringClass()->getName() != $this->class->getClassName()) { |
|
| 156 | $this->class->addMagicMethod( |
|
| 157 | 'current', |
|
| 158 | [], |
|
| 159 | $elementTypeClass->getShortName(), |
|
| 160 | null, |
|
| 161 | null, |
|
| 162 | false, |
|
| 163 | true |
|
| 164 | ); |
|
| 165 | } |
|
| 166 | } |
|
| 167 | } |
|
| 168 | ||
| @@ 183-194 (lines=12) @@ | ||
| 180 | $resultClassReflection = new \ReflectionClass($resultClass); |
|
| 181 | $this->class->addUse($resultClass); |
|
| 182 | $mapResponseMethod = $reflectionClass->getMethod('mapResponse'); |
|
| 183 | if ($mapResponseMethod->getDeclaringClass()->getName() != $this->class->getClassName()) { |
|
| 184 | $this->class->addUse('\Commercetools\Core\Response\ApiResponseInterface'); |
|
| 185 | $this->class->addMagicMethod( |
|
| 186 | 'mapResponse', |
|
| 187 | ['ApiResponseInterface $response'], |
|
| 188 | $resultClassReflection->getShortName(), |
|
| 189 | null, |
|
| 190 | null, |
|
| 191 | false, |
|
| 192 | true |
|
| 193 | ); |
|
| 194 | } |
|
| 195 | } |
|
| 196 | ||
| 197 | /** |
|