From adc78818406ecc0acb9417b6488b83e56b324771 Mon Sep 17 00:00:00 2001 From: Oliver Vogel Date: Sat, 26 Jul 2014 10:16:11 +0200 Subject: [PATCH] implemented "digit" type --- src/Intervention/Image/Gd/Commands/CropCommand.php | 8 ++++---- src/Intervention/Image/Gd/Commands/FillCommand.php | 4 ++-- src/Intervention/Image/Gd/Commands/FitCommand.php | 4 ++-- src/Intervention/Image/Gd/Commands/HeightenCommand.php | 2 +- src/Intervention/Image/Gd/Commands/InsertCommand.php | 4 ++-- src/Intervention/Image/Gd/Commands/PickColorCommand.php | 4 ++-- src/Intervention/Image/Gd/Commands/PixelCommand.php | 4 ++-- src/Intervention/Image/Gd/Commands/PixelateCommand.php | 2 +- .../Image/Gd/Commands/ResizeCanvasCommand.php | 4 ++-- src/Intervention/Image/Gd/Commands/WidenCommand.php | 2 +- src/Intervention/Image/Imagick/Commands/CropCommand.php | 8 ++++---- src/Intervention/Image/Imagick/Commands/FillCommand.php | 4 ++-- src/Intervention/Image/Imagick/Commands/FitCommand.php | 4 ++-- .../Image/Imagick/Commands/HeightenCommand.php | 2 +- src/Intervention/Image/Imagick/Commands/InsertCommand.php | 4 ++-- .../Image/Imagick/Commands/PickColorCommand.php | 4 ++-- src/Intervention/Image/Imagick/Commands/PixelCommand.php | 4 ++-- .../Image/Imagick/Commands/PixelateCommand.php | 2 +- .../Image/Imagick/Commands/ResizeCanvasCommand.php | 4 ++-- src/Intervention/Image/Imagick/Commands/WidenCommand.php | 2 +- 20 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/Intervention/Image/Gd/Commands/CropCommand.php b/src/Intervention/Image/Gd/Commands/CropCommand.php index a770470c..7255e166 100644 --- a/src/Intervention/Image/Gd/Commands/CropCommand.php +++ b/src/Intervention/Image/Gd/Commands/CropCommand.php @@ -15,10 +15,10 @@ class CropCommand extends ResizeCommand */ public function execute($image) { - $width = $this->argument(0)->type('integer')->required()->value(); - $height = $this->argument(1)->type('integer')->required()->value(); - $x = $this->argument(2)->type('integer')->value(); - $y = $this->argument(3)->type('integer')->value(); + $width = $this->argument(0)->type('digit')->required()->value(); + $height = $this->argument(1)->type('digit')->required()->value(); + $x = $this->argument(2)->type('digit')->value(); + $y = $this->argument(3)->type('digit')->value(); if (is_null($width) || is_null($height)) { throw new \Intervention\Image\Exception\InvalidArgumentException( diff --git a/src/Intervention/Image/Gd/Commands/FillCommand.php b/src/Intervention/Image/Gd/Commands/FillCommand.php index fa045ea3..0fc6e915 100644 --- a/src/Intervention/Image/Gd/Commands/FillCommand.php +++ b/src/Intervention/Image/Gd/Commands/FillCommand.php @@ -16,8 +16,8 @@ class FillCommand extends \Intervention\Image\Commands\AbstractCommand public function execute($image) { $filling = $this->argument(0)->value(); - $x = $this->argument(1)->type('integer')->value(); - $y = $this->argument(2)->type('integer')->value(); + $x = $this->argument(1)->type('digit')->value(); + $y = $this->argument(2)->type('digit')->value(); $width = $image->getWidth(); $height = $image->getHeight(); diff --git a/src/Intervention/Image/Gd/Commands/FitCommand.php b/src/Intervention/Image/Gd/Commands/FitCommand.php index 1968d595..c49afc82 100644 --- a/src/Intervention/Image/Gd/Commands/FitCommand.php +++ b/src/Intervention/Image/Gd/Commands/FitCommand.php @@ -15,8 +15,8 @@ class FitCommand extends ResizeCommand */ public function execute($image) { - $width = $this->argument(0)->type('integer')->required()->value(); - $height = $this->argument(1)->type('integer')->value($width); + $width = $this->argument(0)->type('digit')->required()->value(); + $height = $this->argument(1)->type('digit')->value($width); // calculate size $fitted = $image->getSize()->fit(new Size($width, $height)); diff --git a/src/Intervention/Image/Gd/Commands/HeightenCommand.php b/src/Intervention/Image/Gd/Commands/HeightenCommand.php index 6df46564..d5272a59 100644 --- a/src/Intervention/Image/Gd/Commands/HeightenCommand.php +++ b/src/Intervention/Image/Gd/Commands/HeightenCommand.php @@ -12,7 +12,7 @@ class HeightenCommand extends ResizeCommand */ public function execute($image) { - $height = $this->argument(0)->type('integer')->required()->value(); + $height = $this->argument(0)->type('digit')->required()->value(); $this->arguments[0] = null; $this->arguments[1] = $height; diff --git a/src/Intervention/Image/Gd/Commands/InsertCommand.php b/src/Intervention/Image/Gd/Commands/InsertCommand.php index 884e76c1..ed24154c 100644 --- a/src/Intervention/Image/Gd/Commands/InsertCommand.php +++ b/src/Intervention/Image/Gd/Commands/InsertCommand.php @@ -14,8 +14,8 @@ class InsertCommand extends \Intervention\Image\Commands\AbstractCommand { $source = $this->argument(0)->required()->value(); $position = $this->argument(1)->type('string')->value(); - $x = $this->argument(2)->type('integer')->value(0); - $y = $this->argument(3)->type('integer')->value(0); + $x = $this->argument(2)->type('digit')->value(0); + $y = $this->argument(3)->type('digit')->value(0); // build watermark $watermark = $image->getDriver()->init($source); diff --git a/src/Intervention/Image/Gd/Commands/PickColorCommand.php b/src/Intervention/Image/Gd/Commands/PickColorCommand.php index b09807b7..09fb1c11 100644 --- a/src/Intervention/Image/Gd/Commands/PickColorCommand.php +++ b/src/Intervention/Image/Gd/Commands/PickColorCommand.php @@ -14,8 +14,8 @@ class PickColorCommand extends \Intervention\Image\Commands\AbstractCommand */ public function execute($image) { - $x = $this->argument(0)->type('integer')->required()->value(); - $y = $this->argument(1)->type('integer')->required()->value(); + $x = $this->argument(0)->type('digit')->required()->value(); + $y = $this->argument(1)->type('digit')->required()->value(); $format = $this->argument(2)->type('string')->value('array'); // pick color diff --git a/src/Intervention/Image/Gd/Commands/PixelCommand.php b/src/Intervention/Image/Gd/Commands/PixelCommand.php index f4039392..e1d30b6b 100644 --- a/src/Intervention/Image/Gd/Commands/PixelCommand.php +++ b/src/Intervention/Image/Gd/Commands/PixelCommand.php @@ -16,8 +16,8 @@ class PixelCommand extends \Intervention\Image\Commands\AbstractCommand { $color = $this->argument(0)->required()->value(); $color = new Color($color); - $x = $this->argument(1)->type('integer')->required()->value(); - $y = $this->argument(2)->type('integer')->required()->value(); + $x = $this->argument(1)->type('digit')->required()->value(); + $y = $this->argument(2)->type('digit')->required()->value(); return imagesetpixel($image->getCore(), $x, $y, $color->getInt()); } diff --git a/src/Intervention/Image/Gd/Commands/PixelateCommand.php b/src/Intervention/Image/Gd/Commands/PixelateCommand.php index 76cf902d..fc722209 100644 --- a/src/Intervention/Image/Gd/Commands/PixelateCommand.php +++ b/src/Intervention/Image/Gd/Commands/PixelateCommand.php @@ -12,7 +12,7 @@ class PixelateCommand extends \Intervention\Image\Commands\AbstractCommand */ public function execute($image) { - $size = $this->argument(0)->type('integer')->value(10); + $size = $this->argument(0)->type('digit')->value(10); return imagefilter($image->getCore(), IMG_FILTER_PIXELATE, $size, true); } diff --git a/src/Intervention/Image/Gd/Commands/ResizeCanvasCommand.php b/src/Intervention/Image/Gd/Commands/ResizeCanvasCommand.php index 4d886cff..176ab8df 100644 --- a/src/Intervention/Image/Gd/Commands/ResizeCanvasCommand.php +++ b/src/Intervention/Image/Gd/Commands/ResizeCanvasCommand.php @@ -15,8 +15,8 @@ class ResizeCanvasCommand extends \Intervention\Image\Commands\AbstractCommand */ public function execute($image) { - $width = $this->argument(0)->type('integer')->required()->value(); - $height = $this->argument(1)->type('integer')->required()->value(); + $width = $this->argument(0)->type('digit')->required()->value(); + $height = $this->argument(1)->type('digit')->required()->value(); $anchor = $this->argument(2)->value('center'); $relative = $this->argument(3)->type('boolean')->value(); $bgcolor = $this->argument(4)->value(); diff --git a/src/Intervention/Image/Gd/Commands/WidenCommand.php b/src/Intervention/Image/Gd/Commands/WidenCommand.php index edb4350c..23520965 100644 --- a/src/Intervention/Image/Gd/Commands/WidenCommand.php +++ b/src/Intervention/Image/Gd/Commands/WidenCommand.php @@ -12,7 +12,7 @@ class WidenCommand extends ResizeCommand */ public function execute($image) { - $width = $this->argument(0)->type('integer')->required()->value(); + $width = $this->argument(0)->type('digit')->required()->value(); $this->arguments[0] = $width; $this->arguments[1] = null; diff --git a/src/Intervention/Image/Imagick/Commands/CropCommand.php b/src/Intervention/Image/Imagick/Commands/CropCommand.php index ab3e3dae..a2fb8cea 100644 --- a/src/Intervention/Image/Imagick/Commands/CropCommand.php +++ b/src/Intervention/Image/Imagick/Commands/CropCommand.php @@ -15,10 +15,10 @@ class CropCommand extends \Intervention\Image\Commands\AbstractCommand */ public function execute($image) { - $width = $this->argument(0)->type('integer')->required()->value(); - $height = $this->argument(1)->type('integer')->required()->value(); - $x = $this->argument(2)->type('integer')->value(); - $y = $this->argument(3)->type('integer')->value(); + $width = $this->argument(0)->type('digit')->required()->value(); + $height = $this->argument(1)->type('digit')->required()->value(); + $x = $this->argument(2)->type('digit')->value(); + $y = $this->argument(3)->type('digit')->value(); if (is_null($width) || is_null($height)) { throw new \Intervention\Image\Exception\InvalidArgumentException( diff --git a/src/Intervention/Image/Imagick/Commands/FillCommand.php b/src/Intervention/Image/Imagick/Commands/FillCommand.php index 85b42870..92acdf67 100644 --- a/src/Intervention/Image/Imagick/Commands/FillCommand.php +++ b/src/Intervention/Image/Imagick/Commands/FillCommand.php @@ -17,8 +17,8 @@ class FillCommand extends \Intervention\Image\Commands\AbstractCommand public function execute($image) { $filling = $this->argument(0)->value(); - $x = $this->argument(1)->type('integer')->value(); - $y = $this->argument(2)->type('integer')->value(); + $x = $this->argument(1)->type('digit')->value(); + $y = $this->argument(2)->type('digit')->value(); $imagick = $image->getCore(); diff --git a/src/Intervention/Image/Imagick/Commands/FitCommand.php b/src/Intervention/Image/Imagick/Commands/FitCommand.php index 8947b71f..7061b9ec 100644 --- a/src/Intervention/Image/Imagick/Commands/FitCommand.php +++ b/src/Intervention/Image/Imagick/Commands/FitCommand.php @@ -14,8 +14,8 @@ class FitCommand extends \Intervention\Image\Commands\AbstractCommand */ public function execute($image) { - $width = $this->argument(0)->type('integer')->required()->value(); - $height = $this->argument(1)->type('integer')->value($width); + $width = $this->argument(0)->type('digit')->required()->value(); + $height = $this->argument(1)->type('digit')->value($width); // calculate size $fitted = $image->getSize()->fit(new Size($width, $height)); diff --git a/src/Intervention/Image/Imagick/Commands/HeightenCommand.php b/src/Intervention/Image/Imagick/Commands/HeightenCommand.php index 47a38712..3d530c63 100644 --- a/src/Intervention/Image/Imagick/Commands/HeightenCommand.php +++ b/src/Intervention/Image/Imagick/Commands/HeightenCommand.php @@ -12,7 +12,7 @@ class HeightenCommand extends ResizeCommand */ public function execute($image) { - $height = $this->argument(0)->type('integer')->required()->value(); + $height = $this->argument(0)->type('digit')->required()->value(); $this->arguments[0] = null; $this->arguments[1] = $height; diff --git a/src/Intervention/Image/Imagick/Commands/InsertCommand.php b/src/Intervention/Image/Imagick/Commands/InsertCommand.php index 24d535bc..7594fec3 100644 --- a/src/Intervention/Image/Imagick/Commands/InsertCommand.php +++ b/src/Intervention/Image/Imagick/Commands/InsertCommand.php @@ -14,8 +14,8 @@ class InsertCommand extends \Intervention\Image\Commands\AbstractCommand { $source = $this->argument(0)->required()->value(); $position = $this->argument(1)->type('string')->value(); - $x = $this->argument(2)->type('integer')->value(0); - $y = $this->argument(3)->type('integer')->value(0); + $x = $this->argument(2)->type('digit')->value(0); + $y = $this->argument(3)->type('digit')->value(0); // build watermark $watermark = $image->getDriver()->init($source); diff --git a/src/Intervention/Image/Imagick/Commands/PickColorCommand.php b/src/Intervention/Image/Imagick/Commands/PickColorCommand.php index e00ed3bb..77a70815 100644 --- a/src/Intervention/Image/Imagick/Commands/PickColorCommand.php +++ b/src/Intervention/Image/Imagick/Commands/PickColorCommand.php @@ -14,8 +14,8 @@ class PickColorCommand extends \Intervention\Image\Commands\AbstractCommand */ public function execute($image) { - $x = $this->argument(0)->type('integer')->required()->value(); - $y = $this->argument(1)->type('integer')->required()->value(); + $x = $this->argument(0)->type('digit')->required()->value(); + $y = $this->argument(1)->type('digit')->required()->value(); $format = $this->argument(2)->type('string')->value('array'); // pick color diff --git a/src/Intervention/Image/Imagick/Commands/PixelCommand.php b/src/Intervention/Image/Imagick/Commands/PixelCommand.php index 924a8fd6..92c11ce5 100644 --- a/src/Intervention/Image/Imagick/Commands/PixelCommand.php +++ b/src/Intervention/Image/Imagick/Commands/PixelCommand.php @@ -16,8 +16,8 @@ class PixelCommand extends \Intervention\Image\Commands\AbstractCommand { $color = $this->argument(0)->required()->value(); $color = new Color($color); - $x = $this->argument(1)->type('integer')->required()->value(); - $y = $this->argument(2)->type('integer')->required()->value(); + $x = $this->argument(1)->type('digit')->required()->value(); + $y = $this->argument(2)->type('digit')->required()->value(); // prepare pixel $draw = new \ImagickDraw; diff --git a/src/Intervention/Image/Imagick/Commands/PixelateCommand.php b/src/Intervention/Image/Imagick/Commands/PixelateCommand.php index c575d5ce..8859f963 100644 --- a/src/Intervention/Image/Imagick/Commands/PixelateCommand.php +++ b/src/Intervention/Image/Imagick/Commands/PixelateCommand.php @@ -12,7 +12,7 @@ class PixelateCommand extends \Intervention\Image\Commands\AbstractCommand */ public function execute($image) { - $size = $this->argument(0)->type('integer')->value(10); + $size = $this->argument(0)->type('digit')->value(10); $width = $image->getWidth(); $height = $image->getHeight(); diff --git a/src/Intervention/Image/Imagick/Commands/ResizeCanvasCommand.php b/src/Intervention/Image/Imagick/Commands/ResizeCanvasCommand.php index c8a04484..067cc4f7 100644 --- a/src/Intervention/Image/Imagick/Commands/ResizeCanvasCommand.php +++ b/src/Intervention/Image/Imagick/Commands/ResizeCanvasCommand.php @@ -12,8 +12,8 @@ class ResizeCanvasCommand extends \Intervention\Image\Commands\AbstractCommand */ public function execute($image) { - $width = $this->argument(0)->type('integer')->required()->value(); - $height = $this->argument(1)->type('integer')->required()->value(); + $width = $this->argument(0)->type('digit')->required()->value(); + $height = $this->argument(1)->type('digit')->required()->value(); $anchor = $this->argument(2)->value('center'); $relative = $this->argument(3)->type('boolean')->value(); $bgcolor = $this->argument(4)->value(); diff --git a/src/Intervention/Image/Imagick/Commands/WidenCommand.php b/src/Intervention/Image/Imagick/Commands/WidenCommand.php index 54551163..23a52b40 100644 --- a/src/Intervention/Image/Imagick/Commands/WidenCommand.php +++ b/src/Intervention/Image/Imagick/Commands/WidenCommand.php @@ -12,7 +12,7 @@ class WidenCommand extends ResizeCommand */ public function execute($image) { - $width = $this->argument(0)->type('integer')->required()->value(); + $width = $this->argument(0)->type('digit')->required()->value(); $this->arguments[0] = $width; $this->arguments[1] = null;