Fqcn
API reference › Debug Core › Helper › Fqcn
Derives the presentation forms of a fully-qualified class name: short name, namespace prefix, two-tone label, and fragment anchor.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
anchor() static | Returns a URL-safe fragment id for a fully-qualified class name, stable across spellings and free of collisions. | Fqcn |
namespacePart() static | Returns the namespace prefix (everything before the last \, without trailing separator), or '' when none is present. | Fqcn |
renderLabel() static | Renders the shared two-tone label: a muted namespace prefix followed by a bold short name, with the full value preserved in the title attribute for hover inspection. | Fqcn |
shortName() static | Returns the segment after the last \ separator, or the full $fqcn when no separator is present. | Fqcn |
Method details
Section titled “Method details”anchor()
Section titled “anchor() ”public static function anchor(string $fqcn): stringReturns a URL-safe fragment id for a fully-qualified class name, stable across spellings and free of collisions.
The name is lowercased first because PHP resolves class names case-insensitively, so every spelling of one class
must share one anchor. The readable slug collapses each run of characters outside a-z0-9 into a single -,
which on its own is not injective (app\A_B and app\A__b both flatten to app-a-b), so the first 8
hexadecimal characters of the sha1 of the lowercased name are appended to keep distinct classes apart; that
digest identifies a DOM id and is never used as a security primitive. A name made only of separators leaves no
slug and returns the digest alone.
Parameters
| Parameter | Type | Description |
|---|---|---|
$fqcn | string | Fully-qualified class name. |
Returns
string: URL-safe fragment id.
namespacePart()
Section titled “namespacePart() ”public static function namespacePart(string $fqcn): stringReturns the namespace prefix (everything before the last \, without trailing separator), or '' when none is
present.
Parameters
| Parameter | Type | Description |
|---|---|---|
$fqcn | string | Fully-qualified class name. |
Returns
string: Namespace prefix or ''.
renderLabel()
Section titled “renderLabel() ”public static function renderLabel(string $value): stringRenders the shared two-tone label: a muted namespace prefix followed by a bold short name, with the full value
preserved in the title attribute for hover inspection.
Method-suffixed values such as yii\db\Command::query keep the Class::method pair inside the bold segment;
values without a namespace render the bold segment only, and '' collapses to an em dash. A <wbr> between
the two segments marks the namespace boundary as the preferred line-break opportunity.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | string | Fully-qualified class name, FQCN::method pair, or plain category string. |
Returns
string: Two-tone label markup or an em dash for an empty value.
shortName()
Section titled “shortName() ”public static function shortName(string $fqcn): stringReturns the segment after the last \ separator, or the full $fqcn when no separator is present.
Parameters
| Parameter | Type | Description |
|---|---|---|
$fqcn | string | Fully-qualified class name. |
Returns
string: Short class name.