Method writeEnv
has 60 lines of code (exceeds 25 allowed). Consider refactoring.
private function writeEnv(): void
{
$this->tasks->addTask(
'Write HONEYBADGER_API_KEY to .env',
function () {
Similar blocks of code found in 2 locations. Consider refactoring.
if (isset($this->config['app_endpoint'])) {
$this->tasks->addTask(
'Write HONEYBADGER_APP_ENDPOINT to .env',
function () {
return $this->installer->writeConfig([
Similar blocks of code found in 2 locations. Consider refactoring.
if (isset($this->config['endpoint'])) {
$this->tasks->addTask(
'Write HONEYBADGER_ENDPOINT to .env',
function () {
return $this->installer->writeConfig([
Similar blocks of code found in 2 locations. Consider refactoring.
<?php
namespace Honeybadger\HoneybadgerLaravel;
use Honeybadger\Contracts\Reporter;
Similar blocks of code found in 2 locations. Consider refactoring.
<?php
namespace Honeybadger\HoneybadgerLaravel;
use Honeybadger\Contracts\Reporter;
Similar blocks of code found in 2 locations. Consider refactoring.
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($checkinIdOrName);
}
Similar blocks of code found in 2 locations. Consider refactoring.
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($checkinIdOrName);
}
Avoid too many return
statements within this method.
return $this->installer->writeConfig([
'HONEYBADGER_APP_ENDPOINT' => $this->config['app_endpoint'],
], base_path('.env'));
Similar blocks of code found in 2 locations. Consider refactoring.
public function getEventPayload($event): EventPayload
{
$metadata = [
'connectionName' => $event->connectionName,
'command' => $this->formatCommand($event->command, $event->parameters),
Avoid too many return
statements within this method.
return $this->installer->writeConfig([
'HONEYBADGER_APP_ENDPOINT' => $this->config['app_endpoint'],
], base_path('.env.example'));
Similar blocks of code found in 2 locations. Consider refactoring.
public function getEventPayload($event): EventPayload
{
$metadata = [
'connectionName' => $event->connectionName,
'sql' => $this->sanitize($event->sql, $event->connection),
Function setLaravelRouteActionContext
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
private function setLaravelRouteActionContext()
{
$currentRoute = Route::getCurrentRoute();
if ($currentRoute === null) {
return;