Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@cn007b
Last active August 16, 2018 13:09
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 cn007b/a72e6e0089e1304507db2e1f181fc8e8 to your computer and use it in GitHub Desktop.
Save cn007b/a72e6e0089e1304507db2e1f181fc8e8 to your computer and use it in GitHub Desktop.
Value Object instead of Form - ValueObject
<?php
class ValueObject
{
protected $name;
public function __construct(array $args)
{
if (!isset($args['name']) || $args['name'] === '') {
throw new InvalidArgumentException('name cannot be blank');
}
$this->name = $args['name'];
}
public function getName()
{
return $this->name;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment