public function BootstrapConstant::__construct in Express 8
File
- themes/
contrib/ bootstrap/ src/ Annotation/ BootstrapConstant.php, line 31 - Contains \Drupal\bootstrap\Annotation\BootstrapConstant.
Class
- BootstrapConstant
- Defines a BootstrapConstant annotation object.
Namespace
Drupal\bootstrap\AnnotationCode
public function __construct(array $values) {
$string = $values['value'];
// Handle classes.
if (strpos($string, '::') !== FALSE) {
list($class, $constant) = explode('::', $string);
try {
$reflection = new \ReflectionClass($class);
if ($reflection
->hasConstant($constant)) {
$this->value = $reflection
->getConstant($constant);
return;
}
} catch (\ReflectionException $e) {
}
}
// Handle procedural constants.
if (!$this->value && defined($string)) {
$this->value = constant($string);
return;
}
throw AnnotationException::semanticalErrorConstants($this->value);
}