diff --git a/core/lib/Thelia/Autoload/TheliaApcUniversalClassLoader.php b/core/lib/Thelia/Autoload/TheliaApcUniversalClassLoader.php index 8549b646d..ad9818a25 100644 --- a/core/lib/Thelia/Autoload/TheliaApcUniversalClassLoader.php +++ b/core/lib/Thelia/Autoload/TheliaApcUniversalClassLoader.php @@ -2,6 +2,11 @@ namespace Thelia\Autoload; +/** + * + * @author Manuel Raynaud + */ + class TheliaApcUniversalClassLoader extends TheliaUniversalClassLoader { private $prefix; @@ -26,7 +31,7 @@ class TheliaApcUniversalClassLoader extends TheliaUniversalClassLoader { /** * Finds a file by class name while caching lookups to APC. * - * Come from Symfony\Component\ClassLoader\ApcUneiversalClassLoader + * Come from Symfony\Component\ClassLoader\ApcUniversalClassLoader * * @param string $class A class name to resolve to file * diff --git a/core/lib/Thelia/Controller/DefaultController.php b/core/lib/Thelia/Controller/DefaultController.php index 8e22ce8c2..c6f5645cb 100644 --- a/core/lib/Thelia/Controller/DefaultController.php +++ b/core/lib/Thelia/Controller/DefaultController.php @@ -4,6 +4,11 @@ namespace Thelia\Controller; use Thelia\Controller\NullController; +/** + * + * @author Manuel Raynaud + */ + class DefaultController extends NullController{ diff --git a/core/lib/Thelia/Controller/NullController.php b/core/lib/Thelia/Controller/NullController.php index 83568dcad..bd2a51e90 100644 --- a/core/lib/Thelia/Controller/NullController.php +++ b/core/lib/Thelia/Controller/NullController.php @@ -2,6 +2,11 @@ namespace Thelia\Controller; +/** + * + * @author Manuel Raynaud + */ + abstract class NullController { /** diff --git a/core/lib/Thelia/Controller/TheliaController.php b/core/lib/Thelia/Controller/TheliaController.php deleted file mode 100644 index fa4e1de5b..000000000 --- a/core/lib/Thelia/Controller/TheliaController.php +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/core/lib/Thelia/Core/Thelia.php b/core/lib/Thelia/Core/Thelia.php index 343b375e6..9b9f11f9b 100644 --- a/core/lib/Thelia/Core/Thelia.php +++ b/core/lib/Thelia/Core/Thelia.php @@ -5,6 +5,8 @@ namespace Thelia\Core; /** * Root class of Thelia * + * It extends Symfony\Component\HttpKernel\Kernel for changing some fonctionnality + * * * @author Manuel Raynaud */ @@ -17,6 +19,8 @@ use Thelia\Core\TheliaBundle; 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. diff --git a/core/lib/Thelia/Core/TheliaBundle.php b/core/lib/Thelia/Core/TheliaBundle.php index 667f5c3bb..e3d04866a 100644 --- a/core/lib/Thelia/Core/TheliaBundle.php +++ b/core/lib/Thelia/Core/TheliaBundle.php @@ -7,8 +7,26 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Reference; 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 { + + /** + * + * Construct the depency injection builder + * + * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container + */ + public function build(ContainerBuilder $container) { $container->addScope( new Scope('request')); @@ -27,13 +45,16 @@ class TheliaBundle extends Bundle { $container->register('resolver', 'Symfony\Component\HttpKernel\Controller\ControllerResolver'); - $container->register('parser','Thelia\Core\TheliaTemplate'); + //$container->register('parser','Thelia\Core\TheliaTemplate'); /** * RouterListener implements EventSubscriberInterface and listen for kernel.request event */ $container->register('listener.router', 'Symfony\Component\HttpKernel\EventListener\RouterListener') ->setArguments(array(new Reference('matcher'))); + /** + * @TODO think how to use kernel.view event for templating. In most of case controller doesn't return a Response instance + */ //$container->register('listener.view') $container->register('http_kernel','Symfony\Component\HttpKernel\HttpKernel') @@ -45,7 +66,9 @@ class TheliaBundle extends Bundle { ->addMethodCall('addSubscriber', array(new Reference('listener.router'))); - + /** + * @TODO learn about container compilation + */ } } diff --git a/core/lib/Thelia/Routing/Matcher/DefaultMatcher.php b/core/lib/Thelia/Routing/Matcher/DefaultMatcher.php index a78553f14..f6669209d 100644 --- a/core/lib/Thelia/Routing/Matcher/DefaultMatcher.php +++ b/core/lib/Thelia/Routing/Matcher/DefaultMatcher.php @@ -8,6 +8,8 @@ use Thelia\Controller\NullController; /** * Default matcher when no action is needed and there is no result for urlmatcher + * + * @author Manuel Raynaud */ class DefaultMatcher implements RequestMatcherInterface{ diff --git a/core/lib/Thelia/Routing/Matcher/TheliaMatcherCollection.php b/core/lib/Thelia/Routing/Matcher/TheliaMatcherCollection.php index fb9d3be8b..33e40a9e6 100644 --- a/core/lib/Thelia/Routing/Matcher/TheliaMatcherCollection.php +++ b/core/lib/Thelia/Routing/Matcher/TheliaMatcherCollection.php @@ -3,13 +3,22 @@ namespace Thelia\Routing\Matcher; use Symfony\Component\Routing\Matcher\RequestMatcherInterface; -//use Symfony\Component\Routing\Matcher\UrlMatcherInterface; use Symfony\Component\Routing\Exception\ResourceNotFoundException; use Symfony\Component\Routing\Exception\MethodNotAllowedException; use Symfony\Component\Routing\RequestContextAwareInterface; use Symfony\Component\Routing\RequestContext; use Symfony\Component\HttpFoundation\Request; +/** + * + * 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 { @@ -22,7 +31,7 @@ class TheliaMatcherCollection implements RequestMatcherInterface, RequestContext /** * Constructor * - * Check if this constructor id needed (is RequestContext needed ? ) + * Check if this constructor is needed (is RequestContext needed ? ) */ public function __construct() { $this->context = new RequestContext(); @@ -31,7 +40,9 @@ class TheliaMatcherCollection implements RequestMatcherInterface, RequestContext /** * allow to add a matcher routing class to the matchers collection - * matcher must implement RequestMatcherInterface or UrlMatcherInterface + * matcher must implement RequestMatcherInterface + * + * priority can be fixed with $priority parameter * * @param RequestMatcherInterface $matcher * @param int $priority set the priority of the added matcher @@ -50,6 +61,13 @@ class TheliaMatcherCollection implements RequestMatcherInterface, RequestContext $this->sortedMatchers = array(); } + + /** + * + * Sort Matchers by priority + * + * @return array Array of matchers sorted by priority. + */ public function getSortedMatchers(){ if(empty($this->sortedMatchers)){ $this->sortedMatchers = $this->sortMatchers(); @@ -58,6 +76,13 @@ class TheliaMatcherCollection implements RequestMatcherInterface, RequestContext return $this->sortedMatchers; } + + /** + * + * Sort the matcher by priority + * + * @return array Array of matchers sorted by priority. + */ public function sortMatchers(){ $sortedMatchers = array(); krsort($this->matchers);