1: <?php
2: /**
3: * This file is part of the Autarky package.
4: *
5: * (c) Andreas Lutro <anlutro@gmail.com>
6: *
7: * For the full copyright and license information, please view the LICENSE
8: * file that was distributed with this source code.
9: */
10:
11: namespace Autarky\Routing;
12:
13: use Autarky\ConfiguratorInterface;
14: use Autarky\Config\ConfigInterface;
15:
16: /**
17: * This configurator reads the app/config/routes file and mounts it onto the
18: * root path of your application.
19: */
20: class DefaultRouteConfigurator implements ConfiguratorInterface
21: {
22: /**
23: * The config instance.
24: *
25: * @var ConfigInterface
26: */
27: protected $config;
28:
29: /**
30: * The router instance.
31: *
32: * @var RouterInterface
33: */
34: protected $router;
35:
36: /**
37: * Constructor.
38: *
39: * @param RouterInterface $router
40: * @param ConfigInterface $config
41: */
42: public function __construct(
43: RouterInterface $router,
44: ConfigInterface $config
45: ) {
46: $this->router = $router;
47: $this->config = $config;
48: }
49:
50: /**
51: * {@inheritdoc}
52: */
53: public function configure()
54: {
55: $this->router->mount($this->config->get('routes'), '/');
56: }
57: }
58: