/** * @param array $collection * @return array */ public function filter($collection) { if (AccessHelper::keyExists($collection, $this->token->value, $this->magicIsAllowed)) { return array(AccessHelper::getValue($collection, $this->token->value, $this->magicIsAllowed)); } else { if ($this->token->value === "*") { return AccessHelper::arrayValues($collection); } } return array(); }
private function recurse(&$result, $data) { $result[] = $data; if (AccessHelper::isCollectionType($data)) { foreach (AccessHelper::arrayValues($data) as $key => $value) { $results[] = $value; if (AccessHelper::isCollectionType($value)) { $this->recurse($result, $value); } } } }