reviewer-1.2.x-dev/src/Reviewer/Review/ReviewBuilderInterface.php
src/Reviewer/Review/ReviewBuilderInterface.php
<?php
namespace Drupal\reviewer\Reviewer\Review;
use Drupal\reviewer\Plugin\reviewer\BuildableInterface;
/**
* Defines a class which builds runnable reviews from review plugins.
*/
interface ReviewBuilderInterface {
/**
* Create a runnable item from a buildable plugin class string.
*
* @param class-string<\Drupal\reviewer\Plugin\reviewer\BuildableInterface> $runnable_plugin_class
*
* @return array<string, \Drupal\reviewer\Reviewer\Review\ReviewInterface>
* An array of runnable items, keyed by the plugin ID. If the runnable item
* is an instance of EntityReviewInterface and supports bundles, then a
* runnable item will be returned for each bundle, keyed by the plugin ID
* appended with the bundle machine name.
*
* @throws \ReflectionException
* Thrown when the class does not exist.
*/
public function fromClass(string $runnable_plugin_class): array;
/**
* Create a runnable item from an array of buildable plugin class strings.
*
* @param class-string<\Drupal\reviewer\Plugin\reviewer\BuildableInterface>[] $runnable_plugin_classes
*
* @return array<string, \Drupal\reviewer\Reviewer\Review\ReviewInterface>
* An array of runnable items, keyed by the plugin ID. If the runnable item
* is an instance of EntityReviewInterface and supports bundles, then a
* runnable item will be returned for each bundle, keyed by the plugin ID
* appended with the bundle machine name.
*
* @throws \ReflectionException
* Thrown when the class does not exist.
*/
public function fromClasses(array $runnable_plugin_classes): array;
/**
* Create a runnable item from a buildable plugin ID.
*
* @return array<string, \Drupal\reviewer\Reviewer\Review\ReviewInterface>
* An array of runnable items, keyed by the plugin ID. If the runnable item
* is an instance of EntityReviewInterface and supports bundles, then a
* runnable item will be returned for each bundle, keyed by the plugin ID
* appended with the bundle machine name.
*/
public function fromId(string $runnable_plugin_id, string $id = ''): array;
/**
* Create a runnable item from an array of buildable plugin IDs.
*
* @param string[] $runnable_plugin_ids
*
* @return array<string, \Drupal\reviewer\Reviewer\Review\ReviewInterface>
* An array of runnable items, keyed by the plugin ID. If the runnable item
* is an instance of EntityReviewInterface and supports bundles, then a
* runnable item will be returned for each bundle, keyed by the plugin ID
* appended with the bundle machine name.
*/
public function fromIds(array $runnable_plugin_ids, string $id = ''): array;
/**
* Create a runnable item from an instance of a buildable plugin.
*
* @return array<string, \Drupal\reviewer\Reviewer\Review\ReviewInterface>
* An array of runnable items, keyed by the plugin ID. If the runnable item
* is an instance of EntityReviewInterface and supports bundles, then a
* runnable item will be returned for each bundle, keyed by the plugin ID
* appended with the bundle machine name.
*
* @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
* @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
*/
public function fromPlugin(
BuildableInterface $plugin,
string $id = '',
): array;
/**
* Create a runnable item from an array of a buildable plugin instances.
*
* @param \Drupal\reviewer\Plugin\reviewer\BuildableInterface[] $plugins
*
* @return array<string, \Drupal\reviewer\Reviewer\Review\ReviewInterface>
* An array of runnable items, keyed by the plugin ID. If the runnable item
* is an instance of EntityReviewInterface and supports bundles, then a
* runnable item will be returned for each bundle, keyed by the plugin ID
* appended with the bundle machine name.
*
* @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
* @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
*/
public function fromPlugins(array $plugins, string $id = ''): array;
}
