1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace OpenTribes\Core\Silex\Provider; |
4
|
|
|
|
5
|
|
|
|
6
|
|
|
use OpenTribes\Core\Silex\Controller; |
7
|
|
|
use Silex\Application; |
8
|
|
|
use Silex\ControllerCollection; |
9
|
|
|
use Silex\ControllerProviderInterface; |
10
|
|
|
|
11
|
|
|
class RouteServiceProvider implements ControllerProviderInterface{ |
12
|
|
|
/** |
13
|
|
|
* Returns routes to connect to the given application. |
14
|
|
|
* |
15
|
|
|
* @param Application $app An Application instance |
16
|
|
|
* |
17
|
|
|
* @return ControllerCollection A ControllerCollection instance |
18
|
|
|
*/ |
19
|
35 |
|
public function connect(Application $app) |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* @var ControllerCollection $collection |
23
|
|
|
*/ |
24
|
35 |
|
$collection = $app['controllers_factory']; |
25
|
|
|
$collection |
26
|
35 |
|
->match('/', Controller::INDEX . ':indexAction') |
27
|
35 |
|
->method('GET') |
28
|
35 |
|
->value('template', 'pages/landing'); |
29
|
|
|
$collection |
30
|
35 |
|
->match('/account/login', Controller::INDEX . ':indexAction') |
31
|
35 |
|
->method('POST') |
32
|
35 |
|
->value('template', 'pages/landing'); |
33
|
|
|
$collection |
34
|
35 |
|
->match('/account/create', Controller::ACCOUNT . ':indexAction') |
35
|
35 |
|
->method('POST|GET') |
36
|
35 |
|
->value('template', 'pages/registration'); |
37
|
|
|
$collection |
38
|
35 |
|
->match('/game', Controller::INDEX . ':indexAction') |
39
|
35 |
|
->method('GET') |
40
|
35 |
|
->value('template', 'pages/landing'); |
41
|
|
|
$collection |
42
|
35 |
|
->match('/cities',Controller::CITY.':listAction') |
43
|
35 |
|
->method('GET') |
44
|
35 |
|
->value('template','pages/game/cityList'); |
45
|
|
|
$collection |
46
|
35 |
|
->match('/city/create',Controller::CITY.':createAction') |
47
|
35 |
|
->method('GET') |
48
|
35 |
|
->value('template','pages/game/newcity'); |
49
|
|
|
|
50
|
|
|
|
51
|
35 |
|
return $collection; |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
} |