You are here

class SchemaMetatagClient in Schema.org Metatag 8.2

Same name in this branch
  1. 8.2 src/SchemaMetatagClient.php \Drupal\schema_metatag\SchemaMetatagClient
  2. 8.2 tests/modules/schema_metatag_test/src/SchemaMetatagClient.php \Drupal\schema_metatag_test\SchemaMetatagClient

Class SchemaMetatagClient.

A class to parse Schema.org data.

@package Drupal\schema_metatag

Hierarchy

Expanded class hierarchy of SchemaMetatagClient

File

tests/modules/schema_metatag_test/src/SchemaMetatagClient.php, line 14

Namespace

Drupal\schema_metatag_test
View source
class SchemaMetatagClient extends SchemaMetatagClientOriginal {

  /**
   * {@inheritdoc}
   */
  public function getLocalFile() {
    return '';
  }

  /**
   * {@inheritdoc}
   */
  public function getObjects($clear = FALSE) {
    return [];
  }

  /**
   * {@inheritdoc}
   */
  public function getProperties($clear = FALSE) {
    return [];
  }

  /**
   * {@inheritdoc}
   */
  public function getObjectTree($clear = FALSE, $clear_objects = FALSE) {

    // Provide a tree that contains all objects used in tests, organized into
    // their actual hierarchy.
    return [
      'Thing' => [
        'Action' => [
          'ConsumeAction' => [
            'ReadAction' => [],
            'ViewAction' => [],
            'WatchAction' => [],
          ],
          'TradeAction' => [
            'BuyAction' => [],
            'OrderAction' => [],
          ],
          'OrganizeAction' => [
            'PlanAction' => [
              'ReserveAction' => [],
            ],
          ],
          'SearchAction' => [],
        ],
        'CreativeWork' => [
          'Article' => [],
          'Book' => [],
          'Clip' => [],
          'Comment' => [
            'Answer' => [],
          ],
          'Course' => [],
          'CreativeWorkSeason' => [],
          'MediaObject' => [
            'ImageObject' => [],
            'VideoObject' => [],
          ],
          'Movie' => [],
          'HowTo' => [
            'Recipe' => [],
          ],
          'HowToStep' => [],
          'Question' => [],
          'Review' => [],
          'SpecialAnnouncement' => [],
          'WebPage' => [
            'QAPage' => [],
            'FAQPage' => [],
          ],
          'WebPageElement' => [],
          'WebSite' => [],
        ],
        'DataType' => [
          'Boolean' => [],
          'Date' => [],
          'DateTime' => [],
          'Number' => [],
          'Text' => [
            'URL' => [],
          ],
          'Time' => [],
        ],
        'Event' => [
          'PublicationEvent' => [],
        ],
        'Intangible' => [
          'Brand' => [],
          'ContactPoint' => [
            'PostalAddress' => [],
          ],
          'EntryPoint' => [],
          'ItemList' => [
            'BreadcrumbList' => [],
          ],
          'JobPosting' => [],
          'Offer' => [],
          'ProgramMembership' => [],
          'Quantity' => [
            'Duration' => [],
            'Mass' => [],
          ],
          'Rating' => [
            'AggregateRating' => [],
          ],
          'Series' => [
            'CreativeWorkSeries' => [],
          ],
          'Service' => [
            'GovernmentService' => [],
          ],
          'SpeakableSpecification' => [],
          'StructuredValue' => [
            'ContactPoint' => [],
            'GeoCoordinates' => [],
            'MonetaryAmount' => [],
            'NutritionInformation' => [],
            'OpeningHoursSpecification' => [],
            'QuantitativeValue' => [],
          ],
        ],
        'Organization' => [
          'GovernmentOrganization' => [],
          'LocalBusiness' => [
            'FoodEstablishment' => [
              'Restaurant' => [],
            ],
            'GovernmentOffice' => [],
          ],
        ],
        'Person' => [],
        'Place' => [
          'AdministrativeArea' => [
            'Country' => [],
          ],
        ],
        'Product' => [],
      ],
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function getTree($parent_name = NULL, $depth = -1, $clear = FALSE, $clear_tree = FALSE, $clear_objects = FALSE) {

    // Override the original method to skip caching and use our test tree.
    $base_tree = $this
      ->getObjectTree();
    return $this
      ->getUncachedTree($base_tree, $parent_name, $depth);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SchemaMetatagClient::$cacheBackend protected property The cache backend service.
SchemaMetatagClient::$moduleHandler protected property Module handler.
SchemaMetatagClient::$prefix protected static property The object prefix used in the provided Schema.org data.
SchemaMetatagClient::$scheme protected static property The scheme used in the provided Schema.org data.
SchemaMetatagClient::clearData public function Clears all data from the cache. Overrides SchemaMetatagClientInterface::clearData
SchemaMetatagClient::create public static function
SchemaMetatagClient::getLocalFile public function Retrieve and decode data from a local schema.jsonld file. Overrides SchemaMetatagClient::getLocalFile
SchemaMetatagClient::getObjects public function
SchemaMetatagClient::getObjectTree public function Reorganize the classes into a hierarchical tree. Overrides SchemaMetatagClient::getObjectTree
SchemaMetatagClient::getOptionList public function Create a @type option list from a given tree section. Overrides SchemaMetatagClientInterface::getOptionList
SchemaMetatagClient::getParents public function Get an array of all parents of a given class. Overrides SchemaMetatagClientInterface::getParents
SchemaMetatagClient::getProperties public function
SchemaMetatagClient::getTree public function Get some or all of the object tree. Overrides SchemaMetatagClient::getTree
SchemaMetatagClient::getUncachedTree public function Get some or all of the object tree. Overrides SchemaMetatagClientInterface::getUncachedTree
SchemaMetatagClient::isIncludedClass public function Detect if this is a Schema.org class we care about. Overrides SchemaMetatagClientInterface::isIncludedClass
SchemaMetatagClient::isIncludedProperty public function Detect if this is a Schema.org property we care about. Overrides SchemaMetatagClientInterface::isIncludedProperty
SchemaMetatagClient::objectInfo public function Retrieve an array of object information from the raw data. Overrides SchemaMetatagClientInterface::objectInfo
SchemaMetatagClient::propertyInfo public function Retrieve object properties. Overrides SchemaMetatagClientInterface::propertyInfo
SchemaMetatagClient::sortAssocArray public function Sort a nested associative array. Overrides SchemaMetatagClientInterface::sortAssocArray
SchemaMetatagClient::__construct public function Construct a Schema client object.