mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 22:33:55 -07:00
Merge pull request #60 from torrentpier/analysis-qM1M44
Applied fixes from StyleCI
This commit is contained in:
commit
16d94522d3
10 changed files with 151 additions and 149 deletions
|
@ -6,9 +6,7 @@ use Pimple\Container;
|
|||
|
||||
/**
|
||||
* Class Di
|
||||
* Dependency Injection Container
|
||||
*
|
||||
* @package TorrentPier
|
||||
* Dependency Injection Container.
|
||||
*/
|
||||
class Di extends Container
|
||||
{
|
||||
|
|
|
@ -9,11 +9,11 @@ use Zend\Config\Factory;
|
|||
class ConfigServiceProvider implements ServiceProviderInterface
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container['config'] = function($container) {
|
||||
$container['config'] = function ($container) {
|
||||
$config = Factory::fromFile($container['config.file.system.main'], true);
|
||||
|
||||
if (isset($container['config.file.local.main']) && file_exists($container['config.file.local.main'])) {
|
||||
|
|
|
@ -9,13 +9,14 @@ use Zend\Db\Adapter\Adapter;
|
|||
class DbServiceProvider implements ServiceProviderInterface
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container['db'] = function($container) {
|
||||
$container['db'] = function ($container) {
|
||||
$adapter = new Adapter($container['config.db']);
|
||||
unset($container['config.db']);
|
||||
|
||||
return $adapter;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ class RequestServiceProvider implements ServiceProviderInterface
|
|||
{
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container['request'] = function(Container $container) {
|
||||
$container['request'] = function (Container $container) {
|
||||
return Request::createFromGlobals();
|
||||
};
|
||||
}
|
||||
|
|
|
@ -10,9 +10,10 @@ class ResponseServiceProvider implements ServiceProviderInterface
|
|||
{
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container['response'] = function(Container $container) {
|
||||
$container['response'] = function (Container $container) {
|
||||
$response = Response::create();
|
||||
$response->prepare($container['request']);
|
||||
|
||||
return $response;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -14,27 +14,28 @@ use Zend\Db\Adapter\Driver\Pdo\Pdo;
|
|||
class SphinxServiceProvider implements ServiceProviderInterface
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container['sphinx'] = function($container) {
|
||||
$container['sphinx'] = function ($container) {
|
||||
$platform = new SphinxQL();
|
||||
$adapter = new Adapter($container['config.sphinx']);
|
||||
|
||||
$driver = $adapter->getDriver();
|
||||
// Check driver
|
||||
if ($driver instanceof Pdo && $driver->getDatabasePlatformName(Pdo::NAME_FORMAT_CAMELCASE) == 'Mysql' ) {
|
||||
if ($driver instanceof Pdo && $driver->getDatabasePlatformName(Pdo::NAME_FORMAT_CAMELCASE) == 'Mysql') {
|
||||
$driver->registerStatementPrototype(new Statement());
|
||||
} elseif (!$driver instanceof Mysqli) {
|
||||
$class = get_class($driver);
|
||||
throw new UnsupportedDriverException(
|
||||
$class . ' not supported. Use Zend\Db\Adapter\Driver\Pdo\Pdo or Zend\Db\Adapter\Driver\Mysqli\Mysqli'
|
||||
$class.' not supported. Use Zend\Db\Adapter\Driver\Pdo\Pdo or Zend\Db\Adapter\Driver\Mysqli\Mysqli'
|
||||
);
|
||||
}
|
||||
|
||||
$platform->setDriver($adapter->getDriver());
|
||||
unset($container['config.sphinx']);
|
||||
|
||||
return $adapter;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ class TranslationServiceProvider implements ServiceProviderInterface
|
|||
{
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container['translator'] = function(Container $container) {
|
||||
$container['translator'] = function (Container $container) {
|
||||
$translator = new Translator(
|
||||
$container['settings.locale'],
|
||||
null,
|
||||
|
|
|
@ -10,17 +10,17 @@ class TwigServiceProvider implements ServiceProviderInterface
|
|||
{
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container['twig'] = function(Container $container) {
|
||||
$container['twig'] = function (Container $container) {
|
||||
$loader = new \Twig_Loader_Filesystem($container['config.twig.dir_templates']);
|
||||
$twig = new \Twig_Environment($loader, [
|
||||
'debug' => $container['config.debug'],
|
||||
'cache' => $container['config.twig.dir_cache']
|
||||
'cache' => $container['config.twig.dir_cache'],
|
||||
]);
|
||||
|
||||
$twig->addExtension(new \Twig_Extension_Core);
|
||||
$twig->addExtension(new \Twig_Extension_Escaper);
|
||||
$twig->addExtension(new \Twig_Extension_Optimizer);
|
||||
$twig->addExtension(new \Twig_Extension_Debug);
|
||||
$twig->addExtension(new \Twig_Extension_Core());
|
||||
$twig->addExtension(new \Twig_Extension_Escaper());
|
||||
$twig->addExtension(new \Twig_Extension_Optimizer());
|
||||
$twig->addExtension(new \Twig_Extension_Debug());
|
||||
|
||||
$twig->addExtension(new TranslationExtension($container['translator']));
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ class ViewServiceProvider implements ServiceProviderInterface
|
|||
{
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container['view'] = function(Container $container) {
|
||||
$container['view'] = function (Container $container) {
|
||||
return new View($container['twig']);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -17,10 +17,11 @@ class View
|
|||
/**
|
||||
* @param $template
|
||||
* @param array $params
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function make($template, $params = [])
|
||||
{
|
||||
return $this->twig->render($template . '.twig', $params);
|
||||
return $this->twig->render($template.'.twig', $params);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue