Download the PHP package cscfa_tool_division/collections without Composer

On this page you can find all versions of the php package cscfa_tool_division/collections. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package collections

collections

This bundle provide a set of collection class to abstract the usage of the array and provide advanced inheritance and logic.

Structure of a collection

The collections of this bundle are created from the following architecture :

The Interface are childs of the CollectionInterface and defined the public methods of the collections.

The method trait define the logic of the collections. They need a 'content' property to be used. So the functionnal storage property of a collection must be named 'content' and be an array.

The Abstract class is a container for the traits and define the 'content' property.

The Concrete class is usable 'as it'.

Available collections

Abstract collection

method purpose return trait
clear() clear the collection content return an array representative of the content before clear ClearableCollectionTrait
contain($element) check if the collection contain a specified value TRUE if it contain or FALSE ContainerCollectionTrait
containAll(array $elements) as 'contain' but for a set of value as 'contain' method. Return TRUE if all values are contained ContainerCollectionTrait
isEmpty() check if the collection is empty or not TRUE if the collection is empty or FALSE NumberizedCollectionTrait
count() return the count of elements into the collection the count as integer NumberizedCollectionTrait
toArray() normalize the current collection to array the representative array of the collection ArrayContentCollectionTrait

Value collection

method purpose return trait
clear() clear the collection content return an array representative of the content before clear ClearableCollectionTrait
contain($element) check if the collection contain a specified value TRUE if it contain or FALSE ContainerCollectionTrait
containAll(array $elements) as 'contain' but for a set of value as 'contain' method. Return TRUE if all values are contained ContainerCollectionTrait
isEmpty() check if the collection is empty or not TRUE if the collection is empty or FALSE NumberizedCollectionTrait
count() return the count of elements into the collection the count as integer NumberizedCollectionTrait
toArray() normalize the current collection to array the representative array of the collection ArrayContentCollectionTrait
add($value) add a value to the collection return itself to allow chained call ValueCollectionTrait
addAll(array $values) as add, but for a set of value as add ValueCollectionTrait
remove($value) remove a value from the collection return the deleted element or NULL if not currently stored ValueCollectionTrait
removeAll(array $value) as remove but for a set of value return an array containing the deleted elements. Can be empty ValueCollectionTrait

Map collection

method purpose return trait
clear() clear the collection content return an array representative of the content before clear ClearableCollectionTrait
contain($element) check if the collection contain a specified value TRUE if it contain or FALSE ContainerCollectionTrait
containAll(array $elements) as 'contain' but for a set of value as 'contain' method. Return TRUE if all values are contained ContainerCollectionTrait
isEmpty() check if the collection is empty or not TRUE if the collection is empty or FALSE NumberizedCollectionTrait
count() return the count of elements into the collection the count as integer NumberizedCollectionTrait
toArray() normalize the current collection to array the representative array of the collection ArrayContentCollectionTrait
has() check if the collection contain a specified key TRUE if the key exist, or FALSE MapCollectionTrait
get($key) get the content of a key from the collection the content of the key, or NULL if not currently stored MapCollectionTrait
set($key, $value) set the content for a given key or create it if not currently stored the collection to allow chained call MapCollectionTrait
setAll(array $assocArray) as set, but for an associative array as set MapCollectionTrait
remove($key) remove a key from the collection return the content of the key before deletion, or NULL if not currently stored MapCollectionTrait
removeAll(array $keys) as remove but for a set of keys return an array of values corresponding to the deleted key values MapCollectionTrait

Container collection

method purpose return trait
clear() clear the collection content return an array representative of the content before clear ClearableCollectionTrait
contain($element) check if the collection contain a specified value TRUE if it contain or FALSE ContainerCollectionTrait
containAll(array $elements) as 'contain' but for a set of value as 'contain' method. Return TRUE if all values are contained ContainerCollectionTrait
isEmpty() check if the collection is empty or not TRUE if the collection is empty or FALSE NumberizedCollectionTrait
count() return the count of elements into the collection the count as integer NumberizedCollectionTrait
toArray() normalize the current collection to array the representative array of the collection ArrayContentCollectionTrait
has() check if the collection contain a specified key TRUE if the key exist, or FALSE MapCollectionTrait
get($key) get the content of a key from the collection the content of the key, or NULL if not currently stored MapCollectionTrait
set($key, $value) set the content for a given key or create it if not currently stored the collection to allow chained call MapCollectionTrait
setAll(array $assocArray) as set, but for an associative array as set MapCollectionTrait
remove($key) remove a key from the collection return the content of the key before deletion, or NULL if not currently stored MapCollectionTrait
removeAll(array $keys) as remove but for a set of keys return an array of values corresponding to the deleted key values MapCollectionTrait
getSubset($key) create a subset of the key content return a ContainerCollectionInterface containing the value of the key, or an empty one if the key does not exist on is not an array or a CllectionInterface SubsetableCollectionTrait

Value set

method purpose return trait
clear() clear the collection content return an array representative of the content before clear ClearableCollectionTrait
contain($element) check if the collection contain a specified value TRUE if it contain or FALSE ContainerCollectionTrait
containAll(array $elements) as 'contain' but for a set of value as 'contain' method. Return TRUE if all values are contained ContainerCollectionTrait
isEmpty() check if the collection is empty or not TRUE if the collection is empty or FALSE NumberizedCollectionTrait
count() return the count of elements into the collection the count as integer NumberizedCollectionTrait
toArray() normalize the current collection to array the representative array of the collection ArrayContentCollectionTrait
add($value) add a value to the collection. It will not be inserted if it not unique in the current content without throwing any exception return itself to allow chained call ValueCollectionTrait
addAll(array $values) as add, but for a set of value as add ValueCollectionTrait
remove($value) remove a value from the collection return the deleted element or NULL if not currently stored ValueCollectionTrait
removeAll(array $value) as remove but for a set of value return an array containing the deleted elements. Can be empty ValueCollectionTrait

The collection helper

The collection helper take care of the advanced behaviour of the collection logic. It allow to merge, cut, traverse and create collections from array. This helper is a service and can be getted by it's id 'collection.helper.std'.

You will be able to use the following methods :

method purpose arguments return
arrayToCollection create a collection from an array source array, collection classname to create an instance of the needed collection
mergeCollections merge to collections instance first collection, second collection a collection of the first collection given type with the content of the two collections
mergeArray merge a collection and an array collection, array a collection of the given collection type with the content of the collection and the array
subCollection create a new collection from a collection with a subset of the content collection, start index, length return a collection of the given collection type with the content from the started integer index with the given length
subMap create a new collection from a collection with the intersection of the given keys as content collection, array of needed keys return a collection of the given collection type with the keys that exists into the given collection and the key array
walkCollection execute a given function for all of the elements of the given collection. The given function will receive the value, the key and the given argument array in this order as argument collection, function, argument array nothing

To work fine, the collection helper need a array caster that support the given collection. If you create your own collection and want to use it into the helper, you must create an array caster for your collection. Note the existing casters support the MapCollectionInterface childs and ValueCollectionInterfaceChilds.

Create an array caster

The array caster need to implement the ArrayCasterInterface. It define two methods :

After your caster created, you must register it at a service, with the 'collection.helper.caster' tag. The bundle will automatically register it into the array caster manager of the helpers.

A note of quality check

SensioLabsInsight

:white_check_mark: phpcs tested

:white_check_mark: phpmd tested (full rules)

:white_check_mark: phpdcd tested

:white_check_mark: phpcpd tested

:white_check_mark: phpunit tested (code coverage done)

See the doc :


All versions of collections with dependencies

PHP Build Version
Package Version
Requires symfony/symfony Version ~3.0@stable
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package cscfa_tool_division/collections contains the following files

Loading the files please wait ....