DotsUnited\BundleFu\Bundle::writeBundleFile PHP Method

writeBundleFile() protected method

Write a bundle file to disk.
protected writeBundleFile ( string $bundlePath, string $data ) : integer
$bundlePath string
$data string
return integer
    protected function writeBundleFile($bundlePath, $data)
    {
        $dir = dirname($bundlePath);
        if (!file_exists($dir)) {
            mkdir($dir, 0777, true);
        }
        if (false === file_put_contents($bundlePath, $data, LOCK_EX)) {
            // @codeCoverageIgnoreStart
            throw new \RuntimeException('Cannot write cache file to "' . $bundlePath . '"');
            // @codeCoverageIgnoreEnd
        }
        return filemtime($bundlePath);
    }

Usage Example

 protected function writeBundleFile($bundlePath, $data)
 {
     if ($this->hasFsDirectorySupport()) {
         throw new \UnexpectedValueException("This filesystem doesn't support directories.");
     }
     return parent::writeBundleFile($bundlePath, $data);
 }