You are here

protected function AnnotationObject::normalizeValue in Markdown 8.2

Normalizes a value to ensure its ready to be merged with the definition.

Parameters

mixed $value: The value to normalize.

Return value

array The normalized value.

1 call to AnnotationObject::normalizeValue()
AnnotationObject::offsetSet in src/Annotation/AnnotationObject.php

File

src/Annotation/AnnotationObject.php, line 287

Class

AnnotationObject
Base annotation class for retrieving the annotation as an object.

Namespace

Drupal\markdown\Annotation

Code

protected function normalizeValue($value) {
  $normalized = [];
  if ($value instanceof AnnotationInterface) {
    return $value
      ->get();
  }
  elseif (is_array($value) || $value instanceof \Traversable) {
    foreach ($value as $k => $v) {
      $normalized[$k] = $this
        ->normalizeValue($v);
    }
  }
  else {
    return $value;
  }
  return $normalized;
}