ActorPath
in package
implements
ActorPathContract
Tags
Table of Contents
Interfaces
- ActorPathContract
- Common contract for local and remote actor paths.
Methods
- __serialize() : array<string, string>
- Compact serialization — stores just the path string instead of the private elements array with its full namespace-qualified field key.
- __toString() : string
- __unserialize() : void
- child() : self
- Creates a child path by appending a name segment.
- depth() : int
- Returns the depth of this path (0 for root, 1 for `/user`, etc.).
- equals() : bool
- Value equality comparison.
- fromString() : self
- Parses an actor path from a string like `/user/orders`.
- isChildOf() : bool
- Returns true if this path is a direct child of the given parent (i.e., depth is exactly parent depth + 1 and shares the same prefix).
- isDescendantOf() : bool
- Returns true if this path is a descendant (child, grandchild, etc.) of the given ancestor.
- name() : string
- Returns the last segment of the path (`'/'` for root).
- parent() : ActorPathContract|null
- Returns the parent path, or null for the root path.
- root() : self
- Creates the root path `/`.
Methods
__serialize()
Compact serialization — stores just the path string instead of the private elements array with its full namespace-qualified field key.
public
__serialize() : array<string, string>
Before: O:...:1:{s:50:"\0...\0elements";a:2:{i:0;s:4:"user";i:1;s:7:"shard-0";}} After: O:...:1:{s:1:"p";s:14:"/user/shard-0";}
Saves ~130 bytes per Envelope passed through Thread\Queue, improving cross-thread throughput.
Return values
array<string, string>__toString()
public
__toString() : string
Return values
string__unserialize()
public
__unserialize(array<string, string> $data) : void
Parameters
- $data : array<string, string>
child()
Creates a child path by appending a name segment.
public
child(string $name) : self
Parameters
- $name : string
Tags
Return values
selfdepth()
Returns the depth of this path (0 for root, 1 for `/user`, etc.).
public
depth() : int
Return values
intequals()
Value equality comparison.
public
equals(ActorPathContract $other) : bool
Parameters
- $other : ActorPathContract
Return values
boolfromString()
Parses an actor path from a string like `/user/orders`.
public
static fromString(string $path) : self
Parameters
- $path : string
Tags
Return values
selfisChildOf()
Returns true if this path is a direct child of the given parent (i.e., depth is exactly parent depth + 1 and shares the same prefix).
public
isChildOf(ActorPathContract $parent) : bool
Parameters
- $parent : ActorPathContract
Return values
boolisDescendantOf()
Returns true if this path is a descendant (child, grandchild, etc.) of the given ancestor.
public
isDescendantOf(ActorPathContract $ancestor) : bool
Parameters
- $ancestor : ActorPathContract
Return values
boolname()
Returns the last segment of the path (`'/'` for root).
public
name() : string
Return values
stringparent()
Returns the parent path, or null for the root path.
public
parent() : ActorPathContract|null
Return values
ActorPathContract|nullroot()
Creates the root path `/`.
public
static root() : self
The instance is cached per thread (PHP ZTS gives each thread its own static storage), so repeated calls pay only a null-check.