for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Genkgo\Mail\Protocol\Imap\MessageData\Item;
use Genkgo\Mail\Protocol\Imap\MessageData\ItemInterface;
final class NameItem implements ItemInterface
{
/**
* @var string
*/
private $name;
private const VALID_CHAR = "ABCDEFGHIJKLMNOPQRSTUVWXYZ.+-";
* @param string $name
public function __construct(string $name)
if (\strlen($name) !== \strspn($name, self::VALID_CHAR)) {
throw new \InvalidArgumentException('Name can only contain uppercase A-Z chars: ' . $name);
}
$this->name = $name;
* @return string
public function getName(): string
return $this->name;
public function __toString(): string