for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace PragmaRX\Random\Generators;
trait IntegerGenerator
{
protected $start = 0;
protected $end = PHP_INT_MAX;
/**
* Set numeric end.
*
* @param int $end
* @return $this
*/
public function end($end)
$this->end = $end;
return $this;
}
* Generate a random integer.
* @return int
protected function generateInteger()
return $this->generateRandomInt($this->getStart(), $this->getEnd());
* @param int $start
protected function generateRandomInt($start, $end)
return random_int($start, $end);
* Get numeric end.
public function getEnd()
return $this->end;
* Get numeric start.
public function getStart()
return $this->start;
* Set numeric start.
public function start($start)
$this->start = $start;