public function keys($pattern = '*', $dir = null, $collection = []) { $dir = empty($dir) ? $this->motor()->getPath() . DS . 'values' : $dir; $segs = glob($dir . DS . '*'); foreach ($segs as $seg) { if (is_dir($seg)) { $collection[] = $this->keys($pattern, $seg, $collection); } else { $seg = str_replace($this->motor()->getPath() . DS . 'values' . DS, '', $seg); $key = str_replace([DS, '.php'], ['.', ''], $seg); if (fnmatch($pattern, $key)) { $collection[] = $key; } } } return Arrays::flatten($collection); }