protected function _resolveDependencies(Asset $asset, &$resolved = [], &$unresolved = [])
    {
        $unresolved[$asset->getAlias()] = $asset;

        foreach ($asset->getDependencies() as $dependency) {
            if (!Arr::key($dependency, $resolved)) {

                if (isset($unresolved[$dependency])) {
                    throw new Exception(sprintf(
                        'Circular asset dependency "%s > %s" detected.',
                        $asset->getAlias(),
                        $dependency
                    ));
                }

                if ($dep = $this->_collection->get($dependency)) {
                    $this->_resolveDependencies($dep, $resolved, $unresolved);
                } else {
                    throw new Exception("Undefined depends: $dependency");
                }
            }
        }

        $resolved[$asset->getAlias()] = $asset;
        unset($unresolved[$asset->getAlias()]);

        return $resolved;
    }
protected function _resolveDependencies(Asset $asset, &$resolved = [], &$unresolved = [])
    {
        $unresolved[$asset->getAlias()] = $asset;

        foreach ($asset->getDependencies() as $dependency) {
            if (!Arr::key($dependency, $resolved)) {

                if (isset($unresolved[$dependency])) {
                    throw new Exception(sprintf(
                        'Circular asset dependency "%s > %s" detected.',
                        $asset->getAlias(),
                        $dependency
                    ));
                }

                if ($dep = $this->_collection->get($dependency)) {
                    $this->_resolveDependencies($dep, $resolved, $unresolved);
                } else {
                    throw new Exception("Undefined depends: $dependency");
                }
            }
        }

        $resolved[$asset->getAlias()] = $asset;
        unset($unresolved[$asset->getAlias()]);

        return $resolved;
    }
protected function _resolveDependencies ( Asset $ asset , & $ resolved = [ ] , & $ unresolved = [ ] ) { $ unresolved [ $ asset -> getAlias ( ) ] = $ asset ; foreach ( $ asset -> getDependencies ( ) as $ dependency ) { if ( ! Arr :: key ( $ dependency , $ resolved ) ) { if ( isset ( $ unresolved [ $ dependency ] ) ) { throw new Exception ( sprintf ( 'Circular asset dependency "%s > %s" detected.' , $ asset -> getAlias ( ) , $ dependency ) ) ; } if ( $ dep = $ this -> _collection -> get ( $ dependency ) ) { $ this -> _resolveDependencies ( $ dep , $ resolved , $ unresolved ) ; } else { throw new Exception ( "Undefined depends: $dependency" ) ; } } } $ resolved [ $ asset -> getAlias ( ) ] = $ asset ; unset ( $ unresolved [ $ asset -> getAlias ( ) ] ) ; return $ resolved ; }
Resolves asset dependencies.

@param Asset|null $asset
@param Asset[]    $resolved
@param Asset[]    $unresolved
@return Asset[]
@throws Exception
Resolves asset dependencies .