ustream/arr

Ustream Array helpers

Maintainers

Package info

github.com/ustream/arr

Homepage

pkg:composer/ustream/arr

Statistics

Installs: 14

Dependents: 0

Suggesters: 0

Stars: 3

Open Issues: 0

0.1.2 2013-10-21 19:19 UTC

This package is not auto-updated.

Last update: 2026-03-09 22:20:40 UTC


README

This is a collection of Array related utilities.

Extractors

Mining data from a deeply nested array is tedious. The Extractor library give a programable and composable solution to this kind of problems.

Reaching data on a simple "path" in the nested structure:

$sample = array(
  "foo" => array(
    "bar" => array(
      "baz" => "something"
    )
  )
);

$extractor = new PathExtractor(array("foo", "bar", "baz"));
$result = $extractor->extract($sample);
//        "something" # inside an Option instance

$extractor = new PathExtractor(array("foo", "bar"));
$result = $extractor->extract($sample);
//        array("baz" => "something") # inside an Option instance

$extractor = new PathExtractor(array("foo"));
$result = $extractor->extract($sample);
//        array("bar" => array("baz" => "something")) # inside an Option instance