Collections\Collection::__construct PHP Method

__construct() public method

Instantiates the collection by specifying what type of Object will be used.
public __construct ( $type, array $items = [] )
$type
$items array
    public function __construct($type, $items = [])
    {
        $type = $this->determineType($type);
        $this->type = $type;
        if ($items) {
            $this->validateItems($items, $this->type);
        }
        $this->items = $items;
    }

Usage Example

 /**
  * Instantiates the collection by specifying what type of Object will be used.
  *
  * @param string $objectName Name of the class or interface used in the Collection
  */
 public function __construct($objectName = "{{foo}}")
 {
     parent::__construct($objectName);
 }
All Usage Examples Of Collections\Collection::__construct