add some phpdoc

This commit is contained in:
Manuel Raynaud
2012-10-11 18:12:42 +02:00
parent b892264882
commit b603c6cf44
8 changed files with 75 additions and 17 deletions

View File

@@ -2,6 +2,11 @@
namespace Thelia\Autoload;
/**
*
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
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
*

View File

@@ -4,6 +4,11 @@ namespace Thelia\Controller;
use Thelia\Controller\NullController;
/**
*
* @author Manuel Raynaud <mraynadu@openstudio.fr>
*/
class DefaultController extends NullController{

View File

@@ -2,6 +2,11 @@
namespace Thelia\Controller;
/**
*
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
abstract class NullController {
/**

View File

@@ -1,11 +0,0 @@
<?php
namespace Thelia\Controller;
use Symfony\Component\HttpKernel\Controller\ControllerResolver;
class TheliaController extends ControllerResolver {
}
?>

View File

@@ -5,6 +5,8 @@ namespace Thelia\Core;
/**
* Root class of Thelia
*
* It extends Symfony\Component\HttpKernel\Kernel for changing some fonctionnality
*
*
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
@@ -18,6 +20,8 @@ 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.
*/

View File

@@ -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 <mraynaud@openstudio.fr>
*/
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
*/
}
}

View File

@@ -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 <mraynaud@openstudio.fr>
*/
class DefaultMatcher implements RequestMatcherInterface{

View File

@@ -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 <mraynaud@openstudio.fr>
*/
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);