for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of Laravel Love.
*
* (c) Anton Komarev <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Cog\Laravel\Love\Console\Commands;
use Cog\Laravel\Love\ReactionType\Models\ReactionType;
use Illuminate\Console\Command;
use Illuminate\Contracts\Events\Dispatcher;
final class Install extends Command
{
/**
* The name and signature of the console command.
* @var string
protected $signature = 'love:install';
* The console command description.
protected $description = 'Install Laravel Love';
* Execute the console command.
* @param \Illuminate\Contracts\Events\Dispatcher $events
* @return void
public function handle(
Dispatcher $events
$events
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
/** @scrutinizer ignore-unused */ Dispatcher $events
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
): void {
$this->createDefaultReactionTypes();
}
private function createDefaultReactionTypes(): void
$types = [
[
'name' => 'Like',
'weight' => 1,
],
'name' => 'Dislike',
'weight' => -1,
];
foreach ($types as $type) {
if (ReactionType::query()->where('name', $type['name'])->exists()) {
continue;
ReactionType::query()->create($type);
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.