web text renderer
[bdrem.git] / src / bdrem / Cli.php
1 <?php
2 namespace bdrem;
3
4 class Cli
5 {
6     public function run()
7     {
8         $cfg = new Config();
9         $cfg->load();
10         setlocale(LC_TIME, $cfg->locale);
11         $source = $cfg->loadSource();
12
13         $arEvents = $source->getEvents(
14             date('Y-m-d'), $cfg->daysBefore, $cfg->daysAfter
15         );
16         usort($arEvents, '\\bdrem\\Event::compare');
17         $this->render($arEvents);
18     }
19
20     public function render($arEvents)
21     {
22         $r = new Renderer_Console();
23         echo $r->render($arEvents);
24     }
25 }
26 ?>