You are here

class EntityPagerAnalyzer in Entity Pager 8

Same name and namespace in other branches
  1. 2.0.x src/EntityPagerAnalyzer.php \Drupal\entity_pager\EntityPagerAnalyzer

A class for analyzing an entity pager and providing feedback.

Hierarchy

Expanded class hierarchy of EntityPagerAnalyzer

1 file declares its use of EntityPagerAnalyzer
EntityPagerAnalyzerTest.php in tests/src/Unit/EntityPagerAnalyzerTest.php

File

src/EntityPagerAnalyzer.php, line 12

Namespace

Drupal\entity_pager
View source
class EntityPagerAnalyzer implements EntityPagerAnalyzerInterface {

  /**
   * The event dispatcher.
   *
   * @var \Symfony\Component\EventDispatcher\EventDispatcherInterface
   */
  protected $eventDispatcher;

  /**
   * Constructs a new EntityPagerAnalyzer object.
   *
   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher
   *   The event dispatcher.
   */
  public function __construct(EventDispatcherInterface $eventDispatcher) {
    $this->eventDispatcher = $eventDispatcher;
  }

  /**
   * {@inheritdoc}
   */
  public function analyze(EntityPagerInterface $entityPager) {
    $event = new EntityPagerAnalyzeEvent($entityPager);
    $this->eventDispatcher
      ->dispatch(EntityPagerEvents::ENTITY_PAGER_ANALYZE, $event);
    $logs = $event
      ->getLogs();
    foreach ($logs as $message) {
      \Drupal::logger('entity_pager')
        ->notice($message);
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EntityPagerAnalyzer::$eventDispatcher protected property The event dispatcher.
EntityPagerAnalyzer::analyze public function Analyzes the given entity pager. Overrides EntityPagerAnalyzerInterface::analyze
EntityPagerAnalyzer::__construct public function Constructs a new EntityPagerAnalyzer object.