/**
  * Finds the file name extension for a given file path that has no extension.
  *
  * @param string $path The absolute path to a view template, with or without filename extension.
  * @return string|bool The complete file name or false if no suitable file was found.
  */
 private function findTemplate($path)
 {
     if (file_exists($path)) {
         return $path;
     }
     return FilesystemFlow::glob("{$path}.*")->onlyFiles()->fetchKey();
 }
 /**
  * @return string[]
  */
 private function getProjectMigrations()
 {
     return FilesystemFlow::glob("{$this->migrationsPath}/*.php")->keys()->sort()->map(function ($path, &$i) {
         $i = str_segmentsFirst(basename($path), '_');
         return [Migration::date => $i, Migration::name => Migration::nameFromFilename($path), Migration::module => $this->module->name, Migration::path => $path];
     })->all();
 }
 /**
  * Registers a module's macros directory, along with any immediate sub-directories.
  *
  * @param ModuleInfo $moduleInfo
  * @return $this
  */
 function registerMacros(ModuleInfo $moduleInfo)
 {
     $path = "{$this->kernelSettings->baseDirectory}/{$moduleInfo->path}/{$this->moduleMacrosPath}";
     if (fileExists($path)) {
         $all = FilesystemFlow::from($path)->onlyDirectories()->keys()->all();
         array_unshift($all, $path);
         $this->macrosDirectories = array_merge($all, $this->macrosDirectories);
     }
     return $this;
 }
 /**
  * Check if a directory is empty.
  *
  * @param string $path
  * @return bool
  */
 private function isDirectoryEmpty($path)
 {
     return !count(FilesystemFlow::from($path)->all());
 }