/**
* Constructor.
*
* @param IResult $result Result to decorate.
*/
public function __construct(IResult $result)
{
parent::__construct($result);
// Reset timeout flag. This is because wait-for-digit returns 0 on timeout
// and the result is the ascii char of the digit read, while other read
// functions return the digits and (timeout) on data to signal a timeout.
$this->timeout = false;
$this->digits = $result->getResult();
if ($result->hasData()) {
$this->timeout = strpos($result->getData(), '(timeout)') !== false;
}
}