src/Packagist/Api/Result/Factory.php
public function createPackageResults(array $package)
    {
        $created = array();

        if (isset($package['maintainers']) && $package['maintainers']) {
            foreach ($package['maintainers'] as $key => $maintainer) {
                $package['maintainers'][$key] = $this->createResult('Packagist\Api\Result\Package\Maintainer', $maintainer);
            }
        }

        if (isset($package['downloads']) && $package['downloads']) {
            $package['downloads'] = $this->createResult('Packagist\Api\Result\Package\Downloads', $package['downloads']);
        }

        foreach ($package['versions'] as $branch => $version) {
            if (isset($version['authors']) && $version['authors']) {
                foreach ($version['authors'] as $key => $author) {
                    $version['authors'][$key] = $this->createResult('Packagist\Api\Result\Package\Author', $author);
                }
            }
            if ($version['source']) {
                $version['source'] = $this->createResult('Packagist\Api\Result\Package\Source', $version['source']);
            }
            if (isset($version['dist']) && $version['dist']) {
                $version['dist'] = $this->createResult('Packagist\Api\Result\Package\Dist', $version['dist']);
            }

            $package['versions'][$branch] = $this->createResult('Packagist\Api\Result\Package\Version', $version);
        }

        $created = new Package();
        $created->fromArray($package);

        return $created;
    }
public function createPackageResults(array $package)
    {
        $created = array();

        if (isset($package['maintainers']) && $package['maintainers']) {
            foreach ($package['maintainers'] as $key => $maintainer) {
                $package['maintainers'][$key] = $this->createResult('Packagist\Api\Result\Package\Maintainer', $maintainer);
            }
        }

        if (isset($package['downloads']) && $package['downloads']) {
            $package['downloads'] = $this->createResult('Packagist\Api\Result\Package\Downloads', $package['downloads']);
        }

        foreach ($package['versions'] as $branch => $version) {
            if (isset($version['authors']) && $version['authors']) {
                foreach ($version['authors'] as $key => $author) {
                    $version['authors'][$key] = $this->createResult('Packagist\Api\Result\Package\Author', $author);
                }
            }
            if ($version['source']) {
                $version['source'] = $this->createResult('Packagist\Api\Result\Package\Source', $version['source']);
            }
            if (isset($version['dist']) && $version['dist']) {
                $version['dist'] = $this->createResult('Packagist\Api\Result\Package\Dist', $version['dist']);
            }

            $package['versions'][$branch] = $this->createResult('Packagist\Api\Result\Package\Version', $version);
        }

        $created = new Package();
        $created->fromArray($package);

        return $created;
    }
public function createPackageResults ( array $ package ) { $ created = array ( ) ; if ( isset ( $ package [ 'maintainers' ] ) && $ package [ 'maintainers' ] ) { foreach ( $ package [ 'maintainers' ] as $ key => $ maintainer ) { $ package [ 'maintainers' ] [ $ key ] = $ this -> createResult ( 'Packagist\Api\Result\Package\Maintainer' , $ maintainer ) ; } } if ( isset ( $ package [ 'downloads' ] ) && $ package [ 'downloads' ] ) { $ package [ 'downloads' ] = $ this -> createResult ( 'Packagist\Api\Result\Package\Downloads' , $ package [ 'downloads' ] ) ; } foreach ( $ package [ 'versions' ] as $ branch => $ version ) { if ( isset ( $ version [ 'authors' ] ) && $ version [ 'authors' ] ) { foreach ( $ version [ 'authors' ] as $ key => $ author ) { $ version [ 'authors' ] [ $ key ] = $ this -> createResult ( 'Packagist\Api\Result\Package\Author' , $ author ) ; } } if ( $ version [ 'source' ] ) { $ version [ 'source' ] = $ this -> createResult ( 'Packagist\Api\Result\Package\Source' , $ version [ 'source' ] ) ; } if ( isset ( $ version [ 'dist' ] ) && $ version [ 'dist' ] ) { $ version [ 'dist' ] = $ this -> createResult ( 'Packagist\Api\Result\Package\Dist' , $ version [ 'dist' ] ) ; } $ package [ 'versions' ] [ $ branch ] = $ this -> createResult ( 'Packagist\Api\Result\Package\Version' , $ version ) ; } $ created = new Package ( ) ; $ created -> fromArray ( $ package ) ; return $ created ; }
Parse array to \Packagist\Api\Result\Result

@param array $package

@return Package
Parse array to \ Packagist \ Api \ Result \ Result