/** * Run a macro. * * @param $macro * @param Image $image * @return Image * @throws \Exception */ public function run($macro, Image $image) { if (!($process = array_get($this->getMacros(), $macro))) { return $image; } if (is_array($process)) { foreach ($process as $method => $arguments) { $image->addAlteration($method, $arguments); } } if ($process instanceof \Closure) { $this->container->call($process, compact('image', 'macro')); } return $image; }