Cheetah
All Classes Namespaces Files Functions Variables Pages
ResetCommand.php
Go to the documentation of this file.
1 <?php
2 
4 
6 {
13  public function execute($image)
14  {
15  $backupName = $this->argument(0)->value();
16 
17  if (is_resource($backup = $image->getBackup($backupName))) {
18 
19  // destroy current resource
20  imagedestroy($image->getCore());
21 
22  // clone backup
23  $backup = $image->getDriver()->cloneCore($backup);
24 
25  // reset to new resource
26  $image->setCore($backup);
27 
28  return true;
29  }
30 
31  throw new \Intervention\Image\Exception\RuntimeException(
32  "Backup not available. Call backup() before reset()."
33  );
34  }
35 }
Intervention\Image\Gd\Commands
Definition: BackupCommand.php:3
php
Intervention\Image\Gd\Commands\ResetCommand
Definition: ResetCommand.php:6
Intervention\Image\Gd\Commands\ResetCommand\execute
execute($image)
Definition: ResetCommand.php:13
Intervention\Image\Commands\AbstractCommand\argument
argument($key)
Definition: AbstractCommand.php:45
Intervention\Image\Commands\AbstractCommand
Definition: AbstractCommand.php:6