/** * Set the radius in meters. * * @param int $meters * * @return self */ public function setRadius($meters) { Assertion::integer($meters); Assertion::range($meters, 1, 100000); $this->radius = $meters; return $this; }
/** * Set the limit. * * @param int $limit * * @return self */ public function setLimit($limit) { Assertion::integer($limit); Assertion::range($limit, 1, 50); $this->limit = $limit; return $this; }
/** * @test */ public function it_passes_values_and_constraints_to_exception() { try { Assertion::range(0, 10, 20); $this->fail('Exception expected'); } catch (AssertionFailedException $e) { $this->assertEquals(0, $e->getValue()); $this->assertEquals(array('min' => 10, 'max' => 20), $e->getConstraints()); } }
/** * Deflate constructor. * * @param int $compression_level */ public function __construct($compression_level = -1) { Assertion::integer($compression_level, 'The compression level can be given as 0 for no compression up to 9 for maximum compression. If -1 given, the default compression level will be the default compression level of the zlib library.'); Assertion::range($compression_level, -1, 9, 'The compression level can be given as 0 for no compression up to 9 for maximum compression. If -1 given, the default compression level will be the default compression level of the zlib library.'); $this->compression_level = $compression_level; }
public function inRange($value, $min, $max) { parent::range($value, $min, $max); }
/** * @param int $status */ private function setStatus($status) { Assertion::integer($status); Assertion::range($status, 0, 2); $this->status = $status; }
/** * @param integer $interval (1 or 2) * * @return History */ public function getDataPer30Minutes($interval = 1) { Assert::range($interval, 1, 2); $response = $this->browser->get($this->createDataUrl(self::TYPE_HISTORICAL, array('h' => $interval))); return $this->processHistoricalResponse($response); }