src/Packagist/Api/Result/Factory.php
public function create(array $data)
    {
        if (isset($data['results'])) {
            return $this->createSearchResults($data['results']);
        } elseif (isset($data['packages'])) {
            return $this->createSearchResults($data['packages']);
        } elseif (isset($data['package'])) {
            return $this->createPackageResults($data['package']);
        } elseif (isset($data['packageNames'])) {
            return $data['packageNames'];
        }

        throw new InvalidArgumentException('Invalid input data.');
    }
public function create(array $data)
    {
        if (isset($data['results'])) {
            return $this->createSearchResults($data['results']);
        } elseif (isset($data['packages'])) {
            return $this->createSearchResults($data['packages']);
        } elseif (isset($data['package'])) {
            return $this->createPackageResults($data['package']);
        } elseif (isset($data['packageNames'])) {
            return $data['packageNames'];
        }

        throw new InvalidArgumentException('Invalid input data.');
    }
public function create ( array $ data ) { if ( isset ( $ data [ 'results' ] ) ) { return $ this -> createSearchResults ( $ data [ 'results' ] ) ; } elseif ( isset ( $ data [ 'packages' ] ) ) { return $ this -> createSearchResults ( $ data [ 'packages' ] ) ; } elseif ( isset ( $ data [ 'package' ] ) ) { return $ this -> createPackageResults ( $ data [ 'package' ] ) ; } elseif ( isset ( $ data [ 'packageNames' ] ) ) { return $ data [ 'packageNames' ] ; } throw new InvalidArgumentException ( 'Invalid input data.' ) ; }
Analyse the data and transform to a known type

@param array $data
@throws InvalidArgumentException

@return array|Package
Analyse the data and transform to a known type