class BootstrapConstant in Express 8
Defines a BootstrapConstant annotation object.
Hierarchy
- class \Drupal\Component\Annotation\AnnotationBase implements AnnotationInterface
- class \Drupal\bootstrap\Annotation\BootstrapConstant
Expanded class hierarchy of BootstrapConstant
2 files declare their use of BootstrapConstant
- CdnJsdelivrVersion.php in themes/
contrib/ bootstrap/ src/ Plugin/ Setting/ Advanced/ Cdn/ CdnJsdelivrVersion.php - Contains \Drupal\bootstrap\Plugin\Setting\Advanced\Cdn\CdnJsdelivrVersion.
- Link.php in themes/
contrib/ bootstrap/ src/ Plugin/ Prerender/ Link.php - Contains \Drupal\bootstrap\Plugin\Prerender\Link.
File
- themes/
contrib/ bootstrap/ src/ Annotation/ BootstrapConstant.php, line 19 - Contains \Drupal\bootstrap\Annotation\BootstrapConstant.
Namespace
Drupal\bootstrap\AnnotationView source
class BootstrapConstant extends AnnotationBase {
/**
* The stored constant value.
*
* @var mixed
*/
protected $value;
/**
* {@inheritdoc}
*/
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);
}
/**
* {@inheritdoc}
*/
public function get() {
return $this->value;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AnnotationBase:: |
protected | property | The class used for this annotated class. | |
AnnotationBase:: |
public | property | The annotated class ID. | 1 |
AnnotationBase:: |
protected | property | The provider of the annotated class. | |
AnnotationBase:: |
public | function |
Gets the class of the annotated class. Overrides AnnotationInterface:: |
|
AnnotationBase:: |
public | function |
Gets the unique ID for this annotated class. Overrides AnnotationInterface:: |
1 |
AnnotationBase:: |
public | function |
Gets the name of the provider of the annotated class. Overrides AnnotationInterface:: |
|
AnnotationBase:: |
public | function |
Sets the class of the annotated class. Overrides AnnotationInterface:: |
|
AnnotationBase:: |
public | function |
Sets the name of the provider of the annotated class. Overrides AnnotationInterface:: |
|
BootstrapConstant:: |
protected | property | The stored constant value. | |
BootstrapConstant:: |
public | function |
Gets the value of an annotation. Overrides AnnotationInterface:: |
|
BootstrapConstant:: |
public | function |