Secciones

Class Phalcon\Collection

Código fuente en GitHub

Namespace Phalcon   Uses ArrayAccess, ArrayIterator, Countable, IteratorAggregate, JsonSerializable, Phalcon\Collection\CollectionInterface, Phalcon\Helper\Json, Serializable, Traversable   Implements ArrayAccess, CollectionInterface, Countable, IteratorAggregate, JsonSerializable, Serializable

Phalcon\Collection es un objeto sobrecargado orientado a vector. Implementa:

Se puede usar como parte de la aplicación que necesite recolección de datos. Tales implementaciones están por ejemplo al acceder a los globales $_GET, $_POST, etc.

Propiedades

/**
 * @var array
 */
protected data;

/**
 * @var bool
 */
protected insensitive = true;

/**
 * @var array
 */
protected lowerKeys;

Métodos

public function __construct( array $data = [], bool $insensitive = bool );

Constructor de la colección.

public function __get( string $element ): mixed;

Getter mágico para obtener un elemento de la colección

public function __isset( string $element ): bool;

Isset mágico para comprobar si un elemento existe o no

public function __set( string $element, mixed $value ): void;

Setter mágico para asignar valores a un elemento

public function __unset( string $element ): void;

Unset mágico para eliminar un elemento de la colección

public function clear(): void;

Limpia la colección interna

public function count(): int;

Cuenta los elementos de un objeto. Ver count

public function get( string $element, mixed $defaultValue = null, string $cast = null ): mixed;

Obtiene el elemento de la colección

public function getIterator(): Traversable;

Devuelve el iterador de la clase

public function getKeys( bool $insensitive = bool ): array;
public function getValues(): array;
public function has( string $element ): bool;

Determina si un elemento está presente en la colección.

public function init( array $data = [] ): void;

Inicializa el vector interno

public function jsonSerialize(): array;

Especifica los datos que deberían se serializados a JSON. Ver jsonSerialize

public function offsetExists( mixed $element ): bool;

Indica si existe un desplazamiento. Ver offsetExists

public function offsetGet( mixed $element );

Desplazamiento a obtener. Ver offsetGet

public function offsetSet( mixed $element, mixed $value ): void;

Desplazamiento a establecer. Ver offsetSet

public function offsetUnset( mixed $element ): void;

Desplazamiento a eliminar. Ver offsetUnset

public function remove( string $element ): void;

Elimina el elemento de la colección

public function serialize(): string;

Representación del objeto como cadena. Ver serialize

public function set( string $element, mixed $value ): void;

Establece un elemento en la colección

public function toArray(): array;

Devuelve el objeto en un formato vector

public function toJson( int $options = int ): string;

Devuelve el objeto en un formato JSON

La cadena predeterminada usa las siguientes opciones para json_encode

JSON_HEX_TAG, JSON_HEX_APOS, JSON_HEX_AMP, JSON_HEX_QUOT, JSON_UNESCAPED_SLASHES

Ver rfc4627

public function unserialize( mixed $serialized ): void;

Construye el objeto. Ver unserialize

protected function setData( string $element, mixed $value ): void;

Método interno para establecer datos

Interface Phalcon\Collection\CollectionInterface

Código fuente en GitHub

Namespace Phalcon\Collection

Phalcon\Collection\CollectionInterface

Interfaz para la clase Phalcon\Collection

Métodos

public function __get( string $element ): mixed;
public function __isset( string $element ): bool;
public function __set( string $element, mixed $value ): void;
public function __unset( string $element ): void;
public function clear(): void;
public function get( string $element, mixed $defaultValue = null, string $cast = null ): mixed;
public function getKeys( bool $insensitive = bool ): array;
public function getValues(): array;
public function has( string $element ): bool;
public function init( array $data = [] ): void;
public function remove( string $element ): void;
public function set( string $element, mixed $value ): void;
public function toArray(): array;
public function toJson( int $options = int ): string;

Class Phalcon\Collection\Exception

Código fuente en GitHub

Namespace Phalcon\Collection   Uses Throwable   Extends \Phalcon\Exception   Implements Throwable

Excepciones para el objeto Collection

Class Phalcon\Collection\ReadOnly

Código fuente en GitHub

Namespace Phalcon\Collection   Uses Phalcon\Collection   Extends Collection

Phalcon\Collection\ReadOnly es un objeto Collection de sólo lectura

Métodos

public function remove( string $element ): void;

Elimina el elemento de la colección

public function set( string $element, mixed $value ): void;

Establece un elemento en la colección