for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace InShore\Bookwhen\ValueObjects;
use InShore\Bookwhen\Contracts\StringableContract;
/**
* @internal
*/
final class ResourceUri implements StringableContract
{
* Creates a new ResourceUri value object.
private function __construct(private readonly string $uri)
// ..
}
* Creates a new ResourceUri value object that lists the given resource.
public static function list(string $resource): self
if (empty($resource)) {
throw new \InvalidArgumentException();
return new self($resource);
* Creates a new ResourceUri value object that retrieves the given resource.
public static function retrieve(string $resource, string $id): self
if (empty($resource) || empty($id)) {
return new self("{$resource}/{$id}");
* {@inheritDoc}
public function toString(): string
return $this->uri;