Commit c341ca17 authored by Fabien Potencier's avatar Fabien Potencier

moved classes so that Silex\Provider can be used as a sub-tree split...

moved classes so that Silex\Provider can be used as a sub-tree split independently of eveything else
parent 2d3a96bb
......@@ -37,6 +37,7 @@ use Silex\Api\ServiceProviderInterface;
use Silex\EventListener\MiddlewareListener;
use Silex\EventListener\ConverterListener;
use Silex\EventListener\StringToResponseListener;
use Silex\Provider\Router\LazyUrlMatcher;
/**
* The Silex framework class.
......
......@@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Silex;
namespace Silex\Provider\HttpCache;
use Symfony\Component\HttpKernel\HttpCache\HttpCache as BaseHttpCache;
use Symfony\Component\HttpFoundation\Request;
......
......@@ -11,7 +11,7 @@
namespace Silex\Provider;
use Silex\HttpCache;
use Silex\Provider\HttpCache\HttpCache;
use Silex\Api\ServiceProviderInterface;
use Silex\Api\EventListenerProviderInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
......
......@@ -9,13 +9,12 @@
* file that was distributed with this source code.
*/
namespace Silex\EventListener;
namespace Silex\Provider\Locale;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\EventListener\LocaleListener as BaseLocaleListener;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Routing\RequestContextAwareInterface;
use Silex\Application;
/**
* Initializes the locale based on the current request.
......@@ -26,7 +25,7 @@ class LocaleListener extends BaseLocaleListener
{
protected $app;
public function __construct(Application $app, RequestContextAwareInterface $router = null, RequestStack $requestStack = null)
public function __construct(\Pimple $app, RequestContextAwareInterface $router = null, RequestStack $requestStack = null)
{
parent::__construct($app['locale'], $router, $requestStack);
......
......@@ -11,10 +11,10 @@
namespace Silex\Provider;
use Silex\LazyUrlMatcher;
use Silex\Api\ServiceProviderInterface;
use Silex\Api\EventListenerProviderInterface;
use Silex\EventListener\LocaleListener;
use Silex\Provider\Locale\LocaleListener;
use Silex\Provider\Router\LazyUrlMatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
/**
......
......@@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Silex;
namespace Silex\Provider\Router;
use Symfony\Component\Routing\RequestContext as SymfonyRequestContext;
use Symfony\Component\Routing\Matcher\UrlMatcherInterface;
......
......@@ -9,9 +9,8 @@
* file that was distributed with this source code.
*/
namespace Silex\EventListener;
namespace Silex\Provider\Session;
use Silex\Application;
use Symfony\Component\HttpKernel\EventListener\SessionListener as BaseSessionListener;
/**
......@@ -23,7 +22,7 @@ class SessionListener extends BaseSessionListener
{
private $app;
public function __construct(Application $app)
public function __construct(\Pimple $app)
{
$this->app = $app;
}
......
......@@ -9,9 +9,8 @@
* file that was distributed with this source code.
*/
namespace Silex\EventListener;
namespace Silex\Provider\Session;
use Silex\Application;
use Symfony\Component\HttpKernel\EventListener\TestSessionListener as BaseTestSessionListener;
/**
......@@ -23,7 +22,7 @@ class TestSessionListener extends BaseTestSessionListener
{
private $app;
public function __construct(Application $app)
public function __construct(\Pimple $app)
{
$this->app = $app;
}
......
......@@ -13,8 +13,8 @@ namespace Silex\Provider;
use Silex\Api\ServiceProviderInterface;
use Silex\Api\EventListenerProviderInterface;
use Silex\EventListener\SessionListener;
use Silex\EventListener\TestSessionListener;
use Silex\Provider\Session\SessionListener;
use Silex\Provider\Session\TestSessionListener;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler;
use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
......
......@@ -9,13 +9,13 @@
* file that was distributed with this source code.
*/
namespace Silex;
namespace Silex\Provider\Translation;
use Symfony\Component\Translation\Translator as BaseTranslator;
use Symfony\Component\Translation\MessageSelector;
/**
* Translator that gets the current locale from the Silex application.
* Translator that gets the current locale from the container.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
......@@ -23,7 +23,7 @@ class Translator extends BaseTranslator
{
protected $app;
public function __construct(Application $app, MessageSelector $selector)
public function __construct(\Pimple $app, MessageSelector $selector)
{
$this->app = $app;
......
......@@ -12,7 +12,7 @@
namespace Silex\Provider;
use Silex\Api\ServiceProviderInterface;
use Silex\Translator;
use Silex\Provider\Translation\Translator;
use Symfony\Component\Translation\MessageSelector;
use Symfony\Component\Translation\Loader\ArrayLoader;
use Symfony\Component\Translation\Loader\XliffFileLoader;
......
......@@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Silex;
namespace Silex\Provider\Validator;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidatorFactoryInterface;
......
......@@ -12,7 +12,7 @@
namespace Silex\Provider;
use Silex\Api\ServiceProviderInterface;
use Silex\ConstraintValidatorFactory;
use Silex\Provider\Validator\ConstraintValidatorFactory;
use Symfony\Component\Validator\Validator;
use Symfony\Component\Validator\DefaultTranslator;
use Symfony\Component\Validator\Mapping\ClassMetadataFactory;
......
......@@ -11,7 +11,7 @@
namespace Silex\Tests;
use Silex\LazyUrlMatcher;
use Silex\Provider\Router\LazyUrlMatcher;
/**
* LazyUrlMatcher test case.
......
......@@ -31,7 +31,7 @@ class HttpCacheServiceProviderTest extends \PHPUnit_Framework_TestCase
'http_cache.cache_dir' => sys_get_temp_dir().'/silex_http_cache_'.uniqid(),
));
$this->assertInstanceOf('Silex\HttpCache', $app['http_cache']);
$this->assertInstanceOf('Silex\Provider\HttpCache\HttpCache', $app['http_cache']);
return $app;
}
......
......@@ -56,7 +56,7 @@ class ValidatorServiceProviderTest extends \PHPUnit_Framework_TestCase
*/
public function testConstraintValidatorFactory($app)
{
$this->assertInstanceOf('Silex\ConstraintValidatorFactory', $app['validator.validator_factory']);
$this->assertInstanceOf('Silex\Provider\Validator\ConstraintValidatorFactory', $app['validator.validator_factory']);
$validator = $app['validator.validator_factory']->getInstance(new Custom());
$this->assertInstanceOf('Silex\Tests\Provider\ValidatorServiceProviderTest\Constraint\CustomValidator', $validator);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment