Login   Register  
PHP Classes
elePHPant
Icontem

Generic Array: Create arrays that allow members of just one type

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Info   View files View files (5)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings  
2007-10-24 (7 years ago) RSS 2.0 feedStarStarStarStar 62%Total: 618 All time: 4,664 This week: 1,461Up
Version License PHP version Categories  
genericarray 1.0.0GNU Lesser General Publ...5.1PHP 5, Data types, Code Generation
Description Author  

This class can be used to create arrays that allow members of just one type.

It implements a class loader that gives a special treatment to the creation of objects of classes with the names that start with ArrayOf.

The class assumes that it is intended to create an object of a generic class that manages an array of objects of a class named after the ArrayOf prefix.

It generates code for a new generic array handling class based on a generic class template. The generated class uses type hinting to allow only array members of the intended array element class.

This class can be used with the Type Hint class to allow other types of members besides objects and arrays.

Innovation Award  
PHP Programming Innovation award nominee
November 2007
Number 9
In PHP arrays may have element values of mixed types. If an application needs to store values of only one specific type, PHP does not stop eventual bugs from storing values of the wrong types in the values.

This class implements an array interface that checks the types of values before adding them to the array, thus making it possible to early detect eventual application bugs.

Manuel Lemos
Picture of Martin Alterisio
Name: Martin Alterisio <contact>
Classes: 5 packages by
Country: Argentina Argentina
Age: 31
All time rank: 6858 in Argentina Argentina
Week rank: 1043 Down11 in Argentina Argentina Down
Innovation award
Innovation award
Nominee: 5x

  Files folder image Files  
File Role Description
Files folder imagecache (1 file)
Accessible without login Plain text file example.php Example Example script
Accessible without login Plain text file ArrayOfGenericLoader.php Class Array generic class loader
Accessible without login Plain text file ArrayOfGenericX.php Class Array generic template
Accessible without login Plain text file genericarray.lib.php Aux. Library loader script.

  Files folder image Files  /  cache  
File Role Description
  Accessible without login Plain text file MAKE_THIS_DIR_WRITABLE Doc. Make the cache dir writable or face the wrath of uppercase filenames

Downloadgenericarray-2007-10-24.zip 2KB
Downloadgenericarray-2007-10-24.tar.gz 1KB
Install with ComposerInstall with Composer
Needed packages  
Class DownloadWhy it is needed Dependency
Type Hint Class Download .zip .tar.gz Nice addition to create arrays of native types (eg: ArrayOfInt) Recommended
 Version Control Unique User Downloads Download Rankings  
 0%Total:618All time:4,664
 This week:0This week:1,461Up
 User Ratings  
 
 All time
Utility:75%StarStarStarStar
Consistency:91%StarStarStarStarStar
Documentation:66%StarStarStarStar
Examples:91%StarStarStarStarStar
Tests:-
Videos:-
Overall:62%StarStarStarStar
Rank:696