for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Tolerance package.
*
* (c) Samuel ROZE <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Tolerance\Waiter;
class TimeOut implements Waiter, StatefulWaiter
{
/**
* @var Waiter
private $delegateWaiter;
* @var integer
private $timeOut;
* @var float
private $secondsEllapsed;
* @var Waiter $delegateWaiter
* @var integer $timeOut
public function __construct(Waiter $delegateWaiter, $timeOut)
$this->delegateWaiter = $delegateWaiter;
$this->timeOut = $timeOut;
$this->secondsEllapsed = 0.0;
}
* {@inheritdoc}
public function wait($seconds = 1)
$this->delegateWaiter->wait($seconds);
$this->secondsEllapsed += $seconds;
if ($this->timeOut <= $this->secondsEllapsed) {
throw Exception\TimedOutExceeded::withValue($this->timeOut);
public function resetState()
$this->secondsEllapsed = 0;
$secondsEllapsed
double
0
integer
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.
$answer = 42; $correct = false; $correct = (bool) $answer;
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.