src/Common/Service/Asset.php
public function load($mAssets, $sAssetLocation = 'APP', $sForceType = null): self
    {
        //  Cast as an array
        $aAssets = (array) $mAssets;

        // --------------------------------------------------------------------------

        //  Backwards compatibility
        $sAssetLocation = $sAssetLocation === true ? 'NAILS' : $sAssetLocation;

        // --------------------------------------------------------------------------

        switch (strtoupper($sAssetLocation)) {

            case 'NAILS-BOWER':

                $sAssetLocationMethod = 'loadNailsBower';
                break;

            case 'NAILS-PACKAGE':

                $sAssetLocationMethod = 'loadNailsPackage';
                break;

            case 'NAILS':

                $sAssetLocationMethod = 'loadNails';
                break;

            case 'APP-BOWER':
            case 'BOWER':

                $sAssetLocationMethod = 'loadAppBower';
                break;

            case 'APP-PACKAGE':
            case 'PACKAGE':

                $sAssetLocationMethod = 'loadAppPackage';
                break;

            case 'APP':

                $sAssetLocationMethod = 'loadApp';
                break;

            default:

                $sAssetLocationMethod = 'loadModule';
                break;
        }

        // --------------------------------------------------------------------------

        foreach ($aAssets as $sAsset) {

            if (preg_match('#^https?://#', $sAsset)) {

                $this->loadUrl($sAsset, $sForceType);

            } elseif (substr($sAsset, 0, 0) == '/') {

                $this->loadAbsolute(substr($sAsset, 1), $sForceType);

            } else {

                $this->{$sAssetLocationMethod}($sAsset, $sForceType, $sAssetLocation);
            }
        }

        // --------------------------------------------------------------------------

        return $this;
    }
public function load($mAssets, $sAssetLocation = 'APP', $sForceType = null): self
    {
        //  Cast as an array
        $aAssets = (array) $mAssets;

        // --------------------------------------------------------------------------

        //  Backwards compatibility
        $sAssetLocation = $sAssetLocation === true ? 'NAILS' : $sAssetLocation;

        // --------------------------------------------------------------------------

        switch (strtoupper($sAssetLocation)) {

            case 'NAILS-BOWER':

                $sAssetLocationMethod = 'loadNailsBower';
                break;

            case 'NAILS-PACKAGE':

                $sAssetLocationMethod = 'loadNailsPackage';
                break;

            case 'NAILS':

                $sAssetLocationMethod = 'loadNails';
                break;

            case 'APP-BOWER':
            case 'BOWER':

                $sAssetLocationMethod = 'loadAppBower';
                break;

            case 'APP-PACKAGE':
            case 'PACKAGE':

                $sAssetLocationMethod = 'loadAppPackage';
                break;

            case 'APP':

                $sAssetLocationMethod = 'loadApp';
                break;

            default:

                $sAssetLocationMethod = 'loadModule';
                break;
        }

        // --------------------------------------------------------------------------

        foreach ($aAssets as $sAsset) {

            if (preg_match('#^https?://#', $sAsset)) {

                $this->loadUrl($sAsset, $sForceType);

            } elseif (substr($sAsset, 0, 0) == '/') {

                $this->loadAbsolute(substr($sAsset, 1), $sForceType);

            } else {

                $this->{$sAssetLocationMethod}($sAsset, $sForceType, $sAssetLocation);
            }
        }

        // --------------------------------------------------------------------------

        return $this;
    }
public function load ( $ mAssets , $ sAssetLocation = 'APP' , $ sForceType = null ) : self { //  Cast as an array $ aAssets = ( array ) $ mAssets ; // -------------------------------------------------------------------------- //  Backwards compatibility $ sAssetLocation = $ sAssetLocation === true ? 'NAILS' : $ sAssetLocation ; // -------------------------------------------------------------------------- switch ( strtoupper ( $ sAssetLocation ) ) { case 'NAILS-BOWER' : $ sAssetLocationMethod = 'loadNailsBower' ; break ; case 'NAILS-PACKAGE' : $ sAssetLocationMethod = 'loadNailsPackage' ; break ; case 'NAILS' : $ sAssetLocationMethod = 'loadNails' ; break ; case 'APP-BOWER' : case 'BOWER' : $ sAssetLocationMethod = 'loadAppBower' ; break ; case 'APP-PACKAGE' : case 'PACKAGE' : $ sAssetLocationMethod = 'loadAppPackage' ; break ; case 'APP' : $ sAssetLocationMethod = 'loadApp' ; break ; default : $ sAssetLocationMethod = 'loadModule' ; break ; } // -------------------------------------------------------------------------- foreach ( $ aAssets as $ sAsset ) { if ( preg_match ( '#^https?://#' , $ sAsset ) ) { $ this -> loadUrl ( $ sAsset , $ sForceType ) ; } elseif ( substr ( $ sAsset , 0 , 0 ) == '/' ) { $ this -> loadAbsolute ( substr ( $ sAsset , 1 ) , $ sForceType ) ; } else { $ this -> { $ sAssetLocationMethod } ( $ sAsset , $ sForceType , $ sAssetLocation ) ; } } // -------------------------------------------------------------------------- return $ this ; }
Loads an asset

@param  mixed  $mAssets        The asset to load, can be an array or a string
@param  string $sAssetLocation The asset's location
@param  string $sForceType     The asset's file type (e.g., JS or CSS)

@return $this
Loads an asset