Skip to content

Instantly share code, notes, and snippets.

@bzikarsky
Last active December 31, 2015 23:39
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 bzikarsky/8061307 to your computer and use it in GitHub Desktop.
Save bzikarsky/8061307 to your computer and use it in GitHub Desktop.
Immutable ValueObject example
<?php
class ValueObject
{
protected $checked;
protected $value;
protected $exists;
public function __construct($checked = false, $exists = false, $value = null)
{
$this->checked = $checked;
$this->exists = $exists;
$this->value = $value;
}
public function exists()
{
return $this->exists;
}
public function checked()
{
return $this->checked;
}
public function getValue()
{
return $this->value;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment