src/Service/Cdn.php
protected function formatBucket(&$bucket)
    {
        $bucket->id          = (int) $bucket->id;
        $bucket->max_size    = (int) $bucket->max_size;
        $bucket->modified_by = (int) $bucket->modified_by ?: null;

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

        if (!empty($bucket->allowed_types)) {
            if (strpos($bucket->allowed_types, '|') !== false) {
                $aAllowedTypes = explode('|', $bucket->allowed_types);
            } else {
                $aAllowedTypes = explode(',', $bucket->allowed_types);
            }
        } else {
            $aAllowedTypes = $this->aDefaultAllowedTypes;
        }

        $aAllowedTypes = array_map(
            function ($sExt) {
                return preg_replace('/^\./', '', trim($sExt));
            },
            $aAllowedTypes
        );

        $aAllowedTypes = array_map([$this, 'sanitiseExtension'], $aAllowedTypes);
        $aAllowedTypes = array_unique($aAllowedTypes);
        $aAllowedTypes = array_values($aAllowedTypes);

        $bucket->allowed_types = $aAllowedTypes;

        if (isset($bucket->objectCount)) {
            $bucket->objectCount = (int) $bucket->objectCount;
        }
    }
protected function formatBucket(&$bucket)
    {
        $bucket->id          = (int) $bucket->id;
        $bucket->max_size    = (int) $bucket->max_size;
        $bucket->modified_by = (int) $bucket->modified_by ?: null;

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

        if (!empty($bucket->allowed_types)) {
            if (strpos($bucket->allowed_types, '|') !== false) {
                $aAllowedTypes = explode('|', $bucket->allowed_types);
            } else {
                $aAllowedTypes = explode(',', $bucket->allowed_types);
            }
        } else {
            $aAllowedTypes = $this->aDefaultAllowedTypes;
        }

        $aAllowedTypes = array_map(
            function ($sExt) {
                return preg_replace('/^\./', '', trim($sExt));
            },
            $aAllowedTypes
        );

        $aAllowedTypes = array_map([$this, 'sanitiseExtension'], $aAllowedTypes);
        $aAllowedTypes = array_unique($aAllowedTypes);
        $aAllowedTypes = array_values($aAllowedTypes);

        $bucket->allowed_types = $aAllowedTypes;

        if (isset($bucket->objectCount)) {
            $bucket->objectCount = (int) $bucket->objectCount;
        }
    }
protected function formatBucket ( & $ bucket ) { $ bucket -> id = ( int ) $ bucket -> id ; $ bucket -> max_size = ( int ) $ bucket -> max_size ; $ bucket -> modified_by = ( int ) $ bucket -> modified_by ? : null ; // -------------------------------------------------------------------------- if ( ! empty ( $ bucket -> allowed_types ) ) { if ( strpos ( $ bucket -> allowed_types , '|' ) !== false ) { $ aAllowedTypes = explode ( '|' , $ bucket -> allowed_types ) ; } else { $ aAllowedTypes = explode ( ',' , $ bucket -> allowed_types ) ; } } else { $ aAllowedTypes = $ this -> aDefaultAllowedTypes ; } $ aAllowedTypes = array_map ( function ( $ sExt ) { return preg_replace ( '/^\./' , '' , trim ( $ sExt ) ) ; } , $ aAllowedTypes ) ; $ aAllowedTypes = array_map ( [ $ this , 'sanitiseExtension' ] , $ aAllowedTypes ) ; $ aAllowedTypes = array_unique ( $ aAllowedTypes ) ; $ aAllowedTypes = array_values ( $ aAllowedTypes ) ; $ bucket -> allowed_types = $ aAllowedTypes ; if ( isset ( $ bucket -> objectCount ) ) { $ bucket -> objectCount = ( int ) $ bucket -> objectCount ; } }
Formats a bucket object

@param object $bucket The bucket to format

@return  void
Formats a bucket object