Skip to content

Commit

Permalink
Tidying
Browse files Browse the repository at this point in the history
  • Loading branch information
olvlvl committed Jan 2, 2016
1 parent f4273c5 commit 58ff8db
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 22 deletions.
1 change: 1 addition & 0 deletions Makefile
Expand Up @@ -28,6 +28,7 @@ doc: vendor
@mkdir -p build/docs
@apigen generate \
--source lib \
--source helpers.php \
--destination build/docs/ \
--title "$(PACKAGE_NAME) v$(PACKAGE_VERSION)" \
--template-theme "bootstrap"
Expand Down
12 changes: 6 additions & 6 deletions README.md
@@ -1,10 +1,10 @@
# HTTP

[![Release](https://img.shields.io/packagist/v/icanboogie/http.svg)](https://packagist.org/packages/icanboogie/http)
[![Build Status](https://img.shields.io/travis/ICanBoogie/HTTP/2.6.svg)](http://travis-ci.org/ICanBoogie/HTTP)
[![Build Status](https://img.shields.io/travis/ICanBoogie/HTTP/master.svg)](http://travis-ci.org/ICanBoogie/HTTP)
[![HHVM](https://img.shields.io/hhvm/icanboogie/http.svg)](http://hhvm.h4cc.de/package/icanboogie/http)
[![Code Quality](https://img.shields.io/scrutinizer/g/ICanBoogie/HTTP/2.6.svg)](https://scrutinizer-ci.com/g/ICanBoogie/HTTP/?branch=2.5)
[![Code Coverage](https://img.shields.io/coveralls/ICanBoogie/HTTP/2.6.svg)](https://coveralls.io/r/ICanBoogie/HTTP)
[![Code Quality](https://img.shields.io/scrutinizer/g/icanboogie/http.svg)](https://scrutinizer-ci.com/g/ICanBoogie/HTTP)
[![Code Coverage](https://img.shields.io/coveralls/ICanBoogie/HTTP.svg)](https://coveralls.io/r/ICanBoogie/HTTP)
[![Packagist](https://img.shields.io/packagist/dt/icanboogie/http.svg)](https://packagist.org/packages/icanboogie/http)

The **icanboogie/http** package provides an API to handle HTTP requests. It provides representations for requests, request files, responses, and headers. A request dispatcher is also provided, that can be used with your favorite routing solution with very little effort.
Expand Down Expand Up @@ -687,7 +687,7 @@ DispatcherProvider::define(function() use ($domain_dispatchers) {

});

get_dispatcher() === DispatcherProvider::provider(); // true
get_dispatcher() === DispatcherProvider::provide(); // true
```


Expand Down Expand Up @@ -1037,8 +1037,8 @@ the `make clean` command.

The package is continuously tested by [Travis CI](http://about.travis-ci.org/).

[![Build Status](https://img.shields.io/travis/ICanBoogie/HTTP/2.6.svg)](https://travis-ci.org/ICanBoogie/HTTP)
[![Code Coverage](https://img.shields.io/coveralls/ICanBoogie/HTTP/2.6.svg)](https://coveralls.io/r/ICanBoogie/HTTP)
[![Build Status](https://img.shields.io/travis/ICanBoogie/HTTP/master.svg)](https://travis-ci.org/ICanBoogie/HTTP)
[![Code Coverage](https://img.shields.io/coveralls/ICanBoogie/HTTP.svg)](https://coveralls.io/r/ICanBoogie/HTTP)



Expand Down
20 changes: 10 additions & 10 deletions lib/DispatcherProvider.php
Expand Up @@ -24,11 +24,11 @@ class DispatcherProvider
/**
* Whether a provider if defined.
*
* @return bool
* @return callable|null
*/
static public function defined()
{
return isset(self::$provider);
return self::$provider;
}

/**
Expand All @@ -47,6 +47,14 @@ static public function define(callable $provider)
return $previous;
}

/**
* Undefine the {@link Dispatcher} provider.
*/
static public function undefine()
{
self::$provider = null;
}

/**
* Returns a {@link Dispatcher} instance using the provider.
*
Expand All @@ -65,12 +73,4 @@ static public function provide()

return $provider();
}

/**
* Clears the provider.
*/
static public function clear()
{
self::$provider = null;
}
}
8 changes: 4 additions & 4 deletions tests/DispatcherProviderTest.php
Expand Up @@ -15,7 +15,7 @@ class DispatcherProviderTest extends \PHPUnit_Framework_TestCase
{
public function tearDown()
{
DispatcherProvider::clear();
DispatcherProvider::undefine();
}

/**
Expand All @@ -31,12 +31,12 @@ public function test_define()
$provider1 = function() { };
$provider2 = function() { };

$this->assertFalse(DispatcherProvider::defined());
$this->assertNull(DispatcherProvider::defined());
$this->assertNull(DispatcherProvider::define($provider1));
$this->assertSame($provider1, DispatcherProvider::define($provider2));
$this->assertTrue(DispatcherProvider::defined());
$this->assertSame($provider2, DispatcherProvider::defined());

DispatcherProvider::clear();
DispatcherProvider::undefine();
$this->assertNull(DispatcherProvider::define($provider1));
}

Expand Down
2 changes: 1 addition & 1 deletion tests/HelpersTest.php
Expand Up @@ -29,6 +29,6 @@ public function test_dispatcher()

$this->assertSame($other_dispatcher, get_dispatcher());

DispatcherProvider::clear();
DispatcherProvider::undefine();
}
}
2 changes: 1 addition & 1 deletion tests/ProvideDispatcherTest.php
Expand Up @@ -22,7 +22,7 @@ public function setUp()
{
$this->events = new EventCollection;

EventCollectionProvider::using(function() {
EventCollectionProvider::define(function() {

return $this->events;

Expand Down

0 comments on commit 58ff8db

Please sign in to comment.