aboutsummaryrefslogtreecommitdiff
path: root/src/bdrem/Cli.php
blob: c38e1735f06721b8fac1944e500d48294e8aedc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
namespace bdrem;

class Cli extends UserInterface
{
    protected function loadParameters($cfg)
    {
        $params = $GLOBALS['argv'];
        array_shift($params);
        $storeInto = null;
        foreach ($params as $param) {
            if ($storeInto !== null) {
                $cfg->$storeInto = (int)$param;
                $storeInto = null;
                continue;
            }

            if ($param == '--days-after' || $param == '-a') {
                $storeInto = 'daysAfter';
                continue;
            } else if ($param == '--days-before' || $param == '-b') {
                $storeInto = 'daysBefore';
                continue;
            }
            $storeInto = null;
        }
    }

    protected function render($arEvents)
    {
        $r = new Renderer_Console();
        echo $r->render($arEvents);
    }
}
?>