Skip to content

Instantly share code, notes, and snippets.

@mcsee
Last active February 20, 2025 19:10
This gist belongs to Clean Code Cookbook http://cleancodecookbook.com By Maximiliano Contieri http://maximilianocontieri.com
<?
final class Window {
private $width;
private $height;
private $children;
public function width() {
return $this->width;
}
public function area() {
return $this->height * $this->width;
}
public function addChildren($aChild) {
// Do not expose internal attributes
return $this->children[] = $aChild;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment