for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the BenGorFile package.
*
* (c) Beñat Espiña <[email protected]>
* (c) Gorka Laucirica <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace BenGorFile\File\Domain\Model;
use Ramsey\Uuid\Uuid;
/**
* File id domain class.
* @author Beñat Espiña <[email protected]>
* @author Gorka Laucirica <[email protected]>
class FileId
{
* The id in a primitive type.
* @var string|int
private $id;
* Constructor.
* @param string|int|null $anId The id in a primitive type
public function __construct($anId = null)
$this->id = null === $anId ? Uuid::uuid4()->toString() : $anId;
}
* Gets the id.
* @return string|int
public function id()
return $this->id;
* Method that checks if the id given is equal to the current.
* @param FileId $anId The id
* @return bool
public function equals(FileId $anId)
return $this->id() === $anId->id();
* Magic method that represents the file id in string format.
* @return string
public function __toString()
return $this->id();