public static function show($path, $params = []) { foreach ($params as $key => $value) { if (is_numeric($key)) { continue; } ${$key} = $value; } $pagename = multiexplode(['.', '/', '>', '|'], $path)[0]; require_once path('resources.views.' . $path . 'php'); }
public static function path($file) { $chunks = multiexplode(['.', '/', '>', '|'], $file); $file = implode('/', $chunks); $path = __DIR__ . "/../../../{$file}"; if (is_dir($path)) { return $path; } else { $file_name = implode('.', array_slice($chunks, -2, 2)); $file_parent = implode('/', array_slice($chunks, 0, -2)); $path = __DIR__ . "/../../../{$file_parent}/{$file_name}"; return $path; } }
public static function __callStatic($name, $path) { $filename = __DIR__ . "/../../../config/{$name}.php"; if (file_exists($filename)) { if ($path) { $config = (include $filename); $path = multiexplode(['|', '/', '-', '>', ',', '.', ' '], $path[0]); foreach ($path as $key) { $key = trim($key); if (isset($config[$key])) { $config = $config[$key]; } } return $config; } else { return $filename; } } throw new FileNotFoundException('File Not Found Exception'); }
public function call() { if (is_callable($this->callable)) { return call_user_func_array($this->callable, $this->matches); } else { if (is_string($this->callable)) { $parts = multiexplode(['@', '>', '.', '#'], $this->callable); $controller = "App\\Http\\Controllers\\{$parts[0]}Controller"; $controller = new $controller(); return call_user_func_array([$controller, $parts[1]], $this->matches); } } }