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