class Fqsen
Same name in this branch
- 11.1.x vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Reference/Fqsen.php \phpDocumentor\Reflection\DocBlock\Tags\Reference\Fqsen
Value Object for Fqsen.
@link https://github.com/phpDocumentor/fig-standards/blob/master/proposed/php…
@psalm-immutable
Hierarchy
- class \phpDocumentor\Reflection\Fqsen
Expanded class hierarchy of Fqsen
8 files declare their use of Fqsen
- ClassString.php in vendor/
phpdocumentor/ type-resolver/ src/ Types/ ClassString.php - Collection.php in vendor/
phpdocumentor/ type-resolver/ src/ Types/ Collection.php - Covers.php in vendor/
phpdocumentor/ reflection-docblock/ src/ DocBlock/ Tags/ Covers.php - Fqsen.php in vendor/
phpdocumentor/ reflection-docblock/ src/ DocBlock/ Tags/ Reference/ Fqsen.php - InterfaceString.php in vendor/
phpdocumentor/ type-resolver/ src/ Types/ InterfaceString.php
File
-
vendor/
phpdocumentor/ reflection-common/ src/ Fqsen.php, line 32
Namespace
phpDocumentor\ReflectionView source
final class Fqsen {
/** @var string full quallified class name */
private $fqsen;
/** @var string name of the element without path. */
private $name;
/**
* Initializes the object.
*
* @throws InvalidArgumentException when $fqsen is not matching the format.
*/
public function __construct(string $fqsen) {
$matches = [];
$result = preg_match('/^\\\\([a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff\\\\]*)?(?:[:]{2}\\$?([a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*))?(?:\\(\\))?$/', $fqsen, $matches);
if ($result === 0) {
throw new InvalidArgumentException(sprintf('"%s" is not a valid Fqsen.', $fqsen));
}
$this->fqsen = $fqsen;
if (isset($matches[2])) {
$this->name = $matches[2];
}
else {
$matches = explode('\\', $fqsen);
$name = end($matches);
assert(is_string($name));
$this->name = trim($name, '()');
}
}
/**
* converts this class to string.
*/
public function __toString() : string {
return $this->fqsen;
}
/**
* Returns the name of the element without path.
*/
public function getName() : string {
return $this->name;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
Fqsen::$fqsen | private | property | @var string full quallified class name |
Fqsen::$name | private | property | @var string name of the element without path. |
Fqsen::getName | public | function | Returns the name of the element without path. |
Fqsen::__construct | public | function | Initializes the object. |
Fqsen::__toString | public | function | converts this class to string. |