PartialCode

Parent class for PHP classes created for partial PHP sections.

class Cms\Classes\PartialCode
extends Cms\Classes\CodeBase
implements
    ArrayAccess
PHP

Extends

Class Description
CodeBase

Parent class for PHP classes created for layout and page code sections.

Traits

Trait Description
ExtendableTrait

This extension trait is used when access to the underlying base class is not available, such as classes that belong to the foundation framework (Laravel). It is currently used by the Controller and Model classes.

Properties

inherited public $controller : Cms\Classes\controller

Inherited from CodeBase

Specifies the CMS controller

inherited public $implement : string | array | null

Inherited from CodeBase

Extensions implemented by this class.

inherited public $layout : Cms\Classes\Layout

Inherited from CodeBase

Specifies the current layout

inherited public $page : Cms\Classes\Page

Inherited from CodeBase

Specifies the current page

inherited protected static $extendableCallbacks : array

Inherited from CodeBase

Used to extend the constructor of an extendable class. Eg:

Class::extend(function($obj) { })

inherited protected static $extendableClassLoader : ClassLoader | null

Inherited from CodeBase

Class loader instance.

inherited protected $extendableConstructed : bool

Inherited from CodeBase

Indicates if the extendable constructor has completed.

inherited protected static $extendableStaticMethods : array

Inherited from CodeBase

Collection of static methods used by behaviors.

inherited protected $extensionData : array

Inherited from CodeBase

Class reflection information, including behaviors.

inherited protected $localCallbacks : array

Inherited from CodeBase

This stores any locally-scoped callbacks fired before the extendable constructor had completed.

Methods

inherited public __call (string $method, array $parameters) : mixed

Inherited from CodeBase

Dynamically handle calls into the controller instance.

Parameters
Property Description
$method
string
$parameters
array
Returns
mixed

inherited public static __callStatic ($name, $params)

Inherited from CodeBase
Parameters
Property Description
$name
mixed
$params
mixed
Returns
mixed

inherited public __construct (Cms\Classes\Page $page, Cms\Classes\Layout $layout, Cms\Classes\Controller $controller)

Inherited from CodeBase

Creates the object instance.

Parameters
Property Description
$page

Specifies the CMS page.

$layout

Specifies the CMS layout.

$controller

Specifies the CMS controller.

Returns
mixed

inherited public __get (string $name) : void

Inherited from CodeBase

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']

Parameters
Property Description
$name
string
Returns
void

inherited public __isset (string $name) : bool

Inherited from CodeBase

This will check if a property is set on the CMS Page object.

Parameters
Property Description
$name
string
Returns
bool

inherited public __set (string $name, mixed $value) : void

Inherited from CodeBase

This will set a property on the CMS Page object.

Parameters
Property Description
$name
string
$value
mixed
Returns
void

inherited public addDynamicMethod (string $dynamicName, callable $method, string $extension = null)

Inherited from CodeBase

Programmatically adds a method to the extendable class

Parameters
Property Description
$dynamicName
string
$method
callable
$extension
string
Returns
mixed

inherited public addDynamicProperty (string $dynamicName, mixed $value = null) : void

Inherited from CodeBase

Programmatically adds a property to the extendable class

Parameters
Property Description
$dynamicName
string

The name of the property to add

$value
mixed

The value of the property

Returns
void

inherited public asExtension (string $shortName) : mixed

Inherited from CodeBase

Short hand for getClassExtension() method, except takes the short extension name, example:

$this->asExtension('FormController')

Parameters
Property Description
$shortName
string
Returns
mixed

inherited public static clearExtendedClasses () : void

Inherited from CodeBase

Clear the list of extended classes so they will be re-extended.

Returns
void

inherited public extendClassWith (string $extensionName) : void

Inherited from CodeBase

Dynamically extend a class with a specified behavior

Parameters
Property Description
$extensionName
string
Returns
void

inherited public static extendableAddExtension (callable $callback, boolean $scoped = false, $outerScope = null) : void

Inherited from CodeBase

Extends the class using a closure.

The closure will be provided a single parameter which is the instance of the extended class, by default.

You may optionally specify the callback as a scoped callback, which inherits the scope of the extended class and provides access to protected and private methods and properties. This makes any call using $this act on the extended class, not the class providing the extension.

If you use a scoped callback, you can provide the "outer" scope - or the scope of the class providing the extension, with the third parameter. The outer scope object will then be passed as the single parameter to the closure.

Parameters
Property Description
$callback
callable
$scoped
boolean
$outerScope
mixed
Returns
void

inherited public extendableCall (string $name, array $params = null) : mixed

Inherited from CodeBase

Magic method for __call().

Callback priority is as follows:

  • "Dynamic Methods" added locally to the object via addDynamicMethod($name, $callable)
  • Methods available on Behaviors that have been implemented by the object
  • Pass it to the parent's __call() method if it defines one
Parameters
Property Description
$name
string
$params
array
Returns
mixed

inherited public static extendableCallStatic (string $name, array $params = null) : mixed

Inherited from CodeBase

Magic method for __callStatic()

Parameters
Property Description
$name
string
$params
array
Returns
mixed

inherited public extendableConstruct ()

Inherited from CodeBase

This method should be called as part of the constructor.

Returns
mixed

inherited public static extendableExtendCallback (callable $callback, boolean $scoped = false, $outerScope = null) : void

Inherited from CodeBase

Helper method for ::extend() static method.

Parameters
Property Description
$callback
callable
$scoped
boolean
$outerScope
mixed
Returns
void

inherited public extendableGet (string $name) : mixed | null

Inherited from CodeBase

Magic method for __get()

Parameters
Property Description
$name
string
Returns
mixed | null

inherited public extendableSet (string $name, mixed $value) : void

Inherited from CodeBase

Magic method for __set()

Parameters
Property Description
$name
string
$value
mixed
Returns
void

inherited public getClassExtension (string $name) : mixed

Inherited from CodeBase

Returns a behavior object from an extendable class, example:

$this->getClassExtension('Backend.Behaviors.FormController')

Parameters
Property Description
$name
string

Fully qualified behavior name

Returns
mixed

inherited public getClassMethods () : array

Inherited from CodeBase

Get a list of class methods, extension equivalent of get_class_methods()

Returns
array

inherited public getDynamicProperties () : array

Inherited from CodeBase

Returns all dynamic properties and their values

Returns
array

['property' => 'value']

inherited public isClassExtendedWith (string $name) : bool

Inherited from CodeBase

Check if extendable class is extended with a behavior object

Parameters
Property Description
$name
string

Fully qualified behavior name

Returns
bool

inherited public methodExists (string $name) : bool

Inherited from CodeBase

Checks if a method exists, extension equivalent of method_exists()

Parameters
Property Description
$name
string
Returns
bool

inherited public offsetExists ($offset) : bool

Inherited from CodeBase

ArrayAccess implementation

Parameters
Property Description
$offset
mixed
Returns
bool

inherited public offsetGet ($offset)

Inherited from CodeBase

ArrayAccess implementation

Parameters
Property Description
$offset
mixed
Returns
mixed

inherited public offsetSet ($offset, $value) : void

Inherited from CodeBase

ArrayAccess implementation

Parameters
Property Description
$offset
mixed
$value
mixed
Returns
void

inherited public offsetUnset ($offset) : void

Inherited from CodeBase

ArrayAccess implementation

Parameters
Property Description
$offset
mixed
Returns
void

inherited public onEnd ()

Inherited from CodeBase

This event is triggered in the end of the execution cycle, but before the page is displayed.

The layout's onEnd method triggers after the page's onEnd method.

Returns
mixed

inherited public onInit ()

Inherited from CodeBase

This event is triggered when all components are initialized and before AJAX is handled.

The layout's onInit method triggers before the page's onInit method.

Returns
mixed

inherited public onStart ()

Inherited from CodeBase

This event is triggered in the beginning of the execution cycle.

The layout's onStart method triggers before the page's onStart method.

Returns
mixed

inherited public propertyExists (string $name) : bool

Inherited from CodeBase

Checks if a property exists, extension equivalent of property_exists()

Parameters
Property Description
$name
string
Returns
bool

inherited protected extendableAddLocalExtension (Closure $callback, $outerScope = null)

Inherited from CodeBase

Adds local extensibility to the current instance.

This rebinds a given closure to the current instance, making it able to access protected and private methods. This makes any call using $this within the closure act on the extended class, not the class providing the extension.

An outer scope may be provided by providing a second parameter, which will then be passed through to the closure as its first parameter. If this is not given, the current instance will be provided as the first parameter.

Parameters
Property Description
$callback
Closure
$outerScope
mixed
Returns
mixed

inherited protected extendableIsAccessible (mixed $class, string $propertyName) : bool

Inherited from CodeBase

Checks if a property is accessible, property equivalent of is_callable()

Parameters
Property Description
$class
mixed
$propertyName
string
Returns
bool

inherited protected extensionCallMethod (ReflectionClass $class, string $method, array $params)

Inherited from CodeBase

Calls a method through reflection.

Parameters
Property Description
$class
ReflectionClass
$method
string
$params
array
Returns
mixed

inherited protected extensionExtractMethods (string $extensionName, object $extensionObject) : void

Inherited from CodeBase

Extracts the available methods from a behavior and adds it to the list of callable methods.

Parameters
Property Description
$extensionName
string
$extensionObject
object
Returns
void

inherited protected extensionGetClassLoader () : Winter\Storm\Support\ClassLoader | null

Inherited from CodeBase

Gets the class loader

Returns
Winter\Storm\Support\ClassLoader | null

inherited protected extensionGetParentClass ($instance = null) : ReflectionClass | false

Inherited from CodeBase

Gets the parent class using reflection.

The parent class must either not be the Extendable class, or must not be using the ExtendableTrait trait, in order to prevent infinite loops.

Parameters
Property Description
$instance
mixed
Returns
ReflectionClass | false

inherited protected extensionMethodExists (ReflectionClass $class, string $methodName) : bool

Inherited from CodeBase

Determines if the given class reflection contains the given method.

Parameters
Property Description
$class
ReflectionClass
$methodName
string
Returns
bool

inherited protected extensionNormalizeClassName (string $name) : string

Inherited from CodeBase

Normalizes the provided extension name allowing for the ClassLoader to inject aliased classes

Parameters
Property Description
$name
string
Returns
string
Copyright © 2024 Winter CMS