webshelf /
framework
We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| 1 | <?php |
||
| 2 | |||
| 3 | namespace App\Model; |
||
| 4 | |||
| 5 | use Carbon\Carbon; |
||
| 6 | use App\Classes\Interfaces\AuditInterface; |
||
| 7 | use OwenIt\Auditing\Models\Audit as Auditing; |
||
| 8 | |||
| 9 | /** |
||
| 10 | * Class Audit. |
||
| 11 | * |
||
| 12 | * @property int $id |
||
| 13 | * @property int $user_id |
||
| 14 | * @property string $event |
||
| 15 | * @property int $auditable_id |
||
| 16 | * @property string $auditable_type |
||
| 17 | * @property array $old_values |
||
| 18 | * @property array $new_values |
||
| 19 | * @property string $url |
||
| 20 | * @property string $ip_address |
||
| 21 | * @property string $user_agent |
||
| 22 | * @property Carbon $created_at |
||
| 23 | * @property Carbon $updated_at |
||
| 24 | * |
||
| 25 | * @property Account $user |
||
| 26 | * @property AuditInterface $auditable |
||
| 27 | */ |
||
| 28 | class Audit extends Auditing |
||
| 29 | { |
||
| 30 | public function afterActionVerb() |
||
| 31 | { |
||
| 32 | switch ($this->event) { |
||
| 33 | case 'created': return 'created the'; break; |
||
|
0 ignored issues
–
show
|
|||
| 34 | case 'deleted': return 'deleted the'; break; |
||
| 35 | case 'updated': return 'updated the'; break; |
||
| 36 | } |
||
| 37 | |||
| 38 | return false; |
||
| 39 | } |
||
| 40 | |||
| 41 | public function beforeActionVerb() |
||
| 42 | { |
||
| 43 | switch ($this->event) { |
||
| 44 | case 'created': return 'was generated'; break; |
||
|
0 ignored issues
–
show
break is not strictly necessary here and could be removed.
The switch ($x) {
case 1:
return 'foo';
break; // This break is not necessary and can be left off.
}
If you would like to keep this construct to be consistent with other Loading history...
|
|||
| 45 | case 'deleted': return 'was destroyed'; break; |
||
| 46 | case 'updated': return 'was modified'; break; |
||
| 47 | } |
||
| 48 | |||
| 49 | return false; |
||
| 50 | } |
||
| 51 | |||
| 52 | public function model() |
||
| 53 | { |
||
| 54 | return explode('\\', $this->auditable_type)[2]; |
||
| 55 | } |
||
| 56 | } |
||
| 57 |
The
breakstatement is not necessary if it is preceded for example by areturnstatement:If you would like to keep this construct to be consistent with other
casestatements, you can safely mark this issue as a false-positive.