sitemap_status-1.0.0-alpha4/src/Plugin/QueueWorker/LocationQueueWorker.php

src/Plugin/QueueWorker/LocationQueueWorker.php
<?php

namespace Drupal\sitemap_status\Plugin\QueueWorker;

use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Queue\QueueWorkerBase;
use Drupal\sitemap_status\SitemapStatusInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 * Fetches the http status for a location.
 *
 * @QueueWorker(
 *   id = "location",
 *   title = @Translation("Fetches the http status for a location."),
 * )
 */
class LocationQueueWorker extends QueueWorkerBase implements ContainerFactoryPluginInterface {

  /**
   * Drupal\sitemap_status\SitemapStatusInterface definition.
   *
   * @var \Drupal\sitemap_status\SitemapStatusInterface
   */
  protected $sitemapStatus;

  /**
   * ReleaseFilesDuplicateQueueWorker constructor.
   *
   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $sitemap_status
   */
  public function __construct(SitemapStatusInterface $sitemap_status) {
    $this->sitemapStatus = $sitemap_status;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
    return new static(
      $container->get('sitemap_status')
    );
  }

  /**
   * {@inheritdoc}
   */
  public function processItem($data) {
    return [
      $data => $this->sitemapStatus->fetchLocationStatus((string) $data),
    ];
  }

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc