for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Arp\Entity;
/**
* Default trait implementation of the \Arp\Entity\EntityInterface
*
* @author Alex Patterson <[email protected]>
* @package Arp\Entity
*/
trait EntityTrait
{
* @var string|null
protected ?string $id = null;
* Return the entity's identity.
* @return string|null
public function getId(): ?string
return $this->id;
}
* Set the entity's identity.
* @param string|null $id The identity that should be set.
public function setId(?string $id): void
$this->id = $id;
* Check if the identity has been set.
* @return bool
public function hasId(): bool
return !empty($this->id);
* Check if the provided id matches the $id provided.
* @param string $id The identity that should be compared.
public function isId(string $id): bool
return ($id === $this->id);