for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types = 1);
namespace drupol\valuewrapper\Type;
use drupol\valuewrapper\AbstractValue;
use drupol\valuewrapper\ValueInterface;
/**
* Class TypeValue
*/
abstract class TypeValue extends AbstractValue implements TypeValueInterface
{
* {@inheritdoc}
public function hash(): string
return $this->doHash(var_export($this->value(), true));
}
protected function doHash(string $string) : string
return parent::doHash($this->type() . $string);
public function type() : string
return \gettype($this->value());
public function equals(ValueInterface $item, $strict = true) : bool
return ($strict === true) ?
$this === $item:
$this == $item;
public function serialize()
return \serialize([
'value' => $this->value(),
]);
public function unserialize($serialized)
$unserialize = \unserialize($serialized);
$this->set($unserialize['value']);
public function __toString(): string
return (string) $this->value();
public function __toArray(): array
return (array) $this->value();