for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Nip\Dispatcher\Resolver\Cache;
/**
* Class FileManager
* @package Nip\Dispatcher\Resolver\Cache
*/
class FileManager
{
* @param DefinitionsCollection $definitionCollection
* @param null $path
$path
null
public static function write($definitionCollection, $path = null)
$path = $path ? $path : static::filePath();
false
$content = '<?php return ' . var_export($definitionCollection->all(), true) . ';';
file_put_contents($path, $content);
}
public static function read($definitionCollection, $path = null)
/** @noinspection PhpIncludeInspection */
$items = require $path;
$definitionCollection->replace($items);
public static function empty($path = null)
$content = '<?php return [];';
* @return bool
public static function hasCacheFile()
$path = static::filePath();
return is_file($path);
* @return string
public static function filePath()
return static::filePathBase() . '/dispatcher.php';
public static function filePathBase()
return function_exists('app') && app()->has('path.storage')
? app('path.storage') . DIRECTORY_SEPARATOR . 'cache'
app('path.storage')
mixed|object
concatenation
If this is a false-positive, you can also ignore this issue in your code via the ignore-type annotation
ignore-type
? /** @scrutinizer ignore-type */ app('path.storage') . DIRECTORY_SEPARATOR . 'cache'
: dirname(dirname(dirname(__DIR__))) . '/cache';