for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Drupal\mongodb_watchdog\Controller;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\mongodb_watchdog\Logger;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Implements the controller for the request events page.
*/
class RequestController implements ContainerInjectionInterface {
* The mongodb_watchdog logger, to access events.
*
* @var \Drupal\mongodb_watchdog\Logger
protected $watchdog;
public function __construct(Logger $watchdog) {
$this->watchdog = $watchdog;
}
* {@inheritdoc}
public static function create(ContainerInterface $container) {
/** @var \Drupal\mongodb_watchdog\Logger $watchdog */
$watchdog = $container->get('mongodb.logger');
return new static($watchdog);
* Controller.
* @param string $unique_id
* The unique request id from mod_unique_id.
* @return array
array<string,string>
This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.
array
* A render array.
public function track($unique_id) {
$events = $this->watchdog->requestEvents($unique_id);
ksm($events);
return [
'#markup' => $unique_id,
];
This check marks files that end in a newline character, i.e. an empy line.