From b54de957d40a886e75f3198f0ab4787fb11f039d Mon Sep 17 00:00:00 2001 From: Jamie Hannaford Date: Wed, 4 Jun 2014 12:58:42 +0200 Subject: [PATCH] Delete custom autoloader Change-Id: Ib63e4aa7507987e89ed9ed63f0130d4f8d3e5c90 --- doc/documentation.php | 16 +---- doc/oo-tutorial-code.php | 5 +- doc/oo-tutorial.md | 28 ++------ doc/streams-tutorial-example.php | 5 +- doc/streams-tutorial.md | 24 +++---- src/OpenStack/Autoloader.php | 120 ------------------------------- tests/AuthTest.php | 3 +- tests/Tests/AutoloaderTest.php | 48 ------------- 8 files changed, 21 insertions(+), 228 deletions(-) delete mode 100644 src/OpenStack/Autoloader.php delete mode 100644 tests/Tests/AutoloaderTest.php diff --git a/doc/documentation.php b/doc/documentation.php index 2a4e5e1..8b28486 100644 --- a/doc/documentation.php +++ b/doc/documentation.php @@ -52,13 +52,7 @@ * The super-simple stream API: * * +The first line should be self-explanatory: we require the main autoloader file +which is generated by Composer. -The first line should be self-explanatory: We require the main -`Bootstrap.php` file (which contains the `Bootstrap` class). - -After that, we declare a list of namespaced objects that we will use. -This way we can refer to them by their short name, rather than by their -fully qualified name. - -The last line initializes the built-in OpenStack autoloader. What does -this mean? It means that this is the only `require` or `include` -statement you need in your code. The library does the rest of the -including for you, on demand, in a performance-sensitive way. +After that, we declare a list of namespaces that we will use. This way we can +refer to classes by their short name, rather than by their fully qualified name. There are some other fancy things that OpenStack::Bootstrap can do for you. Most notably, you can pass configuration parameters into it. But diff --git a/doc/streams-tutorial-example.php b/doc/streams-tutorial-example.php index 82ec269..5aeddb1 100644 --- a/doc/streams-tutorial-example.php +++ b/doc/streams-tutorial-example.php @@ -1,9 +1,8 @@ -The first thing the example above does is require the Autoloader.php + Bootstrap::useStreamWrappers(); + +The first thing the example above does is require Composer's autoloader file, which contains code necessary to autoload anything else we will need. -Next, we call two static methods: - -- Autoloader::useAutoLoader(): This tells the PHP-Client to load any other - classes on demand. Since we use this, we don't need any more `require` - or `include` statements. -- Bootstrap::useStreamWrappers(): This tells OpenStack to register its - stream wrapper classes. +Next, we call Bootstrap::useStreamWrappers(), which tells OpenStack to register +its stream wrapper classes. In a nutshell, PHP allows libraries to map a particular URL pattern to a stream wrapper. PHP-Client registers the `swift://` URL prefix. So any @@ -181,11 +174,10 @@ tokens in a database and re-using them). Here's how a stream context is used: 0, ]; -\OpenStack\Autoloader::useAutoloader(); \OpenStack\Bootstrap::setConfiguration($config); $help = "Authenticate against OpenStack Identity Service. diff --git a/tests/Tests/AutoloaderTest.php b/tests/Tests/AutoloaderTest.php deleted file mode 100644 index df01dfe..0000000 --- a/tests/Tests/AutoloaderTest.php +++ /dev/null @@ -1,48 +0,0 @@ -assertRegExp('/OpenStack/', $basedir); - } - - /** - * Test the autoloader. - */ - public function testAutoloader() - { - \OpenStack\Autoloader::useAutoloader(); - - // If we can construct a class, we are okay. - $test = new \OpenStack\Common\Exception("TEST"); - - $this->assertInstanceOf('\OpenStack\Common\Exception', $test); - } -}