for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Balloon\Proxy;
use Balloon\Reader\IFileReader;
/**
* Class FileReaderProxy
* @package Balloon\Proxy
* @author Raphaël Lefebvre <[email protected]>
*/
class FileReaderProxy implements IFileReader, IProxy
{
* @var IFileReader
private $fileReader;
* @var FileReaderCache
private $cache;
* @var bool
private $isCached = false;
private $hasChanged = false;
* @param IFileReader $fileReader
* @param FileReaderCache $cache
public function __construct(IFileReader $fileReader, FileReaderCache $cache)
$this->fileReader = $fileReader;
$this->cache = $cache;
}
* @return mixed
public function read()
if(!$this->isCached){
$this->cache->write($this->fileReader->read());
$this->isCached = true;
return $this->cache->read();
* @param mixed $data
* @param int $mode
* @return int
public function write($data, $mode = 0)
$this->hasChanged = true;
return $this->cache->write($data, $mode);
public function flush()
if($this->hasChanged){
$this->hasChanged = false;
return $this->fileReader->write($this->cache->read());
return 0;
*
public function clear()
$this->invalidate();
$this->read();
integer|null
This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.
@return
public function invalidate()
$this->isCached = false;
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.