Class Phalcon\Support\Collection
Código fuente en GitHub
Namespace |
Phalcon\Support |
|
Uses |
ArrayAccess, ArrayIterator, Countable, IteratorAggregate, InvalidArgumentException, JsonSerializable, Phalcon\Support\Collection\CollectionInterface, Serializable, Traversable |
|
Implements |
ArrayAccess, CollectionInterface, Countable, IteratorAggregate, JsonSerializable, Serializable |
Phalcon\Support\Collection
is a supercharged object oriented array. 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 __serialize(): array;
public function __set( string $element, mixed $value ): void;
Setter mágico para asignar valores a un elemento
public function __unserialize( array $data ): void;
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;
Return the keys as an array
public function getValues(): array;
Return the values as an 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 ): mixed;
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( string $serialized ): void;
Construye el objeto. Ver unserialize
protected function phpJsonEncode( mixed $value, int $flags = int, int $depth = int );
@todo to be removed when we get traits
protected function processKey( string $element ): string;
Checks if we need insensitive keys and if so, converts the element to lowercase
protected function setData( string $element, mixed $value ): void;
Método interno para establecer datos
Interface Phalcon\Support\Collection\CollectionInterface
Código fuente en GitHub
Namespace |
Phalcon\Support\Collection |
Phalcon\Support\Collection\CollectionInterface
Interface for Phalcon\Support\Collection class
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\Support\Collection\Exception
Código fuente en GitHub
Namespace |
Phalcon\Support\Collection |
|
Uses |
Throwable |
|
Extends |
\Exception |
Excepciones para el objeto Collection
Class Phalcon\Support\Collection\ReadOnlyCollection
Código fuente en GitHub
Namespace |
Phalcon\Support\Collection |
|
Uses |
Phalcon\Support\Collection |
|
Extends |
Collection |
A read only Collection object
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
Class Phalcon\Support\Debug
Código fuente en GitHub
Namespace |
Phalcon\Support |
|
Uses |
ErrorException, Phalcon\Support\Debug\Exception, ReflectionClass, ReflectionException, ReflectionFunction, Throwable |
Proporciona capacidades de depuración para aplicaciones Phalcon
Propiedades
/**
* @var array
*/
protected blacklist;
/**
* @var array
*/
protected data;
/**
* @var bool
*/
protected hideDocumentRoot = false;
/**
* @var bool
*/
protected static isActive = false;
/**
* @var bool
*/
protected showBackTrace = true;
/**
* @var bool
*/
protected showFileFragment = false;
/**
* @var bool
*/
protected showFiles = true;
/**
* @var string
*/
protected uri = https://assets.phalcon.io/debug/5.0.x/;
/**
* @var Version
*/
private version;
Métodos
public function __construct();
Constructor setting a reusable version object
public function clearVars(): Debug;
Elimina las variables añadidas previamente
public function debugVar( mixed $varz ): Debug;
Agrega una variable al resultado de la depuración
public function getCssSources(): string;
Devuelve las fuentes CSS
public function getJsSources(): string;
Devuelve las fuentes JavaScript
public function getVersion(): string;
Genera un enlace a la versión actual de la documentación
public function halt(): void;
Detiene la solicitud mostrando una traza inversa
@throws Exception
public function listen( bool $exceptions = bool, bool $lowSeverity = bool ): Debug;
Listen for uncaught exceptions and non silent notices or warnings
public function listenExceptions(): Debug;
Escucha excepciones no capturadas
public function listenLowSeverity(): Debug;
Listen for non silent notices or warnings
public function onUncaughtException( \Throwable $exception ): bool;
Maneja las excepciones no capturadas
public function onUncaughtLowSeverity( mixed $severity, mixed $message, mixed $file, mixed $line, mixed $context ): void;
Lanza una excepción cuando se lanza un aviso o advertencia
public function renderHtml( \Throwable $exception ): string;
Render exception to html format.
public function setBlacklist( array $blacklist ): Debug;
Establece si los archivos deben mostrar la traza inversa de la excepción
public function setShowBackTrace( bool $showBackTrace ): Debug;
Establece si los archivos deben mostrar la traza inversa de la excepción
public function setShowFileFragment( bool $showFileFragment ): Debug;
Establece si los ficheros se deben abrir y mostrar completamente en la salida o sólo el fragmento relacionado con la excepción
public function setShowFiles( bool $showFiles ): Debug;
Establezca si los archivos que forman parte de la traza inversa se deben mostrar en la salida
public function setUri( string $uri ): Debug;
Cambia la URI base para recursos estáticos
protected function escapeString( string $value ): string;
Escapa una cadena con htmlentities
protected function getArrayDump( array $argument, mixed $n = int ): string | null;
Produce una representación recursiva de un vector
protected function getVarDump( mixed $variable ): string;
Produce una representación de cadena de una variable
final protected function showTraceItem( int $n, array $trace ): string;
Muestra un elemento de traza inversa
Class Phalcon\Support\Debug\Dump
Código fuente en GitHub
Namespace |
Phalcon\Support\Debug |
|
Uses |
Phalcon\Di\Di, Phalcon\Support\Helper\Json\Encode, Reflection, ReflectionClass, ReflectionProperty, stdClass |
Vuelca información de una variable(s)
$foo = 123;
echo (new \Phalcon\Debug\Dump())->variable($foo, "foo");
$foo = "string";
$bar = ["key" => "value"];
$baz = new stdClass();
echo (new \Phalcon\Debug\Dump())->variables($foo, $bar, $baz);
Propiedades
/**
* @var bool
*/
protected detailed = false;
/**
* @var array
*/
protected methods;
/**
* @var array
*/
protected styles;
/**
* @var Encode
*/
private encode;
Métodos
public function __construct( array $styles = [], bool $detailed = bool );
Constructor Phalcon\Debug\Dump
public function all(): string;
Alias del método variables()
public function getDetailed(): bool;
public function one( mixed $variable, string $name = null ): string;
Alias del método variable()
public function setDetailed( bool $detailed ): void;
public function setStyles( array $styles = [] ): array;
Establece estilos para el tipo vars
public function toJson( mixed $variable ): string;
Devuelve una cadena JSON de información sobre una única variable.
$foo = [
"key" => "value",
];
echo (new \Phalcon\Debug\Dump())->toJson($foo);
$foo = new stdClass();
$foo->bar = "buz";
echo (new \Phalcon\Debug\Dump())->toJson($foo);
public function variable( mixed $variable, string $name = null ): string;
Devuelve una cadena HTML de información sobre una única variable.
echo (new \Phalcon\Debug\Dump())->variable($foo, "foo");
public function variables(): string;
Devuelve una cadena HTML de información de depuración sobre cualquier número de variables, cada una envuelta en una etiqueta “pre”.
$foo = "string";
$bar = ["key" => "value"];
$baz = new stdClass();
echo (new \Phalcon\Debug\Dump())->variables($foo, $bar, $baz);
protected function getStyle( string $type ): string;
Obtiene el estilo para el tipo
protected function output( mixed $variable, string $name = null, int $tab = int ): string;
Prepara una cadena HTML de información sobre una única variable.
Class Phalcon\Support\Debug\Exception
Código fuente en GitHub
Namespace |
Phalcon\Support\Debug |
|
Extends |
\Exception |
Las excepciones lanzadas en Phalcon\Debug usarán esta clase
Class Phalcon\Support\Exception
Código fuente en GitHub
Namespace |
Phalcon\Support |
|
Extends |
\Exception |
Phalcon\Support\Exception
Abstract Class Phalcon\Support\Helper\Arr\AbstractArr
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Arr |
Abstract class offering methods to help with the Arr namespace. This can be moved to a trait once Zephir supports it.
@todo move to trait when there is support for it
Métodos
protected function toFilter( array $collection, mixed $method = null ): array;
Método ayudante para filtrar la colección
Class Phalcon\Support\Helper\Arr\Blacklist
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Arr |
|
Extends |
AbstractArr |
Filtro de lista negra por clave: excluye elementos de un vector por las claves obtenidas de los elementos de una lista negra
Métodos
public function __invoke( array $collection, array $blackList ): array;
Class Phalcon\Support\Helper\Arr\Chunk
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Arr |
Trocea un vector en vectores más pequeños de un determinado tamaño.
Métodos
public function __invoke( array $collection, int $size, bool $preserveKeys = bool ): array;
Class Phalcon\Support\Helper\Arr\Filter
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Arr |
|
Extends |
AbstractArr |
Filters a collection using array_filter and using the callable (if defined)
Métodos
public function __invoke( array $collection, mixed $method = null ): mixed;
Class Phalcon\Support\Helper\Arr\First
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Arr |
|
Extends |
AbstractArr |
Devuelve el primer elemento de la colección. Si se pasa una invocable, el elemento devuelto es el primero que valida a true
Métodos
public function __invoke( array $collection, mixed $method = null ): mixed;
Class Phalcon\Support\Helper\Arr\FirstKey
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Arr |
|
Extends |
AbstractArr |
Devuelve la clave del primer elemento de la colección. Si se indica una invocable, el elemento devuelto es el primero que valida a true
Métodos
public function __invoke( array $collection, mixed $method = null ): mixed;
Class Phalcon\Support\Helper\Arr\Flatten
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Arr |
Flattens an array up to the one level depth, unless $deep
is set to true
Métodos
public function __invoke( array $collection, bool $deep = bool ): array;
Class Phalcon\Support\Helper\Arr\Get
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Arr |
Gets an array element by key and if it does not exist returns the default. It also allows for casting the returned value to a specific type using settype
internally
Métodos
public function __invoke( array $collection, mixed $index, mixed $defaultValue = null, string $cast = null ): mixed;
Class Phalcon\Support\Helper\Arr\Group
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Arr |
Agrupa los elementos de un vector según el invocable pasado
Métodos
public function __invoke( array $collection, mixed $method ): array;
Class Phalcon\Support\Helper\Arr\Has
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Arr |
Checks an array if it has an element with a specific key and returns true
/false
accordingly
Métodos
public function __invoke( array $collection, mixed $index ): bool;
Class Phalcon\Support\Helper\Arr\IsUnique
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Arr |
Comprueba valores duplicados en una lista plana. Devuelve true
si existen valores duplicados y false
si todos los valores son únicos.
Métodos
public function __invoke( array $collection ): bool;
Class Phalcon\Support\Helper\Arr\Last
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Arr |
|
Extends |
AbstractArr |
Devuelve el último elemento de la colección. Si se pasa una invocable, el elemento devuelto es el primero que valida a true
Métodos
public function __invoke( array $collection, mixed $method = null ): mixed;
Class Phalcon\Support\Helper\Arr\LastKey
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Arr |
|
Extends |
AbstractArr |
Devuelve la clave del último elemento de la colección. Si se indica una invocable, el elemento devuelto es el primero que valida a true
Métodos
public function __invoke( array $collection, mixed $method = null ): mixed;
Class Phalcon\Support\Helper\Arr\Order
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Arr |
Sorts a collection of arrays or objects by an attribute of the object. It supports ascending/descending sorts but also flags that are identical to the ones used by ksort
and krsort
Constantes
const ORDER_ASC = 1;
const ORDER_DESC = 2;
Métodos
public function __invoke( array $collection, mixed $attribute, int $order = static-constant-access, int $flags = int ): array;
Class Phalcon\Support\Helper\Arr\Pluck
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Arr |
Returns a subset of the collection based on the values of the collection
Métodos
public function __invoke( array $collection, string $element ): array;
Class Phalcon\Support\Helper\Arr\Set
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Arr |
Sets an array element. Using a key is optional
Métodos
public function __invoke( array $collection, mixed $value, mixed $index = null ): array;
Class Phalcon\Support\Helper\Arr\SliceLeft
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Arr |
Devuelve un nuevo vector con n elementos eliminados desde la izquierda.
Métodos
public function __invoke( array $collection, int $elements = int ): array;
Class Phalcon\Support\Helper\Arr\SliceRight
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Arr |
Devuelve un nuevo vector con n elementos eliminados desde la derecha.
Métodos
public function __invoke( array $collection, int $elements = int ): array;
Class Phalcon\Support\Helper\Arr\Split
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Arr |
Returns a new array with keys of the collection as one element and values as another
Métodos
public function __invoke( array $collection ): array;
Class Phalcon\Support\Helper\Arr\ToObject
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Arr |
Returns the passed array as an object.
Métodos
public function __invoke( array $collection ): object;
Class Phalcon\Support\Helper\Arr\ValidateAll
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Arr |
|
Extends |
AbstractArr |
Returns true
if the provided function returns true
for all elements of the collection, false
otherwise.
Métodos
public function __invoke( array $collection, mixed $method ): bool;
Class Phalcon\Support\Helper\Arr\ValidateAny
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Arr |
|
Extends |
AbstractArr |
Returns true
if the provided function returns true
for at least one element of the collection, false
otherwise.
Métodos
public function __invoke( array $collection, mixed $method ): bool;
Class Phalcon\Support\Helper\Arr\Whitelist
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Arr |
|
Extends |
AbstractArr |
White list filter by key: obtain elements of an array filtering by the keys obtained from the elements of a whitelist
Métodos
public function __invoke( array $collection, array $whiteList ): array;
Class Phalcon\Support\Helper\Exception
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper |
|
Extends |
\Exception |
- Phalcon\Support\Exception */
Class Phalcon\Support\Helper\File\Basename
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\File |
Gets the filename from a given path, Same as PHP’s basename()
but has non-ASCII support. PHP’s basename()
does not properly support streams or filenames beginning with a non-US-ASCII character.
Métodos
public function __invoke( string $uri, string $suffix = null ): string;
@see https://bugs.php.net/bug.php?id=37738
Class Phalcon\Support\Helper\Json\Decode
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Json |
|
Uses |
InvalidArgumentException |
Decodifica una cadena usando json_decode
y lanza una excepción si los datos JSON no se han podido decodificar
The following options are used if none specified for json_encode
JSON_HEX_TAG, JSON_HEX_APOS, JSON_HEX_AMP, JSON_HEX_QUOT, JSON_UNESCAPED_SLASHES
If JSON_THROW_ON_ERROR is defined in the options a JsonException will be thrown in the case of an error. Otherwise, any error will throw InvalidArgumentException
Métodos
public function __invoke( string $data, bool $associative = bool, int $depth = int, int $options = int );
Class Phalcon\Support\Helper\Json\Encode
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Json |
|
Uses |
InvalidArgumentException |
Codifica una cadena usando json_encode
y lanza una excepción si los datos JSON no se han podido codificar
The following options are used if none specified for json_encode
JSON_HEX_TAG, JSON_HEX_APOS, JSON_HEX_AMP, JSON_HEX_QUOT, JSON_UNESCAPED_SLASHES
If JSON_THROW_ON_ERROR is defined in the options a JsonException will be thrown in the case of an error. Otherwise, any error will throw InvalidArgumentException
@see https://www.ietf.org/rfc/rfc4627.txt
Métodos
public function __invoke( mixed $data, int $options = int, int $depth = int ): string;
Class Phalcon\Support\Helper\Number\IsBetween
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Number |
Checks if a number is within a range
Métodos
public function __invoke( int $value, int $start, int $end ): bool;
Abstract Class Phalcon\Support\Helper\Str\AbstractStr
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Str |
Abstract class offering methods to help with the Str namespace. This can be moved to a trait once Zephir supports it.
@todo move to trait when there is support for it
Métodos
protected function toEndsWith( string $haystack, string $needle, bool $ignoreCase = bool ): bool;
Comprueba si una cadena termina con una cadena dada
protected function toInterpolate( string $input, array $context = [], string $left = string, string $right = string ): string;
Interpola los valores de contexto dentro de los marcadores de posición del mensaje
@see https://www.php-fig.org/psr/psr-3/ Section 1.2 Message
protected function toLower( string $text, string $encoding = string ): string;
Lowercases a string using mbstring
protected function toStartsWith( string $haystack, string $needle, bool $ignoreCase = bool ): bool;
Comprueba si una cadena empieza con una cadena dada
protected function toUpper( string $text, string $encoding = string ): string;
Uppercases a string using mbstring
Class Phalcon\Support\Helper\Str\Camelize
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Str |
|
Extends |
PascalCase |
Converts strings to upperCamelCase or lowerCamelCase
Métodos
public function __invoke( string $text, string $delimiters = null, bool $lowerFirst = bool ): string;
Class Phalcon\Support\Helper\Str\Concat
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Str |
|
Uses |
Phalcon\Support\Helper\Exception |
|
Extends |
AbstractStr |
Concatena cadenas usando el separador sólo una vez sin duplicación en los lugares de la concatenación
Métodos
public function __invoke(): string;
Class Phalcon\Support\Helper\Str\CountVowels
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Str |
Devuelve el número de vocales de la cadena indicada. Usa una expresión regular para contar el número de vocales (A, E, I, O, U) en una cadena.
Métodos
public function __invoke( string $text ): int;
Class Phalcon\Support\Helper\Str\Decapitalize
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Str |
|
Extends |
AbstractStr |
Decapitaliza la primera letra de una cadena y luego la añade con el resto de la cadena. Omita el parámetro upperRest
para mantener el resto de la cadena intacta, o establezcalo a true
para convertir a mayúsculas.
Métodos
public function __invoke( string $text, bool $upperRest = bool, string $encoding = string ): string;
Class Phalcon\Support\Helper\Str\Decrement
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Str |
Removes a number from the end of a string or decrements that number if it is already defined
Métodos
public function __invoke( string $text, string $separator = string ): string;
Class Phalcon\Support\Helper\Str\DirFromFile
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Str |
Acepta un nombre de fichero (sin extensión) y devuelve una estructura de directorios calculada con el nombre del fichero al final
Métodos
public function __invoke( string $file ): string;
Class Phalcon\Support\Helper\Str\DirSeparator
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Str |
Acepta un nombre de directorio y se asegura que termina con DIRECTORY_SEPARATOR
Métodos
public function __invoke( string $directory ): string;
Class Phalcon\Support\Helper\Str\Dynamic
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Str |
|
Uses |
RuntimeException |
Generates random text in accordance with the template. The template is defined by the left and right delimiter and it can contain values separated by the separator
Métodos
public function __invoke( string $text, string $leftDelimiter = string, string $rightDelimiter = string, string $separator = string ): string;
Class Phalcon\Support\Helper\Str\EndsWith
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Str |
|
Extends |
AbstractStr |
Comprueba si una cadena termina con una cadena dada
Métodos
public function __invoke( string $haystack, string $needle, bool $ignoreCase = bool ): bool;
Class Phalcon\Support\Helper\Str\FirstBetween
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Str |
Devuelve la primera cadena que hay entre las cadenas desde el parámetro start
y end
.
Métodos
public function __invoke( string $text, string $start, string $end ): string;
Class Phalcon\Support\Helper\Str\Friendly
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Str |
|
Uses |
Phalcon\Support\Helper\Exception |
|
Extends |
AbstractStr |
Changes a text to a URL friendly one. Replaces commonly known accented characters with their Latin equivalents. If a replace
string or array is passed, it will also be used to replace those characters with a space.
Métodos
public function __invoke( string $text, string $separator = string, bool $lowercase = bool, mixed $replace = null ): string;
Class Phalcon\Support\Helper\Str\Humanize
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Str |
Makes an underscored or dashed text human-readable
Métodos
public function __invoke( string $text ): string;
Class Phalcon\Support\Helper\Str\Includes
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Str |
Determines whether a string includes another string or not.
Métodos
public function __invoke( string $haystack, string $needle ): bool;
Class Phalcon\Support\Helper\Str\Increment
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Str |
Adds a number to the end of a string or increments that number if it is already defined
Métodos
public function __invoke( string $text, string $separator = string ): string;
Class Phalcon\Support\Helper\Str\Interpolate
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Str |
Interpolates context values into the message placeholders. By default, the right and left tokens are %
@see https://www.php-fig.org/psr/psr-3/ Section 1.2 Message
Métodos
public function __invoke( string $message, array $context = [], string $leftToken = string, string $rightToken = string ): string;
Class Phalcon\Support\Helper\Str\IsAnagram
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Str |
Compare two strings and returns true
if both strings are anagram, false
otherwise.
Métodos
public function __invoke( string $first, string $second ): bool;
Class Phalcon\Support\Helper\Str\IsLower
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Str |
|
Extends |
AbstractStr |
Returns true
if the given string is in lower case, false
otherwise.
Métodos
public function __invoke( string $text, string $encoding = string ): bool;
Class Phalcon\Support\Helper\Str\IsPalindrome
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Str |
Devuelve true
si la cadena dada es un palíndromo, false
en caso contrario.
Métodos
public function __invoke( string $text ): bool;
Class Phalcon\Support\Helper\Str\IsUpper
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Str |
|
Extends |
AbstractStr |
Returns true
if the given string is in upper case, false
otherwise.
Métodos
public function __invoke( string $text, string $encoding = string ): bool;
Class Phalcon\Support\Helper\Str\KebabCase
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Str |
|
Extends |
PascalCase |
Converts strings to kebab-case style
Métodos
public function __invoke( string $text, string $delimiters = null ): string;
Class Phalcon\Support\Helper\Str\Len
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Str |
Calculates the length of the string using mb_strlen
Métodos
public function __invoke( string $text, string $encoding = string ): int;
Class Phalcon\Support\Helper\Str\Lower
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Str |
|
Extends |
AbstractStr |
Converts a string to lowercase using mbstring
Métodos
public function __invoke( string $text, string $encoding = string ): string;
Class Phalcon\Support\Helper\Str\PascalCase
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Str |
Converts strings to PascalCase style
Métodos
public function __invoke( string $text, string $delimiters = null ): string;
protected function processArray( string $text, string $delimiters = null ): array;
Class Phalcon\Support\Helper\Str\Prefix
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Str |
Prefixes the text with the supplied prefix
Métodos
public function __invoke( mixed $text, string $prefix ): string;
Class Phalcon\Support\Helper\Str\Random
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Str |
Genera una cadena aleatoria basada en el tipo dado. El tipo es una de las constantes RANDOM_*
Constantes
const RANDOM_ALNUM = 0;
const RANDOM_ALPHA = 1;
const RANDOM_DISTINCT = 5;
const RANDOM_HEXDEC = 2;
const RANDOM_NOZERO = 4;
const RANDOM_NUMERIC = 3;
Métodos
public function __invoke( int $type = static-constant-access, int $length = int ): string;
Class Phalcon\Support\Helper\Str\ReduceSlashes
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Str |
Reduce múltiples barras de una cadena a sólo una barra
Métodos
public function __invoke( string $text ): string;
Class Phalcon\Support\Helper\Str\SnakeCase
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Str |
|
Extends |
PascalCase |
Converts strings to snake_case style
Métodos
public function __invoke( string $text, string $delimiters = null ): string;
Class Phalcon\Support\Helper\Str\StartsWith
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Str |
|
Extends |
AbstractStr |
Comprueba si una cadena empieza con una cadena dada
Métodos
public function __invoke( string $haystack, string $needle, bool $ignoreCase = bool ): bool;
Class Phalcon\Support\Helper\Str\Suffix
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Str |
Suffixes the text with the supplied suffix
Métodos
public function __invoke( mixed $text, string $suffix ): string;
Class Phalcon\Support\Helper\Str\Ucwords
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Str |
Capitalizes the first letter of each word
Métodos
public function __invoke( string $text, string $encoding = string ): string;
Class Phalcon\Support\Helper\Str\Uncamelize
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Str |
Converts strings to non camelized style
Métodos
public function __invoke( string $text, string $delimiter = string ): string;
Class Phalcon\Support\Helper\Str\Underscore
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Str |
Makes a text underscored instead of spaced
Métodos
public function __invoke( string $text ): string;
Class Phalcon\Support\Helper\Str\Upper
Código fuente en GitHub
Namespace |
Phalcon\Support\Helper\Str |
|
Extends |
AbstractStr |
Converts a string to uppercase using mbstring
Métodos
public function __invoke( string $text, string $encoding = string ): string;
Class Phalcon\Support\HelperFactory
Código fuente en GitHub
Namespace |
Phalcon\Support |
|
Uses |
Phalcon\Factory\AbstractFactory |
|
Extends |
AbstractFactory |
ServiceLocator implementation for helpers
Métodos
public function __call( string $name, array $arguments );
public function __construct( array $services = [] );
FactoryTrait constructor.
public function newInstance( string $name );
protected function getExceptionClass(): string;
protected function getServices(): array;
Devuelve los adaptadores disponibles
Final Class Phalcon\Support\Registry
Código fuente en GitHub
Namespace |
Phalcon\Support |
|
Uses |
Phalcon\Support\Collection, Traversable |
|
Extends |
Collection |
Phalcon\Registry
Un registro es un contenedor para almacenar objetos y valores en el espacio de la aplicación. Al almacenar el valor en un registro, el mismo objeto siempre está disponible en toda la aplicación.
$registry = new \Phalcon\Registry();
// Set value
$registry->something = "something";
// or
$registry["something"] = "something";
// Get value
$value = $registry->something;
// or
$value = $registry["something"];
// Check if the key exists
$exists = isset($registry->something);
// or
$exists = isset($registry["something"]);
// Unset
unset($registry->something);
// or
unset($registry["something"]);
Además de ArrayAccess, Phalcon\Registry también implementa los interfaces Countable (count ($registry) devolverá la cantidad de elementos en el registro), Serializable e Iterator (puede iterar sobre el registro utilizando un bucle foreach). Para PHP 5.4 y superior, se implementa la interfaz JsonSerializable.
Phalcon\Registry es muy rápido (generalmente es más rápido que cualquier implementación del registro en el espacio de usuario); sin embargo, esto tiene un precio: Phalcon\Registry es una clase final y no se puede heredar.
Though Phalcon\Registry exposes methods like __get(), offsetGet(), count() etc, it is not recommended to invoke them manually (these methods exist mainly to match the interfaces the registry implements): $registry->__get(“property”) is several times slower than $registry->property.
Internamente todos los métodos mágicos (e interfaces excepto JsonSerializable) se implementan utilizando manejadores de objetos o técnicas similares: esto permite eludir llamadas a métodos relativamente lentas.
Métodos
final public function __construct( array $data = [] );
Constructor
final public function __get( string $element ): mixed;
Getter mágico para obtener un elemento de la colección
final public function __isset( string $element ): bool;
Isset mágico para comprobar si un elemento existe o no
final public function __set( string $element, mixed $value ): void;
Setter mágico para asignar valores a un elemento
final public function __unset( string $element ): void;
Unset mágico para eliminar un elemento de la colección
final public function clear(): void;
Limpia la colección interna
final public function count(): int;
Cuenta los elementos de un objeto
@link https://php.net/manual/en/countable.count.php
final public function get( string $element, mixed $defaultValue = null, string $cast = null ): mixed;
Obtiene el elemento de la colección
final public function getIterator(): Traversable;
Devuelve el iterador de la clase
final public function has( string $element ): bool;
Determina si un elemento está presente en la colección.
final public function init( array $data = [] ): void;
Inicializa el vector interno
final public function jsonSerialize(): array;
Especifica los datos que deben ser serializados a JSON
@link https://php.net/manual/en/jsonserializable.jsonserialize.php
final public function offsetExists( mixed $element ): bool;
Si existe un desplazamiento
@link https://php.net/manual/en/arrayaccess.offsetexists.php
final public function offsetGet( mixed $element ): mixed;
Desplazamiento a obtener
@link https://php.net/manual/en/arrayaccess.offsetget.php
final public function offsetSet( mixed $element, mixed $value ): void;
Desplazamiento a establecer
@link https://php.net/manual/en/arrayaccess.offsetset.php
final public function offsetUnset( mixed $element ): void;
Desplazamiento a deconfigurar
@link https://php.net/manual/en/arrayaccess.offsetunset.php
final public function remove( string $element ): void;
Elimina el elemento de la colección
final public function serialize(): string;
Representación del objeto como cadena de texto
@link https://php.net/manual/en/serializable.serialize.php
final public function set( string $element, mixed $value ): void;
Establece un elemento en la colección
final public function toArray(): array;
Devuelve el objeto en un formato vector
final 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
@see https://www.ietf.org/rfc/rfc4627.txt
final public function unserialize( mixed $serialized ): void;
Construye el objeto
@link https://php.net/manual/en/serializable.unserialize.php
Class Phalcon\Support\Version
Código fuente en GitHub
Namespace |
Phalcon\Support |
Esta clase permite obtener la versión instalada del framework
Constantes
const VERSION_MAJOR = 0;
const VERSION_MEDIUM = 1;
const VERSION_MINOR = 2;
const VERSION_SPECIAL = 3;
const VERSION_SPECIAL_NUMBER = 4;
Métodos
public function get(): string;
Devuelve la versión activa (cadena)
echo (new Phalcon\Version())->get();
public function getId(): string;
Devuelve la versión activa en formato numérico
echo (new Phalcon\Version())->getId();
public function getPart( int $part ): string;
Devuelve una parte específica de la versión. Si se pasa el parámetro incorrecto devolverá la versión completa
echo (new Phalcon\Version())->getPart(Phalcon\Version::VERSION_MAJOR);
protected function getVersion(): array;
Área donde se encuentra el número de versión. El formato es el siguiente: ABBCCDE
A - Major version B - Med version (two digits) C - Min version (two digits) D - Special release: 1 = alpha, 2 = beta, 3 = RC, 4 = stable E - Special release version i.e. RC1, Beta2 etc.