Get asset locators.

@param Asset|string $asset Asset or AssetId

@return Locator[]
170575
public function getAssetLocatorList($asset)
    {
        $assetId = Utilities::getEntityId(
            $asset,
            'WindowsAzure\MediaServices\Models\Asset'
        );

        $locatorsList = $this->_getEntityList("Assets('{$assetId}')/Locators");

        $result = [];

        foreach ($locatorsList as $locator) {
            $result[] = Locator::createFromOptions($locator);
        }

        return $result;
    }
69234
public static function process($assets)
    {
        if ($directory = self::getOutputDirectory()) {
            $relativeDirectory = self::getRelativeOutputDirectory();
            $filename = '';
            $sourceFiles = array();
            for ($i = 0; $i < count($assets); ++$i) {
                $asset = $assets[$i];
                $filename .= $asset->getAssetHashKey();
                $sourceFiles[] = $asset->getAssetURL();
            }
            $filename = sha1($filename);
            $cacheFile = $directory.'/'.$filename.'.js';
            if (!file_exists($cacheFile)) {
                $js = '';
                foreach ($assets as $asset) {
                    $contents = $asset->getAssetContents();
                    if (isset($contents)) {
                        if ($asset->assetSupportsMinification()) {
                            $contents = \JShrink\Minifier::minify($contents);
                        }
                        $js .= $contents.";\n\n";
                    }
                }
                @file_put_contents($cacheFile, $js);
            }

            $asset = new self();
            $asset->setAssetURL($relativeDirectory.'/'.$filename.'.js');
            $asset->setAssetPath($directory.'/'.$filename.'.js');
            $asset->setCombinedAssetSourceFiles($sourceFiles);

            return array($asset);
        }

        return $assets;
    }
60532
public function getAssets()
    {
        $assets = $this->assets;

        // Spin through each directory and recursively merge the current directories assets
        // on to the directories assets. This maintains the order of adding in the array
        // structure.
        $this->directories->each(function($directory) use (&$assets)
        {
            $assets = $directory->getAssets()->merge($assets);
        });

        // Spin through each of the filters and apply them to each of the assets. Every filter
        // is applied and then later during the build will be removed if it does not apply
        // to a given asset.
        $this->filters->each(function($filter) use (&$assets)
        {
            $assets->each(function($asset) use ($filter) { $asset->apply($filter); });
        });

        return $assets;
    }
888152
private function loadHandler( $asset )
    {
        // objects of class configurable
        if( is_callable($asset) ) {

            return call_user_func($asset, $this, $this->container);

        // this looks like a file name
        // because we're not taking relative paths look for 1st character being a string
        } elseif ( is_string($asset) and 0 === strpos($asset, '/') and file_exists($asset) ) {

            $yamlFileLoader = new YamlFileLoader(
                $this->container,
                new FileLocator(dirname($asset))
            );
            return $yamlFileLoader->load(basename($asset));

        } elseif ( is_string($asset) and class_exists( $asset ) /* and is_a( $asset, DiConfigurable::class ) */ ) {

            $invokedAsset = new $asset();
            if( !method_exists( $asset, '__invoke' ) ) {
                throw new ClassNotAConfigurableException($asset);
            }
            return call_user_func($invokedAsset, $this, $this->container);

        }

        throw new UnrecognisedAssetException($asset);
    }
260516
public function get (Asset $asset) : Asset
    {
        $cache = $this->locator->get(AssetsCache::class);
        $cachedAsset = $cache->get($asset);

        if (null !== $cachedAsset)
        {
            return $cachedAsset;
        }

        return $this->addAsset($asset);
    }
319009
public function getAssetAssetFileList($asset)
    {
        $assetId = Utilities::getEntityId(
            $asset,
            'WindowsAzure\MediaServices\Models\Asset'
        );

        $propertyList = $this->_getEntityList("Assets('{$assetId}')/Files");
        $result = [];

        foreach ($propertyList as $properties) {
            $result[] = AssetFile::createFromOptions($properties);
        }

        return $result;
    }
619815
protected function filterAssetNames($assetNames)
    {
        $filter = $this->_conn->getConfiguration()->getSchemaAssetsFilter();
        if (! $filter) {
            return $assetNames;
        }

        return array_values(array_filter($assetNames, $filter));
    }
52537
public function download(Asset $asset)
    {
        return Response::file(AssetFacade::path($asset), [
            'Content-Type'        => $asset->getMimetype(),
            'Content-Disposition' => 'download; filename="'.$asset->getOriginalFilename().'"',
        ]);
    }
792538
protected function getAssetEntryBuildPath($asset)
    {
        $path = $asset['path'];
        if (isset($asset['attributes']['build'])) {
            $build = $asset['attributes']['build'];

            if ($build == 'core') {
                $build = 'v' . Parameter::get('system::core.build', 1);
            }
            elseif ($pluginVersion = PluginVersion::getVersion($build)) {
                $build = 'v' . $pluginVersion;
            }

            $path .= '?' . $build;
        }

        return $path;
    }
781807
public function expandAssetGroups(array $assetGroups): array
    {
        $expandedAssetGroups = [];
        foreach ($assetGroups as $assetGroup) {
            if ('@' == substr($assetGroup, 0, 1)) {
                $group = substr($assetGroup, 1);
                $applicationAssetGroups = $this->getAssetGroups();
                if (!isset($applicationAssetGroups[$group])) {
                    $message = "Could not expand asset group \"$group\".";
                    $similarGroups = $this->findSimilarNames($group, array_keys($applicationAssetGroups));
                    if ($similarGroups) {
                        $message .= "\nDid you mean:\n" . implode("\n", $similarGroups) . "\n";
                    }
                    throw new Exception\DomainException($message);
                }

                $expandedAssetGroups = array_merge(
                    $expandedAssetGroups,
                    $this->expandAssetGroups($applicationAssetGroups[$group])
                );
            } else {
                $expandedAssetGroups[] = $assetGroup;
            }
        }

        sort($expandedAssetGroups);
        return $expandedAssetGroups;
    }
115801
public static function get(string $asset_type, string $namespace) : array
    {
        $assets = [];

        // is there some registered $assets for current $namespace ?
        if (isset(Assets::$assets[$namespace])
            && isset(Assets::$assets[$namespace][$asset_type])
            && count(Assets::$assets[$namespace][$asset_type]) > 0) {

            // Get all $assets for given $namespace and $asset_type.
            $assets = Assets::$assets[$namespace][$asset_type];

            // Sort $assets by priority from low to high
            ksort($assets);
        }

        // Return $assets
        return $assets;
    }
685243
protected function filterProvidedAssets($asset)
    {
        foreach ($this->providedAssetGroup->getAssetPointers() as $pass) {
            if ($pass->getHandle() == $asset->getHandle() && $pass->getType() == $asset->getType()) {
                return false;
            }
        }

        // now is the unmatched assets something that matches this asset?
        // (ie, is it a path-style match, like bootstrap/* )
        foreach ($this->providedAssetGroupUnmatched as $assetPointer) {
            if ($assetPointer->getType() == $asset->getType() && fnmatch($assetPointer->getHandle(), $asset->getHandle())) {
                return false;
            }
        }

        return true;
    }
141367
public function get( $type = null ) 
	{
		if ( is_null( $type ) )
		{
			return $this->assets;
		}
		
		if ( !isset( $this->assets[$type] ) )
		{
			return array();
		}
		
		return $this->assets[$type];
	}
304023
protected function sortFilesByDependencies($assets)
    {
        $sortedAssets = array();
        foreach ($assets as $asset) {
            if ($asset->hasDependencies()) {
                $sortedAssets = $this->resolveDependencies($sortedAssets, $assets, $asset);
            } else {
                $sortedAssets[$asset->getAssetName()] = $asset;
            }
        }
        
        return $sortedAssets;
    }
49647
public function asset($asset, $secure = null)
    {
        return url('themes/' . $this->getCurrent() . '/' . $asset, null, $secure);
    }
1178092
protected static function parseLocation($location)
	{
		if (is_string($location))
		{
			$locationName  = self::getMountNameFromPath($location);
			$locationMount = self::findMountByName($locationName);
		}
		else
		{
			$locationName  = uniqid('', true);
			$locationMount = $location->getAdapter();
			$location      = $locationName . '://' . $location->getPath();
		}

		return [$location, $locationName, $locationMount];
	}
918265
public function getForAsset(AssetInterface $asset)
    {
        $sourceRoot = $asset->getSourceRoot();
        if (!isset($this->bundleMap[$sourceRoot])) {
            throw new \Exception('Could not map the asset to a bundle');
        }

        // get the relative path
        $templateName = $asset->getSourcePath();
        // by convention, all symfony views are in Resources/views/, therefore remove this segment
        $templateName = str_replace('Resources/views/', '', $templateName);
        // remove the .ng extension (our convention)
        $templateName = str_replace('.ng', '', $templateName);
        // prepend bundle name
        $bundleName = $this->bundleMap[$sourceRoot];
        $templateName = sprintf('%s/%s', $bundleName, $templateName);

        return $templateName;
    }