Cheetah
All Classes Namespaces Files Functions Variables Pages
EllipseCommand.php
Go to the documentation of this file.
1 <?php
2 
4 
5 use \Closure;
6 
8 {
15  public function execute($image)
16  {
17  $width = $this->argument(0)->type('numeric')->required()->value();
18  $height = $this->argument(1)->type('numeric')->required()->value();
19  $x = $this->argument(2)->type('numeric')->required()->value();
20  $y = $this->argument(3)->type('numeric')->required()->value();
21  $callback = $this->argument(4)->type('closure')->value();
22 
23  $ellipse_classname = sprintf('\Intervention\Image\%s\Shapes\EllipseShape',
24  $image->getDriver()->getDriverName());
25 
26  $ellipse = new $ellipse_classname($width, $height);
27 
28  if ($callback instanceof Closure) {
29  $callback($ellipse);
30  }
31 
32  $ellipse->applyToImage($image, $x, $y);
33 
34  return true;
35  }
36 }
Intervention\Image\Commands
Definition: AbstractCommand.php:3
php
Intervention\Image\Commands\EllipseCommand\execute
execute($image)
Definition: EllipseCommand.php:15
Intervention\Image\Commands\EllipseCommand
Definition: EllipseCommand.php:8
Intervention\Image\Commands\AbstractCommand\argument
argument($key)
Definition: AbstractCommand.php:45
Intervention\Image\Commands\AbstractCommand
Definition: AbstractCommand.php:6