public function writeFile($filePath, $fileContent, $createParentDir = false, $dirMask = 0750)
    {
        if ($createParentDir) {
            $parentDir = dirname($filePath);
            if (false === @file_exists($parentDir)) {
                if (false === @mkdir($parentDir, $dirMask, true)) {
                    throw new RuntimeException(sprintf('unable to create directory "%s"', $parentDir));
                }
            }
        }

        if (false === @file_put_contents($filePath, $fileContent)) {
            throw new RuntimeException(
                sprintf('unable to write file "%s"', $filePath)
            );
        }
    }