CodeBase
extends Extendable
in package
implements
ArrayAccess
Parent class for PHP classes created for layout and page code sections.
Tags
Interfaces, Classes and Traits
- ArrayAccess
Table of Contents
- $controller : controller
- $implement : array<string|int, mixed>
- $layout : Layout
- $page : Page
- $extendableCallbacks : array<string|int, mixed>
- $extendableGuardProperties : bool
- $extendableStaticMethods : array<string|int, mixed>
- $extensionData : array<string|int, mixed>
- __call() : mixed
- Dynamically handle calls into the controller instance.
- __callStatic() : mixed
- __construct() : mixed
- Creates the object instance.
- __get() : void
- This object is referenced as $this->page in Cms\Classes\ComponentBase, so to avoid $this->page->page this method will proxy there. This is also used as a helper for accessing controller variables/components easier in the page code, eg. $this->foo instead of $this['foo']
- __isset() : bool
- This will check if a property is set on the CMS Page object.
- __set() : void
- This will set a property on the CMS Page object.
- addDynamicMethod() : mixed
- Programmatically adds a method to the extendable class
- addDynamicProperty() : mixed
- Programmatically adds a property to the extendable class
- asExtension() : mixed
- Short hand for `getClassExtension()` method, except takes the short extension name, example:
- clearExtendedClasses() : void
- Clear the list of extended classes so they will be re-extended.
- extend() : mixed
- extendableCall() : mixed
- Magic method for `__call()`
- extendableCallStatic() : mixed
- Magic method for `__callStatic()`
- extendableConstruct() : mixed
- This method should be called as part of the constructor.
- extendableExtendCallback() : void
- Helper method for `::extend()` static method
- extendableGet() : string
- Magic method for `__get()`
- extendableSet() : string
- Magic method for `__set()`
- extendClassWith() : void
- Dynamically extend a class with a specified behavior
- getClassExtension() : mixed
- Returns a behavior object from an extendable class, example:
- getClassMethods() : array<string|int, mixed>
- Get a list of class methods, extension equivalent of get_class_methods()
- getDynamicProperties() : array<string|int, mixed>
- Returns all dynamic properties and their values
- isClassExtendedWith() : bool
- Check if extendable class is extended with a behavior object
- methodExists() : bool
- Checks if a method exists, extension equivalent of method_exists()
- offsetExists() : mixed
- ArrayAccess implementation
- offsetGet() : mixed
- ArrayAccess implementation
- offsetSet() : mixed
- ArrayAccess implementation
- offsetUnset() : mixed
- ArrayAccess implementation
- onEnd() : mixed
- This event is triggered in the end of the execution cycle, but before the page is displayed.
- onInit() : mixed
- This event is triggered when all components are initialized and before AJAX is handled.
- onStart() : mixed
- This event is triggered in the beginning of the execution cycle.
- propertyExists() : bool
- Checks if a property exists, extension equivalent of `property_exists()`
- extendableIsAccessible() : bool
- Checks if a property is accessible, property equivalent of `is_callable()`
- extensionExtractMethods() : void
- Extracts the available methods from a behavior and adds it to the list of callable methods.
Properties
$controller
public
controller
$controller
Specifies the CMS controller
$implement
public
array<string|int, mixed>
$implement
Extensions implemented by this class.
$layout
public
Layout
$layout
Specifies the current layout
$page
public
Page
$page
Specifies the current page
$extendableCallbacks
protected
static array<string|int, mixed>
$extendableCallbacks
= []
Used to extend the constructor of an extendable class. Eg:
Class::extend(function($obj) { })
$extendableGuardProperties
protected
static bool
$extendableGuardProperties
= true
Indicates if dynamic properties can be created.
$extendableStaticMethods
protected
static array<string|int, mixed>
$extendableStaticMethods
= []
Collection of static methods used by behaviors.
$extensionData
protected
array<string|int, mixed>
$extensionData
= ['extensions' => [], 'methods' => [], 'dynamicMethods' => [], 'dynamicProperties' => []]
Class reflection information, including behaviors.
Methods
__call()
Dynamically handle calls into the controller instance.
public
__call(string $method, array<string|int, mixed> $parameters) : mixed
Parameters
- $method : string
- $parameters : array<string|int, mixed>
Return values
mixed —__callStatic()
public
static __callStatic(mixed $name, mixed $params) : mixed
Parameters
- $name : mixed
- $params : mixed
Return values
mixed —__construct()
Creates the object instance.
public
__construct(Page $page, Layout $layout, Controller $controller) : mixed
Parameters
- $page : Page
-
Specifies the CMS page.
- $layout : Layout
-
Specifies the CMS layout.
- $controller : Controller
-
Specifies the CMS controller.
Return values
mixed —__get()
This object is referenced as $this->page in Cms\Classes\ComponentBase, so to avoid $this->page->page this method will proxy there. This is also used as a helper for accessing controller variables/components easier in the page code, eg. $this->foo instead of $this['foo']
public
__get(string $name) : void
Parameters
- $name : string
Return values
void —__isset()
This will check if a property is set on the CMS Page object.
public
__isset(string $name) : bool
Parameters
- $name : string
Return values
bool —__set()
This will set a property on the CMS Page object.
public
__set(string $name, mixed $value) : void
Parameters
- $name : string
- $value : mixed
Return values
void —addDynamicMethod()
Programmatically adds a method to the extendable class
public
addDynamicMethod(string $dynamicName, callable $method[, string $extension = null ]) : mixed
Parameters
- $dynamicName : string
- $method : callable
- $extension : string = null
Return values
mixed —addDynamicProperty()
Programmatically adds a property to the extendable class
public
addDynamicProperty(string $dynamicName[, string $value = null ]) : mixed
Parameters
- $dynamicName : string
- $value : string = null
Return values
mixed —asExtension()
Short hand for `getClassExtension()` method, except takes the short extension name, example:
public
asExtension(string $shortName) : mixed
$this->asExtension('FormController')
Parameters
- $shortName : string
Return values
mixed —clearExtendedClasses()
Clear the list of extended classes so they will be re-extended.
public
static clearExtendedClasses() : void
Return values
void —extend()
public
static extend(callable $callback) : mixed
Parameters
- $callback : callable
Return values
mixed —extendableCall()
Magic method for `__call()`
public
extendableCall(string $name[, array<string|int, mixed> $params = null ]) : mixed
Parameters
- $name : string
- $params : array<string|int, mixed> = null
Return values
mixed —extendableCallStatic()
Magic method for `__callStatic()`
public
static extendableCallStatic(string $name[, array<string|int, mixed> $params = null ]) : mixed
Parameters
- $name : string
- $params : array<string|int, mixed> = null
Return values
mixed —extendableConstruct()
This method should be called as part of the constructor.
public
extendableConstruct() : mixed
Return values
mixed —extendableExtendCallback()
Helper method for `::extend()` static method
public
static extendableExtendCallback(callable $callback) : void
Parameters
- $callback : callable
Return values
void —extendableGet()
Magic method for `__get()`
public
extendableGet(string $name) : string
Parameters
- $name : string
Return values
string —extendableSet()
Magic method for `__set()`
public
extendableSet(string $name, string $value) : string
Parameters
- $name : string
- $value : string
Return values
string —extendClassWith()
Dynamically extend a class with a specified behavior
public
extendClassWith(string $extensionName) : void
Parameters
- $extensionName : string
Return values
void —getClassExtension()
Returns a behavior object from an extendable class, example:
public
getClassExtension(string $name) : mixed
$this->getClassExtension('Backend.Behaviors.FormController')
Parameters
- $name : string
-
Fully qualified behavior name
Return values
mixed —getClassMethods()
Get a list of class methods, extension equivalent of get_class_methods()
public
getClassMethods() : array<string|int, mixed>
Return values
array<string|int, mixed> —getDynamicProperties()
Returns all dynamic properties and their values
public
getDynamicProperties() : array<string|int, mixed>
Return values
array<string|int, mixed> —['property' => 'value']
isClassExtendedWith()
Check if extendable class is extended with a behavior object
public
isClassExtendedWith(string $name) : bool
Parameters
- $name : string
-
Fully qualified behavior name
Return values
bool —methodExists()
Checks if a method exists, extension equivalent of method_exists()
public
methodExists(string $name) : bool
Parameters
- $name : string
Return values
bool —offsetExists()
ArrayAccess implementation
public
offsetExists(mixed $offset) : mixed
Parameters
- $offset : mixed
Return values
mixed —offsetGet()
ArrayAccess implementation
public
offsetGet(mixed $offset) : mixed
Parameters
- $offset : mixed
Return values
mixed —offsetSet()
ArrayAccess implementation
public
offsetSet(mixed $offset, mixed $value) : mixed
Parameters
- $offset : mixed
- $value : mixed
Return values
mixed —offsetUnset()
ArrayAccess implementation
public
offsetUnset(mixed $offset) : mixed
Parameters
- $offset : mixed
Return values
mixed —onEnd()
This event is triggered in the end of the execution cycle, but before the page is displayed.
public
onEnd() : mixed
The layout's onEnd method triggers after the page's onEnd method.
Return values
mixed —onInit()
This event is triggered when all components are initialized and before AJAX is handled.
public
onInit() : mixed
The layout's onInit method triggers before the page's onInit method.
Return values
mixed —onStart()
This event is triggered in the beginning of the execution cycle.
public
onStart() : mixed
The layout's onStart method triggers before the page's onStart method.
Return values
mixed —propertyExists()
Checks if a property exists, extension equivalent of `property_exists()`
public
propertyExists(string $name) : bool
Parameters
- $name : string
Return values
bool —extendableIsAccessible()
Checks if a property is accessible, property equivalent of `is_callable()`
protected
extendableIsAccessible(mixed $class, string $propertyName) : bool
Parameters
- $class : mixed
- $propertyName : string
Return values
bool —extensionExtractMethods()
Extracts the available methods from a behavior and adds it to the list of callable methods.
protected
extensionExtractMethods(string $extensionName, object $extensionObject) : void
Parameters
- $extensionName : string
- $extensionObject : object