Skip to content

Commit 5f62ca9

Browse files
authored
Merge pull request #113 from honeybadger-io/checkin-using-name
feat: checkin using name
2 parents 3351751 + 2dacde4 commit 5f62ca9

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
### Changed
9+
- Modify parameter names to be more descriptive (from $id to $idOrName)
810

911
## [3.16.0] - 2023-10-06
1012
### Added

src/Commands/HoneybadgerCheckinCommand.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class HoneybadgerCheckinCommand extends Command
1010
{
1111
/**
1212
* The name and signature of the console command.
13+
* "id" can be the check-in ID or the check-in name.
1314
*
1415
* @var string
1516
*/
@@ -30,8 +31,9 @@ class HoneybadgerCheckinCommand extends Command
3031
public function handle(Reporter $honeybadger)
3132
{
3233
try {
33-
$honeybadger->checkin($this->apiKey());
34-
$this->info(sprintf('Checkin %s was sent to Honeybadger', $this->argument('id')));
34+
$idOrName = $this->checkinIdOrName();
35+
$honeybadger->checkin($idOrName);
36+
$this->info(sprintf('Checkin %s was sent to Honeybadger', $idOrName));
3537
} catch (Exception $e) {
3638
$this->error($e->getMessage());
3739
}
@@ -42,7 +44,7 @@ public function handle(Reporter $honeybadger)
4244
*
4345
* @return string
4446
*/
45-
private function apiKey(): string
47+
private function checkinIdOrName(): string
4648
{
4749
return is_array($this->argument('id'))
4850
? $this->argument('id')[0]

src/HoneybadgerServiceProvider.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,19 +120,19 @@ private function bindCommands()
120120
private function registerEventHooks()
121121
{
122122
/** @param string|array|null $environments */
123-
Event::macro('thenPingHoneybadger', function (string $id, $environments = null) {
124-
return $this->then(function () use ($id, $environments) {
123+
Event::macro('thenPingHoneybadger', function (string $checkinIdOrName, $environments = null) {
124+
return $this->then(function () use ($checkinIdOrName, $environments) {
125125
if ($environments === null || app()->environment($environments)) {
126-
app(Reporter::class)->checkin($id);
126+
app(Reporter::class)->checkin($checkinIdOrName);
127127
}
128128
});
129129
});
130130

131131
/** @param string|array|null $environments */
132-
Event::macro('pingHoneybadgerOnSuccess', function (string $id, $environments = null) {
133-
return $this->onSuccess(function () use ($id, $environments) {
132+
Event::macro('pingHoneybadgerOnSuccess', function (string $checkinIdOrName, $environments = null) {
133+
return $this->onSuccess(function () use ($checkinIdOrName, $environments) {
134134
if ($environments === null || app()->environment($environments)) {
135-
app(Reporter::class)->checkin($id);
135+
app(Reporter::class)->checkin($checkinIdOrName);
136136
}
137137
});
138138
});

0 commit comments

Comments
 (0)