Skip to content

Instantly share code, notes, and snippets.

@genkovich
Last active March 4, 2021 11:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save genkovich/955bd50ea3cb01fec55fdd6d5d5265c4 to your computer and use it in GitHub Desktop.
Save genkovich/955bd50ea3cb01fec55fdd6d5d5265c4 to your computer and use it in GitHub Desktop.
<?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