From ad017285e15b077bf0ca3457f05a7b082abea6b0 Mon Sep 17 00:00:00 2001
From: Thomas Tanghus <thomas@tanghus.net>
Date: Wed, 23 Oct 2013 05:57:34 +0200
Subject: [PATCH] Fix namespace for OCP\Appframework\Http

To avoid having to use OCP\Appframework\Http\Http in the public - and stable
- API OCP\Appframework\Http is now both a class and a namespace.
---
 lib/private/appframework/dependencyinjection/dicontainer.php | 2 +-
 lib/private/appframework/{http => }/http.php                 | 5 +++--
 lib/private/appframework/http/dispatcher.php                 | 1 +
 lib/private/appframework/http/redirectresponse.php           | 3 ++-
 .../appframework/middleware/security/securitymiddleware.php  | 2 +-
 lib/public/appframework/{http => }/http.php                  | 2 +-
 lib/public/appframework/http/jsonresponse.php                | 1 +
 lib/public/appframework/http/response.php                    | 1 +
 tests/lib/appframework/http/DispatcherTest.php               | 4 ++--
 tests/lib/appframework/http/HttpTest.php                     | 1 +
 tests/lib/appframework/http/RedirectResponseTest.php         | 1 +
 tests/lib/appframework/http/ResponseTest.php                 | 3 ++-
 .../middleware/security/SecurityMiddlewareTest.php           | 2 +-
 13 files changed, 18 insertions(+), 10 deletions(-)
 rename lib/private/appframework/{http => }/http.php (98%)
 rename lib/public/appframework/{http => }/http.php (98%)

diff --git a/lib/private/appframework/dependencyinjection/dicontainer.php b/lib/private/appframework/dependencyinjection/dicontainer.php
index 81910df6990..ae2c5e8546b 100644
--- a/lib/private/appframework/dependencyinjection/dicontainer.php
+++ b/lib/private/appframework/dependencyinjection/dicontainer.php
@@ -24,7 +24,7 @@
 
 namespace OC\AppFramework\DependencyInjection;
 
-use OC\AppFramework\Http\Http;
+use OC\AppFramework\Http;
 use OC\AppFramework\Http\Request;
 use OC\AppFramework\Http\Dispatcher;
 use OC\AppFramework\Core\API;
diff --git a/lib/private/appframework/http/http.php b/lib/private/appframework/http.php
similarity index 98%
rename from lib/private/appframework/http/http.php
rename to lib/private/appframework/http.php
index e00dc9cdc4a..41fc0db6b38 100644
--- a/lib/private/appframework/http/http.php
+++ b/lib/private/appframework/http.php
@@ -22,10 +22,11 @@
  */
 
 
-namespace OC\AppFramework\Http;
+namespace OC\AppFramework;
 
+use OCP\AppFramework\Http as BaseHttp;
 
-class Http extends \OCP\AppFramework\Http\Http{
+class Http extends BaseHttp {
 
 	private $server;
 	private $protocolVersion;
diff --git a/lib/private/appframework/http/dispatcher.php b/lib/private/appframework/http/dispatcher.php
index 51283fd64e7..a2afb53f0fa 100644
--- a/lib/private/appframework/http/dispatcher.php
+++ b/lib/private/appframework/http/dispatcher.php
@@ -25,6 +25,7 @@
 namespace OC\AppFramework\Http;
 
 use \OC\AppFramework\Middleware\MiddlewareDispatcher;
+use \OC\AppFramework\Http;
 use OCP\AppFramework\Controller;
 
 
diff --git a/lib/private/appframework/http/redirectresponse.php b/lib/private/appframework/http/redirectresponse.php
index 688447f1618..c4e21059480 100644
--- a/lib/private/appframework/http/redirectresponse.php
+++ b/lib/private/appframework/http/redirectresponse.php
@@ -24,7 +24,8 @@
 
 namespace OC\AppFramework\Http;
 
-use OCP\AppFramework\Http\Response;
+use OCP\AppFramework\Http\Response,
+	OCP\AppFramework\Http;
 
 
 /**
diff --git a/lib/private/appframework/middleware/security/securitymiddleware.php b/lib/private/appframework/middleware/security/securitymiddleware.php
index f103a40ee7f..c3143754823 100644
--- a/lib/private/appframework/middleware/security/securitymiddleware.php
+++ b/lib/private/appframework/middleware/security/securitymiddleware.php
@@ -24,7 +24,7 @@
 
 namespace OC\AppFramework\Middleware\Security;
 
-use OC\AppFramework\Http\Http;
+use OC\AppFramework\Http;
 use OC\AppFramework\Http\RedirectResponse;
 use OC\AppFramework\Utility\MethodAnnotationReader;
 use OCP\AppFramework\Middleware;
diff --git a/lib/public/appframework/http/http.php b/lib/public/appframework/http.php
similarity index 98%
rename from lib/public/appframework/http/http.php
rename to lib/public/appframework/http.php
index 9eafe782726..c05d8f8e46e 100644
--- a/lib/public/appframework/http/http.php
+++ b/lib/public/appframework/http.php
@@ -22,7 +22,7 @@
  */
 
 
-namespace OCP\AppFramework\Http;
+namespace OCP\AppFramework;
 
 
 class Http {
diff --git a/lib/public/appframework/http/jsonresponse.php b/lib/public/appframework/http/jsonresponse.php
index 085fdbed2f9..fa7d32596e8 100644
--- a/lib/public/appframework/http/jsonresponse.php
+++ b/lib/public/appframework/http/jsonresponse.php
@@ -24,6 +24,7 @@
 
 namespace OCP\AppFramework\Http;
 
+use OCP\AppFramework\Http;
 
 /**
  * A renderer for JSON calls
diff --git a/lib/public/appframework/http/response.php b/lib/public/appframework/http/response.php
index 5ca389b9946..54dc860fec2 100644
--- a/lib/public/appframework/http/response.php
+++ b/lib/public/appframework/http/response.php
@@ -24,6 +24,7 @@
 
 namespace OCP\AppFramework\Http;
 
+use OCP\AppFramework\Http;
 
 /**
  * Base class for responses. Also used to just send headers.
diff --git a/tests/lib/appframework/http/DispatcherTest.php b/tests/lib/appframework/http/DispatcherTest.php
index 9052fe0781a..6cf0da879ff 100644
--- a/tests/lib/appframework/http/DispatcherTest.php
+++ b/tests/lib/appframework/http/DispatcherTest.php
@@ -26,7 +26,7 @@ namespace OC\AppFramework\Http;
 
 use OC\AppFramework\Core\API;
 use OC\AppFramework\Middleware\MiddlewareDispatcher;
-
+use OCP\AppFramework\Http;
 //require_once(__DIR__ . "/../classloader.php");
 
 
@@ -53,7 +53,7 @@ class DispatcherTest extends \PHPUnit_Framework_TestCase {
 			->disableOriginalConstructor()
 			->getMock();
 		$this->http = $this->getMockBuilder(
-			'\OC\AppFramework\Http\Http')
+			'\OC\AppFramework\Http')
 			->disableOriginalConstructor()
 			->getMock();
 
diff --git a/tests/lib/appframework/http/HttpTest.php b/tests/lib/appframework/http/HttpTest.php
index 382d511b116..0bdcee24c99 100644
--- a/tests/lib/appframework/http/HttpTest.php
+++ b/tests/lib/appframework/http/HttpTest.php
@@ -24,6 +24,7 @@
 
 namespace OC\AppFramework\Http;
 
+use OC\AppFramework\Http;
 
 //require_once(__DIR__ . "/../classloader.php");
 
diff --git a/tests/lib/appframework/http/RedirectResponseTest.php b/tests/lib/appframework/http/RedirectResponseTest.php
index 1946655b0fa..f82d0c3a675 100644
--- a/tests/lib/appframework/http/RedirectResponseTest.php
+++ b/tests/lib/appframework/http/RedirectResponseTest.php
@@ -24,6 +24,7 @@
 
 namespace OC\AppFramework\Http;
 
+use OCP\AppFramework\Http;
 
 //require_once(__DIR__ . "/../classloader.php");
 
diff --git a/tests/lib/appframework/http/ResponseTest.php b/tests/lib/appframework/http/ResponseTest.php
index 7e09086f801..1a38c38c1e7 100644
--- a/tests/lib/appframework/http/ResponseTest.php
+++ b/tests/lib/appframework/http/ResponseTest.php
@@ -25,7 +25,8 @@
 namespace OC\AppFramework\Http;
 
 
-use OCP\AppFramework\Http\Response;
+use OCP\AppFramework\Http\Response,
+	OCP\AppFramework\Http;
 
 
 class ResponseTest extends \PHPUnit_Framework_TestCase {
diff --git a/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php b/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php
index 4bfd725ffd0..dae6135dc54 100644
--- a/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php
+++ b/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php
@@ -24,7 +24,7 @@
 
 namespace OC\AppFramework\Middleware\Security;
 
-use OC\AppFramework\Http\Http;
+use OC\AppFramework\Http;
 use OC\AppFramework\Http\Request;
 use OC\AppFramework\Http\RedirectResponse;
 use OCP\AppFramework\Http\JSONResponse;
-- 
GitLab