public function pickFrom(GetOpt\GetOpt $optionsFromCommandLine) { if ($option = $optionsFromCommandLine->getOption($this->name)) { return T\Interval::parse($option); } return $this->default; }
public function setUp() { $this->clock = T\clock()->stop(); $this->now = $this->clock->now(); $this->jobRepository = $this->getMockBuilder('Recruiter\\Job\\Repository')->disableOriginalConstructor()->getMock(); $this->mongoLock = $this->getMock('Onebip\\Concurrency\\Lock'); $this->cleaner = new Cleaner($this->jobRepository, $this->mongoLock); $this->interval = Interval::parse('10s'); }
private function validate($argument) { if (!is_null($argument)) { try { return T\Interval::parse($argument); } catch (T\InvalidIntervalFormat $e) { throw new UnexpectedValueException(sprintf("Option '%s' has an invalid value: %s", $this->name, $e->getMessage())); } } return $this->timeToWaitAtMost; }
/** * @expectedException Timeless\InvalidIntervalFormat */ public function testBadString() { Interval::parse('whatever'); }