Conditions | 1 |
Paths | 1 |
Total Lines | 34 |
Code Lines | 23 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
22 | public function connect(Application $app) |
||
23 | { |
||
24 | $this->app = $app; |
||
25 | $this->jsrp = new JSRoutingProvider($app); |
||
26 | |||
27 | /** @var \Silex\ControllerCollection $controllers */ |
||
28 | $controllers = $app['controllers_factory']; |
||
29 | |||
30 | $controllers->get("/router.js", function() { |
||
31 | return new Response( |
||
32 | $this->jsrp->getJavaScript(), |
||
33 | 200, |
||
34 | array("Content-Type" => "text/javascript") |
||
35 | ); |
||
36 | })->bind("jsrouter")->getRoute()->setOption("expose",true); |
||
37 | |||
38 | $controllers->get("/routing.js", function() { |
||
39 | return new Response( |
||
40 | $this->jsrp->getJSwithRoutes(), |
||
41 | 200, |
||
42 | array("Content-Type" => "text/javascript") |
||
43 | ); |
||
44 | })->bind("jsrouting")->getRoute()->setOption("expose",true); |
||
45 | |||
46 | $controllers->get("/routes.js", function() { |
||
47 | return new Response( |
||
48 | $this->jsrp->getJSRoutes(), |
||
49 | 200, |
||
50 | array("Content-Type" => "text/javascript") |
||
51 | ); |
||
52 | })->bind("jsroutes")->getRoute()->setOption("expose",true); |
||
53 | |||
54 | return $controllers; |
||
55 | } |
||
56 | } |