public function after(CommandInterface $command, ResponseInterface $response, Parameter $model, &$result, array $context = [])
 {
     // Handle additional, undefined properties
     $additional = $model->getAdditionalProperties();
     if (!$additional instanceof Parameter) {
         return;
     }
     // Use the model location as the default if one is not set on additional
     $addLocation = $additional->getLocation() ?: $model->getLocation();
     if ($addLocation == $this->locationName) {
         foreach ($this->json as $prop => $val) {
             if (!isset($result[$prop])) {
                 // Only recurse if there is a type specified
                 $result[$prop] = $additional->getType() ? $this->recurse($additional, $val) : $val;
             }
         }
     }
     $this->json = [];
 }
 private function visitOuterArray(Parameter $model, array &$result, GuzzleCommandInterface $command, ResponseInterface $response, array &$context)
 {
     // Use 'location' defined on the top of the model
     if (!($location = $model->getLocation())) {
         return;
     }
     if (!isset($foundVisitors[$location])) {
         $this->triggerBeforeVisitor($location, $model, $result, $command, $response, $context);
     }
     // Visit each item in the response
     $this->responseLocations[$location]->visit($command, $response, $model, $result, $context);
 }
Example #3
0
 public function testAllowsSimpleLocationValue()
 {
     $p = new Parameter(array('name' => 'myname', 'location' => 'foo', 'sentAs' => 'Hello'));
     $this->assertEquals('foo', $p->getLocation());
     $this->assertEquals('Hello', $p->getSentAs());
 }