method fetchDir documentation in bbn\Mvc\Router

function($path, $mode) { // Only for views and models if (!self::isMode($mode) && !\in_array($mode, self::$_controllers)) { throw new \Exception(X::_("The mode %s is invalid", $mode)); } // If there is a prepath defined we prepend it to the path if ($this->_prepath && (strpos($path, '/') !== 0) && (strpos($path, $this->_prepath) !== 0) ) { $path = $this->_prepath . $path; } /** @var string $root Where the files will be searched for by default */ $root = $this->_get_root($mode); $plugin = $this->_find_plugin($path); if ($plugin && ($alt_path = $plugin['url'])) { $alt_root = $this->_get_alt_root($mode, $alt_path); } elseif ($alt_root = $this->_get_alt_root($mode)) { $alt_path = $this->alt_root; } $dir = false; $dir1 = self::parse($root . $path); if (is_dir($dir1) && (strpos($dir1, $root) === 0)) { $dir = $dir1; } elseif (!empty($alt_path) && !empty($alt_root) && ($dir2 = self::parse($alt_root . substr($path, \strlen($alt_path) + 1))) && (strpos($dir2, $alt_root) === 0) && is_dir($dir2) ) { $dir = $dir2; } if (!$dir) { throw new \Exception(X::_("Impossible to find the directory for %s", $path)); } $res = []; $files = bbn\File\Dir::getFiles($dir); $prepath = $path && ($path !== '.') ? $path.'/' : ''; if (!is_array($files)) { throw new \Exception(X::_("Impossible to find the directory for %s", $dir)); } foreach ($files as $f) { if (\in_array(bbn\Str::fileExt($f), self::$_filetypes[$mode], true)) { $res[] = $prepath.bbn\Str::fileExt($f, true)[0]; } } return $res; }

BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way

This website uses cookies to ensure you get the best experience on our website.