These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Drupal\mongodb_watchdog\Controller; |
||
| 4 | |||
| 5 | use Drupal\Core\Config\ImmutableConfig; |
||
| 6 | use Drupal\Core\Controller\ControllerBase as CoreControllerBase; |
||
| 7 | use Drupal\mongodb_watchdog\Logger; |
||
| 8 | use Psr\Log\LoggerAwareTrait; |
||
| 9 | use Psr\Log\LoggerInterface; |
||
| 10 | use Symfony\Component\DependencyInjection\ContainerInterface; |
||
| 11 | |||
| 12 | abstract class ControllerBase extends CoreControllerBase { |
||
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
| 13 | |||
| 14 | use LoggerAwareTrait; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * The items_per_page configuration value. |
||
| 18 | * |
||
| 19 | * @var int |
||
| 20 | */ |
||
| 21 | protected $itemsPerPage; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * The MongoDB logger, to load events. |
||
| 25 | * |
||
| 26 | * @var \Drupal\mongodb_watchdog\Logger |
||
| 27 | */ |
||
| 28 | protected $watchdog; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * ControllerBase constructor. |
||
| 32 | * |
||
| 33 | * @param \Drupal\Core\Config\ImmutableConfig $config |
||
| 34 | * The module configuration. |
||
| 35 | */ |
||
| 36 | public function __construct(LoggerInterface $logger, Logger $watchdog, ImmutableConfig $config) { |
||
| 37 | $this->setLogger($logger); |
||
| 38 | |||
| 39 | $this->itemsPerPage = $config->get('items_per_page'); |
||
| 40 | $this->watchdog = $watchdog; |
||
| 41 | } |
||
| 42 | |||
| 43 | public static function create(ContainerInterface $container) { |
||
|
0 ignored issues
–
show
|
|||
| 44 | $logger = $container->get('logger.channel.mongodb_watchdog'); |
||
| 45 | $watchdog = $container->get('mongodb.logger'); |
||
|
0 ignored issues
–
show
$watchdog is not used, you could remove the assignment.
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently. $myVar = 'Value';
$higher = false;
if (rand(1, 6) > 3) {
$higher = true;
} else {
$higher = false;
}
Both the Loading history...
|
|||
| 46 | |||
| 47 | return new static($logger); |
||
| 48 | } |
||
| 49 | } |
||
|
0 ignored issues
–
show
|
|||
| 50 |