Skip to content

Commit

Permalink
Fixing bug in documentation
Browse files Browse the repository at this point in the history
Signed-off-by: RJ Garcia <rj@bighead.net>
  • Loading branch information
ragboyjr committed Dec 20, 2016
1 parent f1d54f7 commit a740edb
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 10 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ The Mw library is a very flexible framework for converting middleware into handl
use Krak\Mw;

$handler = mw\compose([
function($a, $next) {
return strtoupper($a);
function($s, $next) {
return strtoupper($s);
},
function($a, $next) {
return $next('x' . $a . 'x');
function($s, $next) {
return 'x' . $next($s . 'x');
}
]);

$res = $handler('abc');
// $res == 'xABCx'
assert($res == 'xABCX');
```

![](docs/_static/middleware.png)
Expand Down
10 changes: 5 additions & 5 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ Middleware provide a great system for extendable features and the Krak\\Mw libra
use Krak\Mw;
$handler = mw\compose([
function($a, $next) {
return strtoupper($a);
function($s, $next) {
return strtoupper($s);
},
function($a, $next) {
return $next('x' . $a . 'x');
function($s, $next) {
return 'x' . $next($s . 'x');
}
]);
$res = $handler('abc');
// $res == 'xABCx'
assert($res == 'xABCX');
.. image:: _static/middleware.png

Expand Down
17 changes: 17 additions & 0 deletions example/readme.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

require_once __DIR__ . '/../vendor/autoload.php';

use Krak\Mw;

$handler = mw\compose([
function($s, $next) {
return strtoupper($s);
},
function($s, $next) {
return 'x' . $next($s . 'x');
}
]);

$res = $handler('abc');
assert($res == 'xABCX');

0 comments on commit a740edb

Please sign in to comment.