public function scan($dir, $exclude = []) { $contexts = []; // Crawl directory and parse all files $finder = Util::finder($dir, $exclude); foreach ($finder as $file) { $context = $this->createContextFromFilename($file->getPathname()); if (!empty($context)) { $contexts[] = $context; } } return $contexts; }