for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Equip\ValueObject;
use InvalidArgumentException;
class Identifier
{
/**
* @var int|null
*/
private $id;
public function __construct($id, $is_required = true)
if (empty($id) && !$is_required) {
$this->id = null;
} elseif ($id > 0) {
$this->id = (int) $id;
} else {
throw new InvalidArgumentException(sprintf('`%d` must be a valid identifier', $id));
}
public function value()
return $this->id;