sitemap_status-1.0.0-alpha4/src/SitemapStatusInterface.php

src/SitemapStatusInterface.php
<?php

namespace Drupal\sitemap_status;

/**
 * Interface SitemapStatusInterface.
 */
interface SitemapStatusInterface {

  const CACHE_ID = 'sitemap_status';

  const STATE_CONFIG_OVERRIDE = 'sitemap_status.configuration_override';
  const STATE_LAST_CRON = 'sitemap_status.last_cron';

  const REQUIREMENT_UNKNOWN = -2;
  const REQUIREMENT_INFO = -1;
  const REQUIREMENT_OK = 0;
  const REQUIREMENT_WARNING = 1;
  const REQUIREMENT_ERROR = 2;

  const STATUS_NOT_REACHED = '0';
  const STATUS_2xx = '2';
  const STATUS_3xx = '3';
  const STATUS_4xx = '4';
  const STATUS_5xx = '5';
  const STATUS_DOM_ERROR = '9';

  const MAX_CONCURRENT_REQUESTS = 10;

  const LOCATIONS_GROUP = 'locations_group';
  const LOCATION = 'location';

  /**
   * Checks the sitemap locations.
   *
   * Returns an array of locations indexed by http statuses.
   * As a side effect, caches the result.
   *
   * Uses a queue, meant to be used by Drush and cron only.
   *
   * @return array|int[]
   */
  public function checkLocations();

  /**
   * Optional override of the sitemap status service properties with state.
   *
   * Meant to be used for Drush overrides.
   * Drush makes a complete override if the option is not set,
   * so it does not fallback to the configuration.
   *
   * @see SitemapStatusCommands
   */
  public function overridePropertiesWithState();

  /**
   * Returns an array of locations from a sitemap.
   *
   * @return string[]|array
   */
  public function fetchSitemapLocations();

  /**
   * Groups locations by http status.
   *
   * @param string[] $locations
   *
   * @return int[]
   */
  public function groupLocationsByStatus(array $locations);

  /**
   * Returns an array of locations indexed by http statuses.
   *
   * @return array|int[]
   */
  public function getLocationsStatuses();

  /**
   * Returns the description for a status.
   *
   * @param int $status_code
   *
   * @return string
   */
  public function getStatusDescription(int $status_code);

  /**
   * Returns an array of locations indexed by http statuses groups.
   *
   * @return array|string[]
   */
  public function getLocationsStatusesByGroup();

  /**
   * Returns the status level, to be used in system.status.
   *
   * @return int
   */
  public function getStatusLevel();

  /**
   * Returns the status level icon.
   *
   * @return string
   */
  public function getStatusLevelIcon();

  /**
   * Checks if a location status is an error.
   *
   * @param int $status
   *
   * @return bool
   */
  public function hasLocationStatusError(int $status);

  /**
   * Checks if the batch or queue is configured to stop on error.
   *
   * @param int $status
   *
   * @return bool
   */
  public function stopOnError();

  /**
   * Returns the status summary.
   *
   * @return array
   *   Render array.
   */
  public function getStatusSummary();

  /**
   * Checks if an url is valid.
   *
   * @param string $url
   *
   * @return bool
   */
  public function isUrlValid($url);

  /**
   * Returns the http status for a location.
   *
   * @param string $location
   *
   * @return int
   */
  public function fetchLocationStatus($location);

  /**
   * Returns the http status for several locations.
   *
   * @param array $locations
   *
   * @return array|string[]
   *   Locations as key with status as value.
   */
  public function fetchLocationStatusMultiple(array $locations);

}

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

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