Skip to content

Latest commit

 

History

History
38 lines (29 loc) · 1014 Bytes

ResourcesCollections.md

File metadata and controls

38 lines (29 loc) · 1014 Bytes

Resources Collection

\VersatileCollections\ResourcesCollection is a Collection class that only accepts items that are resources.

Example Usage:

    
    $collection = new \VersatileCollections\ResourcesCollection(
        tmpfile(), 
        tmpfile(), 
        tmpfile(), 
        tmpfile()
    );

    // OR
    
    $collection = \VersatileCollections\ResourcesCollection::makeNew([
        tmpfile(), 
        tmpfile(), 
        tmpfile(), 
        tmpfile()
    ]);

    // OR

    $collection = new \VersatileCollections\ResourcesCollection();
    $collection[] = tmpfile();
    $collection[] = tmpfile();
    $collection[] = tmpfile();
    $collection[] = tmpfile();

A good use-case for this type of collection would be in socket programming, if you want to store a bunch of sockets (resource type) opened via fsockopen in a collection for later use in a script or application.