/** * @test * @dataProvider provideForMixedTest */ public function is_default_mixed_returned_when_path_not_exists($value) { $arrayReader = new ArrayReader(array('hash' => array('with' => array('nested' => $value)))); $this->assertSame(null, $arrayReader->mixedValue('hash.with.unknown', null)); }
/** * @param array $result */ public function fillThroughElasticsearchResponse(array $result) { $arrayReader = new ArrayReader($result); $this->isNew = false; $this->id = $arrayReader->stringValue('_id'); $this->version = $arrayReader->mixedValue('_version', null); $class = get_class($this); $reflection = new \ReflectionClass($class); $properties = $reflection->getProperties(); foreach ($properties as $property) { if ($property->getName() !== 'id') { $reader = new Reader($class, $property->getName(), 'property'); $isBodyParameter = $reader->getParameter('isBodyParameter'); if ($isBodyParameter === true) { $this->{$property->getName()} = $arrayReader->mixedValue('_source.' . $property->getName()); } } } }