public function __toString() { // Ensure that the name property is cast as a string before returning. // This fixes the issue of PHP not bubbling down the __toString() // methods. // Oh and $name is a private variable so can not be accessed directly. // @see https://gist.github.com/lsjroberts/7084126 return (string) parent::__toString(); }