This repository has been archived by the owner on Jul 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
36 changed files
with
330 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ composer.phar | |
composer.lock | ||
.idea/ | ||
config/_bavix.php | ||
cache/*.php |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
return [ | ||
'app' => [ | ||
'namespace' => Modules\App\Controllers::class, | ||
'className' => Modules\App\Module::class, | ||
'path' => BASE_PATH . 'src/Modules/App/Module.php' | ||
], | ||
'foo' => [ | ||
'namespace' => Modules\Foo\Controllers::class, | ||
'className' => Modules\Foo\Module::class, | ||
'path' => BASE_PATH . 'src/Modules/Foo/Module.php' | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?php | ||
|
||
//$router->add('/', [ | ||
// 'controller' => 'index', | ||
// 'action' => 'index' | ||
//]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
<?php | ||
|
||
namespace Framework; | ||
|
||
use Phalcon\Config; | ||
use Phalcon\DiInterface; | ||
use Phalcon\Loader; | ||
use Phalcon\Mvc\ModuleDefinitionInterface; | ||
use Phalcon\Mvc\View; | ||
|
||
abstract | ||
class Module implements ModuleDefinitionInterface | ||
{ | ||
|
||
/** | ||
* @var Builder | ||
*/ | ||
public $builder; | ||
|
||
/** | ||
* Module constructor. | ||
*/ | ||
public function __construct() | ||
{ | ||
global $builder; | ||
$this->builder = $builder; | ||
} | ||
|
||
/** | ||
* Registers an autoloader related to the module | ||
* | ||
* @param DiInterface $di | ||
*/ | ||
public function registerAutoloaders(DiInterface $di = null) | ||
{ | ||
$loader = new Loader(); | ||
|
||
$loader->registerNamespaces([ | ||
$this->namespace() => $this->moduleDir() . '/src' | ||
]); | ||
|
||
$loader->register(); | ||
} | ||
|
||
/** | ||
* Registers services related to the module | ||
* | ||
* @param DiInterface $di | ||
*/ | ||
public function registerServices(DiInterface $di) | ||
{ | ||
$module = $this; | ||
|
||
/** | ||
* Setting up the view component | ||
*/ | ||
$di->setShared('view', function () use ($module) { | ||
|
||
/** | ||
* @var $this \Phalcon\Di\FactoryDefault | ||
* @var $configure Config | ||
*/ | ||
$configure = $this->getConfigure(); | ||
|
||
$view = new View(); | ||
$view->setDI($this); | ||
$view->setViewsDir($module->moduleDir() . '/views'); | ||
|
||
$view->registerEngines([ | ||
'.volt' => function ($view) use ($configure) { | ||
$volt = new View\Engine\Volt($view, $this); | ||
|
||
$volt->setOptions([ | ||
'compiledPath' => $configure->application->cacheDir, | ||
'compiledSeparator' => '_' | ||
]); | ||
|
||
return $volt; | ||
}, | ||
|
||
'.phtml' => View\Engine\Php::class | ||
|
||
]); | ||
|
||
return $view; | ||
}); | ||
|
||
|
||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
abstract public function namespace(): string; | ||
|
||
/** | ||
* @return string | ||
*/ | ||
abstract public function moduleDir(): string; | ||
|
||
} |
Oops, something went wrong.