Completed
Push — master ( df5cd6...0fadf2 )
by Marcos Sigueros
12:09
created

BookController::show()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
include('../vendor/autoload.php');
4
5
class HomeController{
6
    
7
    function index(){
8
        return 'Hello people <form action="greeting/man" method="POST"><input type="Submit"></form>';
9
    }
10
    
11
    function greet($a){
12
        return 'Hello '.$a;
13
    }
14
15
}
16
17
class BookController{
18
    
19
    function show($a){
20
        return 'Book => '.$a;
21
    }
22
    
23
}
24
25
$routes = [
26
    '\/annon' => ['GET', function(){
27
        return "Oh yeah callbacks :D";
28
    }],
29
    '\/greeting\/(.*)' => ['GET', 'HomeController@greet'],
30
    '\/book\/([0-9]*)' => 'BookController@show',
31
    '\/' => 'HomeController'
32
];
33
34
$router = new \PHPico\Router();
35
echo($router->dispatch($routes));
36