class Foo
{
private $protocol = 'http';
private $url = 'mysite.ru';
public function setProtocol(string $protocol): void
{
$this->protocol = $protocol;
}
public function getUrl(): string
{
return $this->protocol . '://' . $this->url;
}
}