PHP Class yii\base\Object

Inheritance: implements Configurable
显示文件 Open project: yiisoft/yii2 Class Usage Examples

Public Methods

Method Description
__call ( string $name, array $params ) : mixed Calls the named method which is not a class method.
__construct ( array $config = [] ) Constructor.
__get ( string $name ) : mixed Returns the value of an object property.
__isset ( string $name ) : boolean Checks if a property is set, i.e. defined and not null.
__set ( string $name, mixed $value ) Sets value of an object property.
__unset ( string $name ) Sets an object property to null.
canGetProperty ( string $name, boolean $checkVars = true ) : boolean Returns a value indicating whether a property can be read.
canSetProperty ( string $name, boolean $checkVars = true ) : boolean Returns a value indicating whether a property can be set.
className ( ) : string Returns the fully qualified name of this class.
hasMethod ( string $name ) : boolean Returns a value indicating whether a method is defined.
hasProperty ( string $name, boolean $checkVars = true ) : boolean Returns a value indicating whether a property is defined.
init ( ) Initializes the object.

Method Details

__call() public method

Do not call this method directly as it is a PHP magic method that will be implicitly called when an unknown method is being invoked.
public __call ( string $name, array $params ) : mixed
$name string the method name
$params array method parameters
return mixed the method return value

__construct() public method

The default implementation does two things: - Initializes the object with the given configuration $config. - Call Object::init. If this method is overridden in a child class, it is recommended that - the last parameter of the constructor is a configuration array, like $config here. - call the parent implementation at the end of the constructor.
public __construct ( array $config = [] )
$config array name-value pairs that will be used to initialize the object properties

__get() public method

Do not call this method directly as it is a PHP magic method that will be implicitly called when executing $value = $object->property;.
See also: __set()
public __get ( string $name ) : mixed
$name string the property name
return mixed the property value

__isset() public method

Do not call this method directly as it is a PHP magic method that will be implicitly called when executing isset($object->property). Note that if the property is not defined, false will be returned.
See also: http://php.net/manual/en/function.isset.php
public __isset ( string $name ) : boolean
$name string the property name or the event name
return boolean whether the named property is set (not null).

__set() public method

Do not call this method directly as it is a PHP magic method that will be implicitly called when executing $object->property = $value;.
See also: __get()
public __set ( string $name, mixed $value )
$name string the property name or the event name
$value mixed the property value

__unset() public method

Do not call this method directly as it is a PHP magic method that will be implicitly called when executing unset($object->property). Note that if the property is not defined, this method will do nothing. If the property is read-only, it will throw an exception.
See also: http://php.net/manual/en/function.unset.php
public __unset ( string $name )
$name string the property name

canGetProperty() public method

A property is readable if: - the class has a getter method associated with the specified name (in this case, property name is case-insensitive); - the class has a member variable with the specified name (when $checkVars is true);
See also: canSetProperty()
public canGetProperty ( string $name, boolean $checkVars = true ) : boolean
$name string the property name
$checkVars boolean whether to treat member variables as properties
return boolean whether the property can be read

canSetProperty() public method

A property is writable if: - the class has a setter method associated with the specified name (in this case, property name is case-insensitive); - the class has a member variable with the specified name (when $checkVars is true);
See also: canGetProperty()
public canSetProperty ( string $name, boolean $checkVars = true ) : boolean
$name string the property name
$checkVars boolean whether to treat member variables as properties
return boolean whether the property can be written

className() public static method

Returns the fully qualified name of this class.
public static className ( ) : string
return string the fully qualified name of this class.

hasMethod() public method

The default implementation is a call to php function method_exists(). You may override this method when you implemented the php magic method __call().
public hasMethod ( string $name ) : boolean
$name string the method name
return boolean whether the method is defined

hasProperty() public method

A property is defined if: - the class has a getter or setter method associated with the specified name (in this case, property name is case-insensitive); - the class has a member variable with the specified name (when $checkVars is true);
See also: canGetProperty()
See also: canSetProperty()
public hasProperty ( string $name, boolean $checkVars = true ) : boolean
$name string the property name
$checkVars boolean whether to treat member variables as properties
return boolean whether the property is defined

init() public method

This method is invoked at the end of the constructor after the object is initialized with the given configuration.
public init ( )