for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Clippings\Freezable;
/**
* @author Haralan Dobrev <[email protected]>
* @copyright 2014, Clippings Ltd.
* @license http://spdx.org/licenses/BSD-3-Clause
*/
trait FreezableValueTrait
{
use FreezableTrait;
* {@inheritdoc}
public function performFreeze()
$this->freezeValue();
}
public function performUnfreeze()
$this->unfreezeValue();
* Get the value - either the frozen one or compute it dynamically
*
* @return mixed
public function getValue()
return $this->isFrozen()
? $this->getFrozenValue()
: $this->computeValue();
* @return self
public function freezeValue()
$this->setValue($this->getValue());
return $this;
public function unfreezeValue()
$this->setValue(null);
* Get frozen value
abstract public function getFrozenValue();
* Set the frozen value
* @param mixed $value
abstract public function setValue($value);
* Compute the value to be frozen
abstract public function computeValue();