diff --git a/CHANGELOG.md b/CHANGELOG.md index 46a0238..d7d9af4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Changed +- Modify parameter names to be more descriptive (from $id to $idOrName) ## [3.16.0] - 2023-10-06 ### Added diff --git a/src/Commands/HoneybadgerCheckinCommand.php b/src/Commands/HoneybadgerCheckinCommand.php index e18972a..fb9d2b8 100644 --- a/src/Commands/HoneybadgerCheckinCommand.php +++ b/src/Commands/HoneybadgerCheckinCommand.php @@ -10,6 +10,7 @@ class HoneybadgerCheckinCommand extends Command { /** * The name and signature of the console command. + * "id" can be the check-in ID or the check-in name. * * @var string */ @@ -30,8 +31,9 @@ class HoneybadgerCheckinCommand extends Command public function handle(Reporter $honeybadger) { try { - $honeybadger->checkin($this->apiKey()); - $this->info(sprintf('Checkin %s was sent to Honeybadger', $this->argument('id'))); + $idOrName = $this->checkinIdOrName(); + $honeybadger->checkin($idOrName); + $this->info(sprintf('Checkin %s was sent to Honeybadger', $idOrName)); } catch (Exception $e) { $this->error($e->getMessage()); } @@ -42,7 +44,7 @@ public function handle(Reporter $honeybadger) * * @return string */ - private function apiKey(): string + private function checkinIdOrName(): string { return is_array($this->argument('id')) ? $this->argument('id')[0] diff --git a/src/HoneybadgerServiceProvider.php b/src/HoneybadgerServiceProvider.php index 0743310..6cd8d25 100644 --- a/src/HoneybadgerServiceProvider.php +++ b/src/HoneybadgerServiceProvider.php @@ -120,19 +120,19 @@ private function bindCommands() private function registerEventHooks() { /** @param string|array|null $environments */ - Event::macro('thenPingHoneybadger', function (string $id, $environments = null) { - return $this->then(function () use ($id, $environments) { + Event::macro('thenPingHoneybadger', function (string $checkinIdOrName, $environments = null) { + return $this->then(function () use ($checkinIdOrName, $environments) { if ($environments === null || app()->environment($environments)) { - app(Reporter::class)->checkin($id); + app(Reporter::class)->checkin($checkinIdOrName); } }); }); /** @param string|array|null $environments */ - Event::macro('pingHoneybadgerOnSuccess', function (string $id, $environments = null) { - return $this->onSuccess(function () use ($id, $environments) { + Event::macro('pingHoneybadgerOnSuccess', function (string $checkinIdOrName, $environments = null) { + return $this->onSuccess(function () use ($checkinIdOrName, $environments) { if ($environments === null || app()->environment($environments)) { - app(Reporter::class)->checkin($id); + app(Reporter::class)->checkin($checkinIdOrName); } }); });