Created
June 20, 2018 08:06
-
-
Save basz/28aa65863f363b163d031fdd985d4d35 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| /** | |
| * @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(); | |
| } |
This file contains hidden or 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
| $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