Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
class ExampleValueObject
{
private string $value;
/**
* ExampleValueObject constructor.
*
* @param string $exampleValue some example value
*
*/
public function __construct(string $exampleValue)
{
if (empty($exampleValue)) {
throw new InvalidArgumentException('value is empty');
}
$this->value = $exampleValue;
}
/**
* @return string
*/
public function __toString() : string
{
return $this->value;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment