src/Service/Cdn.php
public function urlServe($objectId, $forceDownload = false)
    {
        $isTrashed = false;

        if (empty($objectId)) {
            $oObj = $this->emptyObject();
        } elseif (is_numeric($objectId)) {

            $oObj = $this->getObject($objectId);

            if (!$oObj) {

                /**
                 * If the user is a logged in admin with can_browse_trash permission then have a look in the trash
                 */

                if (userHasPermission('admin:cdn:trash:browse')) {
                    $oObj = $this->getObjectFromTrash($objectId);
                    if (!$oObj) {
                        //  Cool, guess it really doesn't exist. Let the renderer show a bad_src graphic
                        $oObj = $this->emptyObject();
                    } else {
                        $isTrashed = true;
                    }
                } else {
                    //  Let the renderer show a bad_src graphic
                    $oObj = $this->emptyObject();
                }
            }
        } elseif (is_object($objectId)) {
            $oObj = $objectId;
        } else {
            throw new UrlException('Supplied $objectId must be numeric or an object', 1);
        }

        $url = $this->callDriver(
            'urlServe',
            [$oObj->file->name->disk, $oObj->bucket->slug, $forceDownload],
            $oObj->driver
        );
        $url .= $isTrashed ? '?trashed=1' : '';

        return $url;
    }
public function urlServe($objectId, $forceDownload = false)
    {
        $isTrashed = false;

        if (empty($objectId)) {
            $oObj = $this->emptyObject();
        } elseif (is_numeric($objectId)) {

            $oObj = $this->getObject($objectId);

            if (!$oObj) {

                /**
                 * If the user is a logged in admin with can_browse_trash permission then have a look in the trash
                 */

                if (userHasPermission('admin:cdn:trash:browse')) {
                    $oObj = $this->getObjectFromTrash($objectId);
                    if (!$oObj) {
                        //  Cool, guess it really doesn't exist. Let the renderer show a bad_src graphic
                        $oObj = $this->emptyObject();
                    } else {
                        $isTrashed = true;
                    }
                } else {
                    //  Let the renderer show a bad_src graphic
                    $oObj = $this->emptyObject();
                }
            }
        } elseif (is_object($objectId)) {
            $oObj = $objectId;
        } else {
            throw new UrlException('Supplied $objectId must be numeric or an object', 1);
        }

        $url = $this->callDriver(
            'urlServe',
            [$oObj->file->name->disk, $oObj->bucket->slug, $forceDownload],
            $oObj->driver
        );
        $url .= $isTrashed ? '?trashed=1' : '';

        return $url;
    }
public function urlServe ( $ objectId , $ forceDownload = false ) { $ isTrashed = false ; if ( empty ( $ objectId ) ) { $ oObj = $ this -> emptyObject ( ) ; } elseif ( is_numeric ( $ objectId ) ) { $ oObj = $ this -> getObject ( $ objectId ) ; if ( ! $ oObj ) { /**
                 * If the user is a logged in admin with can_browse_trash permission then have a look in the trash
                 */ if ( userHasPermission ( 'admin:cdn:trash:browse' ) ) { $ oObj = $ this -> getObjectFromTrash ( $ objectId ) ; if ( ! $ oObj ) { //  Cool, guess it really doesn't exist. Let the renderer show a bad_src graphic $ oObj = $ this -> emptyObject ( ) ; } else { $ isTrashed = true ; } } else { //  Let the renderer show a bad_src graphic $ oObj = $ this -> emptyObject ( ) ; } } } elseif ( is_object ( $ objectId ) ) { $ oObj = $ objectId ; } else { throw new UrlException ( 'Supplied $objectId must be numeric or an object' , 1 ) ; } $ url = $ this -> callDriver ( 'urlServe' , [ $ oObj -> file -> name -> disk , $ oObj -> bucket -> slug , $ forceDownload ] , $ oObj -> driver ) ; $ url .= $ isTrashed ? '?trashed=1' : '' ; return $ url ; }
Calls the driver's public urlServe method

@param int  $objectId      The ID of the object to serve
@param bool $forceDownload Whether or not to force download of the object

@return string
@throws UrlException
Calls the driver s public urlServe method