PHP Класс Essence\Media

This class is useful to ensure that any response from any provider will follow the same conventions.
Наследование: implements IteratorAggregat\IteratorAggregate, implements JsonSerializabl\JsonSerializable
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$_properties array These default properties are gathered from the OEmbed and OpenGraph protocols, and provide all the basic informations needed to embed a media.

Открытые методы

Метод Описание
__construct ( array $properties = [] ) Constructs a Media from the given dataset.
__get ( $property )
__isset ( $property )
__set ( $property, $value )
configure ( array $properties ) Merges the given properties with the current ones.
filledProperties ( ) : array Returns the filled properties.
get ( string $property, mixed $default = null ) : mixed Returns the value of the given property.
getIterator ( ) : ArrayIterator Returns an iterator for the media properties.
has ( string $property ) Returns if there is any value for the given property.
jsonSerialize ( ) : string Returns serialized properties.
properties ( ) : array Returns the entire set of properties.
set ( string $property, string $value ) Sets the value of the given property.
setDefault ( string $property, string $default ) Sets the value of a property if it is empty.
setDefaults ( array $properties ) Sets default values.
setProperties ( array $properties ) Sets the entire set of properties.

Описание методов

__construct() публичный Метод

Constructs a Media from the given dataset.
public __construct ( array $properties = [] )
$properties array An array of media informations.

__get() публичный Метод

См. также: get()
public __get ( $property )

__isset() публичный Метод

См. также: has()
public __isset ( $property )

__set() публичный Метод

См. также: set()
public __set ( $property, $value )

configure() публичный Метод

Merges the given properties with the current ones.
public configure ( array $properties )
$properties array Properties to merge.

filledProperties() публичный Метод

Returns the filled properties.
public filledProperties ( ) : array
Результат array Properties.

get() публичный Метод

Returns the value of the given property.
public get ( string $property, mixed $default = null ) : mixed
$property string Property name.
$default mixed Default value to be returned in case the property doesn't exists.
Результат mixed The property value, or $default.

getIterator() публичный Метод

Returns an iterator for the media properties.
public getIterator ( ) : ArrayIterator
Результат ArrayIterator Iterator.

has() публичный Метод

Returns if there is any value for the given property.
public has ( string $property )
$property string Property name.

jsonSerialize() публичный Метод

Returns serialized properties.
public jsonSerialize ( ) : string
Результат string JSON representation.

properties() публичный Метод

Returns the entire set of properties.
public properties ( ) : array
Результат array Properties.

set() публичный Метод

Sets the value of the given property.
public set ( string $property, string $value )
$property string Property name.
$value string New value.

setDefault() публичный Метод

Sets the value of a property if it is empty.
public setDefault ( string $property, string $default )
$property string Property name.
$default string Default value.

setDefaults() публичный Метод

Sets default values.
См. также: setDefault()
public setDefaults ( array $properties )
$properties array Default properties.

setProperties() публичный Метод

Sets the entire set of properties.
public setProperties ( array $properties )
$properties array Properties to set.

Описание свойств

$_properties защищенное свойство

These default properties are gathered from the OEmbed and OpenGraph protocols, and provide all the basic informations needed to embed a media.
protected array $_properties
Результат array