You are here

protected function Plugin::parse in Service Container 7.2

Same name and namespace in other branches
  1. 7 lib/Drupal/Component/Annotation/Plugin.php \Drupal\Component\Annotation\Plugin::parse()

Parses an annotation into its definition.

Parameters

array $values: The annotation array.

Return value

array The parsed annotation as a definition.

1 call to Plugin::parse()
Plugin::__construct in lib/Drupal/Component/Annotation/Plugin.php
Constructs a Plugin object.

File

lib/Drupal/Component/Annotation/Plugin.php, line 59
Contains \Drupal\Component\Annotation\Plugin.

Class

Plugin
Defines a Plugin annotation object.

Namespace

Drupal\Component\Annotation

Code

protected function parse(array $values) {
  $definitions = array();
  foreach ($values as $key => $value) {
    if ($value instanceof AnnotationInterface) {
      $definitions[$key] = $value
        ->get();
    }
    elseif (is_array($value)) {
      $definitions[$key] = $this
        ->parse($value);
    }
    else {
      $definitions[$key] = $value;
    }
  }
  return $definitions;
}