Example #1
0
 public function factorySetLengthRight($lengthRight)
 {
     if (!Validator::isNumber($lengthRight)) {
         throw new IllegalArgumentException();
     }
     return new Rectangle($this->pointLeftUp, $this->lengthDown, $lengthRight);
 }
Example #2
0
 public function __construct($x, $y, $z)
 {
     parent::__construct($x, $y);
     if (!Validator::isNumber($z)) {
         throw new IllegalArgumentException();
     }
     $this->z = $z;
 }
Example #3
0
 public function __construct($x, $y)
 {
     parent::__construct();
     if (!Validator::isNumber($x) || !Validator::isNumber($y)) {
         throw new IllegalArgumentException();
     }
     $this->x = $x;
     $this->y = $y;
 }
Example #4
0
 public function __construct($width, $height, $trueColor = FALSE)
 {
     parent::__construct();
     if (!Validator::isNumber($width) || !Validator::isNumber($height)) {
         throw new IllegalArgumentException();
     }
     $this->imageResource = $trueColor == TRUE ? imagecreatetruecolor($width, $height) : imagecreate($width, $height);
     $this->height = $height;
     $this->width = $width;
 }
Example #5
0
 public function __construct(Point $pointLefUp, $length)
 {
     parent::__construct();
     if (!Validator::isNumber($length)) {
         throw new IllegalArgumentException();
     }
     $this->pointLeftUp = $pointLefUp;
     $this->pointLeftDown = new Point($this->pointLeftUp->getX(), $this->pointLeftUp->getY() - $length);
     $this->pointRightDown = new Point($this->pointLeftUp->getX() + $length, $this->pointLeftUp->getY() - $length);
     $this->pointRightUp = new Point($this->pointLeftUp->getX(), $this->pointLeftUp->getY() + $length);
     $this->length = $length;
 }
Example #6
0
 public function __construct($width = 400, $height = 200)
 {
     parent::__construct();
     if (!Validator::isNumber($width) || Validator::isNumber($height)) {
         throw new IllegalArgumentException();
     }
     $this->captcha = new Images($width, $height);
     $this->captcha->setBackgroundColor(new Color(0, 0, 0));
     $this->captcha->setTextColor(new Color(255, 255, 255));
     $string = new StringW(Hash::r());
     $this->text = $string->subString(0, Math::randomInterval(6, 8));
     $this->captcha->setText(Math::randomInterval(2, 6), new Point(0, 0), $string, FALSE);
 }
Example #7
0
 public static function checkColor($red = 0, $green = 0, $blue = 0)
 {
     if (!Validator::isNumber($red) || !Validator::isNumber($green) || !Validator::isNumber($blue)) {
         throw new IllegalArgumentException();
     }
     if ($red < 0 || $red > 255) {
         throw new RedColorException();
     }
     if ($green < 0 || $green > 255) {
         throw new GreenColorException();
     }
     if ($blue < 0 || $blue > 255) {
         throw new BlueColorException();
     }
     return TRUE;
 }
Example #8
0
 public function numberSub($number)
 {
     if (!Validator::isNumber($number)) {
         throw new IllegalArgumentException();
     }
     $newMatrix = [];
     for ($i = 0; $i < $this->getMatrixSizeA(); $i++) {
         for ($j = 0; $j < $this->getMatrixSizeB(); $j++) {
             $newMatrix[$i][$j] = $this->getMatrix()[$i][$j] / $number;
         }
     }
     return new Matrix($newMatrix);
 }
Example #9
0
 public function charAt($x)
 {
     if (!Validator::isNumber($x) || $x < 0 || $x > mb_strlen($this->string, 'UTF-8') - 1) {
         throw new IllegalArgumentException();
     }
     return new Character($this->string[$x]);
 }