src/DotsUnited/BundleFu/Bundle.php
public function renderCss()
    {
        $cssFileList = $this->getCssFileList();

        if ($cssFileList->count() == 0) {
            return '';
        }

        $generate   = true;
        $bundlePath = $this->getCssBundlePath();

        if (!$this->getForce() && file_exists($bundlePath)) {
            $cacheTime = filemtime($bundlePath);

            if (false !== $cacheTime && $cacheTime >= $cssFileList->getMaxMTime()) {
                $generate = false;
            }
        }

        $bundleUrl = $this->getCssBundleUrl();

        if ($generate) {
            $data   = '';
            $filter = $this->getCssFilter();

            foreach ($cssFileList as $file => $fileInfo) {
                $data .= '/* --------- ' . $file . ' --------- */' . PHP_EOL;
                $contents = @file_get_contents($fileInfo->getPathname());
                if (!$contents) {
                    $data .= '/* FILE READ ERROR! */' . PHP_EOL;
                } else {
                    if (null !== $filter) {
                        $contents = $filter->filterFile($contents, $file, $fileInfo, $bundleUrl, $bundlePath);
                    }

                    $data .= $contents . PHP_EOL;
                }
            }

            if (null !== $filter) {
                $data = $filter->filter($data);
            }

            $cacheTime = $this->writeBundleFile($bundlePath, $data);
        }

        $template = $this->getCssTemplate();

        if (is_callable($template)) {
            return call_user_func($template, $bundleUrl, $cacheTime, $this->getRenderAsXhtml());
        }

        return sprintf(
            $template,
            $bundleUrl,
            $cacheTime,
            $this->getRenderAsXhtml() ? ' /' : ''
        );
    }
public function renderCss()
    {
        $cssFileList = $this->getCssFileList();

        if ($cssFileList->count() == 0) {
            return '';
        }

        $generate   = true;
        $bundlePath = $this->getCssBundlePath();

        if (!$this->getForce() && file_exists($bundlePath)) {
            $cacheTime = filemtime($bundlePath);

            if (false !== $cacheTime && $cacheTime >= $cssFileList->getMaxMTime()) {
                $generate = false;
            }
        }

        $bundleUrl = $this->getCssBundleUrl();

        if ($generate) {
            $data   = '';
            $filter = $this->getCssFilter();

            foreach ($cssFileList as $file => $fileInfo) {
                $data .= '/* --------- ' . $file . ' --------- */' . PHP_EOL;
                $contents = @file_get_contents($fileInfo->getPathname());
                if (!$contents) {
                    $data .= '/* FILE READ ERROR! */' . PHP_EOL;
                } else {
                    if (null !== $filter) {
                        $contents = $filter->filterFile($contents, $file, $fileInfo, $bundleUrl, $bundlePath);
                    }

                    $data .= $contents . PHP_EOL;
                }
            }

            if (null !== $filter) {
                $data = $filter->filter($data);
            }

            $cacheTime = $this->writeBundleFile($bundlePath, $data);
        }

        $template = $this->getCssTemplate();

        if (is_callable($template)) {
            return call_user_func($template, $bundleUrl, $cacheTime, $this->getRenderAsXhtml());
        }

        return sprintf(
            $template,
            $bundleUrl,
            $cacheTime,
            $this->getRenderAsXhtml() ? ' /' : ''
        );
    }
public function renderCss ( ) { $ cssFileList = $ this -> getCssFileList ( ) ; if ( $ cssFileList -> count ( ) == 0 ) { return '' ; } $ generate = true ; $ bundlePath = $ this -> getCssBundlePath ( ) ; if ( ! $ this -> getForce ( ) && file_exists ( $ bundlePath ) ) { $ cacheTime = filemtime ( $ bundlePath ) ; if ( false !== $ cacheTime && $ cacheTime >= $ cssFileList -> getMaxMTime ( ) ) { $ generate = false ; } } $ bundleUrl = $ this -> getCssBundleUrl ( ) ; if ( $ generate ) { $ data = '' ; $ filter = $ this -> getCssFilter ( ) ; foreach ( $ cssFileList as $ file => $ fileInfo ) { $ data .= '/* --------- ' . $ file . ' --------- */' . PHP_EOL ; $ contents = @ file_get_contents ( $ fileInfo -> getPathname ( ) ) ; if ( ! $ contents ) { $ data .= '/* FILE READ ERROR! */' . PHP_EOL ; } else { if ( null !== $ filter ) { $ contents = $ filter -> filterFile ( $ contents , $ file , $ fileInfo , $ bundleUrl , $ bundlePath ) ; } $ data .= $ contents . PHP_EOL ; } } if ( null !== $ filter ) { $ data = $ filter -> filter ( $ data ) ; } $ cacheTime = $ this -> writeBundleFile ( $ bundlePath , $ data ) ; } $ template = $ this -> getCssTemplate ( ) ; if ( is_callable ( $ template ) ) { return call_user_func ( $ template , $ bundleUrl , $ cacheTime , $ this -> getRenderAsXhtml ( ) ) ; } return sprintf ( $ template , $ bundleUrl , $ cacheTime , $ this -> getRenderAsXhtml ( ) ? ' /' : '' ) ; }
Render out the css bundle.

@return string
Render out the css bundle .