From 43ec85bb1e8dfb7cbd9314ebba24b0c9fe84e02f Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Sat, 3 Nov 2012 09:39:40 +0100 Subject: [PATCH] clean code with php-cs-fixer --- core/autoload.php | 11 +- core/bootstrap.php | 11 +- .../TheliaApcUniversalClassLoader.php | 26 ++--- .../Autoload/TheliaUniversalClassLoader.php | 71 ++++++------ .../Thelia/Controller/DefaultController.php | 21 ++-- .../Controller/NullControllerInterface.php | 9 +- .../Core/EventListener/RequestListener.php | 25 ++-- .../Core/EventListener/ViewListener.php | 50 ++++---- core/lib/Thelia/Core/Template/Parser.php | 69 +++++------ .../Thelia/Core/Template/ParserInterface.php | 22 ++-- core/lib/Thelia/Core/Thelia.php | 58 +++++----- core/lib/Thelia/Core/TheliaBundle.php | 57 +++++---- .../Thelia/Routing/Matcher/DefaultMatcher.php | 27 ++--- .../Matcher/TheliaMatcherCollection.php | 108 +++++++++--------- index.php | 1 - index_dev.php | 6 +- local/config/config_db.mysql.php | 4 - local/config/config_db.pgsql.php | 4 - local/config/config_db.sqlite.php | 4 - local/config/container.php | 11 +- 20 files changed, 273 insertions(+), 322 deletions(-) diff --git a/core/autoload.php b/core/autoload.php index 146891a37..e40822c88 100644 --- a/core/autoload.php +++ b/core/autoload.php @@ -4,15 +4,12 @@ require __DIR__ . '/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Un require __DIR__ . '/lib/Thelia/Autoload/TheliaUniversalClassLoader.php'; require __DIR__ . '/lib/Thelia/Autoload/TheliaApcUniversalClassLoader.php'; - use Thelia\Autoload\TheliaUniversalClassLoader; use Thelia\Autoload\TheliaApcUniversalClassLoader; - -if(extension_loaded('apc') && $env == 'prod'){ +if (extension_loaded('apc') && $env == 'prod') { $loader = new TheliaApcUniversalClassLoader('Thelia'); -} -else{ +} else { $loader = new TheliaUniversalClassLoader(); } @@ -24,8 +21,4 @@ foreach ($namespaces as $namespace => $directory) { $loader->registerNamespace('Thelia', __DIR__ . '/lib/'); - $loader->register(); - - -?> diff --git a/core/bootstrap.php b/core/bootstrap.php index 8b37e3ca3..1f1337b00 100644 --- a/core/bootstrap.php +++ b/core/bootstrap.php @@ -1,23 +1,18 @@ diff --git a/core/lib/Thelia/Autoload/TheliaApcUniversalClassLoader.php b/core/lib/Thelia/Autoload/TheliaApcUniversalClassLoader.php index ad9818a25..162109ee4 100644 --- a/core/lib/Thelia/Autoload/TheliaApcUniversalClassLoader.php +++ b/core/lib/Thelia/Autoload/TheliaApcUniversalClassLoader.php @@ -3,41 +3,42 @@ namespace Thelia\Autoload; /** - * + * * @author Manuel Raynaud */ -class TheliaApcUniversalClassLoader extends TheliaUniversalClassLoader { - +class TheliaApcUniversalClassLoader extends TheliaUniversalClassLoader +{ private $prefix; - + /** * Constructor - * + * * Come from Symfony\Component\ClassLoader\ApcUniversalClassLoader - * - * @param string $prefix + * + * @param string $prefix * @throws \RuntimeException */ - public function __construct($prefix) { + public function __construct($prefix) + { if (!extension_loaded('apc')) { throw new \RuntimeException('Unable to use ApcUniversalClassLoader as APC is not enabled.'); } $this->prefix = $prefix; } - - + /** * Finds a file by class name while caching lookups to APC. - * + * * Come from Symfony\Component\ClassLoader\ApcUniversalClassLoader * * @param string $class A class name to resolve to file * * @return string|null The path, if found */ - public function findFile($class) { + public function findFile($class) + { if (false === $file = apc_fetch($this->prefix.$class)) { apc_store($this->prefix.$class, $file = parent::findFile($class)); } @@ -45,4 +46,3 @@ class TheliaApcUniversalClassLoader extends TheliaUniversalClassLoader { return $file; } } -?> diff --git a/core/lib/Thelia/Autoload/TheliaUniversalClassLoader.php b/core/lib/Thelia/Autoload/TheliaUniversalClassLoader.php index d7fffc667..f7d11c45c 100644 --- a/core/lib/Thelia/Autoload/TheliaUniversalClassLoader.php +++ b/core/lib/Thelia/Autoload/TheliaUniversalClassLoader.php @@ -5,78 +5,77 @@ namespace Thelia\Autoload; use Symfony\Component\ClassLoader\UniversalClassLoader; /** - * TheliaUniversalClassLoader - * + * TheliaUniversalClassLoader + * * extends Symfony\Component\ClassLoader\UniversalClassLoader - * + * * This class respect PSR-0 autoloading standard and allow to load traditionnal Thelia classes - * + * * @author Manuel Raynaud - * + * */ -class TheliaUniversalClassLoader extends UniversalClassLoader{ - +class TheliaUniversalClassLoader extends UniversalClassLoader +{ private $directories = array(); - + /** - * + * * add path directory where autoload can search files - * + * * @param string $directory */ - public function addDirectory($directory){ + public function addDirectory($directory) + { $this->directories[] = $directory; } - - + /** - * + * * add multiple path directory in an array where autoload can search files - * + * * @param array $directories */ - public function addDirectories(array $directories){ - foreach($directories as $directory){ + public function addDirectories(array $directories) + { + foreach ($directories as $directory) { $this->addDirectory($directory); } } - + /** - * + * * return directories where traditional Thelia classes can be found - * + * * @return array an Array of directories */ - public function getDirectories(){ + public function getDirectories() + { return $this->directories; } /** - * + * * Finds the path to the file where the class is defined. - * - * @param string $class The name of the class + * + * @param string $class The name of the class * @return string|null The path, if found */ - public function findFile($class) { - - foreach($this->directories as $directory){ - - if(is_file($directory.DIRECTORY_SEPARATOR.$class.".class.php")){ + public function findFile($class) + { + foreach ($this->directories as $directory) { + + if (is_file($directory.DIRECTORY_SEPARATOR.$class.".class.php")) { return $directory.DIRECTORY_SEPARATOR.$class.".class.php"; } - - if(is_file($directory.DIRECTORY_SEPARATOR.$class.".interface.php")){ + + if (is_file($directory.DIRECTORY_SEPARATOR.$class.".interface.php")) { return $directory.DIRECTORY_SEPARATOR.$class.".interface.php"; } - + } return parent::findFile($class); } - + } - - -?> diff --git a/core/lib/Thelia/Controller/DefaultController.php b/core/lib/Thelia/Controller/DefaultController.php index 9da3e8c2c..4d8f45c6c 100644 --- a/core/lib/Thelia/Controller/DefaultController.php +++ b/core/lib/Thelia/Controller/DefaultController.php @@ -6,29 +6,30 @@ use Thelia\Controller\NullControllerInterface; use Symfony\Component\HttpFoundation\Request; /** - * + * * Must be the last controller call. It fixes default values - * + * * @author Manuel Raynaud */ -class DefaultController implements NullControllerInterface{ +class DefaultController implements NullControllerInterface +{ /** - * + * * set the default value for thelia - * + * * In this case there is no action so we have to verify if some needed params are not missing - * + * * @param \Symfony\Component\HttpFoundation\Request $request */ - public function noAction(Request $request) { - if($request->query->has('view') === false){ + public function noAction(Request $request) + { + if ($request->query->has('view') === false) { $fond = "index"; - if($request->request->has('view')){ + if ($request->request->has('view')) { $fond = $request->request->get('view'); } $request->query->set('view', $fond); } } } -?> diff --git a/core/lib/Thelia/Controller/NullControllerInterface.php b/core/lib/Thelia/Controller/NullControllerInterface.php index bce28c38e..6e832aff6 100644 --- a/core/lib/Thelia/Controller/NullControllerInterface.php +++ b/core/lib/Thelia/Controller/NullControllerInterface.php @@ -5,16 +5,15 @@ namespace Thelia\Controller; use Symfony\Component\HttpFoundation\Request; /** - * + * * @author Manuel Raynaud */ -interface NullControllerInterface { - +interface NullControllerInterface +{ /** * Nothing to do */ public function noAction(Request $request); - + } -?> diff --git a/core/lib/Thelia/Core/EventListener/RequestListener.php b/core/lib/Thelia/Core/EventListener/RequestListener.php index 490645b2e..1f0313196 100644 --- a/core/lib/Thelia/Core/EventListener/RequestListener.php +++ b/core/lib/Thelia/Core/EventListener/RequestListener.php @@ -7,24 +7,23 @@ use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\DependencyInjection\ContainerInterface; -class RequestListener implements EventSubscriberInterface { - +class RequestListener implements EventSubscriberInterface +{ protected $container; - - public function __construct(ContainerInterface $container) { + + public function __construct(ContainerInterface $container) + { $this->container = $container; } - - public function onKernelRequest(GetResponseEvent $event){ - - } - - - public static function getSubscribedEvents(){ + + public function onKernelRequest(GetResponseEvent $event) + { + } + + public static function getSubscribedEvents() + { return array( KernelEvents::REQUEST => array('onKernelRequest', 30) ); } } - -?> diff --git a/core/lib/Thelia/Core/EventListener/ViewListener.php b/core/lib/Thelia/Core/EventListener/ViewListener.php index 33e36e9be..2ae401cc7 100644 --- a/core/lib/Thelia/Core/EventListener/ViewListener.php +++ b/core/lib/Thelia/Core/EventListener/ViewListener.php @@ -5,63 +5,61 @@ namespace Thelia\Core\EventListener; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent; -use Symfony\Component\DependencyInjection\Container; use Symfony\Component\HttpFoundation\Response; use Thelia\Core\Template\ParserInterface; - /** - * + * * ViewSubscriber Main class subscribing to view http response. - * + * * @TODO Look if it's possible to block this definition in dependency-injection - * + * * @author Manuel Raynaud */ -class ViewListener implements EventSubscriberInterface{ - +class ViewListener implements EventSubscriberInterface +{ private $parser; - + /** - * + * * @param \Thelia\Core\Template\ParserInterface $parser */ - public function __construct(ParserInterface $parser) { + public function __construct(ParserInterface $parser) + { $this->parser = $parser; } - + /** - * + * * Launch the parser defined on the constructor and get the result. - * + * * The result is transform id needed into a Response object - * + * * @param \Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent $event */ - public function onKernelView(GetResponseForControllerResultEvent $event){ - + public function onKernelView(GetResponseForControllerResultEvent $event) + { $content = $this->parser->getContent(); - - if($content instanceof Response){ + + if ($content instanceof Response) { $event->setResponse($content); - } - else{ + } else { $event->setResponse(new Response($content, $this->parser->getStatus() ?: 200)); } } - - + + /** - * + * * Register the method to execute in this class for a specific event (here the kernel.view event) - * + * * @return array The event names to listen to */ - public static function getSubscribedEvents(){ + public static function getSubscribedEvents() + { return array( KernelEvents::VIEW => array('onKernelView'), ); } } -?> diff --git a/core/lib/Thelia/Core/Template/Parser.php b/core/lib/Thelia/Core/Template/Parser.php index bd49ba5ec..1ed7a7116 100644 --- a/core/lib/Thelia/Core/Template/Parser.php +++ b/core/lib/Thelia/Core/Template/Parser.php @@ -2,82 +2,85 @@ namespace Thelia\Core\Template; -use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Thelia\Core\Template\ParserInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\EventDispatcher\EventDispatcher; /** - * + * * Master class of Thelia's parser. The loop mechnism depends of this parser - * + * * From this class all the parser is lunch - * - * + * + * * @author Manuel Raynaud */ -class Parser implements ParserInterface { - +class Parser implements ParserInterface +{ const PREFIXE = 'prx'; - + const SHOW_TIME = true; const ALLOW_DEBUG = true; const USE_CACHE = true; - + protected $container; - + protected $content; protected $status = 200; - - public function __construct(ContainerBuilder $container) { + + public function __construct(ContainerBuilder $container) + { $this->container = $container; } - + /** - * + * * This method must return a Symfony\Component\HttpFoudation\Response instance or the content of the response - * + * */ - public function getContent() { + public function getContent() + { $this->loadParser(); $this->content = "toto"; + return $this->content; } - + /** - * + * * set $content with the body of the response or the Response object directly - * + * * @param string|Symfony\Component\HttpFoundation\Response $content */ - public function setContent($content) { + public function setContent($content) + { $this->content = $content; } - + /** - * + * * @return type the status of the response */ - public function getStatus() { + public function getStatus() + { return $this->status; } - + /** - * + * * status HTTP of the response - * + * * @param int $status */ - public function setStatus($status) { + public function setStatus($status) + { $this->status = $status; } - - public function loadParser(){ - + + public function loadParser() + { } - + } -?> diff --git a/core/lib/Thelia/Core/Template/ParserInterface.php b/core/lib/Thelia/Core/Template/ParserInterface.php index a3e234626..18b923e9a 100644 --- a/core/lib/Thelia/Core/Template/ParserInterface.php +++ b/core/lib/Thelia/Core/Template/ParserInterface.php @@ -3,25 +3,23 @@ namespace Thelia\Core\Template; /** - * - * - * + * + * + * * @author Manuel Raynaud - * + * */ -interface ParserInterface { - +interface ParserInterface +{ /** - * + * */ public function getContent(); - + public function setContent($content); - + public function getStatus(); - + public function setStatus($status); } - -?> \ No newline at end of file diff --git a/core/lib/Thelia/Core/Thelia.php b/core/lib/Thelia/Core/Thelia.php index 9b9f11f9b..03c517b6e 100644 --- a/core/lib/Thelia/Core/Thelia.php +++ b/core/lib/Thelia/Core/Thelia.php @@ -4,90 +4,88 @@ namespace Thelia\Core; /** * Root class of Thelia - * + * * It extends Symfony\Component\HttpKernel\Kernel for changing some fonctionnality - * - * + * + * * @author Manuel Raynaud */ - use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Config\Loader\LoaderInterface; use Thelia\Core\TheliaBundle; -class Thelia extends Kernel { +class Thelia extends Kernel +{ /** * Initializes the service container. - * + * * @TODO cache container initialization * * The cached version of the service container is used when fresh, otherwise the * container is built. */ - protected function initializeContainer(){ + protected function initializeContainer() + { $this->container = $this->buildContainer(); $this->container->set('kernel', $this); } - + /** * Builds the service container. * * @return ContainerBuilder The compiled service container */ - protected function buildContainer(){ - + protected function buildContainer() + { $container = $this->getContainerBuilder(); - - foreach($this->bundles as $bundle){ + + foreach ($this->bundles as $bundle) { $bundle->build($container); } - + return $container; } - - - + /** * return available bundle - * + * * Part of Symfony\Component\HttpKernel\KernelInterface - * + * * @return array An array of bundle instances. - * + * */ - public function registerBundles() { - + public function registerBundles() + { $bundles = array( /* TheliaBundle contain all the dependency injection description */ new TheliaBundle() ); - + /** * OTHER CORE BUNDLE CAN BE DECLARE HERE AND INITIALIZE WITH SPECIFIC CONFIGURATION - * + * * HOW TO DECLARE OTHER BUNDLE ? ETC */ - + return $bundles; - + } /** * Loads the container configuration - * + * * part of Symfony\Component\HttpKernel\KernelInterface * * @param LoaderInterface $loader A LoaderInterface instance * * @api */ - public function registerContainerConfiguration(LoaderInterface $loader){ + public function registerContainerConfiguration(LoaderInterface $loader) + { //Nothing is load here but it's possible to load container configuration here. //exemple in sf2 : $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml'); } - - + } -?> diff --git a/core/lib/Thelia/Core/TheliaBundle.php b/core/lib/Thelia/Core/TheliaBundle.php index 0568521e9..135e43011 100644 --- a/core/lib/Thelia/Core/TheliaBundle.php +++ b/core/lib/Thelia/Core/TheliaBundle.php @@ -10,42 +10,42 @@ use Symfony\Component\DependencyInjection\Scope; /** * First Bundle use in Thelia * It initialize dependency injection container. - * + * * @TODO load configuration from thelia plugin * @TODO register database configuration. - * - * + * + * * @author Manuel Raynaud */ -class TheliaBundle extends Bundle { - +class TheliaBundle extends Bundle +{ /** - * + * * Construct the depency injection builder - * + * * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container */ - - public function build(ContainerBuilder $container) { - + + public function build(ContainerBuilder $container) + { $container->addScope( new Scope('request')); - + $container->register('request', 'Symfony\Component\HttpFoundation\Request') ->setSynthetic(true); - + $container->register('controller.default','Thelia\Controller\DefaultController'); $container->register('matcher.default','Thelia\Routing\Matcher\DefaultMatcher') ->addArgument(new Reference('controller.default')); - + $container->register('matcher','Thelia\Routing\Matcher\theliaMatcherCollection') ->addMethodCall('add', array(new Reference('matcher.default'), -255)) //->addMethodCall('add','a matcher class (instance or class name) - + ; - + $container->register('resolver', 'Symfony\Component\HttpKernel\Controller\ControllerResolver'); - + $container->register('parser','Thelia\Core\Template\Parser') ->addArgument(new Reference('service_container')) ; @@ -55,13 +55,13 @@ class TheliaBundle extends Bundle { $container->register('listener.router', 'Symfony\Component\HttpKernel\EventListener\RouterListener') ->setArguments(array(new Reference('matcher'))) ; - + /** * @TODO add an other listener on kernel.request for checking some params Like check if User is log in, set the language and other. - * + * * $container->register() - * - * + * + * * $container->register('listener.request', 'Thelia\Core\EventListener\RequestListener') * ->addArgument(new Reference(''); * ; @@ -70,26 +70,23 @@ class TheliaBundle extends Bundle { $container->register('thelia.listener.view','Thelia\Core\EventListener\ViewListener') ->addArgument(new Reference('parser')) ; - + $container->register('http_kernel','Symfony\Component\HttpKernel\HttpKernel') - ->addArgument(new Reference('dispatcher')) + ->addArgument(new Reference('dispatcher')) ->addArgument(new Reference('resolver')) - ; - + ; + $container->register('dispatcher','Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher') ->addArgument(new Reference('service_container')) ->addMethodCall('addSubscriber', array(new Reference('listener.router'))) ->addMethodCall('addSubscriber', array(new Reference('thelia.listener.view'))) ; - + // DEFINE DEFAULT PARAMETER LIKE - - - + /** * @TODO learn about container compilation */ - + } } -?> diff --git a/core/lib/Thelia/Routing/Matcher/DefaultMatcher.php b/core/lib/Thelia/Routing/Matcher/DefaultMatcher.php index 2962cbab4..2e8a158ca 100644 --- a/core/lib/Thelia/Routing/Matcher/DefaultMatcher.php +++ b/core/lib/Thelia/Routing/Matcher/DefaultMatcher.php @@ -8,29 +8,26 @@ use Thelia\Controller\NullControllerInterface; /** * Default matcher when no action is needed and there is no result for urlmatcher - * + * * @author Manuel Raynaud */ -class DefaultMatcher implements RequestMatcherInterface{ - +class DefaultMatcher implements RequestMatcherInterface +{ protected $controller; - - public function __construct(NullControllerInterface $controller) { + + public function __construct(NullControllerInterface $controller) + { $this->controller = $controller; } - - public function matchRequest(Request $request) { - - + + public function matchRequest(Request $request) + { $objectInformation = new \ReflectionObject($this->controller); - + $parameter = array( - '_controller' => $objectInformation->getName().'::noAction' + '_controller' => $objectInformation->getName().'::noAction' ); - + return $parameter; } } - - -?> \ No newline at end of file diff --git a/core/lib/Thelia/Routing/Matcher/TheliaMatcherCollection.php b/core/lib/Thelia/Routing/Matcher/TheliaMatcherCollection.php index 546b03a03..ebaa3c83a 100644 --- a/core/lib/Thelia/Routing/Matcher/TheliaMatcherCollection.php +++ b/core/lib/Thelia/Routing/Matcher/TheliaMatcherCollection.php @@ -10,91 +10,90 @@ use Symfony\Component\Routing\RequestContext; use Symfony\Component\HttpFoundation\Request; /** - * - * Collection of Matcher. - * + * + * Collection of Matcher. + * * Matcher resolve request into controller::method * exemple of Matcher : UrlMatcher of HttpKernel component (but it implements UrlMatcherInterface and not RequestMatcherInterface. - * + * * @author Manuel Raynaud */ - -class TheliaMatcherCollection implements RequestMatcherInterface, RequestContextAwareInterface { - +class TheliaMatcherCollection implements RequestMatcherInterface, RequestContextAwareInterface +{ protected $context; protected $matchers = array(); protected $defaultMatcher; - + protected $sortedMatchers = array(); - + /** * Constructor - * + * * Check if this constructor is needed (is RequestContext needed ? ) */ - public function __construct() { + public function __construct() + { $this->context = new RequestContext(); } - - + /** * allow to add a matcher routing class to the matchers collection * matcher must implement RequestMatcherInterface - * + * * priority can be fixed with $priority parameter - * + * * @param RequestMatcherInterface $matcher - * @param int $priority set the priority of the added matcher - * + * @param int $priority set the priority of the added matcher + * */ - public function add(RequestMatcherInterface $matcher, $priority = 0){ - if(!is_object($matcher)){ + public function add(RequestMatcherInterface $matcher, $priority = 0) + { + if (!is_object($matcher)) { $matcher = new $matcher(); } - - if(!isset($this->matchers[$priority])){ + + if (!isset($this->matchers[$priority])) { $this->matchers[$priority] = array(); } - + $this->matchers[$priority][] = $matcher; $this->sortedMatchers = array(); } - - + /** - * + * * Sort Matchers by priority - * + * * @return array Array of matchers sorted by priority. */ - public function getSortedMatchers(){ - if(empty($this->sortedMatchers)){ + public function getSortedMatchers() + { + if (empty($this->sortedMatchers)) { $this->sortedMatchers = $this->sortMatchers(); } - + return $this->sortedMatchers; } - - + /** - * + * * Sort the matcher by priority - * + * * @return array Array of matchers sorted by priority. */ - public function sortMatchers(){ + public function sortMatchers() + { $sortedMatchers = array(); krsort($this->matchers); - - foreach($this->matchers as $matcher){ + + foreach ($this->matchers as $matcher) { $sortedMatchers = array_merge($sortedMatchers,$matcher); } - + return $sortedMatchers; } - - + /** * Tries to match a request with a set of routes. * @@ -108,38 +107,37 @@ class TheliaMatcherCollection implements RequestMatcherInterface, RequestContext * @throws ResourceNotFoundException If no matching resource could be found * @throws MethodNotAllowedException If a matching resource was found but the request method is not allowed */ - public function matchRequest(Request $request) { - if(empty($this->matchers)){ + public function matchRequest(Request $request) + { + if (empty($this->matchers)) { throw new \InvalidArgumentException('there is no matcher added to the TheliaMatcherCollection'); } - - foreach($this->getSortedMatchers() as $matcher){ - try{ + + foreach ($this->getSortedMatchers() as $matcher) { + try { return $matcher->matchRequest($request); - } - catch (ResourceNotFoundException $e){ + } catch (ResourceNotFoundException $e) { //no action, wait for next matcher - } - catch(MethodNotAllowedException $e){ + } catch (MethodNotAllowedException $e) { /** * @todo what todo with a MethodNotAllowedException ? */ } } - throw new ResourceNotFoundException('No one matcher in this collection matched the current request'); } - + /** * Sets the request context. * * @param RequestContext $context The context * */ - public function setContext(RequestContext $context){ + public function setContext(RequestContext $context) + { $this->context = $context; - + } /** @@ -148,8 +146,8 @@ class TheliaMatcherCollection implements RequestMatcherInterface, RequestContext * @return RequestContext The context * */ - public function getContext(){ + public function getContext() + { return $this->context; - } + } } -?> \ No newline at end of file diff --git a/index.php b/index.php index f31f4cbf5..32a82052e 100644 --- a/index.php +++ b/index.php @@ -1,4 +1,3 @@ diff --git a/index_dev.php b/index_dev.php index 0f7bc8f16..d8a403ff7 100644 --- a/index_dev.php +++ b/index_dev.php @@ -15,16 +15,12 @@ $trustIp = array( $request = Request::createFromGlobals(); -if( false === in_array($request->getClientIp(), $trustIp)){ +if ( false === in_array($request->getClientIp(), $trustIp)) { //change request to send to a 404 error page } - $thelia = new Thelia('dev', true); $response = $thelia->handle($request)->prepare($request)->send(); $thelia->terminate($request, $response); - - -?> diff --git a/local/config/config_db.mysql.php b/local/config/config_db.mysql.php index 1e54ecf4d..e69a0e2ef 100644 --- a/local/config/config_db.mysql.php +++ b/local/config/config_db.mysql.php @@ -6,7 +6,6 @@ //database type : mysql, sqlite, pgsql, etc define('THELIA_DB_TYPE','mysql'); - // database login define('THELIA_BD_LOGIN', '__DB_LOGIN__'); @@ -15,6 +14,3 @@ define('THELIA_BD_PASSWORD', '__DB_PASSWORD__'); //database DSN define('THELIA_DB_DSN','mysql:dbname=__DB_NAME__;host:__DB_HOST__'); - - -?> diff --git a/local/config/config_db.pgsql.php b/local/config/config_db.pgsql.php index 4ec0fed8f..683bd9eb0 100644 --- a/local/config/config_db.pgsql.php +++ b/local/config/config_db.pgsql.php @@ -12,8 +12,4 @@ define('THELIA_BD_LOGIN', '__DB_LOGIN__'); // database password define('THELIA_BD_PASSWORD', '__DB_PASSWORD__'); - define('THELIA_DB_DSN','pgsql:dbname=__DB_NAME__;host:__DB_HOST__'); - - -?> diff --git a/local/config/config_db.sqlite.php b/local/config/config_db.sqlite.php index e20c73846..d6e539543 100644 --- a/local/config/config_db.sqlite.php +++ b/local/config/config_db.sqlite.php @@ -12,8 +12,4 @@ define('THELIA_BD_LOGIN', '__DB_LOGIN__'); // database password define('THELIA_BD_PASSWORD', '__DB_PASSWORD__'); - define('THELIA_DB_DSN','sqlite:__DB_FILE__'); - - -?> diff --git a/local/config/container.php b/local/config/container.php index bdd3471f5..b74e9dacf 100644 --- a/local/config/container.php +++ b/local/config/container.php @@ -1,25 +1,18 @@ register('database','Thelia\\Database\\Connection'); $container->register('http_kernel','Symfony\\Component\\HttpKernel\\HttpKernel'); $container->register('session','Symfony\\Component\\HttpFoundation\\Session\\Session'); - return $container; -?>