1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-13 12:14:06 +02:00

[ticket/11700] Move all recent code to namespaces

PHPBB3-11700
This commit is contained in:
Nils Adermann
2013-09-10 14:01:09 +02:00
parent 196e1813cd
commit b95fdacdd3
420 changed files with 2316 additions and 1840 deletions

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\controller;
/**
* @ignore
*/
@@ -19,6 +21,6 @@ if (!defined('IN_PHPBB'))
* Controller exception class
* @package phpBB3
*/
class phpbb_controller_exception extends RuntimeException
class exception extends \RuntimeException
{
}

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\controller;
/**
* @ignore
*/
@@ -21,17 +23,17 @@ use Symfony\Component\HttpFoundation\Response;
* Controller helper class, contains methods that do things for controllers
* @package phpBB3
*/
class phpbb_controller_helper
class helper
{
/**
* Template object
* @var phpbb_template
* @var \phpbb\template\template
*/
protected $template;
/**
* User object
* @var phpbb_user
* @var \phpbb\user
*/
protected $user;
@@ -50,12 +52,12 @@ class phpbb_controller_helper
/**
* Constructor
*
* @param phpbb_template $template Template object
* @param phpbb_user $user User object
* @param \phpbb\template\template $template Template object
* @param \phpbb\user $user User object
* @param string $phpbb_root_path phpBB root path
* @param string $php_ext PHP extension
*/
public function __construct(phpbb_template $template, phpbb_user $user, $phpbb_root_path, $php_ext)
public function __construct(\phpbb\template\template $template, \phpbb\user $user, $phpbb_root_path, $php_ext)
{
$this->template = $template;
$this->user = $user;
@@ -81,7 +83,7 @@ class phpbb_controller_helper
page_footer(true, false, false);
return new Response($this->template->assign_display('body'), $status_code);
return new \Response($this->template->assign_display('body'), $status_code);
}
/**

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\controller;
/**
* @ignore
*/
@@ -23,7 +25,7 @@ use Symfony\Component\Config\FileLocator;
* Controller interface
* @package phpBB3
*/
class phpbb_controller_provider
class provider
{
/**
* YAML file(s) containing route information
@@ -48,7 +50,7 @@ class phpbb_controller_provider
*
* @return The current instance of this object for method chaining
*/
public function import_paths_from_finder(phpbb_extension_finder $finder)
public function import_paths_from_finder(\phpbb\extension\finder $finder)
{
// We hardcode the path to the core config directory
// because the finder cannot find it

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\controller;
/**
* @ignore
*/
@@ -23,11 +25,11 @@ use Symfony\Component\HttpFoundation\Request;
* Controller manager class
* @package phpBB3
*/
class phpbb_controller_resolver implements ControllerResolverInterface
class resolver implements ControllerResolverInterface
{
/**
* User object
* @var phpbb_user
* @var \phpbb\user
*/
protected $user;
@@ -38,19 +40,19 @@ class phpbb_controller_resolver implements ControllerResolverInterface
protected $container;
/**
* phpbb_style object
* @var phpbb_style
* \phpbb\style\style object
* @var \phpbb\style\style
*/
protected $style;
/**
* Construct method
*
* @param phpbb_user $user User Object
* @param \phpbb\user $user User Object
* @param ContainerInterface $container ContainerInterface object
* @param phpbb_style $style
* @param \phpbb\style\style $style
*/
public function __construct(phpbb_user $user, ContainerInterface $container, phpbb_style $style = null)
public function __construct(\phpbb\user $user, ContainerInterface $container, \phpbb\style\style $style = null)
{
$this->user = $user;
$this->container = $container;
@@ -62,7 +64,7 @@ class phpbb_controller_resolver implements ControllerResolverInterface
*
* @param Symfony\Component\HttpFoundation\Request $request Symfony Request object
* @return bool|Callable Callable or false
* @throws phpbb_controller_exception
* @throws \phpbb\controller\exception
*/
public function getController(Request $request)
{
@@ -70,20 +72,20 @@ class phpbb_controller_resolver implements ControllerResolverInterface
if (!$controller)
{
throw new phpbb_controller_exception($this->user->lang['CONTROLLER_NOT_SPECIFIED']);
throw new \phpbb\controller\exception($this->user->lang['CONTROLLER_NOT_SPECIFIED']);
}
// Require a method name along with the service name
if (stripos($controller, ':') === false)
{
throw new phpbb_controller_exception($this->user->lang['CONTROLLER_METHOD_NOT_SPECIFIED']);
throw new \phpbb\controller\exception($this->user->lang['CONTROLLER_METHOD_NOT_SPECIFIED']);
}
list($service, $method) = explode(':', $controller);
if (!$this->container->has($service))
{
throw new phpbb_controller_exception($this->user->lang('CONTROLLER_SERVICE_UNDEFINED', $service));
throw new \phpbb\controller\exception($this->user->lang('CONTROLLER_SERVICE_UNDEFINED', $service));
}
$controller_object = $this->container->get($service);
@@ -118,13 +120,13 @@ class phpbb_controller_resolver implements ControllerResolverInterface
* @param Symfony\Component\HttpFoundation\Request $request Symfony Request object
* @param mixed $controller A callable (controller class, method)
* @return bool False
* @throws phpbb_controller_exception
* @throws \phpbb\controller\exception
*/
public function getArguments(Request $request, $controller)
{
// At this point, $controller contains the object and method name
list($object, $method) = $controller;
$mirror = new ReflectionMethod($object, $method);
$mirror = new \ReflectionMethod($object, $method);
$arguments = array();
$parameters = $mirror->getParameters();
@@ -145,7 +147,7 @@ class phpbb_controller_resolver implements ControllerResolverInterface
}
else
{
throw new phpbb_controller_exception($this->user->lang('CONTROLLER_ARGUMENT_VALUE_MISSING', $param->getPosition() + 1, get_class($object) . ':' . $method, $param->name));
throw new \phpbb\controller\exception($this->user->lang('CONTROLLER_ARGUMENT_VALUE_MISSING', $param->getPosition() + 1, get_class($object) . ':' . $method, $param->name));
}
}