File indexing completed on 2025-01-26 05:29:13
0001 <?php 0002 0003 namespace Intervention\Image\Commands; 0004 0005 use Closure; 0006 0007 class EllipseCommand extends \Intervention\Image\Commands\AbstractCommand 0008 { 0009 /** 0010 * Draws ellipse on given image 0011 * 0012 * @param \Intervention\Image\Image $image 0013 * @return boolean 0014 */ 0015 public function execute($image) 0016 { 0017 $width = $this->argument(0)->type('numeric')->required()->value(); 0018 $height = $this->argument(1)->type('numeric')->required()->value(); 0019 $x = $this->argument(2)->type('numeric')->required()->value(); 0020 $y = $this->argument(3)->type('numeric')->required()->value(); 0021 $callback = $this->argument(4)->type('closure')->value(); 0022 0023 $ellipse_classname = sprintf('\Intervention\Image\%s\Shapes\EllipseShape', 0024 $image->getDriver()->getDriverName()); 0025 0026 $ellipse = new $ellipse_classname($width, $height); 0027 0028 if ($callback instanceof Closure) { 0029 $callback($ellipse); 0030 } 0031 0032 $ellipse->applyToImage($image, $x, $y); 0033 0034 return true; 0035 } 0036 }