for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Bavix\Lumper;
use Bavix\Slice\Slice;
class Lumper
{
/**
* @var []
*/
protected $instances = [];
* @param callable $callback
*
* @return string
protected function _string(callable $callback)
return new Reflection\Func($callback);
}
* @param string $hash
protected function _unique(callable $callback, $hash)
if (null === $hash || $hash instanceof Slice)
$hash .= $this->_string($callback);
return $hash;
* @param string $unique
* @return mixed
public function once(callable $callback, $unique = null)
$_ = (string)$this->_unique($callback, $unique);
if (empty($this->instances[$_]))
$this->instances[$_] =
$unique instanceof Slice ?
$callback($unique) :
$callback();
return $this->instances[$_];