1 <?php
2
3 /**
4 * Slimore - The fully (H)MVC framework based on the Slim PHP framework.
5 *
6 * @author Pandao <slimore@ipandao.com>
7 * @copyright 2015 Pandao
8 * @link http://github.com/slimore/slimore
9 * @license MIT License https://github.com/slimore/slimore#license
10 * @version 0.1.0
11 * @package Slimore\Debug
12 */
13
14 namespace Slimore\Debug;
15
16 /**
17 * Class Simpler
18 *
19 * @author Pandao
20 * @package Slimore\Debug
21 */
22
23 class Simpler
24 {
25 /**
26 * Construction method
27 */
28 public function __construct()
29 {
30
31 }
32
33 /**
34 * Using javascript
35 *
36 * @param string|array $script
37 * @param bool $wrap false
38 * @return string
39 */
40
41 public static function js($script, $wrap = false)
42 {
43 echo js($script, $wrap);
44 }
45
46 /**
47 * Alias js() method
48 *
49 * @param string|array $script
50 * @param bool $wrap false
51 * @return string
52 */
53
54 public static function javascript($script, $wrap = false)
55 {
56 echo js($script, $wrap);
57 }
58
59 /**
60 * Using pre format tag and var_dump() formatted printing array/object
61 *
62 * @param array|mixed $array
63 * @return void
64 */
65
66 public static function varDump($array)
67 {
68 echo "<pre>";
69 print_r($array);
70 echo "</pre>";
71 }
72
73 /**
74 * Using pre format tag and print_r() formatted printing array/object
75 *
76 * @param array|mixed $array
77 * @return void
78 */
79
80 public static function printr($array)
81 {
82 echo "<pre>";
83 print_r($array);
84 echo "</pre>";
85 }
86
87 /**
88 * Array to json
89 *
90 * @param array $array
91 * @param bool $return false
92 * @return string
93 */
94
95 public static function json(array $array, $return = false)
96 {
97 header('Content-Type: application/json');
98
99 $json = json_encode($array);
100
101 if ($return) return $json;
102 else echo $json;
103 }
104
105 /**
106 * Like/Using javascript console object
107 *
108 * @param $message
109 * @param string $type log
110 * @return string
111 */
112
113 public static function console($message, $type = 'log')
114 {
115 echo console($message, $type);
116 }
117 }