Last active
March 4, 2021 11:52
-
-
Save genkovich/955bd50ea3cb01fec55fdd6d5d5265c4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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