4 * Contains \Drupal\bootstrap\Annotation\BootstrapConstant.
7 namespace Drupal\bootstrap\Annotation;
9 use Doctrine\Common\Annotations\AnnotationException;
10 use Drupal\Component\Annotation\AnnotationBase;
13 * Defines a BootstrapConstant annotation object.
19 class BootstrapConstant extends AnnotationBase {
22 * The stored constant value.
31 public function __construct(array $values) {
32 $string = $values['value'];
35 if (strpos($string, '::') !== FALSE) {
36 list($class, $constant) = explode('::', $string);
38 $reflection = new \ReflectionClass($class);
39 if ($reflection->hasConstant($constant)) {
40 $this->value = $reflection->getConstant($constant);
44 catch (\ReflectionException $e) {
48 // Handle procedural constants.
49 if (!$this->value && defined($string)) {
50 $this->value = constant($string);
54 throw AnnotationException::semanticalErrorConstants($this->value);
60 public function get() {