Commit 31fe1d5e authored by Taddeus Kroes's avatar Taddeus Kroes

Updated some docs and a test.

parent 04252c05
......@@ -35,8 +35,7 @@ require_once 'base.php';
* $baz = new Foo\Bar\Baz(); // Includes 'classes/foo/bar/baz.php'
* </code>
*
* Multiple autoloaders can be registered at the same time. Be sure to disable
* exceptions on the previously added loaders!
* Multiple autoloaders can be registered at the same time:
* <code>
* <code>
* File structure:
......@@ -45,7 +44,7 @@ require_once 'base.php';
* other_classes/
* | bar.php // Contains class 'Bar'
* </code>
* Autoloader::create('classes', false)->register();
* Autoloader::create('classes')->register();
* Autoloader::create('other_classes')->register();
* $foo = new Foo(); // Includes 'classes/foo.php'
* $bar = new Bar(); // Includes 'other_classes/bar.php', since 'classes/bar.php' does not exist
......
......@@ -15,7 +15,27 @@ require_once 'logger.php';
* Base class for instantiable classes in the BasicWeb package.
*
* The base class defines a static 'create' method that acts as a chainable
* shortcut for the class constructor.
* shortcut for the class constructor:
* <code>
* class Foo extends Base {
* function __contruct($bar, $baz) {
* $this->bar = bar;
* $this->baz = baz;
* }
* }
*
* $foo = Foo::create('bar', 'baz');
* // is equivalent to:
* $foo = new Foo('bar', 'baz');
* </code>
*
* The advantage of the 'create' constructor is that is allows chaining:
* <code>
* Foo::create('bar', 'baz')->method();
* // as opposed to:
* $foo = new Foo('bar', 'baz');
* $foo->method();
* </code>
*
* @package BasicWeb
*/
......
......@@ -20,6 +20,7 @@ require_once 'base.php';
* </code>
*
* @package BasicWeb
* @todo Example
*/
class Router extends Base {
/**
......
......@@ -147,7 +147,6 @@ class AutoloaderTest extends PHPUnit_Framework_TestCase {
$second_loader = new Autoloader(PATH.'second');
$this->autoloader->register();
$second_loader->register(true); // Prepend so that the second loader attemps to load Bar first
$second_loader->set_throw_errors(false);
$this->assertInstanceOf('Foo', new FooBaz());
}
}
......
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