Component
abstract class Component implements IComponent
Base class for all components. Components have a parent, name, and can be monitored by ancestors.
Properties
| string read-only | $name | ||
| IContainer read-only | $parent |
Methods
Finds the closest ancestor of specified type.
Finds the closest ancestor specified by class or interface name and returns backtrace path.
Starts monitoring ancestors for attach/detach events.
Stops monitoring ancestors of specified type.
This method will be called when the component (or component's parent) becomes attached to a monitored object. Do not call this method yourself.
This method will be called before the component (or component's parent) becomes detached from a monitored object. Do not call this method yourself.
No description
Returns the parent container if any.
Sets or removes the parent of this component. This method is managed by containers and should not be called by applications
Object cloning.
Prevents serialization.
Details
at line 47
final IComponent|null
lookup(string|null $type, bool $throw = true)
Finds the closest ancestor of specified type.
at line 89
final string|null
lookupPath(string|null $type = null, bool $throw = true)
Finds the closest ancestor specified by class or interface name and returns backtrace path.
A path is the concatenation of component names separated by self::NameSeparator.
at line 103
final void
monitor(string $type, callable|null $attached = null, callable|null $detached = null)
Starts monitoring ancestors for attach/detach events.
at line 130
final void
unmonitor(string $type)
Stops monitoring ancestors of specified type.
at line 141
protected void
attached(IComponent $obj)
deprecated
deprecated
This method will be called when the component (or component's parent) becomes attached to a monitored object. Do not call this method yourself.
at line 151
protected void
detached(IComponent $obj)
deprecated
deprecated
This method will be called before the component (or component's parent) becomes detached from a monitored object. Do not call this method yourself.
at line 159
final string|null
getName()
No description
at line 168
final IContainer|null
getParent()
Returns the parent container if any.
at line 180
IComponent
setParent(IContainer|null $parent, string|null $name = null)
| internal |
Sets or removes the parent of this component. This method is managed by containers and should not be called by applications
at line 220
protected void
validateParent(IContainer $parent)
Validates the new parent before it's set.
Descendant classes can override this to implement custom validation logic.
at line 304
__clone()
Object cloning.
at line 324
final
__serialize()
Prevents serialization.