public function __construct($cb = null) { $this->state = self::STATE_WAITING; if ($cb !== null) { $this->addListener($cb); } }