I was reading about Object Calisthenics and one of the rules was wrapping primitive types and strings:
class UIComponent {
public function repaint($animate = true)
{
//
}
}
$component->animate(false);
becomes:
class UIComponent {
public function repaint(Animate $animate)
{
//
}
}
class Animate {
private $animate;
public function __construct($animate = true)
{
$this->animate = $animate;
}
}
$component->animate(new Animate(false));
What advantages do I gain with this technique? In my opinion, I think it just complicated things and added more lines of code.