-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue if ServerRequestInterface is an argument
- Loading branch information
Showing
20 changed files
with
364 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
use Rougin\Slytherin\Sample\Router; | ||
|
||
$packages = array(); | ||
|
||
// Testing Packages ----------------------------------------------- | ||
$packages[] = 'Rougin\Slytherin\Sample\Packages\HttpPackage'; | ||
$packages[] = 'Rougin\Slytherin\Sample\Packages\MiddlewarePackage'; | ||
$packages[] = 'Rougin\Slytherin\Sample\Packages\RoutingPackage'; | ||
// ---------------------------------------------------------------- | ||
|
||
$config = array('name' => 'Slytherin'); | ||
|
||
$config['base_url'] = 'http://localhost:8000'; | ||
|
||
$config['environment'] = 'development'; | ||
|
||
$config['timezone'] = 'Asia/Manila'; | ||
|
||
$config['router'] = new Router; | ||
|
||
$config['middlewares'] = array(); | ||
|
||
$config['packages'] = $packages; | ||
|
||
return (array) $config; |
2 changes: 1 addition & 1 deletion
2
tests/Forward/Fixture/Depots/SestDepot.php → tests/Sample/Depots/SestDepot.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tests/Forward/Fixture/Depots/TestDepot.php → tests/Sample/Depots/TestDepot.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace Rougin\Slytherin\Sample\Handlers; | ||
|
||
use Interop\Http\ServerMiddleware\DelegateInterface; | ||
use Interop\Http\ServerMiddleware\MiddlewareInterface; | ||
use Psr\Http\Message\ServerRequestInterface; | ||
|
||
/** | ||
* @package Slytherin | ||
* @author Rougin Gutib <rougingutib@gmail.com> | ||
*/ | ||
class Parsed implements MiddlewareInterface | ||
{ | ||
public function process(ServerRequestInterface $request, DelegateInterface $delegate) | ||
{ | ||
$data = array('name' => 'Slytherin'); | ||
|
||
$request = $request->withParsedBody($data); | ||
|
||
return $delegate->process($request); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace Rougin\Slytherin\Sample\Handlers; | ||
|
||
use Interop\Http\ServerMiddleware\DelegateInterface; | ||
use Interop\Http\ServerMiddleware\MiddlewareInterface; | ||
use Psr\Http\Message\ServerRequestInterface; | ||
|
||
/** | ||
* @package Slytherin | ||
* @author Rougin Gutib <rougingutib@gmail.com> | ||
*/ | ||
class ToJson implements MiddlewareInterface | ||
{ | ||
public function process(ServerRequestInterface $request, DelegateInterface $delegate) | ||
{ | ||
$response = $delegate->process($request); | ||
|
||
return $response->withHeader('Content-Type', 'application/json'); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
.../Forward/Fixture/Packages/HttpPackage.php → tests/Sample/Packages/HttpPackage.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...rd/Fixture/Packages/MiddlewarePackage.php → tests/Sample/Packages/MiddlewarePackage.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...rward/Fixture/Packages/RoutingPackage.php → tests/Sample/Packages/RoutingPackage.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.