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