Skip to content

ustream/arr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ustream Arr Build Status

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages