public function set($resource, $value)
    {
        $path = $this->getSourcePath($resource);

        if (!is_dir($dir = dirname($path)) && false === @mkdir($dir, 0777, true)) {
            // @codeCoverageIgnoreStart
            throw new \RuntimeException('Unable to create directory '.$dir);
            // @codeCoverageIgnoreEnd
        }

        if (false === @file_put_contents($path, sprintf("<?php\n\n// $resource\nreturn %s;\n", var_export($value, true)))) {
            // @codeCoverageIgnoreStart
            throw new \RuntimeException('Unable to write file '.$path);
            // @codeCoverageIgnoreEnd
        }
    }
public function set($resource, $value)
    {
        $path = $this->getSourcePath($resource);

        if (!is_dir($dir = dirname($path)) && false === @mkdir($dir, 0777, true)) {
            // @codeCoverageIgnoreStart
            throw new \RuntimeException('Unable to create directory '.$dir);
            // @codeCoverageIgnoreEnd
        }

        if (false === @file_put_contents($path, sprintf("<?php\n\n// $resource\nreturn %s;\n", var_export($value, true)))) {
            // @codeCoverageIgnoreStart
            throw new \RuntimeException('Unable to write file '.$path);
            // @codeCoverageIgnoreEnd
        }
    }
public function set ( $ resource , $ value ) { $ path = $ this -> getSourcePath ( $ resource ) ; if ( ! is_dir ( $ dir = dirname ( $ path ) ) && false === @ mkdir ( $ dir , 0777 , true ) ) { // @codeCoverageIgnoreStart throw new \ RuntimeException ( 'Unable to create directory ' . $ dir ) ; // @codeCoverageIgnoreEnd } if ( false === @ file_put_contents ( $ path , sprintf ( "<?php\n\n// $resource\nreturn %s;\n" , var_export ( $ value , true ) ) ) ) { // @codeCoverageIgnoreStart throw new \ RuntimeException ( 'Unable to write file ' . $ path ) ; // @codeCoverageIgnoreEnd } }
Writes a value to a file.

@param string $resource A cache key
@param mixed  $value    A value to cache
Writes a value to a file .