for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Nord\Lumen\Core\Domain;
use Crisu83\ShortId\ShortId;
use Nord\Lumen\Core\Contracts\ValueObject;
class DomainId implements ValueObject
{
/**
* @var string
*/
private $value;
* @var \Crisu83\ShortId\ShortId
private static $identityGenerator;
* DomainId constructor.
*
* @param string $value
public function __construct($value = null)
$this->value = $value === null ? $this->nextIdentity() : $value;
}
* @return string
private static function nextIdentity()
if (self::$identityGenerator === null) {
self::$identityGenerator = ShortId::create();
return self::$identityGenerator->generate();
public function getValue()
return $this->value;
public function __toString()
return $this->getValue();