Skip to content
Snippets Groups Projects
Commit 38542040 authored by Dinesh Kumar Bollu's avatar Dinesh Kumar Bollu Committed by Gisle Hannemyr
Browse files

Issue #3357564 by dineshkumarbollu: Fixed PHP CS

parent 0e8ee73c
No related branches found
No related tags found
No related merge requests found
......@@ -42,4 +42,3 @@ fields available to **Views**.
The three counters (week, month, year) are reset in `hook_cron`. For
this to work, [cron](https://www.drupal.org/cron) needs to run as
frequent as you want the counters reset.
......@@ -2,7 +2,6 @@
namespace Drupal\statistics_counter\EventSubscriber;
use Drupal;
use Drupal\Core\Database\Database;
use Drupal\Core\Render\HtmlResponse;
use Drupal\node\NodeInterface;
......@@ -29,14 +28,14 @@ class StatisticsCounterSubscriber implements EventSubscriberInterface {
* @param \Symfony\Component\HttpKernel\Event\TerminateEvent $event
* Event.
*/
static function updateStatistics(TerminateEvent $event) {
$node = Drupal::request()->attributes->get('node');
$views = Drupal::config('statistics.settings')->get('count_content_views');
public static function updateStatistics(TerminateEvent $event) {
$node = \Drupal::request()->attributes->get('node');
$views = \Drupal::config('statistics.settings')->get('count_content_views');
if (($node instanceof NodeInterface) && ($event->getResponse() instanceof HtmlResponse) && $views) {
// Support statistics filter.
if (Drupal::moduleHandler()
->moduleExists('statistics_filter') && statistics_filter_do_filter()) {
if (\Drupal::moduleHandler()
->moduleExists('statistics_filter') && statistics_filter_do_filter()) {
return;
}
......
......@@ -5,7 +5,7 @@
* Statistics Counter.
*/
use \Drupal\Core\Database\Database;
use Drupal\Core\Database\Database;
/**
* Implements hook_install().
......
......@@ -5,6 +5,8 @@
* Statistics Counter.
*/
use Drupal\Core\Database\Database;
/**
* Implements hook_cron().
*/
......@@ -40,7 +42,7 @@ function statistics_counter_cron() {
if (!empty($fields)) {
// Reset year counts.
\Drupal\Core\Database\Database::getConnection('default')
Database::getConnection('default')
->update('node_counter')
->fields($fields)
->execute();
......@@ -133,7 +135,7 @@ function statistics_counter_yearcount_getter_callback($item) {
* Counter.
*/
function _statistics_counter_getter_callback($nid, $counter) {
return \Drupal\Core\Database\Database::getConnection('default')
return Database::getConnection('default')
->select('node_counter', 'nc')
->fields('nc', [$counter])
->condition('nid', $nid)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment