* // Returns array('admin', 'test.example') * Module::parse('admin::test.example'); * * // Returns array('application', 'test.example') * Module::parse('test.example'); * * * @param string $key * @return array */ public static function parse($key) { $module = (strpos($key, '::') !== false) ? substr($key, 0, strpos($key, ':')) : DEFAULT_MODULE; $module = str_replace('.', '/', $module); if ($module !== DEFAULT_MODULE) $key = substr($key, strpos($key, ':') + 2); return array($module, $key); } /** * Get the path for a given module. * * Once the path has been determined, it will be cached by the class for quick access. * * @param string $module * @return string */ public static function path($module) { if (array_key_exists($module, static::$paths)) return static::$paths[$module]; if (in_array($module, static::$modules)) { return static::$paths[$module] = MODULE_PATH.$module.'/'; } } /** * Get the an array of paths to all of the modules. * * @return array */ public static function paths() { return array_map(function($module) { return Laravel\Module::path($module); }, static::$modules); } }