src/CSS/AbstractCompiler.php
public function compile($source, $destination = null, $include = null)
    {
        $include = array_merge($this->includes, (array) $include);
        
        $useCache = null == $destination && null !== $this->cache;
         
        if ($useCache) {
            if ($this->cache->hasItem($source)) {
                return $this->cache->getItem($source);
            }
        }

        $arguments = implode(' ', array_map('escapeshellarg', $this->arguments));
        $arguments .= ' ' . $this->getCommandArguments($source, $destination, $include);
        
        $command = "{$this->compiler} $arguments" . ' 2>&1'; 

        $result = exec($command, $output, $exitCode);
        if ($exitCode != 0) {
            throw new \Exception(sprintf('Error compiling CSS "%s": %s', 
                $source, 
                implode(PHP_EOL, $output)));
        }
        
        $css = implode(PHP_EOL, $output);
        
        if ($useCache) {
            $this->cache->setItem($source, $css);
        }
        
        return $css;
    }
public function compile($source, $destination = null, $include = null)
    {
        $include = array_merge($this->includes, (array) $include);
        
        $useCache = null == $destination && null !== $this->cache;
         
        if ($useCache) {
            if ($this->cache->hasItem($source)) {
                return $this->cache->getItem($source);
            }
        }

        $arguments = implode(' ', array_map('escapeshellarg', $this->arguments));
        $arguments .= ' ' . $this->getCommandArguments($source, $destination, $include);
        
        $command = "{$this->compiler} $arguments" . ' 2>&1'; 

        $result = exec($command, $output, $exitCode);
        if ($exitCode != 0) {
            throw new \Exception(sprintf('Error compiling CSS "%s": %s', 
                $source, 
                implode(PHP_EOL, $output)));
        }
        
        $css = implode(PHP_EOL, $output);
        
        if ($useCache) {
            $this->cache->setItem($source, $css);
        }
        
        return $css;
    }
public function compile ( $ source , $ destination = null , $ include = null ) { $ include = array_merge ( $ this -> includes , ( array ) $ include ) ; $ useCache = null == $ destination && null !== $ this -> cache ; if ( $ useCache ) { if ( $ this -> cache -> hasItem ( $ source ) ) { return $ this -> cache -> getItem ( $ source ) ; } } $ arguments = implode ( ' ' , array_map ( 'escapeshellarg' , $ this -> arguments ) ) ; $ arguments .= ' ' . $ this -> getCommandArguments ( $ source , $ destination , $ include ) ; $ command = "{$this->compiler} $arguments" . ' 2>&1' ; $ result = exec ( $ command , $ output , $ exitCode ) ; if ( $ exitCode != 0 ) { throw new \ Exception ( sprintf ( 'Error compiling CSS "%s": %s' , $ source , implode ( PHP_EOL , $ output ) ) ) ; } $ css = implode ( PHP_EOL , $ output ) ; if ( $ useCache ) { $ this -> cache -> setItem ( $ source , $ css ) ; } return $ css ; }
Compile to file. If destination is not specified return CSS.

@param string $source
@param string|null $destination
@param array|string|null $include Include path(s) to use
@throws \Exception on compilation error
@return string Compiled CSS
Compile to file . If destination is not specified return CSS .