Skip to content
Snippets Groups Projects

Fix the issues reported by phpcs.

7 files
+ 95
76
Compare changes
  • Side-by-side
  • Inline
Files
7
@@ -6,13 +6,16 @@ use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Database\Connection;
use Drupal\Core\Datetime\DateFormatter;
use Drupal\Core\Form\FormBuilderInterface;
use Symfony\Component\Serializer\Serializer;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Serializer\Serializer;
/**
* The main controller for the module.
*/
class DevelDebugLogController extends ControllerBase {
/**
* The Database Connection
* The Database Connection.
*
* @var \Drupal\Core\Database\Connection
*/
@@ -21,7 +24,7 @@ class DevelDebugLogController extends ControllerBase {
/**
* The Serializer service.
*
* @var Symfony\Component\Serializer\Serializer;
* @var Symfony\Component\Serializer\Serializer
*/
protected $serializer;
@@ -35,7 +38,7 @@ class DevelDebugLogController extends ControllerBase {
/**
* The FormBuilder object.
*
* @var Drupal\Core\Form\FormBuilderInterface;
* @var Drupal\Core\Form\FormBuilderInterface
*/
protected $formBuilder;
@@ -54,10 +57,14 @@ class DevelDebugLogController extends ControllerBase {
/**
* DevelDebugLogController constructor.
*
* @param Connection $database
* @param DateFormatter $dateFormatter
* @param Serializer $serializer
* @param FormBuilderInterface $formBuilder
* @param \Drupal\Core\Database\Connection $database
* The database object.
* @param \Drupal\Core\Datetime\DateFormatter $dateFormatter
* The dateFormatter object.
* @param \Symfony\Component\Serializer\Serializer $serializer
* The serializer object.
* @param \Drupal\Core\Form\FormBuilderInterface $formBuilder
* The formBuilder object.
*/
public function __construct(Connection $database, DateFormatter $dateFormatter, Serializer $serializer, FormBuilderInterface $formBuilder) {
$this->database = $database;
@@ -70,7 +77,7 @@ class DevelDebugLogController extends ControllerBase {
* Lists debug information.
*
* @return array
* Renderable array that contains a list of debug data.
* Renderable array that contains a list of debug data.
*/
public function listLogs() {
$query = $this->database->select('devel_debug_log', 'm')
@@ -81,31 +88,32 @@ class DevelDebugLogController extends ControllerBase {
$rows = [];
foreach ($results as $result) {
$rows[] = array(
$rows[] = [
'title' => $result->title,
'time' => $this->dateFormatter
->format($result->timestamp, 'short'),
->format($result->timestamp, 'short'),
'message' => $result->message,
);
];
}
if (empty($rows)) {
return array(
return [
'#markup' => $this->t('No debug messages.'),
);
];
}
$build = array(
'messages' => array(
$build = [
'messages' => [
'#theme' => 'devel_debug_log_list',
'#content' => $rows,
'#delete_form' => $this->formBuilder->getForm('Drupal\devel_debug_log\Form\DevelDebugLogDeleteForm'),
),
'pager' => array(
'#type' => 'pager'
),
);
],
'pager' => [
'#type' => 'pager',
],
];
return $build;
}
}
Loading