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;
/**
* Class ParenthesizedList
* @package Genkgo\Mail\Protocol\Imap
*/
final class ParenthesizedList
{
* @var array
private $list = [];
* ParenthesizedList constructor.
* @param array $list
public function __construct(array $list = [])
$this->list = $list;
}
* @param string $name
* @return ParenthesizedList
public function with(string $name): self
$clone = clone $this;
$clone->list[] = $name;
return $clone;
* @return string
public function __toString(): string
if (empty($this->list)) {
return '';
return sprintf(
'(%s)',
implode(' ', $this->list)
);