-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathview_cli.php
executable file
·58 lines (51 loc) · 1.19 KB
/
view_cli.php
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
namespace PMVC\PlugIn\view;
${_INIT_CONFIG}[_CLASS] = __NAMESPACE__.'\view_cli';
/**
* @parameters bool $flush
* @parameters bool $plainText
*/
class view_cli extends ViewEngine
{
private function _dump()
{
$data = func_get_args();
if (!is_string($data[0]) && !is_numeric($data[0])) {
$data = \PMVC\plug('underscore')->array()->toQuery($data[0]);
} else {
$data = array_diff($data, [null]);
$data = join(': ', $data);
}
if ($this['plainText']) {
echo $data."\n";
} else {
\PMVC\plug('cli')->tree($data, '%C');
}
}
public function process()
{
if (!empty($this['forward']->action)) {
return;
}
$all = $this->get();
if (!empty($all)) {
$this->_dump($all);
}
}
/**
* Set theme
*/
public function setThemeFolder($val) { }
public function setThemePath($val) { }
/**
* Set veiw
*/
public function set($k, $v=null)
{
if ($this['flush']) {
$this->_dump($k, $v);
} else {
return parent::set($k, $v);
}
}
}