Skip to content

Instantly share code, notes, and snippets.

@basz
Created June 20, 2018 08:06
Show Gist options
  • Select an option

  • Save basz/28aa65863f363b163d031fdd985d4d35 to your computer and use it in GitHub Desktop.

Select an option

Save basz/28aa65863f363b163d031fdd985d4d35 to your computer and use it in GitHub Desktop.
/**
* @param Length $height
*
* @return Volume
*/
public function withHeight(Length $height): self
{
$new = clone $this;
$new->setHeight($height);
return $new;
}
/**
* @return Length
*/
public function getHeight(): Length
{
return $this->height;
}
/**
* @param Length $depth
*/
private function setDepth(Length $depth)
{
$this->depth = $depth;
$this->invalidateComputed();
}
$volume = Volume::create(Lenght::create(10, 'm'), Lenght::create(10, 'm'), Lenght::create(10, 'm'));
$volume = $volume->withHeight(Lenght::create(10, 'm'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment