ngsoft / tools
A set of reusable tools used on my projects.
Installs: 3 290
Dependents: 9
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=8.1
- ext-mbstring: *
- psr/log: ^1|^2|^3
This package is auto-updated.
Last update: 2024-10-28 09:31:41 UTC
README
Table of Contents
Method | Description |
---|---|
CacheLock | Use a cache pool to manage your locks |
CacheLock::__construct | |
CacheLock::forceRelease | {@inheritdoc} |
CharMap | A Multibyte/byte string convertion Map |
CharMap::create | Create a new CharMap |
CharMap::getCharOffset | Get character offset from byte offsetReturns -1 on failure |
CharMap::getByteOffset | Get byte offset from character Offsetreturns -1 on failure |
CharMap::__construct | Create a new CharMap |
CharMap::convertByteOffset | Get Character Offset from Byte Offset |
CharMap::convertCharacterOffset | Get Byte offset from Character Offset |
CharMap::getLength | Get number of characters |
CharMap::getSize | Get number of bytes |
CharMap::count | |
CharMap::isEmpty | |
CharMap::toString | |
CharMap::__toString | |
CharMap::__unserialize | |
CharMap::__serialize | |
CircularDependencyException | |
Container | |
Container::__construct | |
Container::alias | Alias an entry to a different name |
Container::has | {@inheritdoc} |
Container::get | {@inheritdoc} |
Container::make | Resolves an entry by its name. If given a class name, it will return a fresh instance of that class. |
Container::call | Call the given function using the given parameters. |
Container::register | Register a service |
Container::set | Add a definition to the container |
Container::setMany | Adds multiple definitions |
Container::addContainerResolver | Adds an handler to manage entry resolution (afyer params have been resolved) |
Container::__debugInfo | |
Container | |
Container::alias | Alias an entry to a different name |
Container::has | Returns true if the container can return an entry for the given identifier. |
Container::get | Finds an entry of the container by its identifier and returns it. |
Container::make | Resolves an entry by its name. If given a class name, it will return a fresh instance of that class. |
Container::call | Call the given function using the given parameters. |
Container::register | Register a service |
Container::set | Add a definition to the container |
Container::setMany | Adds multiple definitions |
Container::addContainerResolver | Adds an handler to manage entry resolution (after params have been resolved) |
ContainerError | |
Directory | Manages a directory |
Directory::scanFiles | Scan files in a directory |
Directory::scanFilesArray | |
Directory::cwd | |
Directory::pushd | Change the current active directory and stores the last position |
Directory::popd | Restore the last active directory position and returns it |
Directory::__construct | |
Directory::copy | Copy Directory to another location |
Directory::delete | Recursively delete a directory. |
Directory::exists | Checks if directory exists |
Directory::isEmpty | Checks if no files |
Directory::mkdir | Create dir |
Directory::rmdir | Remove dir |
Directory::chdir | Change dir |
Directory::isCurrentWorkingDir | Checks if is current active dir |
Directory::search | Search for a file recursively using regex, glob or check if filename contains $query |
Directory::glob | Executes a glob search inside the directory |
Directory::files | List files inside directory |
Directory::allFiles | List files recursively |
Directory::directories | List directories |
Directory::getFile | Access a file in that directory |
Directory::getIterator | |
EnumUtils | |
EnumUtils::generateEnumClassPhpDoc | Generates Doc Comment for magic static methods |
EnumUtils::addPhpDocToEnumClass | Auto Generates static methods doc blocks for enums |
FacadeUtils | |
FacadeUtils::getClassDocBlocks | |
FacadeUtils::createDocBlock | |
FacadeUtils::createMethodsForInstance | |
FacadeUtils::createMethods | |
FacadeUtils::createFacadeCode | |
File | Manages a File |
File::__construct | |
File::__destruct | |
File::getDirectory | Get file directory |
File::exists | Checks if file exists and is regular file |
File::isModified | Check if crc checksum has changed |
File::unlink | Deletes the file |
File::copy | Copy File |
File::delete | Delete the file |
File::require | Includes file as php file |
File::name | Get file name without extension |
File::extension | Get the last file extension |
File::hash | Get CRC32 Checksum |
File::touch | Sets access and modification time of file |
File::getContents | Loads file as an Iterator |
File::createContents | Creates file contents |
File::read | Loads file |
File::readAsArray | Read file as array of lines |
File::readJson | Decodes json file |
File::write | Save File |
File::writeJson | Dumps data to json |
File::getIterator | |
File::lock | Locks file access on concurrent requests |
File::__debugInfo | |
FileContents | |
FileContents::__construct | |
FileContents::refresh | Reorganize lines |
FileContents::reload | Reloads file contents |
FileContents::clear | Clears the contents |
FileContents::map | Run the callable with all the lines and replaces the contents with the return value |
FileContents::filter | Run a callable for all the line and removes line that does not pass the test |
FileContents::save | Save file contents |
FileContents::readLine | Reads a line |
FileContents::write | Replaces the entire contents |
FileContents::writeLine | replaces / adds a line |
FileContents::insertLine | Insert a lineif no offset defined will add to the begining of the file, if out of range will be added to the end of the file |
FileContents::removeLine | Delete a line, also reorganize lines |
FileContents::offsetExists | {@inheritdoc} |
FileContents::offsetGet | {@inheritdoc} |
FileContents::offsetSet | {@inheritdoc} |
FileContents::offsetUnset | {@inheritdoc} |
FileContents::isEmpty | |
FileContents::count | {@inheritdoc} |
FileContents::getIterator | |
FileContents::jsonSerialize | {@inheritdoc} |
FileContents::__toString | {@inheritdoc} |
FileContents::__serialize | {@inheritdoc} |
FileContents::__unserialize | {@inheritdoc} |
FileContents::__debugInfo | |
FileFactory | |
FileFactory::getFile | Get a File instance |
FileFactory::getDirectory | Get a Directory instance |
FileFactory::getFileContents | Get File Contents |
FileList | File list Iterator |
FileList::create | |
FileList::append | Adds a file to the list |
FileList::files | Returns only files |
FileList::directories | Returns only directories |
FileList::filter | Filter results using callable |
FileList::toArray | Returns files realpaths |
FileList::isEmpty | |
FileList::count | |
FileList::getIterator | |
FileList::keys | |
FileList::values | |
FileList::__serialize | |
FileList::__unserialize | |
FileList::__debugInfo | |
FileLock | Uses php files to create locks |
FileLock::__construct | |
FileLock::forceRelease | {@inheritdoc} |
FileSystem | |
FileSystem::getFile | Get a File instance |
FileSystem::getDirectory | Get a Directory instance |
FileSystem::getFileContents | Get File Contents |
FileSystemLock | Creates a lock file with the same filename and directory as provided file |
FileSystemLock::__construct | |
FileSystemLock::forceRelease | |
FixedArray | An array with fixed capacityUses LRU model (Last Recently Used gets removed first)SplFixedArray only works with int offsets (not null or strings) |
FixedArray::create | Creates a new Fixed Array |
FixedArray::__construct | |
FixedArray::clear | |
FixedArray::getSize | Gets the size of the array. |
FixedArray::setSize | Change the size of an array to the new size of size. If size is less than the current array size,any values after the new size will be discarded. |
FixedArray::count | {@inheritdoc} |
FixedArray::entries | Iterates entries in sort order |
FixedArray::keys | Returns a new iterable with only the indexes |
FixedArray::values | Returns a new iterable with only the values |
FixedArray::jsonSerialize | {@inheritdoc} |
FixedArray::offsetExists | {@inheritdoc} |
FixedArray::offsetGet | {@inheritdoc} |
FixedArray::offsetSet | {@inheritdoc} |
FixedArray::offsetUnset | {@inheritdoc} |
FixedArray::__debugInfo | {@inheritdoc} |
FixedArray::__serialize | {@inheritdoc} |
FixedArray::__unserialize | {@inheritdoc} |
FixedArray::__clone | {@inheritdoc} |
Inject | |
Inject::__construct | |
Inject::__toString | |
InjectProperties | Scans for #[Inject] attribute on the loaded class properties |
InjectProperties::resolve | Resolves an entry from the container |
InjectProperties::getDefaultPriority | Set the default priority |
InnerFacade | |
InnerFacade::boot | Starts the container |
InnerFacade::registerServiceProvider | |
InnerFacade::getResovedInstance | |
InnerFacade::setResolvedInstance | |
InnerFacade::getContainer | |
InnerFacade::setContainer | |
JsonObject | A Json object that syncs data with a json file concurently |
JsonObject::fromJsonFile | |
Lock | |
Lock::createFileLock | Create a Php File Lock |
Lock::createFileSystemLock | |
Lock::createSQLiteLock | Create a SQLite Lock |
Lock::createNoLock | Create a NoLock |
Lock::createCacheLock | Create a lock using a PSR-6 Cache |
Lock::createSimpleCacheLock | Create a lock using a PSR-16 Cache |
LockFactory | |
LockFactory::__construct | |
LockFactory::createFileLock | Create a Php File Lock |
LockFactory::createFileSystemLock | Create a .lock file inside the dame directory as the provided file |
LockFactory::createSQLiteLock | Create a SQLite Lock |
LockFactory::createNoLock | Create a NoLock |
LockFactory::createCacheLock | Create a lock using a PSR-6 Cache |
LockFactory::createSimpleCacheLock | Create a lock using a PSR-16 Cache |
LockServiceProvider | |
LockServiceProvider::provides | Get the services provided by the provider. |
LockServiceProvider::register | Register the service into the container |
LockTimeout | |
Logger | |
Logger::log | Logs with an arbitrary level. |
Logger::emergency | System is unusable. |
Logger::alert | Action must be taken immediately. |
Logger::critical | Critical conditions. |
Logger::error | Runtime errors that do not require immediate action but should typicallybe logged and monitored. |
Logger::warning | Exceptional occurrences that are not errors. |
Logger::notice | Normal but significant events. |
Logger::info | Interesting events. |
Logger::debug | Detailed debug information. |
LoggerAwareResolver | Injects Logger |
LoggerAwareResolver::resolve | Resolves an entry from the container |
LoggerAwareResolver::getDefaultPriority | Set the default priority |
Map | The Map object holds key-value pairs and remembers the original insertion order of the keys. |
Map::clear | The clear() method removes all elements from a Map object. |
Map::delete | The delete() method removes the specified element from a Map object by key. |
Map::get | The get() method returns a specified element from a Map object. |
Map::search | The search() method returns the first key match from a value |
Map::set | The set() method adds or updates an element with a specified key and a value to a Map object. |
Map::add | The add() method adds an element with a specified key and a value to a Map object if it does'n already exists. |
Map::has | The has() method returns a boolean indicating whether an element with the specified key exists or not. |
Map::keys | The keys() method returns a new iterator object that contains the keys for each element in the Map object in insertion order |
Map::values | The values() method returns a new iterator object that contains the values for each element in the Map object in insertion order. |
Map::entries | The entries() method returns a new iterator object that contains the [key, value] pairs for each element in the Map object in insertion order. |
Map::forEach | The forEach() method executes a provided function once per each key/value pair in the Map object, in insertion order. |
Map::offsetExists | {@inheritdoc} |
Map::offsetGet | {@inheritdoc} |
Map::offsetSet | {@inheritdoc} |
Map::offsetUnset | {@inheritdoc} |
Map::count | {@inheritdoc} |
Map::jsonSerialize | {@inheritdoc} |
Map::__debugInfo | {@inheritdoc} |
Map::__serialize | {@inheritdoc} |
Map::__unserialize | {@inheritdoc} |
Map::__clone | {@inheritdoc} |
NoLock | NullLock |
NoLock::acquire | Acquires the lock. |
NoLock::forceRelease | {@inheritdoc} |
NoLock::isAcquired | Returns whether or not the lock is acquired. |
NoLock::release | Release the lock. |
NotFound | |
NotFound::for | |
NullServiceProvider | |
NullServiceProvider::__construct | |
NullServiceProvider::provides | Get the services provided by the provider. |
NullServiceProvider::register | Register the service into the container |
OwnedList | Simulates one to many relationships found in databases |
OwnedList::create | Creates a new OwnedList for the given value |
OwnedList::__construct | |
OwnedList::add | Adds a relationship between current value and the given value |
OwnedList::delete | Removes a relationship between current value and the given value |
OwnedList::has | Checks if a relationship exists between current value and the given value |
OwnedList::clear | Removes all relationships |
OwnedList::entries | Iterates entries |
OwnedList::values | Iterates owned values |
OwnedList::count | {@inheritdoc} |
OwnedList::offsetExists | |
OwnedList::offsetGet | |
OwnedList::offsetSet | |
OwnedList::offsetUnset | |
OwnedList::jsonSerialize | {@inheritdoc} |
OwnedList::__debugInfo | {@inheritdoc} |
OwnedList::__serialize | {@inheritdoc} |
OwnedList::__unserialize | {@inheritdoc} |
OwnedList::__clone | {@inheritdoc} |
ParameterResolver | |
ParameterResolver::__construct | |
ParameterResolver::canResolve | |
ParameterResolver::resolve | |
PrioritySet | A Priority Set is a set that sorts entries by priority |
PrioritySet::create | Create a new Set |
PrioritySet::add | The add() method adds a new element with a specified value with a given priority. |
PrioritySet::getPriority | |
PrioritySet::clear | The clear() method removes all elements from a Set object. |
PrioritySet::delete | The delete() method removes a specified value from a Set object, if it is in the set. |
PrioritySet::entries | The entries() method returns a new Iterator object that contains an array of [value, value] for each element in the Set object, in insertion order. |
PrioritySet::forEach | The forEach() method executes a provided function once for each value in the Set object, in insertion order. |
PrioritySet::has | The has() method returns a boolean indicating whether an element with the specified value exists in a Set object or not. |
PrioritySet::isEmpty | Checks if set is empty |
PrioritySet::values | The values() method returns a new Iterator object that contains the values for each element in the Set object in insertion order. |
PrioritySet::count | {@inheritdoc} |
PrioritySet::getIterator | {@inheritdoc} |
PrioritySet::jsonSerialize | {@inheritdoc} |
PrioritySet::__debugInfo | {@inheritdoc} |
PrioritySet::__serialize | |
PrioritySet::__unserialize | |
PrioritySet::__clone | {@inheritdoc} |
Range | Returns a sequence of numbers, starting from 0 by default, and increments by 1 (by default), and stops before a specified number. |
Range::__construct | |
Range::create | Creates a Range |
Range::of | Get a range for a Countable |
Range::__debugInfo | |
Range::__toString | |
Range::isEmpty | Checks if empty range |
Range::count | |
Range::entries | Iterates entries in sort order |
RegExp | |
RegExp::create | Initialize RegExp |
RegExp::__construct | Initialize RegExp |
RegExp::getLastIndex | Get the last index |
RegExp::setLastIndex | Set the Last Index |
RegExp::test | The test() method executes a search for a match between a regular expression and a specified string. |
RegExp::exec | The exec() method executes a search for a match in a specified string. Returns a result array, or null. |
RegExp::replace | The replace() method replaces some or all matches of a this pattern in a string by a replacement,and returns the result of the replacement as a new string. |
RegExp::search | The search() method executes a search for a match between a regular expression and a string. |
RegExp::split | The split() method divides a String into an ordered list of substrings, |
RegExp::matchAll | The matchAll() method returns an iterator of all results matching a string against a regular expression, including capturing groups. |
RegExp::match | The match() method retrieves the result of matching a string against a regular expression. |
RegExp::__unserialize | {@inheritdoc} |
RegExp::__serialize | {@inheritdoc} |
RegExp::jsonSerialize | {@inheritdoc} |
RegExp::__toString | {@inheritdoc} |
RegExp::__debugInfo | |
RegExpException | |
RegExpException::__construct | |
RegExpException::getRegExp | Get the RegExp Object |
ResolverException | |
ResolverException::notTwice | |
ResolverException::invalidCallable | |
Set | The Set object lets you store unique values of any type, whether primitive values or object references. |
Set::create | Create a new Set |
Set::add | The add() method appends a new element with a specified value to the end of a Set object. |
Set::clear | The clear() method removes all elements from a Set object. |
Set::delete | The delete() method removes a specified value from a Set object, if it is in the set. |
Set::entries | The entries() method returns a new Iterator object that contains an array of [value, value] for each element in the Set object, in insertion order. |
Set::has | The has() method returns a boolean indicating whether an element with the specified value exists in a Set object or not. |
Set::isEmpty | Checks if set is empty |
Set::values | The values() method returns a new Iterator object that contains the values for each element in the Set object in insertion order. |
Set::count | {@inheritdoc} |
Set::getIterator | {@inheritdoc} |
Set::jsonSerialize | {@inheritdoc} |
Set::__debugInfo | {@inheritdoc} |
Set::__serialize | |
Set::__unserialize | |
Set::__clone | {@inheritdoc} |
SharedList | Simulates Many-To-Many relations found in database |
SharedList::create | Create a new SharedList |
SharedList::clear | |
SharedList::hasValue | Checks if value exists in the set |
SharedList::has | Checks if relationship exists between 2 values |
SharedList::add | Add a relationship between 2 values |
SharedList::deleteValue | Removes a value and all its relationships |
SharedList::delete | Removes a relationship between 2 values |
SharedList::get | Get value shared list |
SharedList::entries | Iterates all values shared lists |
SharedList::count | |
SharedList::getIterator | |
SharedList::jsonSerialize | |
SharedList::__serialize | |
SharedList::__unserialize | |
SharedList::__debugInfo | |
SimpleArray | A base Collection |
SimpleArray::unshift | Prepend one or more elements to the beginning of an array |
SimpleArray::push | Appends one or more elements at the end of an array |
SimpleArray::shift | Shift an element off the beginning of array |
SimpleArray::pop | Pop the element off the end of array |
SimpleArray::indexOf | Returns the value index |
SimpleCacheLock | Use SimpleCache to manage your locks |
SimpleCacheLock::__construct | |
SimpleCacheLock::forceRelease | {@inheritdoc} |
SimpleIterator | The SimpleIterator can iterate everything in any order |
SimpleIterator::__construct | |
SimpleIterator::of | Create a new SimpleIterator |
SimpleIterator::ofStringable | Creates a new SimpleIterator that iterates each characters |
SimpleIterator::ofList | Creates an iterator from a list |
SimpleIterator::count | |
SimpleIterator::entries | Iterates entries in sort order |
SimpleObject | A base Collection |
SimpleObject::search | Searches the array for a given value and returns the first corresponding key if successful |
SimpleObject::__get | {@inheritdoc} |
SimpleObject::__set | {@inheritdoc} |
SimpleObject::__unset | {@inheritdoc} |
SimpleObject::__isset | {@inheritdoc} |
SimpleServiceProvider | |
SimpleServiceProvider::__construct | |
SimpleServiceProvider::provides | Get the services provided by the provider. |
SimpleServiceProvider::register | Register the service into the container |
Slice | |
Slice::create | Creates a Slice instance |
Slice::of | Create a Slice instance using python slice notation |
Slice::isValid | Checks if valid slice syntax |
Slice::__construct | |
Slice::getStart | |
Slice::getStop | |
Slice::getStep | |
Slice::getIteratorFor | |
Slice::getOffsetList | |
Slice::slice | Returns a slice of an array like object |
Slice::join | Returns a String of a slice |
Slice::__debugInfo | |
Slice::__toString | |
SQLiteLock | A SQLite database to manage your locks |
SQLiteLock::__construct | |
SQLiteLock::forceRelease | {@inheritdoc} |
StackableContainer | |
StackableContainer::__construct | |
StackableContainer::hasContainer | Check if container already stacked |
StackableContainer::addContainer | Stacks a new Container on top |
StackableContainer::get | {@inheritdoc} |
StackableContainer::has | {@inheritdoc} |
State | Basic Enum Class Support (Polyfill)Adds the ability to class constants to work as php 8.1 backed enums cases |
StopWatch | |
StopWatch::startTask | Starts a callable and returns result time |
StopWatch::startTaskWithStartTime | |
StopWatch::__construct | |
StopWatch::getTask | |
StopWatch::executeTask | |
StopWatch::start | Starts the clock |
StopWatch::resume | Resumes the clock (only if paused) |
StopWatch::reset | Resets the clock |
StopWatch::pause | Pauses the clock |
StopWatch::stop | Stops the clock |
StopWatch::read | Reads the clock |
StopWatch::getLaps | |
StopWatch::lap | Adds a lap time |
StopWatch::isStarted | |
StopWatch::isPaused | |
StopWatch::isStopped | |
Text | Transform a scalar to its stringable representation |
Text::create | Create new Text |
Text::of | Create new Text |
Text::ofSegments | Create multiple segments of Text |
Text::__construct | |
Text::copy | Get a Text Copy |
Text::indexOf | The indexOf() method, given one argument: a substring/regex to search for, searches the entire calling string, and returns the index of the first occurrence of the specified substring |
Text::search | Alias of indexOf |
Text::lastIndexOf | The lastIndexOf() method, given one argument: a substring/regex to search for, searches the entire calling string, and returns the index of the last occurrence of the specified substring. |
Text::at | The at() method takes an integer value and returns the character located at the specified offset |
Text::concat | The concat() method concatenates the string arguments to the current Text |
Text::toLowerCase | Converts Text to lower case |
Text::toUpperCase | Converts Text to upper case |
Text::endsWith | The endsWith() method determines whether a string ends with the characters of a specified string, returning true or false as appropriate. |
Text::startsWith | The startsWith() method determines whether a string begins with the characters of a specified string, returning true or false as appropriate. |
Text::contains | The includes() method performs a search to determine whether one string may be found within another string/regex, returning true or false as appropriate. |
Text::containsAll | Determine if a given string contains all needles |
Text::includes | The includes() method performs a case-sensitive search to determine whether one string may be found within another string, returning true or false as appropriate. |
Text::match | The match() method retrieves the result of matching a string against a regular expression. |
Text::matchAll | The matchAll() method returns an iterator of all results matching a string against a regular expression, including capturing groups. |
Text::padStart | Pad the left side of a string with another. |
Text::padEnd | Pad the right side of a string with another. |
Text::pad | Pad on both sides of a string with another. |
Text::repeat | The repeat() method constructs and returns a new string which contains the specified number of copies of the string on which it was called,concatenated together. |
Text::replace | Replace the first occurrence of a given value in the string. |
Text::replaceAll | |
Text::substring | The substring() method returns the part of the string between the start and end indexes, or to the end of the string. |
Text::ltrim | Left Trim the string of the given characters. |
Text::trimStart | Alias of ltrim |
Text::rtrim | Right Trim the string of the given characters. |
Text::trimEnd | Alias of rtrim |
Text::trim | Trim the string of the given characters. |
Text::capitalize | Return a copy of the string with its first character capitalized and the rest lowercased. |
Text::center | Return centered in a string of length width. Padding is done using the specified fillchar (default is an ASCII space). |
Text::expandtabs | Return a copy of the string where all tab characters are replaced by one or more spaces |
Text::find | Return the lowest index in the string where substring sub is found within the slice s[start:end]. |
Text::format | Perform a string formatting operation. The string on which this method is called can contain literal text or replacement fields delimited by braces {}. |
Text::index | Like find(), but raise ValueError when the substring is not found. |
Text::isalnum | Return True if all characters in the string are alphanumeric and there is at least one character, False otherwise |
Text::isalpha | Return True if all characters in the string are alphabetic and there is at least one character, False otherwise. |
Text::isdecimal | Return True if all characters in the string are decimal characters and there is at least one character, False otherwise |
Text::isdigit | Return True if all characters in the string are digits and there is at least one character, False otherwise. |
Text::islower | Return True if all cased characters in the string are lowercase and there is at least one cased character, False otherwise. |
Text::isnumeric | Finds whether a variable is a number or a numeric string |
Text::istitle | Return True if the string is a titlecased string and there is at least one character,for example uppercase characters may only follow uncased characters and lowercase characters only cased ones. |
Text::isspace | Return True if there are only whitespace characters in the string and there is at least one character, False otherwise. |
Text::isprintable | Return True if all characters in the string are printable or the string is empty, False otherwise. |
Text::ispunct | Checks if all of the characters in the provided Text, are punctuation character. |
Text::iscontrol | Checks if all characters in Text are control characters |
Text::isupper | Return True if all characters in the string are uppercase and there is at least one lowercase character, False otherwise. |
Text::join | Return a string which is the concatenation of the strings in iterable. |
Text::lower | Return a copy of the string with all characters converted to lowercase. |
Text::lstrip | Return a copy of the string with leading characters removed. |
Text::partition | Split the string at the first occurrence of sep,and return a 3-tuple containing the part before the separator, the separator itself, and the part after the separator. |
Text::removeprefix | If the string starts with the prefix string,return string[len(prefix):]. Otherwise, return a copy of the original string: |
Text::removeSuffix | If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. |
Text::reverse | Reverse the string |
Text::rfind | Return the highest index in the string where substring sub is found, such that sub is contained within s[start:end]. |
Text::rindex | Like rfind() but raises ValueError when the substring sub is not found. |
Text::rpartition | Split the string at the last occurrence of sep,and return a 3-tuple containing the part before the separator, the separator itself, and the part after the separator. |
Text::rstrip | Return a copy of the string with trailing characters removed. |
Text::strip | Return a copy of the string with the leading and trailing characters removed. |
Text::swapcase | Return a copy of the string with uppercase characters converted to lowercase and vice versa. |
Text::slice | The slice() method extracts a section of a string and returns it as a new string |
Text::title | Return a titlecased version of the string where words start with an uppercase character and the remaining characters are lowercase. |
Text::upper | Return a copy of the string with all the cased characters converted to uppercase |
Text::split | Return a list of the words in the string, using sep as the delimiter string. |
Text::rsplit | Return a list of the words in the string, using sep as the delimiter string. |
Text::splitlines | Return a list of the lines in the string, breaking at line boundaries. |
Text::sprintf | Use sprintf to format string |
Text::ucfirst | Use ucfirst on the string |
Text::lcfirst | Use lcfirst on the string |
Text::append | Returns new Text with suffix added |
Text::prepend | Returns new Text with prefix added |
Text::isBase64 | Checks if Text is base 64 encoded |
Text::base64Encode | Returns a base64 decoded Text |
Text::base64Decode | Returns a base64 decoded Text |
Text::splitChars | Split the Text into multiple Text[] |
Text::countChars | Count needle occurences inside Textif using a regex as needle the search will be case sensitive |
Text::isEquals | Checks if Text is the same as the provided needle |
Text::ishexadecimal | Checks if string is hexadecimal number |
Text::length | Returns the length of the text |
Text::size | Returns the byte size |
Text::offsetExists | |
Text::offsetGet | |
Text::offsetSet | |
Text::offsetUnset | |
Text::count | |
Text::isEmpty | |
Text::jsonSerialize | |
Text::toString | |
Text::__toString | |
Text::__serialize | |
Text::__unserialize | |
Text::__debugInfo | |
Timer | |
Timer::getWatch | Get a watch |
Timer::read | Reads the clock |
Timer::start | Starts the clock |
Timer::resume | Resumes the clock (only if paused) |
Timer::reset | Resets the clock |
Timer::resetAll | Resets all the clocks |
Timer::pause | Pauses the clock |
Timer::stop | Stops the clock |
Timer::getLaps | |
Timer::lap | Adds a lap time |
Tools | Useful Functions to use in my projects |
Tools::safe_exec | Execute a callback and hides all php errors that can be thrownExceptions thrown inside the callback will be preserved |
Tools::errors_as_exceptions | Convenient Function used to convert php errors, warning, ... as Throwable |
Tools::suppress_errors | Set error handler to empty closure (as of php 8.1 @ doesn't works anymore) |
Tools::normalize_path | Normalize pathnames |
Tools::pushd | Change the current active directoryAnd stores the last position, use popd() to return to previous directory |
Tools::popd | Restore the last active directory changed by pushd |
Tools::each | Uses callback for each elements of the array and returns the value |
Tools::iterateAll | Iterate iterable |
Tools::filter | Filters elements of an iterable using a callback function |
Tools::search | Searches an iterable until element is found |
Tools::map | Same as the original except callback accepts more arguments and works with string keys |
Tools::some | Tests if at least one element in the iterable passes the test implemented by the provided function. |
Tools::every | Tests if all elements in the iterable pass the test implemented by the provided function. |
Tools::pull | Get a value(s) from the array, and remove it. |
Tools::cloneArray | Clone all objects of an array recursively |
Tools::iterableToArray | Converts an iterable to an array recursivelyif the keys are not string the will be indexed |
Tools::concat | Concatenate multiple values into the iterable provided recursivelyIf a provided value is iterable it will be merged into the iterable(non numeric keys will be replaced if not iterable into the provided object) |
Tools::countValue | Count number of occurences of value |
Tools::isValidUrl | Checks if is a valid url |
Tools::to_snake | Convert CamelCased to camel_cased |
Tools::toCamelCase | Convert snake_case to snakeCase |
Tools::millitime | Return current Unix timestamp in milliseconds |
Tools::generate_uuid_v4 | Generates a uuid V4 |
Tools::isAscii | Returns whether this string consists entirely of ASCII characters |
Tools::isPrintableAscii | Returns whether this string consists entirely of printable ASCII characters |
Tools::getFilesize | Get Human Readable file size |
Tools::randomString | Generate a more truly "random" alpha-numeric string. |
Tools::getWordSize | Get the size of the longest word on a string |
Tools::splitString | Split the string at the given length without cutting words |
Tools::join | Joins iterable together using provided glue |
Tools::format | Try to reproduce python format |
Tools::split | Split a stringable using provided separator |
Tools::getExecutionTime | Get script execution time |
Tools::pause | Pauses script execution for a given amount of timecombines sleep or usleep |
Tools::msleep | Pauses script execution for a given amount of milliseconds |
Tools::implements_class | Get class implementing given parent class from the loaded classes |
Tools::getClassConstants | Get Constants defined in a class |
Tools::callPrivateMethod | Call a method within an object ignoring its status |
TypeCheck | Checks for mixed union/intersection types |
TypeCheck::assertType | Check the given value against the supplied types and throw TypeError if not valid |
TypeCheck::assertTypeMethod | Check the given value against the supplied types and throw TypeError if not valid |
TypeCheck::checkType | Can check a mix of intersection and union |
Units | Basic Enum Class Support (Polyfill)Adds the ability to class constants to work as php 8.1 backed enums cases |
Units::getStep | |
Units::getPlural | |
Units::getSingular | |
WatchFactory | |
WatchFactory::__construct | |
WatchFactory::getWatch | Get a watch |
WatchFactory::read | Reads the clock |
WatchFactory::start | Starts the clock |
WatchFactory::resume | Resumes the clock (only if paused) |
WatchFactory::reset | Resets the clock |
WatchFactory::resetAll | Resets all the clocks |
WatchFactory::pause | Pauses the clock |
WatchFactory::stop | Stops the clock |
WatchFactory::getLaps | |
WatchFactory::lap | Adds a lap time |
CacheLock
Use a cache pool to manage your locks
- Full name: \NGSOFT\Lock\CacheLock
- Parent class: \NGSOFT\Lock\CacheLockAbstract
CacheLock::__construct
CacheLock::__construct( \Psr\Cache\CacheItemPoolInterface cache, string|\Stringable name, int|float seconds, string|\Stringable owner = '', bool autoRelease = true ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
cache |
\Psr\Cache\CacheItemPoolInterface | |
name |
string|\Stringable | |
seconds |
int|float | |
owner |
string|\Stringable | |
autoRelease |
bool |
Return Value:
CacheLock::forceRelease
{@inheritdoc}
CacheLock::forceRelease( ): void
Return Value:
CharMap
A Multibyte/byte string convertion Map
- Full name: \NGSOFT\Tools\CharMap
- This class implements: \Stringable, \Countable
CharMap::create
Create a new CharMap
CharMap::create( string string ): static
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
string |
string |
Return Value:
CharMap::getCharOffset
Get character offset from byte offset Returns -1 on failure
CharMap::getCharOffset( string string, int byte ): int
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
string |
string | |
byte |
int |
Return Value:
CharMap::getByteOffset
Get byte offset from character Offset returns -1 on failure
CharMap::getByteOffset( string string, int char ): int
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
string |
string | |
char |
int |
Return Value:
CharMap::__construct
Create a new CharMap
CharMap::__construct( string string ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
string |
string |
Return Value:
CharMap::convertByteOffset
Get Character Offset from Byte Offset
CharMap::convertByteOffset( int byte ): int
Parameters:
Parameter | Type | Description |
---|---|---|
byte |
int |
Return Value:
CharMap::convertCharacterOffset
Get Byte offset from Character Offset
CharMap::convertCharacterOffset( int char ): int
Parameters:
Parameter | Type | Description |
---|---|---|
char |
int |
Return Value:
CharMap::getLength
Get number of characters
CharMap::getLength( ): int
Return Value:
CharMap::getSize
Get number of bytes
CharMap::getSize( ): int
Return Value:
CharMap::count
CharMap::count( ): int
Return Value:
CharMap::isEmpty
CharMap::isEmpty( ): bool
Return Value:
CharMap::toString
CharMap::toString( ): string
Return Value:
CharMap::__toString
CharMap::__toString( ): string
Return Value:
CharMap::__unserialize
CharMap::__unserialize( array data ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
data |
array |
Return Value:
CharMap::__serialize
CharMap::__serialize( ): array
Return Value:
CircularDependencyException
- Full name: \NGSOFT\Container\Exceptions\CircularDependencyException
- Parent class: \NGSOFT\Container\Exceptions\ContainerError
Container
- Full name: \NGSOFT\Container\Container
- This class implements: \NGSOFT\Container\ContainerInterface
Container::__construct
Container::__construct( iterable definitions = [] ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
definitions |
iterable |
Return Value:
Container::alias
Alias an entry to a different name
Container::alias( string|array alias, string id ): void
Parameters:
Parameter | Type | Description |
---|---|---|
alias |
string|array | |
id |
string |
Return Value:
Container::has
{@inheritdoc}
Container::has( string id ): bool
Parameters:
Parameter | Type | Description |
---|---|---|
id |
string |
Return Value:
Container::get
{@inheritdoc}
Container::get( string id ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
id |
string |
Return Value:
Container::make
Resolves an entry by its name. If given a class name, it will return a fresh instance of that class.
Container::make( string id, array parameters = [] ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
id |
string | |
parameters |
array |
Return Value:
Container::call
Call the given function using the given parameters.
Container::call( object|array|string callable, array parameters = [] ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
callable |
object|array|string | |
parameters |
array |
Return Value:
Container::register
Register a service
Container::register( \NGSOFT\Container\ServiceProvider service ): void
Parameters:
Parameter | Type | Description |
---|---|---|
service |
\NGSOFT\Container\ServiceProvider |
Return Value:
Container::set
Add a definition to the container
Container::set( string id, mixed value ): void
Parameters:
Parameter | Type | Description |
---|---|---|
id |
string | |
value |
mixed |
Return Value:
Container::setMany
Adds multiple definitions
Container::setMany( iterable definitions ): void
Parameters:
Parameter | Type | Description |
---|---|---|
definitions |
iterable |
Return Value:
Container::addContainerResolver
Adds an handler to manage entry resolution (afyer params have been resolved)
Container::addContainerResolver( \NGSOFT\Container\Resolvers\ContainerResolver resolver, ?int priority = null ): void
Parameters:
Parameter | Type | Description |
---|---|---|
resolver |
\NGSOFT\Container\Resolvers\ContainerResolver | |
priority |
?int |
Return Value:
Container::__debugInfo
Container::__debugInfo( ): mixed
Return Value:
Container
- Full name: \NGSOFT\Facades\Container
- Parent class: \NGSOFT\Facades\Facade
Container::alias
Alias an entry to a different name
Container::alias( array|string alias, string id ): void
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
alias |
array|string | |
id |
string |
Return Value:
Container::has
Returns true if the container can return an entry for the given identifier.
Container::has( string id ): bool
Returns false otherwise.
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
id |
string |
Return Value:
Container::get
Finds an entry of the container by its identifier and returns it.
Container::get( string id ): mixed
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
id |
string |
Return Value:
Container::make
Resolves an entry by its name. If given a class name, it will return a fresh instance of that class.
Container::make( string id, array parameters = [] ): mixed
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
id |
string | |
parameters |
array |
Return Value:
Container::call
Call the given function using the given parameters.
Container::call( object|array|string callable, array parameters = [] ): mixed
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
callable |
object|array|string | |
parameters |
array |
Return Value:
Container::register
Register a service
Container::register( \NGSOFT\Container\ServiceProvider service ): void
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
service |
\NGSOFT\Container\ServiceProvider |
Return Value:
Container::set
Add a definition to the container
Container::set( string id, mixed value ): void
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
id |
string | |
value |
mixed |
Return Value:
Container::setMany
Adds multiple definitions
Container::setMany( iterable definitions ): void
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
definitions |
iterable |
Return Value:
Container::addContainerResolver
Adds an handler to manage entry resolution (after params have been resolved)
Container::addContainerResolver( \NGSOFT\Container\Resolvers\ContainerResolver resolver, ?int priority = null ): void
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
resolver |
\NGSOFT\Container\Resolvers\ContainerResolver | |
priority |
?int |
Return Value:
ContainerError
- Full name: \NGSOFT\Container\Exceptions\ContainerError
- Parent class:
- This class implements: \Psr\Container\ContainerExceptionInterface
Directory
Manages a directory
- Full name: \NGSOFT\Filesystem\Directory
- Parent class: \NGSOFT\Filesystem\Filesystem
- This class implements: \IteratorAggregate
Directory::scanFiles
Scan files in a directory
Directory::scanFiles( string dirname, bool recursive = false ): \NGSOFT\Filesystem\FileList
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
dirname |
string | |
recursive |
bool |
Return Value:
Directory::scanFilesArray
Directory::scanFilesArray( string dirname, bool recursive = false ): array
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
dirname |
string | |
recursive |
bool |
Return Value:
Directory::cwd
Directory::cwd( ): static
- This method is static.
Return Value:
Directory::pushd
Change the current active directory and stores the last position
Directory::pushd( string|self directory ): static|false
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
directory |
string|self |
Return Value:
Directory::popd
Restore the last active directory position and returns it
Directory::popd( ): static|false
- This method is static.
Return Value:
Directory::__construct
Directory::__construct( string path = '' ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
path |
string |
Return Value:
Directory::copy
Copy Directory to another location
Directory::copy( string|self target, ?bool &success = null ): static
Parameters:
Parameter | Type | Description |
---|---|---|
target |
string|self | new directory |
success |
?bool | True if the operation succeeded |
Return Value:
a Directory instance for the target
Directory::delete
Recursively delete a directory.
Directory::delete( ): bool
Return Value:
Directory::exists
Checks if directory exists
Directory::exists( ): bool
Return Value:
Directory::isEmpty
Checks if no files
Directory::isEmpty( ): bool
Return Value:
Directory::mkdir
Create dir
Directory::mkdir( int mode = 0777, bool recursive = true ): bool
Parameters:
Parameter | Type | Description |
---|---|---|
mode |
int | |
recursive |
bool |
Return Value:
Directory::rmdir
Remove dir
Directory::rmdir( ): bool
Return Value:
Directory::chdir
Change dir
Directory::chdir( ): bool
Return Value:
Directory::isCurrentWorkingDir
Checks if is current active dir
Directory::isCurrentWorkingDir( ): bool
Return Value:
Directory::search
Search for a file recursively using regex, glob or check if filename contains $query
Directory::search( string pattern ): \NGSOFT\Filesystem\FileList
Parameters:
Parameter | Type | Description |
---|---|---|
pattern |
string |
Return Value:
Directory::glob
Executes a glob search inside the directory
Directory::glob( string pattern, int flags ): \NGSOFT\Filesystem\FileList
Parameters:
Parameter | Type | Description |
---|---|---|
pattern |
string | |
flags |
int |
Return Value:
Directory::files
List files inside directory
Directory::files( string|array extensions = [], bool hidden = false ): \NGSOFT\Filesystem\FileList
Parameters:
Parameter | Type | Description |
---|---|---|
extensions |
string|array | |
hidden |
bool |
Return Value:
Directory::allFiles
List files recursively
Directory::allFiles( string|array extensions = [], bool hidden = false ): \NGSOFT\Filesystem\FileList
Parameters:
Parameter | Type | Description |
---|---|---|
extensions |
string|array | |
hidden |
bool |
Return Value:
Directory::directories
List directories
Directory::directories( bool recursive = false ): \NGSOFT\Filesystem\FileList
Parameters:
Parameter | Type | Description |
---|---|---|
recursive |
bool |
Return Value:
Directory::getFile
Access a file in that directory
Directory::getFile( string target ): \NGSOFT\Filesystem\File|\NGSOFT\Filesystem\Directory
Parameters:
Parameter | Type | Description |
---|---|---|
target |
string |
Return Value:
Directory::getIterator
Directory::getIterator( ): \Traversable
Return Value:
EnumUtils
- Full name: \NGSOFT\Enums\EnumUtils
EnumUtils::generateEnumClassPhpDoc
Generates Doc Comment for magic static methods
EnumUtils::generateEnumClassPhpDoc( string className ): string
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
className |
string |
Return Value:
EnumUtils::addPhpDocToEnumClass
Auto Generates static methods doc blocks for enums
EnumUtils::addPhpDocToEnumClass( string className ): bool
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
className |
string |
Return Value:
FacadeUtils
- Full name: \NGSOFT\Tools\Utils\FacadeUtils
FacadeUtils::getClassDocBlocks
FacadeUtils::getClassDocBlocks( object|string instance, bool static = true ): array
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
instance |
object|string | |
static |
bool |
Return Value:
FacadeUtils::createDocBlock
FacadeUtils::createDocBlock( string facade ): string
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
facade |
string |
Return Value:
FacadeUtils::createMethodsForInstance
FacadeUtils::createMethodsForInstance( object|string instance, string facade = null ): string
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
instance |
object|string | |
facade |
string |
Return Value:
FacadeUtils::createMethods
FacadeUtils::createMethods( string facade ): mixed
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
facade |
string |
Return Value:
FacadeUtils::createFacadeCode
FacadeUtils::createFacadeCode( object instance, ?string name = null, ?string accessor = null ): mixed
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
instance |
object | |
name |
?string | |
accessor |
?string |
Return Value:
File
Manages a File
- Full name: \NGSOFT\Filesystem\File
- Parent class: \NGSOFT\Filesystem\Filesystem
- This class implements: \IteratorAggregate
File::__construct
File::__construct( string path ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
path |
string |
Return Value:
File::__destruct
File::__destruct( ): mixed
Return Value:
File::getDirectory
Get file directory
File::getDirectory( ): \NGSOFT\Filesystem\Directory
Return Value:
File::exists
Checks if file exists and is regular file
File::exists( ): bool
Return Value:
File::isModified
Check if crc checksum has changed
File::isModified( ): bool
Return Value:
File::unlink
Deletes the file
File::unlink( ): bool
Return Value:
File::copy
Copy File
File::copy( string|self target, ?bool &success = null ): static
Parameters:
Parameter | Type | Description |
---|---|---|
target |
string|self | new file |
success |
?bool | True if the operation succeeded |
Return Value:
a File instance for the target
File::delete
Delete the file
File::delete( ): bool
Return Value:
File::require
Includes file as php file
File::require( array data = [], bool once = false ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
data |
array | data to extract |
once |
bool | require_once |
Return Value:
File::name
Get file name without extension
File::name( ): string
Return Value:
File::extension
Get the last file extension
File::extension( ): string
Return Value:
File::hash
Get CRC32 Checksum
File::hash( ): string|null
Return Value:
File::touch
Sets access and modification time of file
File::touch( int|null mtime = null, int|null atime = null ): bool
Parameters:
Parameter | Type | Description |
---|---|---|
mtime |
int|null | |
atime |
int|null |
Return Value:
File::getContents
Loads file as an Iterator
File::getContents( ): \NGSOFT\Filesystem\FileContents
Return Value:
File::createContents
Creates file contents
File::createContents( ): \NGSOFT\Filesystem\FileContents
Return Value:
File::read
Loads file
File::read( ): string
Return Value:
File::readAsArray
Read file as array of lines
File::readAsArray( ): string[]
Return Value:
File::readJson
Decodes json file
File::readJson( ): mixed
Return Value:
File::write
Save File
File::write( string|string[]|\Stringable|\Stringable[] contents ): bool
Parameters:
Parameter | Type | Description |
---|---|---|
contents |
string|string[]|\Stringable|\Stringable[] |
Return Value:
File::writeJson
Dumps data to json
File::writeJson( mixed data, int flags = JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ): bool
Parameters:
Parameter | Type | Description |
---|---|---|
data |
mixed | |
flags |
int |
Return Value:
File::getIterator
File::getIterator( ): \Traversable
Return Value:
File::lock
Locks file access on concurrent requests
File::lock( int|float seconds, string owner = '' ): \NGSOFT\Lock\FileSystemLock
Parameters:
Parameter | Type | Description |
---|---|---|
seconds |
int|float | |
owner |
string |
Return Value:
File::__debugInfo
File::__debugInfo( ): array
Return Value:
FileContents
- Full name: \NGSOFT\Filesystem\FileContents
- This class implements: \IteratorAggregate, \ArrayAccess, \Countable, \Stringable, \JsonSerializable
FileContents::__construct
FileContents::__construct( \NGSOFT\Filesystem\File file, array lines = [], bool loaded = false ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
file |
\NGSOFT\Filesystem\File | |
lines |
array | |
loaded |
bool |
Return Value:
FileContents::refresh
Reorganize lines
FileContents::refresh( ): void
Return Value:
FileContents::reload
Reloads file contents
FileContents::reload( ): void
Return Value:
FileContents::clear
Clears the contents
FileContents::clear( ): void
Return Value:
FileContents::map
Run the callable with all the lines and replaces the contents with the return value
FileContents::map( callable callable ): static
Parameters:
Parameter | Type | Description |
---|---|---|
callable |
callable |
Return Value:
FileContents::filter
Run a callable for all the line and removes line that does not pass the test
FileContents::filter( callable callable ): static
Parameters:
Parameter | Type | Description |
---|---|---|
callable |
callable |
Return Value:
FileContents::save
Save file contents
FileContents::save( ): bool
Return Value:
FileContents::readLine
Reads a line
FileContents::readLine( int offset ): string|null
Parameters:
Parameter | Type | Description |
---|---|---|
offset |
int |
Return Value:
FileContents::write
Replaces the entire contents
FileContents::write( string|iterable lines ): static
Parameters:
Parameter | Type | Description |
---|---|---|
lines |
string|iterable |
Return Value:
FileContents::writeLine
replaces / adds a line
FileContents::writeLine( string value, int|null offset = null ): static
Parameters:
Parameter | Type | Description |
---|---|---|
value |
string | |
offset |
int|null |
Return Value:
FileContents::insertLine
Insert a line if no offset defined will add to the begining of the file, if out of range will be added to the end of the file
FileContents::insertLine( string value, int|null offset = null ): static
Parameters:
Parameter | Type | Description |
---|---|---|
value |
string | |
offset |
int|null |
Return Value:
FileContents::removeLine
Delete a line, also reorganize lines
FileContents::removeLine( int offset ): static
Parameters:
Parameter | Type | Description |
---|---|---|
offset |
int |
Return Value:
FileContents::offsetExists
{@inheritdoc}
FileContents::offsetExists( mixed offset ): bool
Parameters:
Parameter | Type | Description |
---|---|---|
offset |
mixed |
Return Value:
FileContents::offsetGet
{@inheritdoc}
FileContents::offsetGet( mixed offset ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
offset |
mixed |
Return Value:
FileContents::offsetSet
{@inheritdoc}
FileContents::offsetSet( mixed offset, mixed value ): void
Parameters:
Parameter | Type | Description |
---|---|---|
offset |
mixed | |
value |
mixed |
Return Value:
FileContents::offsetUnset
{@inheritdoc}
FileContents::offsetUnset( mixed offset ): void
Parameters:
Parameter | Type | Description |
---|---|---|
offset |
mixed |
Return Value:
FileContents::isEmpty
FileContents::isEmpty( ): bool
Return Value:
FileContents::count
{@inheritdoc}
FileContents::count( ): int
Return Value:
FileContents::getIterator
FileContents::getIterator( ): \Traversable<int,string>
Return Value:
FileContents::jsonSerialize
{@inheritdoc}
FileContents::jsonSerialize( ): mixed
Return Value:
FileContents::__toString
{@inheritdoc}
FileContents::__toString( ): string
Return Value:
FileContents::__serialize
{@inheritdoc}
FileContents::__serialize( ): array
Return Value:
FileContents::__unserialize
{@inheritdoc}
FileContents::__unserialize( array data ): void
Parameters:
Parameter | Type | Description |
---|---|---|
data |
array |
Return Value:
FileContents::__debugInfo
FileContents::__debugInfo( ): array
Return Value:
FileFactory
- Full name: \NGSOFT\Filesystem\FileFactory
FileFactory::getFile
Get a File instance
FileFactory::getFile( string filename ): \NGSOFT\Filesystem\File
Parameters:
Parameter | Type | Description |
---|---|---|
filename |
string |
Return Value:
FileFactory::getDirectory
Get a Directory instance
FileFactory::getDirectory( string dirname ): \NGSOFT\Filesystem\Directory
Parameters:
Parameter | Type | Description |
---|---|---|
dirname |
string |
Return Value:
FileFactory::getFileContents
Get File Contents
FileFactory::getFileContents( string filename ): \NGSOFT\Filesystem\FileContents
Parameters:
Parameter | Type | Description |
---|---|---|
filename |
string |
Return Value:
FileList
File list Iterator
- Full name: \NGSOFT\Filesystem\FileList
- This class implements: \IteratorAggregate, \Countable
FileList::create
FileList::create( array files = [] ): mixed
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
files |
array |
Return Value:
FileList::append
Adds a file to the list
FileList::append( string|iterable|\NGSOFT\Filesystem\Filesystem files ): void
Parameters:
Parameter | Type | Description |
---|---|---|
files |
string|iterable|\NGSOFT\Filesystem\Filesystem |
Return Value:
FileList::files
Returns only files
FileList::files( ): static
Return Value:
FileList::directories
Returns only directories
FileList::directories( ): static
Return Value:
FileList::filter
Filter results using callable
FileList::filter( callable callable ): static
Parameters:
Parameter | Type | Description |
---|---|---|
callable |
callable |
Return Value:
FileList::toArray
Returns files realpaths
FileList::toArray( ): array
Return Value:
FileList::isEmpty
FileList::isEmpty( ): bool
Return Value:
FileList::count
FileList::count( ): int
Return Value:
FileList::getIterator
FileList::getIterator( ): \Traversable<string,\NGSOFT\Filesystem\File|\NGSOFT\Filesystem\Directory>
Return Value:
FileList::keys
FileList::keys( ): string[]
Return Value:
FileList::values
FileList::values( ): \NGSOFT\Filesystem\File[]|\NGSOFT\Filesystem\Directory[]
Return Value:
FileList::__serialize
FileList::__serialize( ): array
Return Value:
FileList::__unserialize
FileList::__unserialize( array data ): void
Parameters:
Parameter | Type | Description |
---|---|---|
data |
array |
Return Value:
FileList::__debugInfo
FileList::__debugInfo( ): array
Return Value:
FileLock
Uses php files to create locks
- Full name: \NGSOFT\Lock\FileLock
- Parent class: \NGSOFT\Lock\BaseLockStore
FileLock::__construct
FileLock::__construct( string|\Stringable name, int|float seconds, string|\Stringable owner = '', bool autoRelease = true, string rootpath = '', string prefix = '@flocks' ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
name |
string|\Stringable | |
seconds |
int|float | |
owner |
string|\Stringable | |
autoRelease |
bool | |
rootpath |
string | where to put the locks |
prefix |
string | subdirectory to $rootpath |
Return Value:
FileLock::forceRelease
{@inheritdoc}
FileLock::forceRelease( ): void
Return Value:
FileSystem
- Full name: \NGSOFT\Facades\FileSystem
- Parent class: \NGSOFT\Facades\Facade
FileSystem::getFile
Get a File instance
FileSystem::getFile( string filename ): \NGSOFT\Filesystem\File
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
filename |
string |
Return Value:
FileSystem::getDirectory
Get a Directory instance
FileSystem::getDirectory( string dirname ): \NGSOFT\Filesystem\Directory
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
dirname |
string |
Return Value:
FileSystem::getFileContents
Get File Contents
FileSystem::getFileContents( string filename ): \NGSOFT\Filesystem\FileContents
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
filename |
string |
Return Value:
FileSystemLock
Creates a lock file with the same filename and directory as provided file
- Full name: \NGSOFT\Lock\FileSystemLock
- Parent class: \NGSOFT\Lock\BaseLockStore
FileSystemLock::__construct
FileSystemLock::__construct( \NGSOFT\Filesystem\File name, int|float seconds, string|\Stringable owner = '', bool autoRelease = true ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
name |
\NGSOFT\Filesystem\File | |
seconds |
int|float | |
owner |
string|\Stringable | |
autoRelease |
bool |
Return Value:
FileSystemLock::forceRelease
FileSystemLock::forceRelease( ): void
Return Value:
FixedArray
An array with fixed capacity Uses LRU model (Last Recently Used gets removed first) SplFixedArray only works with int offsets (not null or strings)
- Full name: \NGSOFT\DataStructure\FixedArray
- This class implements: \NGSOFT\DataStructure\ReversibleIterator, \ArrayAccess, \JsonSerializable, \Stringable
FixedArray::create
Creates a new Fixed Array
FixedArray::create( int size = self::DEFAULT_CAPACITY ): static
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
size |
int |
Return Value:
FixedArray::__construct
FixedArray::__construct( int size = self::DEFAULT_CAPACITY ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
size |
int |
Return Value:
FixedArray::clear
FixedArray::clear( ): void
Return Value:
FixedArray::getSize
Gets the size of the array.
FixedArray::getSize( ): int
Return Value:
FixedArray::setSize
Change the size of an array to the new size of size. If size is less than the current array size, any values after the new size will be discarded.
FixedArray::setSize( int size ): bool
If size is greater than the current array size, the array will be padded with null values.
Parameters:
Parameter | Type | Description |
---|---|---|
size |
int |
Return Value:
FixedArray::count
{@inheritdoc}
FixedArray::count( ): int
Return Value:
FixedArray::entries
Iterates entries in sort order
FixedArray::entries( \NGSOFT\DataStructure\Sort sort = Sort::ASC ): iterable
Parameters:
Parameter | Type | Description |
---|---|---|
sort |
\NGSOFT\DataStructure\Sort |
Return Value:
FixedArray::keys
Returns a new iterable with only the indexes
FixedArray::keys( \NGSOFT\DataStructure\Sort sort = Sort::ASC ): iterable
Parameters:
Parameter | Type | Description |
---|---|---|
sort |
\NGSOFT\DataStructure\Sort |
Return Value:
FixedArray::values
Returns a new iterable with only the values
FixedArray::values( \NGSOFT\DataStructure\Sort sort = Sort::ASC ): iterable
Parameters:
Parameter | Type | Description |
---|---|---|
sort |
\NGSOFT\DataStructure\Sort |
Return Value:
FixedArray::jsonSerialize
{@inheritdoc}
FixedArray::jsonSerialize( ): mixed
Return Value:
FixedArray::offsetExists
{@inheritdoc}
FixedArray::offsetExists( mixed offset ): bool
Parameters:
Parameter | Type | Description |
---|---|---|
offset |
mixed |
Return Value:
FixedArray::offsetGet
{@inheritdoc}
FixedArray::offsetGet( mixed offset ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
offset |
mixed |
Return Value:
FixedArray::offsetSet
{@inheritdoc}
FixedArray::offsetSet( mixed offset, mixed value ): void
Parameters:
Parameter | Type | Description |
---|---|---|
offset |
mixed | |
value |
mixed |
Return Value:
FixedArray::offsetUnset
{@inheritdoc}
FixedArray::offsetUnset( mixed offset ): void
Parameters:
Parameter | Type | Description |
---|---|---|
offset |
mixed |
Return Value:
FixedArray::__debugInfo
{@inheritdoc}
FixedArray::__debugInfo( ): array
Return Value:
FixedArray::__serialize
{@inheritdoc}
FixedArray::__serialize( ): array
Return Value:
FixedArray::__unserialize
{@inheritdoc}
FixedArray::__unserialize( array data ): void
Parameters:
Parameter | Type | Description |
---|---|---|
data |
array |
Return Value:
FixedArray::__clone
{@inheritdoc}
FixedArray::__clone( ): void
Return Value:
Inject
- Full name: \NGSOFT\Container\Attribute\Inject
- This class implements: \Stringable
Inject::__construct
Inject::__construct( string|array name = '' ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
name |
string|array |
Return Value:
Inject::__toString
Inject::__toString( ): string
Return Value:
InjectProperties
Scans for #[Inject] attribute on the loaded class properties
- Full name: \NGSOFT\Container\Resolvers\InjectProperties
- Parent class: \NGSOFT\Container\Resolvers\ContainerResolver
InjectProperties::resolve
Resolves an entry from the container
InjectProperties::resolve( mixed value ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
value |
mixed |
Return Value:
InjectProperties::getDefaultPriority
Set the default priority
InjectProperties::getDefaultPriority( ): int
Return Value:
InnerFacade
- Full name: \NGSOFT\Facades\Facade\InnerFacade
- Parent class: \NGSOFT\Facades\Facade
InnerFacade::boot
Starts the container
InnerFacade::boot( array definitions = [] ): void
Parameters:
Parameter | Type | Description |
---|---|---|
definitions |
array |
Return Value:
InnerFacade::registerServiceProvider
InnerFacade::registerServiceProvider( string accessor, \NGSOFT\Container\ServiceProvider provider ): void
Parameters:
Parameter | Type | Description |
---|---|---|
accessor |
string | |
provider |
\NGSOFT\Container\ServiceProvider |
Return Value:
InnerFacade::getResovedInstance
InnerFacade::getResovedInstance( string name ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
name |
string |
Return Value:
InnerFacade::setResolvedInstance
InnerFacade::setResolvedInstance( string name, object instance ): void
Parameters:
Parameter | Type | Description |
---|---|---|
name |
string | |
instance |
object |
Return Value:
InnerFacade::getContainer
InnerFacade::getContainer( ): \NGSOFT\Container\ContainerInterface
Return Value:
InnerFacade::setContainer
InnerFacade::setContainer( \NGSOFT\Container\ContainerInterface container ): void
Parameters:
Parameter | Type | Description |
---|---|---|
container |
\NGSOFT\Container\ContainerInterface |
Return Value:
JsonObject
A Json object that syncs data with a json file concurently
- Full name: \NGSOFT\DataStructure\JsonObject
- Parent class: \NGSOFT\DataStructure\SimpleObject
JsonObject::fromJsonFile
JsonObject::fromJsonFile( string filename, bool recursive = true ): static
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
filename |
string | |
recursive |
bool |
Return Value:
Lock
- Full name: \NGSOFT\Facades\Lock
- Parent class: \NGSOFT\Facades\Facade
Lock::createFileLock
Create a Php File Lock
Lock::createFileLock( string name, int seconds, string owner = '', string rootpath = '' ): \NGSOFT\Lock\FileLock
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
name |
string | |
seconds |
int | |
owner |
string | |
rootpath |
string |
Return Value:
Lock::createFileSystemLock
Lock::createFileSystemLock( string|\NGSOFT\Filesystem\File file, int seconds, string owner = '' ): \NGSOFT\Lock\FileSystemLock
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
file |
string|\NGSOFT\Filesystem\File | |
seconds |
int | |
owner |
string |
Return Value:
Lock::createSQLiteLock
Create a SQLite Lock
Lock::createSQLiteLock( string name, int seconds, string owner = '', string dbname = 'sqlocks.db3', string table = 'locks' ): \NGSOFT\Lock\SQLiteLock
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
name |
string | |
seconds |
int | |
owner |
string | |
dbname |
string | |
table |
string |
Return Value:
Lock::createNoLock
Create a NoLock
Lock::createNoLock( string name, int seconds, string owner = '' ): \NGSOFT\Lock\NoLock
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
name |
string | |
seconds |
int | |
owner |
string |
Return Value:
Lock::createCacheLock
Create a lock using a PSR-6 Cache
Lock::createCacheLock( \Psr\Cache\CacheItemPoolInterface cache, string name, int seconds, string owner = '' ): \NGSOFT\Lock\CacheLock
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
cache |
\Psr\Cache\CacheItemPoolInterface | |
name |
string | |
seconds |
int | |
owner |
string |
Return Value:
Lock::createSimpleCacheLock
Create a lock using a PSR-16 Cache
Lock::createSimpleCacheLock( \Psr\SimpleCache\CacheInterface cache, string name, int seconds, string owner = '' ): \NGSOFT\Lock\SimpleCacheLock
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
cache |
\Psr\SimpleCache\CacheInterface | |
name |
string | |
seconds |
int | |
owner |
string |
Return Value:
LockFactory
- Full name: \NGSOFT\Lock\LockFactory
LockFactory::__construct
LockFactory::__construct( mixed rootpath = '', int|float seconds, string owner = '' ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
rootpath |
mixed | |
seconds |
int|float | |
owner |
string |
Return Value:
LockFactory::createFileLock
Create a Php File Lock
LockFactory::createFileLock( string name, int seconds, string owner = '', string rootpath = '' ): \NGSOFT\Lock\FileLock
Parameters:
Parameter | Type | Description |
---|---|---|
name |
string | |
seconds |
int | |
owner |
string | |
rootpath |
string |
Return Value:
LockFactory::createFileSystemLock
Create a .lock file inside the dame directory as the provided file
LockFactory::createFileSystemLock( string|\NGSOFT\Filesystem\File file, int seconds, string owner = '' ): \NGSOFT\Lock\FileSystemLock
Parameters:
Parameter | Type | Description |
---|---|---|
file |
string|\NGSOFT\Filesystem\File | |
seconds |
int | |
owner |
string |
Return Value:
LockFactory::createSQLiteLock
Create a SQLite Lock
LockFactory::createSQLiteLock( string name, int seconds, string owner = '', string dbname = 'sqlocks.db3', string table = 'locks' ): \NGSOFT\Lock\SQLiteLock
Parameters:
Parameter | Type | Description |
---|---|---|
name |
string | |
seconds |
int | |
owner |
string | |
dbname |
string | |
table |
string |
Return Value:
LockFactory::createNoLock
Create a NoLock
LockFactory::createNoLock( string name, int seconds, string owner = '' ): \NGSOFT\Lock\NoLock
Parameters:
Parameter | Type | Description |
---|---|---|
name |
string | |
seconds |
int | |
owner |
string |
Return Value:
LockFactory::createCacheLock
Create a lock using a PSR-6 Cache
LockFactory::createCacheLock( \Psr\Cache\CacheItemPoolInterface cache, string name, int seconds, string owner = '' ): \NGSOFT\Lock\CacheLock
Parameters:
Parameter | Type | Description |
---|---|---|
cache |
\Psr\Cache\CacheItemPoolInterface | |
name |
string | |
seconds |
int | |
owner |
string |
Return Value:
LockFactory::createSimpleCacheLock
Create a lock using a PSR-16 Cache
LockFactory::createSimpleCacheLock( \Psr\SimpleCache\CacheInterface cache, string name, int seconds, string owner = '' ): \NGSOFT\Lock\SimpleCacheLock
Parameters:
Parameter | Type | Description |
---|---|---|
cache |
\Psr\SimpleCache\CacheInterface | |
name |
string | |
seconds |
int | |
owner |
string |
Return Value:
LockServiceProvider
- Full name: \NGSOFT\Lock\LockServiceProvider
- This class implements: \NGSOFT\Container\ServiceProvider
LockServiceProvider::provides
Get the services provided by the provider.
LockServiceProvider::provides( ): string[]
Return Value:
LockServiceProvider::register
Register the service into the container
LockServiceProvider::register( \NGSOFT\Container\ContainerInterface container ): void
Parameters:
Parameter | Type | Description |
---|---|---|
container |
\NGSOFT\Container\ContainerInterface |
Return Value:
LockTimeout
- Full name: \NGSOFT\Lock\LockTimeout
- Parent class:
Logger
- Full name: \NGSOFT\Facades\Logger
- Parent class: \NGSOFT\Facades\Facade
Logger::log
Logs with an arbitrary level.
Logger::log( mixed level, string|\Stringable message, array context = [] ): void
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
level |
mixed | |
message |
string|\Stringable | |
context |
array |
Return Value:
Logger::emergency
System is unusable.
Logger::emergency( string|\Stringable message, array context = [] ): void
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
message |
string|\Stringable | |
context |
array |
Return Value:
Logger::alert
Action must be taken immediately.
Logger::alert( string|\Stringable message, array context = [] ): void
Example: Entire website down, database unavailable, etc. This should trigger the SMS alerts and wake you up.
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
message |
string|\Stringable | |
context |
array |
Return Value:
Logger::critical
Critical conditions.
Logger::critical( string|\Stringable message, array context = [] ): void
Example: Application component unavailable, unexpected exception.
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
message |
string|\Stringable | |
context |
array |
Return Value:
Logger::error
Runtime errors that do not require immediate action but should typically be logged and monitored.
Logger::error( string|\Stringable message, array context = [] ): void
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
message |
string|\Stringable | |
context |
array |
Return Value:
Logger::warning
Exceptional occurrences that are not errors.
Logger::warning( string|\Stringable message, array context = [] ): void
Example: Use of deprecated APIs, poor use of an API, undesirable things that are not necessarily wrong.
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
message |
string|\Stringable | |
context |
array |
Return Value:
Logger::notice
Normal but significant events.
Logger::notice( string|\Stringable message, array context = [] ): void
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
message |
string|\Stringable | |
context |
array |
Return Value:
Logger::info
Interesting events.
Logger::info( string|\Stringable message, array context = [] ): void
Example: User logs in, SQL logs.
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
message |
string|\Stringable | |
context |
array |
Return Value:
Logger::debug
Detailed debug information.
Logger::debug( string|\Stringable message, array context = [] ): void
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
message |
string|\Stringable | |
context |
array |
Return Value:
LoggerAwareResolver
Injects Logger
- Full name: \NGSOFT\Container\Resolvers\LoggerAwareResolver
- Parent class: \NGSOFT\Container\Resolvers\ContainerResolver
LoggerAwareResolver::resolve
Resolves an entry from the container
LoggerAwareResolver::resolve( mixed value ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
value |
mixed |
Return Value:
LoggerAwareResolver::getDefaultPriority
Set the default priority
LoggerAwareResolver::getDefaultPriority( ): int
Return Value:
Map
The Map object holds key-value pairs and remembers the original insertion order of the keys.
Any value (both objects and primitive values) may be used as either a key or a value.
- Full name: \NGSOFT\DataStructure\Map
- This class implements: \ArrayAccess, \NGSOFT\DataStructure\ReversibleIterator, \Stringable, \JsonSerializable
See Also:
Map::clear
The clear() method removes all elements from a Map object.
Map::clear( ): void
Return Value:
Map::delete
The delete() method removes the specified element from a Map object by key.
Map::delete( mixed key ): bool
Parameters:
Parameter | Type | Description |
---|---|---|
key |
mixed |
Return Value:
Map::get
The get() method returns a specified element from a Map object.
Map::get( mixed key ): mixed
If the value that is associated to the provided key is an object, then you will get a reference to that object and any change made to that object will effectively modify it inside the Map object.
Parameters:
Parameter | Type | Description |
---|---|---|
key |
mixed |
Return Value:
Map::search
The search() method returns the first key match from a value
Map::search( mixed value ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
value |
mixed |
Return Value:
Map::set
The set() method adds or updates an element with a specified key and a value to a Map object.
Map::set( mixed key, mixed value ): static
Parameters:
Parameter | Type | Description |
---|---|---|
key |
mixed | |
value |
mixed |
Return Value:
Map::add
The add() method adds an element with a specified key and a value to a Map object if it does'n already exists.
Map::add( mixed key, mixed value ): static
Parameters:
Parameter | Type | Description |
---|---|---|
key |
mixed | |
value |
mixed |
Return Value:
Map::has
The has() method returns a boolean indicating whether an element with the specified key exists or not.
Map::has( mixed key ): bool
Parameters:
Parameter | Type | Description |
---|---|---|
key |
mixed |
Return Value:
Map::keys
The keys() method returns a new iterator object that contains the keys for each element in the Map object in insertion order
Map::keys( \NGSOFT\DataStructure\Sort sort = Sort::ASC ): iterable
Parameters:
Parameter | Type | Description |
---|---|---|
sort |
\NGSOFT\DataStructure\Sort |
Return Value:
Map::values
The values() method returns a new iterator object that contains the values for each element in the Map object in insertion order.
Map::values( \NGSOFT\DataStructure\Sort sort = Sort::ASC ): iterable
Parameters:
Parameter | Type | Description |
---|---|---|
sort |
\NGSOFT\DataStructure\Sort |
Return Value:
Map::entries
The entries() method returns a new iterator object that contains the [key, value] pairs for each element in the Map object in insertion order.
Map::entries( \NGSOFT\DataStructure\Sort sort = Sort::ASC ): iterable
Parameters:
Parameter | Type | Description |
---|---|---|
sort |
\NGSOFT\DataStructure\Sort |
Return Value:
Map::forEach
The forEach() method executes a provided function once per each key/value pair in the Map object, in insertion order.
Map::forEach( callable callable ): void
Parameters:
Parameter | Type | Description |
---|---|---|
callable |
callable |
Return Value:
Map::offsetExists
{@inheritdoc}
Map::offsetExists( mixed offset ): bool
Parameters:
Parameter | Type | Description |
---|---|---|
offset |
mixed |
Return Value:
Map::offsetGet
{@inheritdoc}
Map::offsetGet( mixed offset ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
offset |
mixed |
Return Value:
Map::offsetSet
{@inheritdoc}
Map::offsetSet( mixed offset, mixed value ): void
Parameters:
Parameter | Type | Description |
---|---|---|
offset |
mixed | |
value |
mixed |
Return Value:
Map::offsetUnset
{@inheritdoc}
Map::offsetUnset( mixed offset ): void
Parameters:
Parameter | Type | Description |
---|---|---|
offset |
mixed |
Return Value:
Map::count
{@inheritdoc}
Map::count( ): int
Return Value:
Map::jsonSerialize
{@inheritdoc}
Map::jsonSerialize( ): mixed
Return Value:
Map::__debugInfo
{@inheritdoc}
Map::__debugInfo( ): array
Return Value:
Map::__serialize
{@inheritdoc}
Map::__serialize( ): array
Return Value:
Map::__unserialize
{@inheritdoc}
Map::__unserialize( array data ): void
Parameters:
Parameter | Type | Description |
---|---|---|
data |
array |
Return Value:
Map::__clone
{@inheritdoc}
Map::__clone( ): void
Return Value:
NoLock
NullLock
- Full name: \NGSOFT\Lock\NoLock
- Parent class: \NGSOFT\Lock\BaseLockStore
NoLock::acquire
Acquires the lock.
NoLock::acquire( ): bool
Return Value:
NoLock::forceRelease
{@inheritdoc}
NoLock::forceRelease( ): void
Return Value:
NoLock::isAcquired
Returns whether or not the lock is acquired.
NoLock::isAcquired( ): bool
Return Value:
NoLock::release
Release the lock.
NoLock::release( ): bool
Return Value:
False if lock not already acquired or not owned
NotFound
- Full name: \NGSOFT\Container\Exceptions\NotFound
- Parent class: \NGSOFT\Container\Exceptions\ContainerError
- This class implements: \Psr\Container\NotFoundExceptionInterface
NotFound::for
NotFound::for( string id, \Throwable previous = null ): static
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
id |
string | |
previous |
\Throwable |
Return Value:
NullServiceProvider
- Full name: \NGSOFT\Container\NullServiceProvider
- This class implements: \NGSOFT\Container\ServiceProvider
NullServiceProvider::__construct
NullServiceProvider::__construct( string|array provides = [] ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
provides |
string|array |
Return Value:
NullServiceProvider::provides
Get the services provided by the provider.
NullServiceProvider::provides( ): string[]
Return Value:
NullServiceProvider::register
Register the service into the container
NullServiceProvider::register( \NGSOFT\Container\ContainerInterface container ): void
Parameters:
Parameter | Type | Description |
---|---|---|
container |
\NGSOFT\Container\ContainerInterface |
Return Value:
OwnedList
Simulates one to many relationships found in databases
- Full name: \NGSOFT\DataStructure\OwnedList
- This class implements: \Stringable, \NGSOFT\DataStructure\ReversibleIterator, \JsonSerializable, \ArrayAccess
OwnedList::create
Creates a new OwnedList for the given value
OwnedList::create( int|float|string|object value ): static
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
value |
int|float|string|object |
Return Value:
OwnedList::__construct
OwnedList::__construct( int|float|string|object value ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
value |
int|float|string|object |
Return Value:
OwnedList::add
Adds a relationship between current value and the given value
OwnedList::add( int|float|string|object value ): static
Parameters:
Parameter | Type | Description |
---|---|---|
value |
int|float|string|object |
Return Value:
OwnedList::delete
Removes a relationship between current value and the given value
OwnedList::delete( int|float|string|object value ): bool
Parameters:
Parameter | Type | Description |
---|---|---|
value |
int|float|string|object |
Return Value:
OwnedList::has
Checks if a relationship exists between current value and the given value
OwnedList::has( int|float|string|object value ): bool
Parameters:
Parameter | Type | Description |
---|---|---|
value |
int|float|string|object |
Return Value:
OwnedList::clear
Removes all relationships
OwnedList::clear( ): void
Return Value:
OwnedList::entries
Iterates entries
OwnedList::entries( \NGSOFT\DataStructure\Sort sort = Sort::ASC ): \Generator
Parameters:
Parameter | Type | Description |
---|---|---|
sort |
\NGSOFT\DataStructure\Sort |
Return Value:
OwnedList::values
Iterates owned values
OwnedList::values( ): \Generator
Return Value:
OwnedList::count
{@inheritdoc}
OwnedList::count( ): int
Return Value:
OwnedList::offsetExists
OwnedList::offsetExists( mixed offset ): bool
Parameters:
Parameter | Type | Description |
---|---|---|
offset |
mixed |
Return Value:
OwnedList::offsetGet
OwnedList::offsetGet( mixed offset ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
offset |
mixed |
Return Value:
OwnedList::offsetSet
OwnedList::offsetSet( mixed offset, mixed value ): void
Parameters:
Parameter | Type | Description |
---|---|---|
offset |
mixed | |
value |
mixed |
Return Value:
OwnedList::offsetUnset
OwnedList::offsetUnset( mixed offset ): void
Parameters:
Parameter | Type | Description |
---|---|---|
offset |
mixed |
Return Value:
OwnedList::jsonSerialize
{@inheritdoc}
OwnedList::jsonSerialize( ): mixed
Return Value:
OwnedList::__debugInfo
{@inheritdoc}
OwnedList::__debugInfo( ): array
Return Value:
OwnedList::__serialize
{@inheritdoc}
OwnedList::__serialize( ): array
Return Value:
OwnedList::__unserialize
{@inheritdoc}
OwnedList::__unserialize( array data ): void
Parameters:
Parameter | Type | Description |
---|---|---|
data |
array |
Return Value:
OwnedList::__clone
{@inheritdoc}
OwnedList::__clone( ): void
Return Value:
ParameterResolver
- Full name: \NGSOFT\Container\ParameterResolver
ParameterResolver::__construct
ParameterResolver::__construct( \NGSOFT\Container\ContainerInterface container ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
container |
\NGSOFT\Container\ContainerInterface |
Return Value:
ParameterResolver::canResolve
ParameterResolver::canResolve( string id, mixed value ): bool
Parameters:
Parameter | Type | Description |
---|---|---|
id |
string | |
value |
mixed |
Return Value:
ParameterResolver::resolve
ParameterResolver::resolve( string|array|object callable, array providedParameters = [] ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
callable |
string|array|object | |
providedParameters |
array |
Return Value:
PrioritySet
A Priority Set is a set that sorts entries by priority
- Full name: \NGSOFT\DataStructure\PrioritySet
- This class implements: \Countable, \JsonSerializable, \Stringable, \IteratorAggregate
PrioritySet::create
Create a new Set
PrioritySet::create( ): static
- This method is static.
Return Value:
PrioritySet::add
The add() method adds a new element with a specified value with a given priority.
PrioritySet::add( mixed value, int|\NGSOFT\DataStructure\Priority priority = Priority::MEDIUM ): static
Parameters:
Parameter | Type | Description |
---|---|---|
value |
mixed | |
priority |
int|\NGSOFT\DataStructure\Priority | > 0 the highest the number, the highest the priority |
Return Value:
PrioritySet::getPriority
PrioritySet::getPriority( mixed value ): int
Parameters:
Parameter | Type | Description |
---|---|---|
value |
mixed |
Return Value:
PrioritySet::clear
The clear() method removes all elements from a Set object.
PrioritySet::clear( ): void
Return Value:
PrioritySet::delete
The delete() method removes a specified value from a Set object, if it is in the set.
PrioritySet::delete( mixed value ): bool
Parameters:
Parameter | Type | Description |
---|---|---|
value |
mixed |
Return Value:
PrioritySet::entries
The entries() method returns a new Iterator object that contains an array of [value, value] for each element in the Set object, in insertion order.
PrioritySet::entries( \NGSOFT\DataStructure\Sort sort = Sort::DESC ): iterable
Parameters:
Parameter | Type | Description |
---|---|---|
sort |
\NGSOFT\DataStructure\Sort |
Return Value:
PrioritySet::forEach
The forEach() method executes a provided function once for each value in the Set object, in insertion order.
PrioritySet::forEach( callable callable ): void
Parameters:
Parameter | Type | Description |
---|---|---|
callable |
callable | ($value,$value, Set) |
Return Value:
PrioritySet::has
The has() method returns a boolean indicating whether an element with the specified value exists in a Set object or not.
PrioritySet::has( mixed value ): bool
Parameters:
Parameter | Type | Description |
---|---|---|
value |
mixed |
Return Value:
PrioritySet::isEmpty
Checks if set is empty
PrioritySet::isEmpty( ): bool
Return Value:
PrioritySet::values
The values() method returns a new Iterator object that contains the values for each element in the Set object in insertion order.
PrioritySet::values( \NGSOFT\DataStructure\Sort sort = Sort::DESC ): \Generator
Parameters:
Parameter | Type | Description |
---|---|---|
sort |
\NGSOFT\DataStructure\Sort |
Return Value:
PrioritySet::count
{@inheritdoc}
PrioritySet::count( ): int
Return Value:
PrioritySet::getIterator
{@inheritdoc}
PrioritySet::getIterator( ): \Traversable
Return Value:
PrioritySet::jsonSerialize
{@inheritdoc}
PrioritySet::jsonSerialize( ): mixed
Return Value:
PrioritySet::__debugInfo
{@inheritdoc}
PrioritySet::__debugInfo( ): array
Return Value:
PrioritySet::__serialize
PrioritySet::__serialize( ): array
Return Value:
PrioritySet::__unserialize
PrioritySet::__unserialize( array data ): void
Parameters:
Parameter | Type | Description |
---|---|---|
data |
array |
Return Value:
PrioritySet::__clone
{@inheritdoc}
PrioritySet::__clone( ): void
Return Value:
Range
Returns a sequence of numbers, starting from 0 by default, and increments by 1 (by default), and stops before a specified number.
- Full name: \NGSOFT\DataStructure\Range
- This class implements: \NGSOFT\DataStructure\ReversibleIterator, \Stringable
Range::__construct
Range::__construct( int start, ?int stop = null, int step = 1 ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
start |
int | |
stop |
?int | |
step |
int |
Return Value:
Range::create
Creates a Range
Range::create( int start, ?int stop = null, int step = 1 ): static
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
start |
int | |
stop |
?int | |
step |
int |
Return Value:
Range::of
Get a range for a Countable
Range::of( \Countable|array countable ): static
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
countable |
\Countable|array |
Return Value:
Range::__debugInfo
Range::__debugInfo( ): array
Return Value:
Range::__toString
Range::__toString( ): string
Return Value:
Range::isEmpty
Checks if empty range
Range::isEmpty( ): bool
Return Value:
Range::count
Range::count( ): int
Return Value:
Range::entries
Iterates entries in sort order
Range::entries( \NGSOFT\DataStructure\Sort sort = Sort::ASC ): iterable
Parameters:
Parameter | Type | Description |
---|---|---|
sort |
\NGSOFT\DataStructure\Sort |
Return Value:
RegExp
- Full name: \NGSOFT\RegExp
- This class implements: \Stringable, \JsonSerializable
RegExp::create
Initialize RegExp
RegExp::create( string pattern, string|string[] flags = '' ): static
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
pattern |
string | full pattern or pattern without delimitters and modifiers |
flags |
string|string[] | modifiers |
Return Value:
RegExp::__construct
Initialize RegExp
RegExp::__construct( string pattern, string|string[] flags = '' ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
pattern |
string | full pattern or pattern without delimitters and modifiers |
flags |
string|string[] | modifiers |
Return Value:
See Also:
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp - Same as that except pattern is a string
RegExp::getLastIndex
Get the last index
RegExp::getLastIndex( ): int
Return Value:
RegExp::setLastIndex
Set the Last Index
RegExp::setLastIndex( int index ): static
Parameters:
Parameter | Type | Description |
---|---|---|
index |
int |
Return Value:
RegExp::test
The test() method executes a search for a match between a regular expression and a specified string.
RegExp::test( string str ): bool
Parameters:
Parameter | Type | Description |
---|---|---|
str |
string |
Return Value:
RegExp::exec
The exec() method executes a search for a match in a specified string. Returns a result array, or null.
RegExp::exec( string str ): array|null
Will only gives the first result. if the global flag is set, the lastIndex from the previous match will be stored, so you can loop through results (while loop).
Parameters:
Parameter | Type | Description |
---|---|---|
str |
string | The string against which to match the regular expression |
Return Value:
If the match fails, the exec() method returns null, and sets lastIndex to 0.
RegExp::replace
The replace() method replaces some or all matches of a this pattern in a string by a replacement, and returns the result of the replacement as a new string.
RegExp::replace( string str, string|\Stringable|callable replacement ): string
If global modifier is used all occurences will be replaced, else only the first occurence will be replaced.
Parameters:
Parameter | Type | Description |
---|---|---|
str |
string | |
replacement |
string|\Stringable|callable |
Return Value:
RegExp::search
The search() method executes a search for a match between a regular expression and a string.
RegExp::search( string str ): int
Parameters:
Parameter | Type | Description |
---|---|---|
str |
string |
Return Value:
The index of the first match between the regular expression and the given string, or -1 if no match was found.
RegExp::split
The split() method divides a String into an ordered list of substrings,
RegExp::split( string str, int limit = -1 ): array
Parameters:
Parameter | Type | Description |
---|---|---|
str |
string | |
limit |
int |
Return Value:
RegExp::matchAll
The matchAll() method returns an iterator of all results matching a string against a regular expression, including capturing groups.
RegExp::matchAll( string str ): \Traversable
Parameters:
Parameter | Type | Description |
---|---|---|
str |
string |
Return Value:
RegExp::match
The match() method retrieves the result of matching a string against a regular expression.
RegExp::match( string str ): array|null
Parameters:
Parameter | Type | Description |
---|---|---|
str |
string |
Return Value:
RegExp::__unserialize
{@inheritdoc}
RegExp::__unserialize( array data ): void
Parameters:
Parameter | Type | Description |
---|---|---|
data |
array |
Return Value:
RegExp::__serialize
{@inheritdoc}
RegExp::__serialize( ): array
Return Value:
RegExp::jsonSerialize
{@inheritdoc}
RegExp::jsonSerialize( ): mixed
Return Value:
RegExp::__toString
{@inheritdoc}
RegExp::__toString( ): string
Return Value:
RegExp::__debugInfo
RegExp::__debugInfo( ): array
Return Value:
RegExpException
- Full name: \NGSOFT\Exceptions\RegExpException
- Parent class:
RegExpException::__construct
RegExpException::__construct( \NGSOFT\RegExp regExp, string message = "", int code, \Throwable previous = null ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
regExp |
\NGSOFT\RegExp | |
message |
string | |
code |
int | |
previous |
\Throwable |
Return Value:
RegExpException::getRegExp
Get the RegExp Object
RegExpException::getRegExp( ): \NGSOFT\RegExp
Return Value:
ResolverException
- Full name: \NGSOFT\Container\Exceptions\ResolverException
- Parent class: \NGSOFT\Container\Exceptions\ContainerError
ResolverException::notTwice
ResolverException::notTwice( object resolver ): mixed
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
resolver |
object |
Return Value:
ResolverException::invalidCallable
ResolverException::invalidCallable( mixed callable ): static
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
callable |
mixed |
Return Value:
Set
The Set object lets you store unique values of any type, whether primitive values or object references.
- Full name: \NGSOFT\DataStructure\Set
- This class implements: \NGSOFT\DataStructure\ReversibleIterator, \JsonSerializable, \Stringable
Set::create
Create a new Set
Set::create( ): static
- This method is static.
Return Value:
Set::add
The add() method appends a new element with a specified value to the end of a Set object.
Set::add( mixed value ): static
Parameters:
Parameter | Type | Description |
---|---|---|
value |
mixed |
Return Value:
Set::clear
The clear() method removes all elements from a Set object.
Set::clear( ): void
Return Value:
Set::delete
The delete() method removes a specified value from a Set object, if it is in the set.
Set::delete( mixed value ): bool
Parameters:
Parameter | Type | Description |
---|---|---|
value |
mixed |
Return Value:
Set::entries
The entries() method returns a new Iterator object that contains an array of [value, value] for each element in the Set object, in insertion order.
Set::entries( \NGSOFT\DataStructure\Sort sort = Sort::ASC ): iterable
Parameters:
Parameter | Type | Description |
---|---|---|
sort |
\NGSOFT\DataStructure\Sort |
Return Value:
Set::has
The has() method returns a boolean indicating whether an element with the specified value exists in a Set object or not.
Set::has( mixed value ): bool
Parameters:
Parameter | Type | Description |
---|---|---|
value |
mixed |
Return Value:
Set::isEmpty
Checks if set is empty
Set::isEmpty( ): bool
Return Value:
Set::values
The values() method returns a new Iterator object that contains the values for each element in the Set object in insertion order.
Set::values( \NGSOFT\DataStructure\Sort sort = Sort::ASC ): iterable
Parameters:
Parameter | Type | Description |
---|---|---|
sort |
\NGSOFT\DataStructure\Sort |
Return Value:
Set::count
{@inheritdoc}
Set::count( ): int
Return Value:
Set::getIterator
{@inheritdoc}
Set::getIterator( ): \Traversable
Return Value:
Set::jsonSerialize
{@inheritdoc}
Set::jsonSerialize( ): mixed
Return Value:
Set::__debugInfo
{@inheritdoc}
Set::__debugInfo( ): array
Return Value:
Set::__serialize
Set::__serialize( ): array
Return Value:
Set::__unserialize
Set::__unserialize( array data ): void
Parameters:
Parameter | Type | Description |
---|---|---|
data |
array |
Return Value:
Set::__clone
{@inheritdoc}
Set::__clone( ): void
Return Value:
SharedList
Simulates Many-To-Many relations found in database
- Full name: \NGSOFT\DataStructure\SharedList
- This class implements: \Countable, \IteratorAggregate, \JsonSerializable, \Stringable
See Also:
SharedList::create
Create a new SharedList
SharedList::create( ): static
- This method is static.
Return Value:
SharedList::clear
SharedList::clear( ): void
Return Value:
SharedList::hasValue
Checks if value exists in the set
SharedList::hasValue( int|float|string|object value ): bool
Parameters:
Parameter | Type | Description |
---|---|---|
value |
int|float|string|object |
Return Value:
SharedList::has
Checks if relationship exists between 2 values
SharedList::has( int|float|string|object value, int|float|string|object sharedValue ): bool
Parameters:
Parameter | Type | Description |
---|---|---|
value |
int|float|string|object | |
sharedValue |
int|float|string|object |
Return Value:
SharedList::add
Add a relationship between 2 values
SharedList::add( int|float|string|object value, int|float|string|object sharedValue ): static
Parameters:
Parameter | Type | Description |
---|---|---|
value |
int|float|string|object | |
sharedValue |
int|float|string|object |
Return Value:
SharedList::deleteValue
Removes a value and all its relationships
SharedList::deleteValue( int|float|string|object value ): static
Parameters:
Parameter | Type | Description |
---|---|---|
value |
int|float|string|object |
Return Value:
SharedList::delete
Removes a relationship between 2 values
SharedList::delete( int|float|string|object value, int|float|string|object sharedValue ): static
Parameters:
Parameter | Type | Description |
---|---|---|
value |
int|float|string|object | |
sharedValue |
int|float|string|object |
Return Value:
SharedList::get
Get value shared list
SharedList::get( int|float|string|object value ): \NGSOFT\DataStructure\Set
Parameters:
Parameter | Type | Description |
---|---|---|
value |
int|float|string|object |
Return Value:
SharedList::entries
Iterates all values shared lists
SharedList::entries( ): iterable
Return Value:
SharedList::count
SharedList::count( ): int
Return Value:
SharedList::getIterator
SharedList::getIterator( ): \Traversable
Return Value:
SharedList::jsonSerialize
SharedList::jsonSerialize( ): mixed
Return Value:
SharedList::__serialize
SharedList::__serialize( ): array
Return Value:
SharedList::__unserialize
SharedList::__unserialize( array data ): void
Parameters:
Parameter | Type | Description |
---|---|---|
data |
array |
Return Value:
SharedList::__debugInfo
SharedList::__debugInfo( ): array
Return Value:
SimpleArray
A base Collection
- Full name: \NGSOFT\DataStructure\SimpleArray
- Parent class: \NGSOFT\DataStructure\Collection
SimpleArray::unshift
Prepend one or more elements to the beginning of an array
SimpleArray::unshift( mixed values ): int
Parameters:
Parameter | Type | Description |
---|---|---|
values |
mixed |
Return Value:
SimpleArray::push
Appends one or more elements at the end of an array
SimpleArray::push( mixed values ): int
Parameters:
Parameter | Type | Description |
---|---|---|
values |
mixed |
Return Value:
SimpleArray::shift
Shift an element off the beginning of array
SimpleArray::shift( ): mixed
Return Value:
the removed element
SimpleArray::pop
Pop the element off the end of array
SimpleArray::pop( ): mixed
Return Value:
the removed element
SimpleArray::indexOf
Returns the value index
SimpleArray::indexOf( mixed value ): int
Parameters:
Parameter | Type | Description |
---|---|---|
value |
mixed |
Return Value:
the index or -1 if not found
SimpleCacheLock
Use SimpleCache to manage your locks
- Full name: \NGSOFT\Lock\SimpleCacheLock
- Parent class: \NGSOFT\Lock\CacheLockAbstract
SimpleCacheLock::__construct
SimpleCacheLock::__construct( \Psr\SimpleCache\CacheInterface cache, string|\Stringable name, int|float seconds, string|\Stringable owner = '', bool autoRelease = true ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
cache |
\Psr\SimpleCache\CacheInterface | |
name |
string|\Stringable | |
seconds |
int|float | |
owner |
string|\Stringable | |
autoRelease |
bool |
Return Value:
SimpleCacheLock::forceRelease
{@inheritdoc}
SimpleCacheLock::forceRelease( ): void
Return Value:
SimpleIterator
The SimpleIterator can iterate everything in any order
- Full name: \NGSOFT\DataStructure\SimpleIterator
- This class implements: \NGSOFT\DataStructure\ReversibleIterator
SimpleIterator::__construct
SimpleIterator::__construct( iterable iterator ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
iterator |
iterable |
Return Value:
SimpleIterator::of
Create a new SimpleIterator
SimpleIterator::of( iterable iterable ): static
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
iterable |
iterable |
Return Value:
SimpleIterator::ofStringable
Creates a new SimpleIterator that iterates each characters
SimpleIterator::ofStringable( string|\Stringable value ): static
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
value |
string|\Stringable |
Return Value:
SimpleIterator::ofList
Creates an iterator from a list
SimpleIterator::ofList( iterable&\ArrayAccess&\Countable value ): static
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
value |
iterable&\ArrayAccess&\Countable |
Return Value:
SimpleIterator::count
SimpleIterator::count( ): int
Return Value:
SimpleIterator::entries
Iterates entries in sort order
SimpleIterator::entries( \NGSOFT\DataStructure\Sort sort = Sort::ASC ): iterable
Parameters:
Parameter | Type | Description |
---|---|---|
sort |
\NGSOFT\DataStructure\Sort |
Return Value:
SimpleObject
A base Collection
- Full name: \NGSOFT\DataStructure\SimpleObject
- Parent class: \NGSOFT\DataStructure\Collection
SimpleObject::search
Searches the array for a given value and returns the first corresponding key if successful
SimpleObject::search( mixed value ): int|string|null
Parameters:
Parameter | Type | Description |
---|---|---|
value |
mixed |
Return Value:
SimpleObject::__get
{@inheritdoc}
SimpleObject::__get( string name ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
name |
string |
Return Value:
SimpleObject::__set
{@inheritdoc}
SimpleObject::__set( string name, mixed value ): void
Parameters:
Parameter | Type | Description |
---|---|---|
name |
string | |
value |
mixed |
Return Value:
SimpleObject::__unset
{@inheritdoc}
SimpleObject::__unset( string name ): void
Parameters:
Parameter | Type | Description |
---|---|---|
name |
string |
Return Value:
SimpleObject::__isset
{@inheritdoc}
SimpleObject::__isset( string name ): bool
Parameters:
Parameter | Type | Description |
---|---|---|
name |
string |
Return Value:
SimpleServiceProvider
- Full name: \NGSOFT\Container\SimpleServiceProvider
- This class implements: \NGSOFT\Container\ServiceProvider
SimpleServiceProvider::__construct
SimpleServiceProvider::__construct( string|array provides, mixed register ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
provides |
string|array | |
register |
mixed |
Return Value:
SimpleServiceProvider::provides
Get the services provided by the provider.
SimpleServiceProvider::provides( ): string[]
Return Value:
SimpleServiceProvider::register
Register the service into the container
SimpleServiceProvider::register( \NGSOFT\Container\ContainerInterface container ): void
Parameters:
Parameter | Type | Description |
---|---|---|
container |
\NGSOFT\Container\ContainerInterface |
Return Value:
Slice
- Full name: \NGSOFT\DataStructure\Slice
- This class implements: \Stringable
Slice::create
Creates a Slice instance
Slice::create( ?int start = null, ?int stop = null, ?int step = null ): static
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
start |
?int | |
stop |
?int | |
step |
?int |
Return Value:
Slice::of
Create a Slice instance using python slice notation
Slice::of( string slice ): static
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
slice |
string |
Return Value:
See Also:
- https://www.bestprog.net/en/2019/12/07/python-strings-access-by-indexes-slices-get-a-fragment-of-a-string-examples/ - eg ':' '::' '0:1:' '10:2:-1' '1:'
Slice::isValid
Checks if valid slice syntax
Slice::isValid( string slice ): bool
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
slice |
string |
Return Value:
Slice::__construct
Slice::__construct( ?int start = null, ?int stop = null, ?int step = null ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
start |
?int | |
stop |
?int | |
step |
?int |
Return Value:
Slice::getStart
Slice::getStart( ): ?int
Return Value:
Slice::getStop
Slice::getStop( ): ?int
Return Value:
Slice::getStep
Slice::getStep( ): ?int
Return Value:
Slice::getIteratorFor
Slice::getIteratorFor( array&\ArrayAccess&\Countable value ): \Traversable<int>
Parameters:
Parameter | Type | Description |
---|---|---|
value |
array&\ArrayAccess&\Countable |
Return Value:
Slice::getOffsetList
Slice::getOffsetList( array&\ArrayAccess&\Countable value ): int[]
Parameters:
Parameter | Type | Description |
---|---|---|
value |
array&\ArrayAccess&\Countable |
Return Value:
Slice::slice
Returns a slice of an array like object
Slice::slice( array&\ArrayAccess&\Countable value ): array
Parameters:
Parameter | Type | Description |
---|---|---|
value |
array&\ArrayAccess&\Countable |
Return Value:
Slice::join
Returns a String of a slice
Slice::join( mixed glue, mixed value ): string
Parameters:
Parameter | Type | Description |
---|---|---|
glue |
mixed | |
value |
mixed |
Return Value:
Slice::__debugInfo
Slice::__debugInfo( ): array
Return Value:
Slice::__toString
Slice::__toString( ): string
Return Value:
SQLiteLock
A SQLite database to manage your locks
- Full name: \NGSOFT\Lock\SQLiteLock
- Parent class: \NGSOFT\Lock\BaseLockStore
SQLiteLock::__construct
SQLiteLock::__construct( string|\Stringable name, int|float seconds, string|\PDO database = '', string|\Stringable owner = '', bool autoRelease = true, string table = 'locks' ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
name |
string|\Stringable | Lock name |
seconds |
int|float | lock duration |
database |
string|\PDO | db3 filename or pdo instance |
owner |
string|\Stringable | the owner of the lock |
autoRelease |
bool | release lock when object is destroyed |
table |
string | table name to tuse for the locks |
Return Value:
SQLiteLock::forceRelease
{@inheritdoc}
SQLiteLock::forceRelease( ): void
Return Value:
StackableContainer
- Full name: \NGSOFT\Container\StackableContainer
- This class implements: \Psr\Container\ContainerInterface, \Stringable
StackableContainer::__construct
StackableContainer::__construct( \Psr\Container\ContainerInterface|array containers ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
containers |
\Psr\Container\ContainerInterface|array |
Return Value:
StackableContainer::hasContainer
Check if container already stacked
StackableContainer::hasContainer( \Psr\Container\ContainerInterface container ): bool
Parameters:
Parameter | Type | Description |
---|---|---|
container |
\Psr\Container\ContainerInterface |
Return Value:
StackableContainer::addContainer
Stacks a new Container on top
StackableContainer::addContainer( \Psr\Container\ContainerInterface container ): void
Parameters:
Parameter | Type | Description |
---|---|---|
container |
\Psr\Container\ContainerInterface |
Return Value:
StackableContainer::get
{@inheritdoc}
StackableContainer::get( string id ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
id |
string |
Return Value:
StackableContainer::has
{@inheritdoc}
StackableContainer::has( string id ): bool
Parameters:
Parameter | Type | Description |
---|---|---|
id |
string |
Return Value:
State
Basic Enum Class Support (Polyfill) Adds the ability to class constants to work as php 8.1 backed enums cases
- Full name: \NGSOFT\Timer\State
- Parent class: \NGSOFT\Enums\Enum
StopWatch
- Full name: \NGSOFT\Timer\StopWatch
StopWatch::startTask
Starts a callable and returns result time
StopWatch::startTask( callable task, mixed arguments ): \NGSOFT\Timer\StopWatchResult
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
task |
callable | |
arguments |
mixed |
Return Value:
StopWatch::startTaskWithStartTime
StopWatch::startTaskWithStartTime( mixed task, int|float startTime, bool highResolution = false ): static
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
task |
mixed | |
startTime |
int|float | |
highResolution |
bool |
Return Value:
StopWatch::__construct
StopWatch::__construct( mixed|callable task = self::DEFAULT_TASK, bool highResolution = true ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
task |
mixed|callable | can be anything |
highResolution |
bool | if True use hrtime() if available, else use microtime() |
Return Value:
StopWatch::getTask
StopWatch::getTask( ): mixed
Return Value:
StopWatch::executeTask
StopWatch::executeTask( array arguments = [] ): \NGSOFT\Timer\StopWatchResult
Parameters:
Parameter | Type | Description |
---|---|---|
arguments |
array |
Return Value:
StopWatch::start
Starts the clock
StopWatch::start( int|float|null startTime = null ): bool
Parameters:
Parameter | Type | Description |
---|---|---|
startTime |
int|float|null | Set the start time |
Return Value:
StopWatch::resume
Resumes the clock (only if paused)
StopWatch::resume( ): bool
Return Value:
StopWatch::reset
Resets the clock
StopWatch::reset( ): void
Return Value:
StopWatch::pause
Pauses the clock
StopWatch::pause( ?bool &success = null ): \NGSOFT\Timer\StopWatchResult
Parameters:
Parameter | Type | Description |
---|---|---|
success |
?bool | True if operation succeeded |
Return Value:
Current time
StopWatch::stop
Stops the clock
StopWatch::stop( ?bool &success = null ): \NGSOFT\Timer\StopWatchResult
Parameters:
Parameter | Type | Description |
---|---|---|
success |
?bool | True if operation succeeded |
Return Value:
Current time
StopWatch::read
Reads the clock
StopWatch::read( ): \NGSOFT\Timer\StopWatchResult
Return Value:
StopWatch::getLaps
StopWatch::getLaps( ): \Generator|\NGSOFT\Timer\StopWatchResult[]
Return Value:
StopWatch::lap
Adds a lap time
StopWatch::lap( ?string label = null ): bool
Parameters:
Parameter | Type | Description |
---|---|---|
label |
?string |
Return Value:
StopWatch::isStarted
StopWatch::isStarted( ): bool
Return Value:
StopWatch::isPaused
StopWatch::isPaused( ): bool
Return Value:
StopWatch::isStopped
StopWatch::isStopped( ): bool
Return Value:
Text
Transform a scalar to its stringable representation
- Full name: \NGSOFT\DataStructure\Text
- This class implements: \Stringable, \Countable, \ArrayAccess, \JsonSerializable
Text::create
Create new Text
Text::create( mixed text ): static
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
text |
mixed |
Return Value:
Text::of
Create new Text
Text::of( mixed text ): static
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
text |
mixed |
Return Value:
Text::ofSegments
Create multiple segments of Text
Text::ofSegments( mixed segments ): static[]
Parameters:
Parameter | Type | Description |
---|---|---|
segments |
mixed |
Return Value:
Text::__construct
Text::__construct( mixed text = '' ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
text |
mixed |
Return Value:
Text::copy
Get a Text Copy
Text::copy( ): static
Return Value:
Text::indexOf
The indexOf() method, given one argument: a substring/regex to search for, searches the entire calling string, and returns the index of the first occurrence of the specified substring
Text::indexOf( mixed needle, int offset ): int
Parameters:
Parameter | Type | Description |
---|---|---|
needle |
mixed | |
offset |
int |
Return Value:
Text::search
Alias of indexOf
Text::search( mixed needle ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
needle |
mixed |
Return Value:
Text::lastIndexOf
The lastIndexOf() method, given one argument: a substring/regex to search for, searches the entire calling string, and returns the index of the last occurrence of the specified substring.
Text::lastIndexOf( mixed needle, int offset ): int
Parameters:
Parameter | Type | Description |
---|---|---|
needle |
mixed | |
offset |
int |
Return Value:
Text::at
The at() method takes an integer value and returns the character located at the specified offset
Text::at( int offset ): string
Parameters:
Parameter | Type | Description |
---|---|---|
offset |
int |
Return Value:
Text::concat
The concat() method concatenates the string arguments to the current Text
Text::concat( mixed strings ): static
Parameters:
Parameter | Type | Description |
---|---|---|
strings |
mixed |
Return Value:
Text::toLowerCase
Converts Text to lower case
Text::toLowerCase( ): static
Return Value:
Text::toUpperCase
Converts Text to upper case
Text::toUpperCase( ): static
Return Value:
Text::endsWith
The endsWith() method determines whether a string ends with the characters of a specified string, returning true or false as appropriate.
Text::endsWith( mixed needle, bool ignoreCase = false ): bool
Parameters:
Parameter | Type | Description |
---|---|---|
needle |
mixed | |
ignoreCase |
bool |
Return Value:
Text::startsWith
The startsWith() method determines whether a string begins with the characters of a specified string, returning true or false as appropriate.
Text::startsWith( mixed needle, bool ignoreCase = false ): bool
Parameters:
Parameter | Type | Description |
---|---|---|
needle |
mixed | |
ignoreCase |
bool |
Return Value:
Text::contains
The includes() method performs a search to determine whether one string may be found within another string/regex, returning true or false as appropriate.
Text::contains( mixed needle, bool ignoreCase = false ): bool
Parameters:
Parameter | Type | Description |
---|---|---|
needle |
mixed | |
ignoreCase |
bool |
Return Value:
Text::containsAll
Determine if a given string contains all needles
Text::containsAll( iterable needles, bool ignoreCase = false ): bool
Parameters:
Parameter | Type | Description |
---|---|---|
needles |
iterable | |
ignoreCase |
bool |
Return Value:
Text::includes
The includes() method performs a case-sensitive search to determine whether one string may be found within another string, returning true or false as appropriate.
Text::includes( mixed needle ): bool
Parameters:
Parameter | Type | Description |
---|---|---|
needle |
mixed |
Return Value:
Text::match
The match() method retrieves the result of matching a string against a regular expression.
Text::match( string pattern ): string[]
Parameters:
Parameter | Type | Description |
---|---|---|
pattern |
string |
Return Value:
Text::matchAll
The matchAll() method returns an iterator of all results matching a string against a regular expression, including capturing groups.
Text::matchAll( string pattern ): array
Parameters:
Parameter | Type | Description |
---|---|---|
pattern |
string |
Return Value:
Text::padStart
Pad the left side of a string with another.
Text::padStart( int length, mixed pad = ' ' ): static
Parameters:
Parameter | Type | Description |
---|---|---|
length |
int | |
pad |
mixed |
Return Value:
Text::padEnd
Pad the right side of a string with another.
Text::padEnd( int length, mixed pad = ' ' ): static
Parameters:
Parameter | Type | Description |
---|---|---|
length |
int | |
pad |
mixed |
Return Value:
Text::pad
Pad on both sides of a string with another.
Text::pad( int length, mixed pad = ' ' ): static
Parameters:
Parameter | Type | Description |
---|---|---|
length |
int | |
pad |
mixed |
Return Value:
Text::repeat
The repeat() method constructs and returns a new string which contains the specified number of copies of the string on which it was called, concatenated together.
Text::repeat( int times ): static
Parameters:
Parameter | Type | Description |
---|---|---|
times |
int |
Return Value:
Text::replace
Replace the first occurrence of a given value in the string.
Text::replace( mixed search, mixed replacement ): static
Parameters:
Parameter | Type | Description |
---|---|---|
search |
mixed | |
replacement |
mixed |
Return Value:
Text::replaceAll
Text::replaceAll( mixed search, mixed replacement ): static
Parameters:
Parameter | Type | Description |
---|---|---|
search |
mixed | |
replacement |
mixed |
Return Value:
Text::substring
The substring() method returns the part of the string between the start and end indexes, or to the end of the string.
Text::substring( int start, int|null end = null ): static
Parameters:
Parameter | Type | Description |
---|---|---|
start |
int | |
end |
int|null |
Return Value:
Text::ltrim
Left Trim the string of the given characters.
Text::ltrim( mixed chars ): static
Parameters:
Parameter | Type | Description |
---|---|---|
chars |
mixed |
Return Value:
Text::trimStart
Alias of ltrim
Text::trimStart( mixed chars ): static
Parameters:
Parameter | Type | Description |
---|---|---|
chars |
mixed |
Return Value:
Text::rtrim
Right Trim the string of the given characters.
Text::rtrim( mixed chars ): static
Parameters:
Parameter | Type | Description |
---|---|---|
chars |
mixed |
Return Value:
Text::trimEnd
Alias of rtrim
Text::trimEnd( mixed chars ): static
Parameters:
Parameter | Type | Description |
---|---|---|
chars |
mixed |
Return Value:
Text::trim
Trim the string of the given characters.
Text::trim( mixed chars ): static
Parameters:
Parameter | Type | Description |
---|---|---|
chars |
mixed |
Return Value:
Text::capitalize
Return a copy of the string with its first character capitalized and the rest lowercased.
Text::capitalize( ): static
Return Value:
Text::center
Return centered in a string of length width. Padding is done using the specified fillchar (default is an ASCII space).
Text::center( int width, mixed fillchar = ' ' ): static
The original string is returned if width is less than or equal to len(s).
Parameters:
Parameter | Type | Description |
---|---|---|
width |
int | |
fillchar |
mixed |
Return Value:
Text::expandtabs
Return a copy of the string where all tab characters are replaced by one or more spaces
Text::expandtabs( int tabsize = 8 ): static
Parameters:
Parameter | Type | Description |
---|---|---|
tabsize |
int |
Return Value:
Text::find
Return the lowest index in the string where substring sub is found within the slice s[start:end].
Text::find( mixed sub, ?int start = null, ?int end = null ): int
Optional arguments start and end are interpreted as in slice notation. Return -1 if sub is not found.
Parameters:
Parameter | Type | Description |
---|---|---|
sub |
mixed | |
start |
?int | |
end |
?int |
Return Value:
Text::format
Perform a string formatting operation. The string on which this method is called can contain literal text or replacement fields delimited by braces {}.
Text::format( mixed args ): static
Each replacement field contains either the numeric index of a positional argument, or the name of a keyword argument.
Parameters:
Parameter | Type | Description |
---|---|---|
args |
mixed |
Return Value:
Text::index
Like find(), but raise ValueError when the substring is not found.
Text::index( mixed sub, ?int start = null, ?int end = null ): int
Parameters:
Parameter | Type | Description |
---|---|---|
sub |
mixed | |
start |
?int | |
end |
?int |
Return Value:
Text::isalnum
Return True if all characters in the string are alphanumeric and there is at least one character, False otherwise
Text::isalnum( ): bool
Return Value:
Text::isalpha
Return True if all characters in the string are alphabetic and there is at least one character, False otherwise.
Text::isalpha( ): bool
Return Value:
Text::isdecimal
Return True if all characters in the string are decimal characters and there is at least one character, False otherwise
Text::isdecimal( ): bool
Return Value:
Text::isdigit
Return True if all characters in the string are digits and there is at least one character, False otherwise.
Text::isdigit( ): bool
Return Value:
Text::islower
Return True if all cased characters in the string are lowercase and there is at least one cased character, False otherwise.
Text::islower( ): bool
Return Value:
Text::isnumeric
Finds whether a variable is a number or a numeric string
Text::isnumeric( ): bool
Return Value:
See Also:
Text::istitle
Return True if the string is a titlecased string and there is at least one character, for example uppercase characters may only follow uncased characters and lowercase characters only cased ones.
Text::istitle( ): bool
Return False otherwise.
Return Value:
Text::isspace
Return True if there are only whitespace characters in the string and there is at least one character, False otherwise.
Text::isspace( ): bool
Return Value:
Text::isprintable
Return True if all characters in the string are printable or the string is empty, False otherwise.
Text::isprintable( ): bool
Return Value:
Text::ispunct
Checks if all of the characters in the provided Text, are punctuation character.
Text::ispunct( ): bool
Return Value:
Text::iscontrol
Checks if all characters in Text are control characters
Text::iscontrol( ): bool
Return Value:
Text::isupper
Return True if all characters in the string are uppercase and there is at least one lowercase character, False otherwise.
Text::isupper( ): bool
Return Value:
Text::join
Return a string which is the concatenation of the strings in iterable.
Text::join( mixed iterable ): static
The separator between elements is the Text providing this method.
Parameters:
Parameter | Type | Description |
---|---|---|
iterable |
mixed |
Return Value:
Text::lower
Return a copy of the string with all characters converted to lowercase.
Text::lower( ): static
Return Value:
Text::lstrip
Return a copy of the string with leading characters removed.
Text::lstrip( mixed chars = null ): static
The chars argument is a string specifying the set of characters to be removed. If omitted or null, the chars argument defaults to removing whitespace. The chars argument is not a prefix; rather, all combinations of its values are stripped:
Parameters:
Parameter | Type | Description |
---|---|---|
chars |
mixed |
Return Value:
Text::partition
Split the string at the first occurrence of sep, and return a 3-tuple containing the part before the separator, the separator itself, and the part after the separator.
Text::partition( mixed sep ): array
If the separator is not found, return a 3-tuple containing the string itself, followed by two empty strings.
Parameters:
Parameter | Type | Description |
---|---|---|
sep |
mixed |
Return Value:
Text::removeprefix
If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string:
Text::removeprefix( mixed prefix ): static
Parameters:
Parameter | Type | Description |
---|---|---|
prefix |
mixed |
Return Value:
Text::removeSuffix
If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)].
Text::removeSuffix( mixed suffix ): static
Otherwise, return a copy of the original string:
Parameters:
Parameter | Type | Description |
---|---|---|
suffix |
mixed |
Return Value:
Text::reverse
Reverse the string
Text::reverse( ): static
Return Value:
Text::rfind
Return the highest index in the string where substring sub is found, such that sub is contained within s[start:end].
Text::rfind( mixed sub, ?int start = null, ?int end = null ): int
Optional arguments start and end are interpreted as in slice notation. Return -1 on failure.
Parameters:
Parameter | Type | Description |
---|---|---|
sub |
mixed | |
start |
?int | |
end |
?int |
Return Value:
Text::rindex
Like rfind() but raises ValueError when the substring sub is not found.
Text::rindex( mixed sub, ?int start = null, ?int end = null ): int
Parameters:
Parameter | Type | Description |
---|---|---|
sub |
mixed | |
start |
?int | |
end |
?int |
Return Value:
Text::rpartition
Split the string at the last occurrence of sep, and return a 3-tuple containing the part before the separator, the separator itself, and the part after the separator.
Text::rpartition( mixed sep ): array
If the separator is not found, return a 3-tuple containing two empty strings, followed by the string itself.
Parameters:
Parameter | Type | Description |
---|---|---|
sep |
mixed |
Return Value:
Text::rstrip
Return a copy of the string with trailing characters removed.
Text::rstrip( mixed chars = null ): static
The chars argument is a string specifying the set of characters to be removed. If omitted or None, the chars argument defaults to removing whitespace. The chars argument is not a suffix; rather, all combinations of its values are stripped:
Parameters:
Parameter | Type | Description |
---|---|---|
chars |
mixed |
Return Value:
Text::strip
Return a copy of the string with the leading and trailing characters removed.
Text::strip( mixed chars = null ): static
The chars argument is a string specifying the set of characters to be removed. If omitted or None, the chars argument defaults to removing whitespace. The chars argument is not a prefix or suffix; rather, all combinations of its values are stripped:
Parameters:
Parameter | Type | Description |
---|---|---|
chars |
mixed |
Return Value:
Text::swapcase
Return a copy of the string with uppercase characters converted to lowercase and vice versa.
Text::swapcase( ): static
Return Value:
Text::slice
The slice() method extracts a section of a string and returns it as a new string
Text::slice( ?int start = null, ?int end = null, ?int step = null ): static
Parameters:
Parameter | Type | Description |
---|---|---|
start |
?int | |
end |
?int | |
step |
?int |
Return Value:
Text::title
Return a titlecased version of the string where words start with an uppercase character and the remaining characters are lowercase.
Text::title( ): static
Return Value:
Text::upper
Return a copy of the string with all the cased characters converted to uppercase
Text::upper( ): static
Return Value:
Text::split
Return a list of the words in the string, using sep as the delimiter string.
Text::split( mixed sep = null, int maxsplit = -1 ): static[]
If maxsplit is given, at most maxsplit splits are done (thus, the list will have at most maxsplit+1 elements). If maxsplit is not specified or -1, then there is no limit on the number of splits (all possible splits are made).
Parameters:
Parameter | Type | Description |
---|---|---|
sep |
mixed | |
maxsplit |
int |
Return Value:
Text::rsplit
Return a list of the words in the string, using sep as the delimiter string.
Text::rsplit( mixed sep = ' ', int maxsplit = -1 ): array
If maxsplit is given, at most maxsplit splits are done, the rightmost ones. If sep is not specified or None, any whitespace string is a separator. Except for splitting from the right, rsplit() behaves like split().
Parameters:
Parameter | Type | Description |
---|---|---|
sep |
mixed | |
maxsplit |
int |
Return Value:
Text::splitlines
Return a list of the lines in the string, breaking at line boundaries.
Text::splitlines( bool keepends = false ): array
Line breaks are not included in the resulting list unless keepends is given and true.
Parameters:
Parameter | Type | Description |
---|---|---|
keepends |
bool |
Return Value:
Text::sprintf
Use sprintf to format string
Text::sprintf( mixed args ): static
Parameters:
Parameter | Type | Description |
---|---|---|
args |
mixed |
Return Value:
Text::ucfirst
Use ucfirst on the string
Text::ucfirst( ): static
Return Value:
Text::lcfirst
Use lcfirst on the string
Text::lcfirst( ): static
Return Value:
Text::append
Returns new Text with suffix added
Text::append( mixed suffix ): static
Parameters:
Parameter | Type | Description |
---|---|---|
suffix |
mixed |
Return Value:
Text::prepend
Returns new Text with prefix added
Text::prepend( mixed prefix ): static
Parameters:
Parameter | Type | Description |
---|---|---|
prefix |
mixed |
Return Value:
Text::isBase64
Checks if Text is base 64 encoded
Text::isBase64( ): bool
Return Value:
Text::base64Encode
Returns a base64 decoded Text
Text::base64Encode( ): static
Return Value:
Text::base64Decode
Returns a base64 decoded Text
Text::base64Decode( ): static
Return Value:
Text::splitChars
Split the Text into multiple Text[]
Text::splitChars( int length = 1 ): array
Parameters:
Parameter | Type | Description |
---|---|---|
length |
int |
Return Value:
Text::countChars
Count needle occurences inside Text if using a regex as needle the search will be case sensitive
Text::countChars( mixed needle, bool ignoreCase = false ): int
Parameters:
Parameter | Type | Description |
---|---|---|
needle |
mixed | |
ignoreCase |
bool |
Return Value:
Text::isEquals
Checks if Text is the same as the provided needle
Text::isEquals( mixed needle, bool ignoreCase = false ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
needle |
mixed | |
ignoreCase |
bool |
Return Value:
Text::ishexadecimal
Checks if string is hexadecimal number
Text::ishexadecimal( ): bool
Return Value:
Text::length
Returns the length of the text
Text::length( ): int
Return Value:
Text::size
Returns the byte size
Text::size( ): int
Return Value:
Text::offsetExists
Text::offsetExists( mixed offset ): bool
Parameters:
Parameter | Type | Description |
---|---|---|
offset |
mixed |
Return Value:
Text::offsetGet
Text::offsetGet( mixed offset ): static
Parameters:
Parameter | Type | Description |
---|---|---|
offset |
mixed |
Return Value:
Text::offsetSet
Text::offsetSet( mixed offset, mixed value ): void
Parameters:
Parameter | Type | Description |
---|---|---|
offset |
mixed | |
value |
mixed |
Return Value:
Text::offsetUnset
Text::offsetUnset( mixed offset ): void
Parameters:
Parameter | Type | Description |
---|---|---|
offset |
mixed |
Return Value:
Text::count
Text::count( ): int
Return Value:
Text::isEmpty
Text::isEmpty( ): bool
Return Value:
Text::jsonSerialize
Text::jsonSerialize( ): mixed
Return Value:
Text::toString
Text::toString( ): string
Return Value:
Text::__toString
Text::__toString( ): string
Return Value:
Text::__serialize
Text::__serialize( ): array
Return Value:
Text::__unserialize
Text::__unserialize( array data ): void
Parameters:
Parameter | Type | Description |
---|---|---|
data |
array |
Return Value:
Text::__debugInfo
Text::__debugInfo( ): array
Return Value:
Timer
- Full name: \NGSOFT\Facades\Timer
- Parent class: \NGSOFT\Facades\Facade
Timer::getWatch
Get a watch
Timer::getWatch( mixed task = WatchFactory::DEFAULT_WATCH ): \NGSOFT\Timer\StopWatch
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
task |
mixed |
Return Value:
Timer::read
Reads the clock
Timer::read( mixed task = WatchFactory::DEFAULT_WATCH ): \NGSOFT\Timer\StopWatchResult
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
task |
mixed |
Return Value:
Timer::start
Starts the clock
Timer::start( mixed task = WatchFactory::DEFAULT_WATCH, int|float|null startTime = null ): bool
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
task |
mixed | |
startTime |
int|float|null |
Return Value:
Timer::resume
Resumes the clock (only if paused)
Timer::resume( mixed task = WatchFactory::DEFAULT_WATCH ): bool
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
task |
mixed |
Return Value:
Timer::reset
Resets the clock
Timer::reset( mixed task = WatchFactory::DEFAULT_WATCH ): void
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
task |
mixed |
Return Value:
Timer::resetAll
Resets all the clocks
Timer::resetAll( ): void
- This method is static.
Return Value:
Timer::pause
Pauses the clock
Timer::pause( mixed task = WatchFactory::DEFAULT_WATCH, ?bool &success = null ): \NGSOFT\Timer\StopWatchResult
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
task |
mixed | |
success |
?bool |
Return Value:
Timer::stop
Stops the clock
Timer::stop( mixed task = WatchFactory::DEFAULT_WATCH, ?bool &success = null ): \NGSOFT\Timer\StopWatchResult
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
task |
mixed | |
success |
?bool |
Return Value:
Timer::getLaps
Timer::getLaps( mixed task = WatchFactory::DEFAULT_WATCH ): \Generator|\NGSOFT\Timer\StopWatchResult[]
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
task |
mixed |
Return Value:
Timer::lap
Adds a lap time
Timer::lap( mixed task = WatchFactory::DEFAULT_WATCH, ?string label = null ): bool
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
task |
mixed | |
label |
?string |
Return Value:
Tools
Useful Functions to use in my projects
- Full name: \NGSOFT\Tools
Tools::safe_exec
Execute a callback and hides all php errors that can be thrown Exceptions thrown inside the callback will be preserved
Tools::safe_exec( callable callback, mixed args ): mixed
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
callback |
callable | |
args |
mixed | args to be passed to the callback |
Return Value:
Tools::errors_as_exceptions
Convenient Function used to convert php errors, warning, ... as Throwable
Tools::errors_as_exceptions( ): callable|null
- This method is static.
Return Value:
Tools::suppress_errors
Set error handler to empty closure (as of php 8.1 @ doesn't works anymore)
Tools::suppress_errors( ): callable|null
- This method is static.
Return Value:
Tools::normalize_path
Normalize pathnames
Tools::normalize_path( string path ): string
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
path |
string |
Return Value:
Tools::pushd
Change the current active directory And stores the last position, use popd() to return to previous directory
Tools::pushd( string dir ): bool
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
dir |
string |
Return Value:
Tools::popd
Restore the last active directory changed by pushd
Tools::popd( ): string|false
- This method is static.
Return Value:
current directory
Tools::each
Uses callback for each elements of the array and returns the value
Tools::each( callable callback, iterable iterable ): iterable
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
callback |
callable | |
iterable |
iterable |
Return Value:
Tools::iterateAll
Iterate iterable
Tools::iterateAll( iterable iterable ): array
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
iterable |
iterable |
Return Value:
Tools::filter
Filters elements of an iterable using a callback function
Tools::filter( callable callback, iterable iterable ): array
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
callback |
callable | accepts $value, $key, $array |
iterable |
iterable |
Return Value:
Tools::search
Searches an iterable until element is found
Tools::search( callable callback, iterable iterable ): null|mixed
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
callback |
callable | |
iterable |
iterable |
Return Value:
Tools::map
Same as the original except callback accepts more arguments and works with string keys
Tools::map( callable callback, iterable iterable ): array
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
callback |
callable | accepts $value, $key, $array |
iterable |
iterable |
Return Value:
Tools::some
Tests if at least one element in the iterable passes the test implemented by the provided function.
Tools::some( callable callback, iterable iterable ): bool
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
callback |
callable | |
iterable |
iterable |
Return Value:
Tools::every
Tests if all elements in the iterable pass the test implemented by the provided function.
Tools::every( callable callback, iterable iterable ): bool
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
callback |
callable | |
iterable |
iterable |
Return Value:
Tools::pull
Get a value(s) from the array, and remove it.
Tools::pull( iterable|string|int keys, array|\ArrayAccess &iterable ): mixed
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
keys |
iterable|string|int | |
iterable |
array|\ArrayAccess |
Return Value:
Tools::cloneArray
Clone all objects of an array recursively
Tools::cloneArray( array array, bool recursive = true ): array
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
array |
array | |
recursive |
bool |
Return Value:
Tools::iterableToArray
Converts an iterable to an array recursively if the keys are not string the will be indexed
Tools::iterableToArray( iterable iterable ): array
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
iterable |
iterable |
Return Value:
Tools::concat
Concatenate multiple values into the iterable provided recursively If a provided value is iterable it will be merged into the iterable (non numeric keys will be replaced if not iterable into the provided object)
Tools::concat( array|\ArrayAccess &iterable, mixed values ): array|\ArrayAccess
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
iterable |
array|\ArrayAccess | |
values |
mixed |
Return Value:
Tools::countValue
Count number of occurences of value
Tools::countValue( mixed value, iterable iterable ): int
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
value |
mixed | |
iterable |
iterable |
Return Value:
Tools::isValidUrl
Checks if is a valid url
Tools::isValidUrl( string url, bool webonly = false ): bool
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
url |
string | |
webonly |
bool | Put local urls as invalid ( eg : "http://localhost/index.php" ) |
Return Value:
See Also:
Tools::to_snake
Convert CamelCased to camel_cased
Tools::to_snake( string camelCased ): string
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
camelCased |
string |
Return Value:
Tools::toCamelCase
Convert snake_case to snakeCase
Tools::toCamelCase( string snake_case ): string
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
snake_case |
string |
Return Value:
Tools::millitime
Return current Unix timestamp in milliseconds
Tools::millitime( ): int
- This method is static.
Return Value:
See Also:
Tools::generate_uuid_v4
Generates a uuid V4
Tools::generate_uuid_v4( ): string
- This method is static.
Return Value:
See Also:
Tools::isAscii
Returns whether this string consists entirely of ASCII characters
Tools::isAscii( string input ): bool
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
input |
string |
Return Value:
Tools::isPrintableAscii
Returns whether this string consists entirely of printable ASCII characters
Tools::isPrintableAscii( string input ): bool
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
input |
string |
Return Value:
Tools::getFilesize
Get Human Readable file size
Tools::getFilesize( int|float size, int precision = 2 ): string
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
size |
int|float | |
precision |
int |
Return Value:
See Also:
Tools::randomString
Generate a more truly "random" alpha-numeric string.
Tools::randomString( int length = 16 ): string
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
length |
int |
Return Value:
Tools::getWordSize
Get the size of the longest word on a string
Tools::getWordSize( string|\Stringable string ): int
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
string |
string|\Stringable |
Return Value:
Tools::splitString
Split the string at the given length without cutting words
Tools::splitString( string|\Stringable string, int &length = null ): array
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
string |
string|\Stringable | |
length |
int |
Return Value:
Tools::join
Joins iterable together using provided glue
Tools::join( mixed glue, iterable values ): string
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
glue |
mixed | |
values |
iterable |
Return Value:
Tools::format
Try to reproduce python format
Tools::format( string message, mixed args ): string
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
message |
string | |
args |
mixed |
Return Value:
Tools::split
Split a stringable using provided separator
Tools::split( mixed separator, mixed value, int limit = -1 ): array
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
separator |
mixed | |
value |
mixed | |
limit |
int |
Return Value:
Tools::getExecutionTime
Get script execution time
Tools::getExecutionTime( int precision = 6 ): float|int
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
precision |
int |
Return Value:
Tools::pause
Pauses script execution for a given amount of time combines sleep or usleep
Tools::pause( int|float seconds ): void
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
seconds |
int|float |
Return Value:
Tools::msleep
Pauses script execution for a given amount of milliseconds
Tools::msleep( int milliseconds ): void
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
milliseconds |
int |
Return Value:
Tools::implements_class
Get class implementing given parent class from the loaded classes
Tools::implements_class( string|object parentClass, bool instanciable = true ): array
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
parentClass |
string|object | |
instanciable |
bool |
Return Value:
Tools::getClassConstants
Get Constants defined in a class
Tools::getClassConstants( string|object class, bool public = true ): array
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
class |
string|object | |
public |
bool | if True returns only public visibility constants |
Return Value:
Tools::callPrivateMethod
Call a method within an object ignoring its status
Tools::callPrivateMethod( object instance, string method, mixed arguments ): mixed
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
instance |
object | |
method |
string | |
arguments |
mixed |
Return Value:
TypeCheck
Checks for mixed union/intersection types
- Full name: \NGSOFT\Tools\TypeCheck
TypeCheck::assertType
Check the given value against the supplied types and throw TypeError if not valid
TypeCheck::assertType( string name, mixed value, string types ): void
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
name |
string | name to be displayed on error |
value |
mixed | the value to check |
types |
string | the types |
Return Value:
TypeCheck::assertTypeMethod
Check the given value against the supplied types and throw TypeError if not valid
TypeCheck::assertTypeMethod( string|array method, mixed value, string types ): void
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
method |
string|array | |
value |
mixed | |
types |
string |
Return Value:
TypeCheck::checkType
Can check a mix of intersection and union
TypeCheck::checkType( mixed value, string types ): bool
eg TypeCheck::checkType([], 'Traversable & ArrayAccess | array') or TypeCheck::checkType([], 'Traversable&ArrayAccess|array') or TypeCheck::checkType([], \Traversable::class, '&', \ArrayAccess::class, 'array') or TypeCheck::checkType([], \Traversable::class, '&', \ArrayAccess::class, '|','array') or TypeCheck::checkType([], \Traversable::class, TypeCheck::INTERSECTION, \ArrayAccess::class, TypeCheck::UNION,'array') the use of TypeCheck::UNION is not required eg: TypeCheck::checkType([], 'string', 'object', 'array') will check 'string|object|array'
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
value |
mixed | |
types |
string |
Return Value:
Units
Basic Enum Class Support (Polyfill) Adds the ability to class constants to work as php 8.1 backed enums cases
- Full name: \NGSOFT\Timer\Units
- Parent class: \NGSOFT\Enums\Enum
Units::getStep
Units::getStep( ): int|float
Return Value:
Units::getPlural
Units::getPlural( ): string
Return Value:
Units::getSingular
Units::getSingular( ): string
Return Value:
WatchFactory
- Full name: \NGSOFT\Timer\WatchFactory
WatchFactory::__construct
WatchFactory::__construct( bool highResolution = false ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
highResolution |
bool |
Return Value:
WatchFactory::getWatch
Get a watch
WatchFactory::getWatch( mixed task = self::DEFAULT_WATCH ): \NGSOFT\Timer\StopWatch
Parameters:
Parameter | Type | Description |
---|---|---|
task |
mixed |
Return Value:
WatchFactory::read
Reads the clock
WatchFactory::read( mixed task = self::DEFAULT_WATCH ): \NGSOFT\Timer\StopWatchResult
Parameters:
Parameter | Type | Description |
---|---|---|
task |
mixed |
Return Value:
WatchFactory::start
Starts the clock
WatchFactory::start( mixed task = self::DEFAULT_WATCH, int|float|null startTime = null ): bool
Parameters:
Parameter | Type | Description |
---|---|---|
task |
mixed | |
startTime |
int|float|null |
Return Value:
WatchFactory::resume
Resumes the clock (only if paused)
WatchFactory::resume( mixed task = self::DEFAULT_WATCH ): bool
Parameters:
Parameter | Type | Description |
---|---|---|
task |
mixed |
Return Value:
WatchFactory::reset
Resets the clock
WatchFactory::reset( mixed task = self::DEFAULT_WATCH ): void
Parameters:
Parameter | Type | Description |
---|---|---|
task |
mixed |
Return Value:
WatchFactory::resetAll
Resets all the clocks
WatchFactory::resetAll( ): void
Return Value:
WatchFactory::pause
Pauses the clock
WatchFactory::pause( mixed task = self::DEFAULT_WATCH, bool &success = null ): \NGSOFT\Timer\StopWatchResult
Parameters:
Parameter | Type | Description |
---|---|---|
task |
mixed | |
success |
bool |
Return Value:
WatchFactory::stop
Stops the clock
WatchFactory::stop( mixed task = self::DEFAULT_WATCH, bool &success = null ): \NGSOFT\Timer\StopWatchResult
Parameters:
Parameter | Type | Description |
---|---|---|
task |
mixed | |
success |
bool |
Return Value:
WatchFactory::getLaps
WatchFactory::getLaps( mixed task = self::DEFAULT_WATCH ): \Generator|\NGSOFT\Timer\StopWatchResult[]
Parameters:
Parameter | Type | Description |
---|---|---|
task |
mixed |
Return Value:
WatchFactory::lap
Adds a lap time
WatchFactory::lap( mixed task = self::DEFAULT_WATCH, ?string label = null ): bool
Parameters:
Parameter | Type | Description |
---|---|---|
task |
mixed | |
label |
?string |
Return Value: