herpaderpaldent/seat-groups

View on GitHub

Showing 30 of 30 total issues

Similar blocks of code found in 3 locations. Consider refactoring.
Open

<?php
/**
* MIT License.
*
* Copyright (c) 2019. Felix Huber
src/Http/Controllers/Notifications/MissingRefreshTokenController.php on lines 1..116
src/Http/Controllers/Notifications/SeatGroupSyncController.php on lines 1..93

Similar blocks of code found in 3 locations. Consider refactoring.
Open

<?php
 
namespace Herpaderpaldent\Seat\SeatGroups\Http\Controllers\Notifications;
 
use Herpaderpaldent\Seat\SeatNotifications\Http\Controllers\BaseNotificationController;
src/Http/Controllers/Notifications/MissingRefreshTokenController.php on lines 1..116
src/Http/Controllers/Notifications/SeatGroupErrorController.php on lines 1..116

Similar blocks of code found in 3 locations. Consider refactoring.
Open

<?php
/**
* MIT License.
*
* Copyright (c) 2019. Felix Huber
src/Http/Controllers/Notifications/SeatGroupErrorController.php on lines 1..116
src/Http/Controllers/Notifications/SeatGroupSyncController.php on lines 1..93

Function isQualified has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

public function isQualified(Group $group)
{
 
$action = new GetCurrentAffiliationAction;
 
 
Severity: Minor
Found in src/Models/SeatGroup.php - About 3 hrs to fix

Identical blocks of code found in 3 locations. Consider refactoring.
Open

public function dontSend($notifiable) :bool
{
$value = collect([
'recipient' => $notifiable->driver_id,
'notification' => get_called_class(),
src/Notifications/MissingRefreshToken/AbstractMissingRefreshTokenNotification.php on lines 136..153
src/Notifications/SeatGroupError/AbstractSeatGroupErrorNotification.php on lines 131..148

Identical blocks of code found in 3 locations. Consider refactoring.
Open

public function dontSend($notifiable) :bool
{
$value = collect([
'recipient' => $notifiable->driver_id,
'notification' => get_called_class(),
src/Notifications/SeatGroupError/AbstractSeatGroupErrorNotification.php on lines 131..148
src/Notifications/SeatGroupSync/AbstractSeatGroupSyncNotification.php on lines 144..161

Identical blocks of code found in 3 locations. Consider refactoring.
Open

public function dontSend($notifiable) :bool
{
$value = collect([
'recipient' => $notifiable->driver_id,
'notification' => get_called_class(),
src/Notifications/MissingRefreshToken/AbstractMissingRefreshTokenNotification.php on lines 136..153
src/Notifications/SeatGroupSync/AbstractSeatGroupSyncNotification.php on lines 144..161

Function update has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

public function update(Request $request, $id)
{
 
$seatgroup = SeatGroup::find($id);
 
 
Severity: Minor
Found in src/Http/Controllers/SeatGroupUserController.php - About 1 hr to fix

Method update has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

public function update(Request $request, $id)
{
 
$seatgroup = SeatGroup::find($id);
 
 
Severity: Minor
Found in src/Http/Controllers/SeatGroupUserController.php - About 1 hr to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    if (! empty($event->sync['attached'])) {
     
    SeatgroupLog::create([
    'event' => 'attached',
    'message' => sprintf('The user group of %s (%s) has successfully been attached to the following roles: %s.',
    Severity: Major
    Found in src/Listeners/CreateSyncedSeatLogsEntry.php and 1 other location - About 1 hr to fix
    src/Listeners/CreateSyncedSeatLogsEntry.php on lines 46..59

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    if (! empty($event->sync['detached'])) {
     
    SeatgroupLog::create([
    'event' => 'detached',
    'message' => sprintf('The user group of %s (%s) has been detached from the following roles: %s.',
    Severity: Major
    Found in src/Listeners/CreateSyncedSeatLogsEntry.php and 1 other location - About 1 hr to fix
    src/Listeners/CreateSyncedSeatLogsEntry.php on lines 31..44

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    return DataTables::of($affiliations)
    ->addColumn('affiliation', function ($row) {
    return view('seatgroups::affiliation.partials.table-partials.affiliation', compact('row'))->render();
    })
    ->addColumn('remove', function ($row) {
    src/Http/Controllers/SeatGroupUserController.php on lines 255..263

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    return DataTables::of($seatgroup_members)
    ->addColumn('name', function ($row) {
    return view('seatgroups::partials.modal-partials.modal-name', compact('row'))->render();
    })
    ->addColumn('actions', function ($row) {
    Severity: Major
    Found in src/Http/Controllers/SeatGroupUserController.php and 1 other location - About 1 hr to fix
    src/Http/Controllers/Affiliation/SeatGroupAffiliationController.php on lines 23..31

    Method execute has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    public function execute(array $data)
    {
    $seatgroup = SeatGroup::find($data['seatgroup_id']);
     
    $affiliations = collect();
    Severity: Minor
    Found in src/Actions/SeatGroups/GetCurrentAffiliationAction.php - About 1 hr to fix

      Method handle has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      public function handle(GroupApplication $event)
      {
      $should_send = false;
       
      if (class_exists(SeatNotificationsServiceProvider::class))
      Severity: Minor
      Found in src/Listeners/GroupApplicationNotification.php - About 1 hr to fix

        Method up has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        public function up()
        {
        Schema::create('seatgroups', function ($table) {
        $table->increments('id')->index();
        $table->string('name');
        Severity: Minor
        Found in src/database/migrations/2018_02_11_144653_initial_deployment.php - About 1 hr to fix

          Method execute has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          public function execute(Group $group)
          {
          $this->group = $group;
          $main_character = $this->get_main_character_action->execute($this->group);
          $this->has_missing_refresh_token = false;
          Severity: Minor
          Found in src/Actions/Sync/CatchMissingRefreshTokenAction.php - About 1 hr to fix

            Function mergeConfigs has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            protected function mergeConfigs(array $original, array $merging)
            {
            $array = array_merge($original, $merging);
             
            foreach ($original as $key => $value) {
            Severity: Minor
            Found in src/GroupsServiceProvider.php - About 1 hr to fix

            Method execute has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            public function execute(Group $group) : Collection
            {
             
            $this->group = $group;
             
             
            Severity: Minor
            Found in src/Actions/Sync/GetRolesToSyncAction.php - About 1 hr to fix

              Method handle has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              public function handle(GroupSynced $event)
              {
              if (empty($event->sync['attached']) && empty($event->sync['detached']))
              $this->delete();
               
               
              Severity: Minor
              Found in src/Listeners/CreateSyncedSeatLogsEntry.php - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language