validator(); if ($validator->fails()) { foreach ($validator->errors()->all() as $error) { Log::error($error); $this->error($error); } return 1; } $action = $this->getAction(); $storageResults = $action->handle(); $storageResults->toLog(); $storageResults->toConsole($this); $action->then($storageResults); $result = $storageResults->toActionResult(); return $result->hasFailed() ? 1 : 0; } /** * Get the underlying action. * * @return StorageAction */ abstract protected function getAction(): StorageAction; /** * Get the validator for options. * * @return Validator */ abstract protected function validator(): Validator; }