/** * Hydrate the knowing type depending on passed data * * @param array $data * * @return array|Packagist\Api\Result\Package */ protected function create(array $data) { if (null === $this->resultFactory) { $this->resultFactory = new Factory(); } return $this->resultFactory->create($data); }
public function setup() { $factory = new Factory(); $this->results = json_decode(file_get_contents(__DIR__ . '/stubs/results.json'), true); $this->results = $factory->create($this->results); }