Class Phalcon\Support\Collection
Source on 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. It implements:
It can be used in any part of the application that needs collection of data Such implementations are for instance accessing globals $_GET
, $_POST
etc.
Properties
/**
* @var array
*/
protected data;
/**
* @var bool
*/
protected insensitive = true;
/**
* @var array
*/
protected lowerKeys;
Methods
public function __construct( array $data = [], bool $insensitive = bool );
Collection constructor.
public function __get( string $element ): mixed;
Magic getter to get an element from the collection
public function __isset( string $element ): bool;
Magic isset to check whether an element exists or not
public function __serialize(): array;
public function __set( string $element, mixed $value ): void;
Magic setter to assign values to an element
public function __unserialize( array $data ): void;
public function __unset( string $element ): void;
Magic unset to remove an element from the collection
public function clear(): void;
Clears the internal collection
public function count(): int;
Count elements of an object. See count
public function get( string $element, mixed $defaultValue = null, string $cast = null ): mixed;
Get the element from the collection
public function getIterator(): Traversable;
Returns the iterator of the class
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;
Determines whether an element is present in the collection.
public function init( array $data = [] ): void;
Initialize internal array
public function jsonSerialize(): array;
Specify data which should be serialized to JSON See jsonSerialize
public function offsetExists( mixed $element ): bool;
Whether a offset exists See offsetExists
public function offsetGet( mixed $element ): mixed;
Offset to retrieve See offsetGet
public function offsetSet( mixed $element, mixed $value ): void;
Offset to set See offsetSet
public function offsetUnset( mixed $element ): void;
Offset to unset See offsetUnset
public function remove( string $element ): void;
Delete the element from the collection
public function serialize(): string;
String representation of object See serialize
public function set( string $element, mixed $value ): void;
Set an element in the collection
public function toArray(): array;
Returns the object in an array format
public function toJson( int $options = int ): string;
Returns the object in a JSON format
The default string uses the following options for json_encode
JSON_HEX_TAG
, JSON_HEX_APOS
, JSON_HEX_AMP
, JSON_HEX_QUOT
, JSON_UNESCAPED_SLASHES
See rfc4627
public function unserialize( string $serialized ): void;
Constructs the object See 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;
Internal method to set data
Interface Phalcon\Support\Collection\CollectionInterface
Source on GitHub
Namespace |
Phalcon\Support\Collection |
Phalcon\Support\Collection\CollectionInterface
Interface for Phalcon\Support\Collection class
Methods
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
Source on GitHub
Namespace |
Phalcon\Support\Collection |
|
Uses |
Throwable |
|
Extends |
\Exception |
Exceptions for the Collection object
Class Phalcon\Support\Collection\ReadOnlyCollection
Source on GitHub
Namespace |
Phalcon\Support\Collection |
|
Uses |
Phalcon\Support\Collection |
|
Extends |
Collection |
A read only Collection object
Methods
public function remove( string $element ): void;
Delete the element from the collection
public function set( string $element, mixed $value ): void;
Set an element in the collection
Class Phalcon\Support\Debug
Source on GitHub
Namespace |
Phalcon\Support |
|
Uses |
ErrorException, Phalcon\Support\Debug\Exception, ReflectionClass, ReflectionException, ReflectionFunction, Throwable |
Provides debug capabilities to Phalcon applications
Properties
/**
* @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;
Methods
public function __construct();
Constructor setting a reusable version object
public function clearVars(): Debug;
Clears are variables added previously
public function debugVar( mixed $varz ): Debug;
Adds a variable to the debug output
public function getCssSources(): string;
Returns the CSS sources
public function getJsSources(): string;
Returns the JavaScript sources
public function getVersion(): string;
Generates a link to the current version documentation
public function halt(): void;
Halts the request showing a backtrace
@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;
Listen for uncaught exceptions
public function listenLowSeverity(): Debug;
Listen for non silent notices or warnings
public function onUncaughtException( \Throwable $exception ): bool;
Handles uncaught exceptions
public function onUncaughtLowSeverity( mixed $severity, mixed $message, mixed $file, mixed $line, mixed $context ): void;
Throws an exception when a notice or warning is raised
public function renderHtml( \Throwable $exception ): string;
Render exception to html format.
public function setBlacklist( array $blacklist ): Debug;
Sets if files the exception’s backtrace must be showed
public function setShowBackTrace( bool $showBackTrace ): Debug;
Sets if files the exception’s backtrace must be showed
public function setShowFileFragment( bool $showFileFragment ): Debug;
Sets if files must be completely opened and showed in the output or just the fragment related to the exception
public function setShowFiles( bool $showFiles ): Debug;
Set if files part of the backtrace must be shown in the output
public function setUri( string $uri ): Debug;
Change the base URI for static resources
protected function escapeString( string $value ): string;
Escapes a string with htmlentities
protected function getArrayDump( array $argument, mixed $n = int ): string | null;
Produces a recursive representation of an array
protected function getVarDump( mixed $variable ): string;
Produces an string representation of a variable
final protected function showTraceItem( int $n, array $trace ): string;
Shows a backtrace item
Class Phalcon\Support\Debug\Dump
Source on GitHub
Namespace |
Phalcon\Support\Debug |
|
Uses |
InvalidArgumentException, Phalcon\Di\Di, Reflection, ReflectionClass, ReflectionProperty, stdClass |
Dumps information about a 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);
Properties
/**
* @var bool
*/
protected detailed = false;
/**
* @var array
*/
protected methods;
/**
* @var array
*/
protected styles;
Methods
public function __construct( array $styles = [], bool $detailed = bool );
Phalcon\Debug\Dump constructor
public function all(): string;
Alias of variables() method
public function getDetailed(): bool;
public function one( mixed $variable, string $name = null ): string;
Alias of variable() method
public function setDetailed( bool $detailed ): void;
public function setStyles( array $styles = [] ): array;
Set styles for vars type
public function toJson( mixed $variable ): string;
Returns an JSON string of information about a single 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;
Returns an HTML string of information about a single variable.
echo (new \Phalcon\Debug\Dump())->variable($foo, "foo");
public function variables(): string;
Returns an HTML string of debugging information about any number of variables, each wrapped in a “pre” tag.
$foo = "string";
$bar = ["key" => "value"];
$baz = new stdClass();
echo (new \Phalcon\Debug\Dump())->variables($foo, $bar, $baz);
protected function getStyle( string $type ): string;
Get style for type
protected function output( mixed $variable, string $name = null, int $tab = int ): string;
Prepare an HTML string of information about a single variable.
Class Phalcon\Support\Debug\Exception
Source on GitHub
Namespace |
Phalcon\Support\Debug |
|
Extends |
\Exception |
Exceptions thrown in Phalcon\Debug will use this class
Class Phalcon\Support\Exception
Source on GitHub
Namespace |
Phalcon\Support |
|
Extends |
\Exception |
Phalcon\Support\Exception
Abstract Class Phalcon\Support\Helper\Arr\AbstractArr
Source on 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
Methods
protected function toFilter( array $collection, mixed $method = null ): array;
Helper method to filter the collection
Class Phalcon\Support\Helper\Arr\Blacklist
Source on GitHub
Namespace |
Phalcon\Support\Helper\Arr |
|
Extends |
AbstractArr |
Black list filter by key: exclude elements of an array by the keys obtained from the elements of a blacklist
Methods
public function __invoke( array $collection, array $blackList ): array;
Class Phalcon\Support\Helper\Arr\Chunk
Source on GitHub
Namespace |
Phalcon\Support\Helper\Arr |
Chunks an array into smaller arrays of a specified size.
Methods
public function __invoke( array $collection, int $size, bool $preserveKeys = bool ): array;
Class Phalcon\Support\Helper\Arr\Filter
Source on GitHub
Namespace |
Phalcon\Support\Helper\Arr |
|
Extends |
AbstractArr |
Filters a collection using array_filter and using the callable (if defined)
Methods
public function __invoke( array $collection, mixed $method = null ): mixed;
Class Phalcon\Support\Helper\Arr\First
Source on GitHub
Namespace |
Phalcon\Support\Helper\Arr |
|
Extends |
AbstractArr |
Returns the first element of the collection. If a callable is passed, the element returned is the first that validates true
Methods
public function __invoke( array $collection, mixed $method = null ): mixed;
Class Phalcon\Support\Helper\Arr\FirstKey
Source on GitHub
Namespace |
Phalcon\Support\Helper\Arr |
|
Extends |
AbstractArr |
Returns the key of the first element of the collection. If a callable is passed, the element returned is the first that validates true
Methods
public function __invoke( array $collection, mixed $method = null ): mixed;
Class Phalcon\Support\Helper\Arr\Flatten
Source on GitHub
Namespace |
Phalcon\Support\Helper\Arr |
Flattens an array up to the one level depth, unless $deep
is set to true
Methods
public function __invoke( array $collection, bool $deep = bool ): array;
Class Phalcon\Support\Helper\Arr\Get
Source on 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
Methods
public function __invoke( array $collection, mixed $index, mixed $defaultValue = null, string $cast = null ): mixed;
Class Phalcon\Support\Helper\Arr\Group
Source on GitHub
Namespace |
Phalcon\Support\Helper\Arr |
Groups the elements of an array based on the passed callable
Methods
public function __invoke( array $collection, mixed $method ): array;
Class Phalcon\Support\Helper\Arr\Has
Source on GitHub
Namespace |
Phalcon\Support\Helper\Arr |
Checks an array if it has an element with a specific key and returns true
/false
accordingly
Methods
public function __invoke( array $collection, mixed $index ): bool;
Class Phalcon\Support\Helper\Arr\IsUnique
Source on GitHub
Namespace |
Phalcon\Support\Helper\Arr |
Checks a flat list for duplicate values. Returns true if duplicate values exist and false if values are all unique.
Methods
public function __invoke( array $collection ): bool;
Class Phalcon\Support\Helper\Arr\Last
Source on GitHub
Namespace |
Phalcon\Support\Helper\Arr |
|
Extends |
AbstractArr |
Returns the last element of the collection. If a callable is passed, the element returned is the first that validates true
Methods
public function __invoke( array $collection, mixed $method = null ): mixed;
Class Phalcon\Support\Helper\Arr\LastKey
Source on GitHub
Namespace |
Phalcon\Support\Helper\Arr |
|
Extends |
AbstractArr |
Returns the key of the last element of the collection. If a callable is passed, the element returned is the first that validates true
Methods
public function __invoke( array $collection, mixed $method = null ): mixed;
Class Phalcon\Support\Helper\Arr\Order
Source on 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
Constants
const ORDER_ASC = 1;
const ORDER_DESC = 2;
Methods
public function __invoke( array $collection, mixed $attribute, int $order = static-constant-access, int $flags = int ): array;
Class Phalcon\Support\Helper\Arr\Pluck
Source on GitHub
Namespace |
Phalcon\Support\Helper\Arr |
Returns a subset of the collection based on the values of the collection
Methods
public function __invoke( array $collection, string $element ): array;
Class Phalcon\Support\Helper\Arr\Set
Source on GitHub
Namespace |
Phalcon\Support\Helper\Arr |
Sets an array element. Using a key is optional
Methods
public function __invoke( array $collection, mixed $value, mixed $index = null ): array;
Class Phalcon\Support\Helper\Arr\SliceLeft
Source on GitHub
Namespace |
Phalcon\Support\Helper\Arr |
Returns a new array with n elements removed from the left.
Methods
public function __invoke( array $collection, int $elements = int ): array;
Class Phalcon\Support\Helper\Arr\SliceRight
Source on GitHub
Namespace |
Phalcon\Support\Helper\Arr |
Returns a new array with n elements removed from the right.
Methods
public function __invoke( array $collection, int $elements = int ): array;
Class Phalcon\Support\Helper\Arr\Split
Source on GitHub
Namespace |
Phalcon\Support\Helper\Arr |
Returns a new array with keys of the collection as one element and values as another
Methods
public function __invoke( array $collection ): array;
Class Phalcon\Support\Helper\Arr\ToObject
Source on GitHub
Namespace |
Phalcon\Support\Helper\Arr |
Returns the passed array as an object.
Methods
public function __invoke( array $collection ): object;
Class Phalcon\Support\Helper\Arr\ValidateAll
Source on GitHub
Namespace |
Phalcon\Support\Helper\Arr |
|
Extends |
AbstractArr |
Returns true
if the provided function returns true
for all elements of the collection, false
otherwise.
Methods
public function __invoke( array $collection, mixed $method ): bool;
Class Phalcon\Support\Helper\Arr\ValidateAny
Source on 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.
Methods
public function __invoke( array $collection, mixed $method ): bool;
Class Phalcon\Support\Helper\Arr\Whitelist
Source on 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
Methods
public function __invoke( array $collection, array $whiteList ): array;
Class Phalcon\Support\Helper\Exception
Source on GitHub
Namespace |
Phalcon\Support\Helper |
|
Extends |
\Exception |
- Phalcon\Support\Exception */
Class Phalcon\Support\Helper\File\Basename
Source on 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.
Methods
public function __invoke( string $uri, string $suffix = null ): string;
@see https://bugs.php.net/bug.php?id=37738
Class Phalcon\Support\Helper\Json\Decode
Source on GitHub
Namespace |
Phalcon\Support\Helper\Json |
|
Uses |
InvalidArgumentException |
Decodes a string using json_decode
and throws an exception if the JSON data cannot be decoded
Methods
public function __invoke( string $data, bool $associative = bool, int $depth = int, int $options = int );
Class Phalcon\Support\Helper\Json\Encode
Source on GitHub
Namespace |
Phalcon\Support\Helper\Json |
|
Uses |
JsonException |
Encodes a string using json_encode
and throws an exception if the JSON data cannot be encoded
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, JSON_THROW_ON_ERROR
@see https://www.ietf.org/rfc/rfc4627.txt
Methods
public function __invoke( mixed $data, int $options = int, int $depth = int ): string;
Class Phalcon\Support\Helper\Number\IsBetween
Source on GitHub
Namespace |
Phalcon\Support\Helper\Number |
Checks if a number is within a range
Methods
public function __invoke( int $value, int $start, int $end ): bool;
Abstract Class Phalcon\Support\Helper\Str\AbstractStr
Source on 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
Methods
protected function toEndsWith( string $haystack, string $needle, bool $ignoreCase = bool ): bool;
Check if a string ends with a given string
protected function toInterpolate( string $input, array $context = [], string $left = string, string $right = string ): string;
Interpolates context values into the message placeholders
@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;
Check if a string starts with a given string
protected function toUpper( string $text, string $encoding = string ): string;
Uppercases a string using mbstring
Class Phalcon\Support\Helper\Str\Camelize
Source on GitHub
Namespace |
Phalcon\Support\Helper\Str |
|
Extends |
PascalCase |
Converts strings to upperCamelCase or lowerCamelCase
Methods
public function __invoke( string $text, string $delimiters = null, bool $lowerFirst = bool ): string;
Class Phalcon\Support\Helper\Str\Concat
Source on GitHub
Namespace |
Phalcon\Support\Helper\Str |
|
Uses |
Phalcon\Support\Helper\Exception |
|
Extends |
AbstractStr |
Concatenates strings using the separator only once without duplication in places concatenation
Methods
public function __invoke(): string;
Class Phalcon\Support\Helper\Str\CountVowels
Source on GitHub
Namespace |
Phalcon\Support\Helper\Str |
Returns number of vowels in provided string. Uses a regular expression to count the number of vowels (A, E, I, O, U) in a string.
Methods
public function __invoke( string $text ): int;
Class Phalcon\Support\Helper\Str\Decapitalize
Source on GitHub
Namespace |
Phalcon\Support\Helper\Str |
|
Extends |
AbstractStr |
Decapitalizes the first letter of the string and then adds it with rest of the string. Omit the upperRest parameter to keep the rest of the string intact, or set it to true to convert to uppercase.
Methods
public function __invoke( string $text, bool $upperRest = bool, string $encoding = string ): string;
Class Phalcon\Support\Helper\Str\Decrement
Source on GitHub
Namespace |
Phalcon\Support\Helper\Str |
Removes a number from the end of a string or decrements that number if it is already defined
Methods
public function __invoke( string $text, string $separator = string ): string;
Class Phalcon\Support\Helper\Str\DirFromFile
Source on GitHub
Namespace |
Phalcon\Support\Helper\Str |
Accepts a file name (without extension) and returns a calculated directory structure with the filename in the end
Methods
public function __invoke( string $file ): string;
Class Phalcon\Support\Helper\Str\DirSeparator
Source on GitHub
Namespace |
Phalcon\Support\Helper\Str |
Accepts a directory name and ensures that it ends with DIRECTORY_SEPARATOR
Methods
public function __invoke( string $directory ): string;
Class Phalcon\Support\Helper\Str\Dynamic
Source on 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
Methods
public function __invoke( string $text, string $leftDelimiter = string, string $rightDelimiter = string, string $separator = string ): string;
Class Phalcon\Support\Helper\Str\EndsWith
Source on GitHub
Namespace |
Phalcon\Support\Helper\Str |
|
Extends |
AbstractStr |
Check if a string ends with a given string
Methods
public function __invoke( string $haystack, string $needle, bool $ignoreCase = bool ): bool;
Class Phalcon\Support\Helper\Str\FirstBetween
Source on GitHub
Namespace |
Phalcon\Support\Helper\Str |
Returns the first string there is between the strings from the parameter start and end.
Methods
public function __invoke( string $text, string $start, string $end ): string;
Class Phalcon\Support\Helper\Str\Friendly
Source on 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.
Methods
public function __invoke( string $text, string $separator = string, bool $lowercase = bool, mixed $replace = null ): string;
Class Phalcon\Support\Helper\Str\Humanize
Source on GitHub
Namespace |
Phalcon\Support\Helper\Str |
Makes an underscored or dashed text human-readable
Methods
public function __invoke( string $text ): string;
Class Phalcon\Support\Helper\Str\Includes
Source on GitHub
Namespace |
Phalcon\Support\Helper\Str |
Determines whether a string includes another string or not.
Methods
public function __invoke( string $haystack, string $needle ): bool;
Class Phalcon\Support\Helper\Str\Increment
Source on GitHub
Namespace |
Phalcon\Support\Helper\Str |
Adds a number to the end of a string or increments that number if it is already defined
Methods
public function __invoke( string $text, string $separator = string ): string;
Class Phalcon\Support\Helper\Str\Interpolate
Source on 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
Methods
public function __invoke( string $message, array $context = [], string $leftToken = string, string $rightToken = string ): string;
Class Phalcon\Support\Helper\Str\IsAnagram
Source on GitHub
Namespace |
Phalcon\Support\Helper\Str |
Compare two strings and returns true
if both strings are anagram, false
otherwise.
Methods
public function __invoke( string $first, string $second ): bool;
Class Phalcon\Support\Helper\Str\IsLower
Source on GitHub
Namespace |
Phalcon\Support\Helper\Str |
|
Extends |
AbstractStr |
Returns true
if the given string is in lower case, false
otherwise.
Methods
public function __invoke( string $text, string $encoding = string ): bool;
Class Phalcon\Support\Helper\Str\IsPalindrome
Source on GitHub
Namespace |
Phalcon\Support\Helper\Str |
Returns true
if the given string is a palindrome, false
otherwise.
Methods
public function __invoke( string $text ): bool;
Class Phalcon\Support\Helper\Str\IsUpper
Source on GitHub
Namespace |
Phalcon\Support\Helper\Str |
|
Extends |
AbstractStr |
Returns true
if the given string is in upper case, false
otherwise.
Methods
public function __invoke( string $text, string $encoding = string ): bool;
Class Phalcon\Support\Helper\Str\KebabCase
Source on GitHub
Namespace |
Phalcon\Support\Helper\Str |
|
Extends |
PascalCase |
Converts strings to kebab-case style
Methods
public function __invoke( string $text, string $delimiters = null ): string;
Class Phalcon\Support\Helper\Str\Len
Source on GitHub
Namespace |
Phalcon\Support\Helper\Str |
Calculates the length of the string using mb_strlen
Methods
public function __invoke( string $text, string $encoding = string ): int;
Class Phalcon\Support\Helper\Str\Lower
Source on GitHub
Namespace |
Phalcon\Support\Helper\Str |
|
Extends |
AbstractStr |
Converts a string to lowercase using mbstring
Methods
public function __invoke( string $text, string $encoding = string ): string;
Class Phalcon\Support\Helper\Str\PascalCase
Source on GitHub
Namespace |
Phalcon\Support\Helper\Str |
Converts strings to PascalCase style
Methods
public function __invoke( string $text, string $delimiters = null ): string;
protected function processArray( string $text, string $delimiters = null ): array;
Class Phalcon\Support\Helper\Str\Prefix
Source on GitHub
Namespace |
Phalcon\Support\Helper\Str |
Prefixes the text with the supplied prefix
Methods
public function __invoke( mixed $text, string $prefix ): string;
Class Phalcon\Support\Helper\Str\Random
Source on GitHub
Namespace |
Phalcon\Support\Helper\Str |
Generates a random string based on the given type. Type is one of the RANDOM_* constants
Constants
const RANDOM_ALNUM = 0;
const RANDOM_ALPHA = 1;
const RANDOM_DISTINCT = 5;
const RANDOM_HEXDEC = 2;
const RANDOM_NOZERO = 4;
const RANDOM_NUMERIC = 3;
Methods
public function __invoke( int $type = static-constant-access, int $length = int ): string;
Class Phalcon\Support\Helper\Str\ReduceSlashes
Source on GitHub
Namespace |
Phalcon\Support\Helper\Str |
Reduces multiple slashes in a string to single slashes
Methods
public function __invoke( string $text ): string;
Class Phalcon\Support\Helper\Str\SnakeCase
Source on GitHub
Namespace |
Phalcon\Support\Helper\Str |
|
Extends |
PascalCase |
Converts strings to snake_case style
Methods
public function __invoke( string $text, string $delimiters = null ): string;
Class Phalcon\Support\Helper\Str\StartsWith
Source on GitHub
Namespace |
Phalcon\Support\Helper\Str |
|
Extends |
AbstractStr |
Check if a string starts with a given string
Methods
public function __invoke( string $haystack, string $needle, bool $ignoreCase = bool ): bool;
Class Phalcon\Support\Helper\Str\Suffix
Source on GitHub
Namespace |
Phalcon\Support\Helper\Str |
Suffixes the text with the supplied suffix
Methods
public function __invoke( mixed $text, string $suffix ): string;
Class Phalcon\Support\Helper\Str\Ucwords
Source on GitHub
Namespace |
Phalcon\Support\Helper\Str |
Capitalizes the first letter of each word
Methods
public function __invoke( string $text, string $encoding = string ): string;
Class Phalcon\Support\Helper\Str\Uncamelize
Source on GitHub
Namespace |
Phalcon\Support\Helper\Str |
Converts strings to non camelized style
Methods
public function __invoke( string $text, string $delimiter = string ): string;
Class Phalcon\Support\Helper\Str\Underscore
Source on GitHub
Namespace |
Phalcon\Support\Helper\Str |
Makes a text underscored instead of spaced
Methods
public function __invoke( string $text ): string;
Class Phalcon\Support\Helper\Str\Upper
Source on GitHub
Namespace |
Phalcon\Support\Helper\Str |
|
Extends |
AbstractStr |
Converts a string to uppercase using mbstring
Methods
public function __invoke( string $text, string $encoding = string ): string;
Class Phalcon\Support\HelperFactory
Source on GitHub
Namespace |
Phalcon\Support |
|
Uses |
Phalcon\Factory\AbstractFactory |
|
Extends |
AbstractFactory |
ServiceLocator implementation for helpers
Methods
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;
Returns the available adapters
Final Class Phalcon\Support\Registry
Source on GitHub
Namespace |
Phalcon\Support |
|
Uses |
Phalcon\Support\Collection, Traversable |
|
Extends |
Collection |
Phalcon\Registry
A registry is a container for storing objects and values in the application space. By storing the value in a registry, the same object is always available throughout your application.
$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"]);
In addition to ArrayAccess, Phalcon\Registry also implements Countable (count($registry) will return the number of elements in the registry), Serializable and Iterator (you can iterate over the registry using a foreach loop) interfaces. For PHP 5.4 and higher, JsonSerializable interface is implemented.
Phalcon\Registry is very fast (it is typically faster than any userspace implementation of the registry); however, this comes at a price: Phalcon\Registry is a final class and cannot be inherited from.
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.
Internally all the magic methods (and interfaces except JsonSerializable) are implemented using object handlers or similar techniques: this allows to bypass relatively slow method calls.
Methods
final public function __construct( array $data = [] );
Constructor
final public function __get( string $element ): mixed;
Magic getter to get an element from the collection
final public function __isset( string $element ): bool;
Magic isset to check whether an element exists or not
final public function __set( string $element, mixed $value ): void;
Magic setter to assign values to an element
final public function __unset( string $element ): void;
Magic unset to remove an element from the collection
final public function clear(): void;
Clears the internal collection
final public function count(): int;
Count elements of an object
@link https://php.net/manual/en/countable.count.php
final public function get( string $element, mixed $defaultValue = null, string $cast = null ): mixed;
Get the element from the collection
final public function getIterator(): Traversable;
Returns the iterator of the class
final public function has( string $element ): bool;
Determines whether an element is present in the collection.
final public function init( array $data = [] ): void;
Initialize internal array
final public function jsonSerialize(): array;
Specify data which should be serialized to JSON
@link https://php.net/manual/en/jsonserializable.jsonserialize.php
final public function offsetExists( mixed $element ): bool;
Whether a offset exists
@link https://php.net/manual/en/arrayaccess.offsetexists.php
final public function offsetGet( mixed $element ): mixed;
Offset to retrieve
@link https://php.net/manual/en/arrayaccess.offsetget.php
final public function offsetSet( mixed $element, mixed $value ): void;
Offset to set
@link https://php.net/manual/en/arrayaccess.offsetset.php
final public function offsetUnset( mixed $element ): void;
Offset to unset
@link https://php.net/manual/en/arrayaccess.offsetunset.php
final public function remove( string $element ): void;
Delete the element from the collection
final public function serialize(): string;
String representation of object
@link https://php.net/manual/en/serializable.serialize.php
final public function set( string $element, mixed $value ): void;
Set an element in the collection
final public function toArray(): array;
Returns the object in an array format
final public function toJson( int $options = int ): string;
Returns the object in a JSON format
The default string uses the following options for 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;
Constructs the object
@link https://php.net/manual/en/serializable.unserialize.php
Class Phalcon\Support\Version
Source on GitHub
Namespace |
Phalcon\Support |
This class allows to get the installed version of the framework
Constants
const VERSION_MAJOR = 0;
const VERSION_MEDIUM = 1;
const VERSION_MINOR = 2;
const VERSION_SPECIAL = 3;
const VERSION_SPECIAL_NUMBER = 4;
Methods
public function get(): string;
Returns the active version (string)
echo (new Phalcon\Version())->get();
public function getId(): string;
Returns the numeric active version
echo (new Phalcon\Version())->getId();
public function getPart( int $part ): string;
Returns a specific part of the version. If the wrong parameter is passed it will return the full version
echo (new Phalcon\Version())->getPart(Phalcon\Version::VERSION_MAJOR);
protected function getVersion(): array;
Area where the version number is set. The format is as follows: 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.