Style fixes.
This commit is contained in:
parent
a7a59b690a
commit
8b44550f06
42 changed files with 186 additions and 148 deletions
|
|
@ -12,7 +12,7 @@ use Phalcon\Di\FactoryDefault as DiDefault,
|
|||
Phalcon\Flash\Direct as FlashDirect,
|
||||
Phalcon\Mvc\Model\Metadata\Memory as MemoryMetaData,
|
||||
Phalcon\Mvc\Model\MetaData\Apc as ApcMetaData,
|
||||
Phalcon\Mvc\ViewBaseInterface,
|
||||
Phalcon\Mvc\ViewBaseInterface,
|
||||
Phalcon\Cache\Frontend\Data as FrontendDataCache,
|
||||
Phalcon\Cache\Backend\Apc as BackendApcCache,
|
||||
Phalcon\Translate\Adapter\NativeArray as TranslateAdapter,
|
||||
|
|
@ -44,13 +44,12 @@ class Services extends DiDefault
|
|||
$reflection = new \ReflectionObject($this);
|
||||
$methods = $reflection->getMethods(\ReflectionMethod::IS_PROTECTED);
|
||||
|
||||
foreach($methods as $method) {
|
||||
foreach ($methods as $method) {
|
||||
|
||||
if (substr($method->getName(),0, 11) == '_initShared') {
|
||||
if (substr($method->getName(), 0, 11) == '_initShared') {
|
||||
$service = lcfirst(substr($method->getName(), 11));
|
||||
$this->setShared($service, $method->getClosure($this));
|
||||
}
|
||||
else if (substr($method->getName(),0, 5) == '_init') {
|
||||
} else if (substr($method->getName(), 0, 5) == '_init') {
|
||||
$service = lcfirst(substr($method->getName(), 5));
|
||||
$this->set($service, $method->getClosure($this));
|
||||
}
|
||||
|
|
@ -84,7 +83,7 @@ class Services extends DiDefault
|
|||
try {
|
||||
$tmp = new Config($basePath . $file);
|
||||
$config->merge($tmp);
|
||||
} catch(\Phalcon\Config\Exception $e) {
|
||||
} catch (\Phalcon\Config\Exception $e) {
|
||||
// Sometime went wrong. Log here?
|
||||
}
|
||||
}
|
||||
|
|
@ -118,7 +117,7 @@ class Services extends DiDefault
|
|||
|
||||
$eventsManager = new \Phalcon\Events\Manager();
|
||||
|
||||
$eventsManager->attach("dispatch", function($event, $dispatcher) {
|
||||
$eventsManager->attach("dispatch", function ($event, $dispatcher) {
|
||||
$actionName = lcfirst(\Phalcon\Text::camelize($dispatcher->getActionName(), '-_'));
|
||||
$dispatcher->setActionName($actionName);
|
||||
});
|
||||
|
|
@ -194,7 +193,7 @@ class Services extends DiDefault
|
|||
protected function _initSession()
|
||||
{
|
||||
$config = $this->get('config');
|
||||
$session = new \Phalcon\Session\Manager();
|
||||
$session = new \Phalcon\Session\Manager();
|
||||
|
||||
if (isset($config->session)) {
|
||||
$data = $config->session->toArray();
|
||||
|
|
@ -212,7 +211,7 @@ class Services extends DiDefault
|
|||
$adapter = new \Phalcon\Session\Adapter\Stream();
|
||||
}
|
||||
|
||||
$session->setAdapter($adapter);
|
||||
$session->setAdapter($adapter);
|
||||
|
||||
// Start session.
|
||||
$session->start();
|
||||
|
|
@ -228,7 +227,7 @@ class Services extends DiDefault
|
|||
|
||||
$view = new View();
|
||||
|
||||
$view->setViewsDir([ $config->application->viewsDir ]);
|
||||
$view->setViewsDir([$config->application->viewsDir]);
|
||||
$view->setLayoutsDir('_layouts/');
|
||||
$view->setPartialsDir('_partials/');
|
||||
|
||||
|
|
@ -322,7 +321,7 @@ class Services extends DiDefault
|
|||
$router = new Router(false);
|
||||
$router->removeExtraSlashes($config->get('removeExtraSlashes', false));
|
||||
|
||||
foreach($config->routes as $name => $def) {
|
||||
foreach ($config->routes as $name => $def) {
|
||||
|
||||
if (!($def instanceof \Phalcon\Config)) {
|
||||
continue;
|
||||
|
|
@ -366,10 +365,10 @@ class Services extends DiDefault
|
|||
|
||||
protected function _initSharedLogger()
|
||||
{
|
||||
$path = $this->get('config')->application->logDir;
|
||||
return new \Phalcon\Logger('default', [
|
||||
'main' => new \Phalcon\Logger\Adapter\Stream($path . 'app.txt')
|
||||
]);
|
||||
$path = $this->get('config')->application->logDir;
|
||||
return new \Phalcon\Logger('default', [
|
||||
'main' => new \Phalcon\Logger\Adapter\Stream($path . 'app.txt')
|
||||
]);
|
||||
}
|
||||
|
||||
protected function _initTemplate()
|
||||
|
|
@ -379,7 +378,7 @@ class Services extends DiDefault
|
|||
$view = new SimpleView();
|
||||
$view->setViewsDir($config->application->templateDir);
|
||||
$view->registerEngines([
|
||||
'.volt' => function (ViewBaseInterface $view) use ($config) {
|
||||
'.volt' => function (ViewBaseInterface $view) use ($config) {
|
||||
$volt = new VoltEngine($view, $this);
|
||||
|
||||
$volt->setOptions(array(
|
||||
|
|
|
|||
Reference in a new issue