ICanBoogie
  • Documentation
  • API Reference
  • Accessor v1.0.3
Namespaces
  • ICanBoogie
    • Accessor
Classes
  • AccessorReflection
Interfaces
  • HasAccessor
Traits
  • AccessorCamelTrait
  • AccessorSnakeTrait
  • AccessorTrait
  • FormatAsCamel
  • FormatAsSnake
  • SerializableTrait

Interface HasAccessor

Interface for classes implementing the accessor pattern.

Namespace: ICanBoogie\Accessor
Located at HasAccessor.php

Methods summary

public static accessor_format( string $property, string $type, string $lazy = self::ACCESSOR_IS_NOT_LAZY ) : mixed

Formats an accessor method name.

Formats an accessor method name.

Parameters

$property
A property.
$type
One of ICanBoogie\Accessor\HasAccessor::ACCESSOR_TYPE_GETTER and ICanBoogie\Accessor\HasAccessor::ACCESSOR_TYPE_SETTER.
$lazy

One of ICanBoogie\Accessor\HasAccessor::ACCESSOR_IS_NOT_LAZY and ICanBoogie\Accessor\HasAccessor::ACCESSOR_IS_LAZY. Defaults to ICanBoogie\Accessor\HasAccessor::ACCESSOR_IS_NOT_LAZY.

Returns

mixed
public __get( string $property ) : mixed

Returns the value of a property.

Returns the value of a property.

Parameters

$property

Returns

mixed

Throws

ICanBoogie\PropertyNotDefined
when the property is not defined.
ICanBoogie\PropertyNotReadable

when the property is not accessible or is write-only (the property is not defined and only a setter is available).

public __set( string $property, mixed $value )

Sets the value of a property.

Sets the value of a property.

Parameters

$property
$value

Throws

ICanBoogie\PropertyNotWritable

when the property doesn't exists, has no lazy getter and is not public; or when only a getter is implemented.

public has_property( string $property ) : boolean

Whether an object has a property.

Whether an object has a property.

Parameters

$property

Returns

boolean
true if the object has a property, false otherwise.
public has_method( string $method ) : boolean

Whether an object has a method.

Whether an object has a method.

Parameters

$method

Returns

boolean
true if the object has a method, false otherwise.

Constants summary

ACCESSOR_TYPE_GETTER : string
"get"
ACCESSOR_TYPE_SETTER : string
"set"
ACCESSOR_IS_LAZY : string
'lazy'
ACCESSOR_IS_NOT_LAZY : string
''
Accessor v1.0.3 – Check on GitHub – API documentation generated by ApiGen