Skip to content

Instantly share code, notes, and snippets.

@ephrin
Created May 22, 2013 09:58
Show Gist options
  • Save ephrin/5626498 to your computer and use it in GitHub Desktop.
Save ephrin/5626498 to your computer and use it in GitHub Desktop.
Test Quest OOP (php version > 5.3)
interface ArrayHelperInterface extends IteratorAggregate,
Traversable,
ArrayAccess,
Serializable,
Countable {
/**
* @param ArrayHelperInterface|ArrayObject|array $array
*/
function __construct($array);
/**
* Creates a new array with the results of calling a provided function on every element in the ArrayHelperInterface.
* @param $callback
* @return ArrayHelperInterface
*/
public function map($callback);
/**
* Calls a function for each element in the ArrayHelperInterface.
* @param $callback
* @return void
*/
public function each($callback);
/**
* Returns true if at least one element in the array satisfies the provided testing function.
* @dev must finish iteration after first matching
* @param Closure|string $callback
* @return boolean
*/
public function some($callback);
/**
* Returns true if every element in the array satisfies the provided testing function.
* @param Closure|string $callback
* @return boolean
*/
public function every($callback);
/**
*
* @param object|mixed $value
* @return mixed
*/
public function indexOf($value);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment