3 namespace Drupal\migrate\Exception;
10 * @see \Drupal\migrate\Plugin\RequirementsInterface
12 class RequirementsException extends \RuntimeException {
15 * The missing requirements.
19 protected $requirements;
22 * Constructs a new RequirementsException instance.
24 * @param string $message
25 * (optional) The Exception message to throw.
26 * @param array $requirements
27 * (optional) The missing requirements.
29 * (optional) The Exception code.
30 * @param \Exception $previous
31 * (optional) The previous exception used for the exception chaining.
33 public function __construct($message = "", array $requirements = [], $code = 0, Exception $previous = NULL) {
34 parent::__construct($message, $code, $previous);
36 $this->requirements = $requirements;
40 * Get an array of requirements.
45 public function getRequirements() {
46 return $this->requirements;
50 * Get the requirements as a string.
53 * A formatted requirements string.
55 public function getRequirementsString() {
57 foreach ($this->requirements as $requirement_type => $requirements) {
58 if (!is_array($requirements)) {
59 $requirements = [$requirements];
62 foreach ($requirements as $value) {
63 $output .= "$requirement_type: $value. ";