Exemple #1
0
 public function __construct($debug)
 {
     if (!Validator::isBool($debug)) {
         throw new IllegalArgumentException();
     }
     $this->debug = $debug;
 }
Exemple #2
0
 public function factorySetLengthRight($lengthRight)
 {
     if (!Validator::isNumber($lengthRight)) {
         throw new IllegalArgumentException();
     }
     return new Rectangle($this->pointLeftUp, $this->lengthDown, $lengthRight);
 }
Exemple #3
0
 public function __construct($double = 0.0)
 {
     parent::__construct();
     if (!Validator::isDouble($double)) {
         throw new IllegalArgumentException();
     }
     $this->double = $double;
 }
Exemple #4
0
 public function __construct($integer)
 {
     parent::__construct();
     if (!Validator::isInt($integer)) {
         throw new IllegalArgumentException();
     }
     $this->integer = $integer;
 }
Exemple #5
0
 public function __construct($boolean)
 {
     parent::__construct();
     if (!Validator::isBool($boolean)) {
         throw new IllegalArgumentException();
     }
     $this->boolean = $boolean;
 }
Exemple #6
0
 public function __construct($x, $y, $z)
 {
     parent::__construct($x, $y);
     if (!Validator::isNumber($z)) {
         throw new IllegalArgumentException();
     }
     $this->z = $z;
 }
Exemple #7
0
 public function __construct($char = '')
 {
     parent::__construct();
     if (!Validator::isChar($char)) {
         throw new IllegalArgumentException();
     }
     $this->char = $char;
 }
Exemple #8
0
 public function __construct($x, $y)
 {
     parent::__construct();
     if (!Validator::isNumber($x) || !Validator::isNumber($y)) {
         throw new IllegalArgumentException();
     }
     $this->x = $x;
     $this->y = $y;
 }
Exemple #9
0
 public function deepClone(&$object)
 {
     foreach ($object as &$val) {
         if (Validator::isObject($val)) {
             $val = clone $val;
         } elseif (Validator::isArray($val)) {
             $this->deepClone($val);
         }
     }
 }
Exemple #10
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;
 }
Exemple #11
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);
 }
Exemple #12
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;
 }
Exemple #13
0
 public function setSubject($subject)
 {
     if (!Validator::isEmpty($subject)) {
         throw new IllegalArgumentException('Prázdný text předmětu');
     }
     $this->subject = (string) $subject;
     return $this;
 }
Exemple #14
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);
 }
Exemple #15
0
 public final function moveUploaded($to)
 {
     if (!Validator::isDir($to)) {
         throw new IllegalArgumentException();
     }
     return move_uploaded_file($this->filePath, $to);
 }
Exemple #16
0
 public function toPNG()
 {
     if (Validator::isResource($this->imageResource)) {
         throw new RuntimeException();
     }
     imagepng($this->imageResource);
     imagedestroy($this->imageResource);
 }
Exemple #17
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]);
 }
Exemple #18
0
 public static final function isIPv6($ip)
 {
     return Validator::validateIPv6UsingFilter($ip);
 }
Exemple #19
0
 public static function validateDepend($depends)
 {
     if (!Validator::isArray($depends) || !Validator::isObject($depends)) {
         throw new IllegalArgumentException();
     }
 }