Completed
Push — master ( 6a4fed...14d2cb )
by judicael
03:36
created
bundles/lib/Cache/Redis.php 1 patch
Indentation   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -32,109 +32,109 @@
 block discarded – undo
32 32
  */
33 33
 class Redis extends RealRedis implements CacheInterface
34 34
 {
35
-    /**
36
-     * constructor with the connection to Redis
37
-     *
38
-     * @access public
39
-     * @param $oConf
40
-     * @throws \Exception
41
-     * @internal param string $sName name of the session
42
-     * @internal param int $iFlags flags
43
-     * @internal param int $iTimeout expiration of cache
44
-     */
45
-    public function __construct($oConf)
46
-    {
47
-        if (!$this->connect($oConf->host, $oConf->port)) {
35
+	/**
36
+	 * constructor with the connection to Redis
37
+	 *
38
+	 * @access public
39
+	 * @param $oConf
40
+	 * @throws \Exception
41
+	 * @internal param string $sName name of the session
42
+	 * @internal param int $iFlags flags
43
+	 * @internal param int $iTimeout expiration of cache
44
+	 */
45
+	public function __construct($oConf)
46
+	{
47
+		if (!$this->connect($oConf->host, $oConf->port)) {
48 48
 
49
-            throw new \Exception('Redis server unavailable');
50
-        }
49
+			throw new \Exception('Redis server unavailable');
50
+		}
51 51
     
52
-        // Select the REDIS db index
53
-        $this->select($oConf->index);
54
-    }
52
+		// Select the REDIS db index
53
+		$this->select($oConf->index);
54
+	}
55 55
 
56
-    /**
57
-     * get a value
58
-     *
59
-     * @access public
60
-     * @param  string $sName name of the session
61
-     * @param  int $iFlags flags
62
-     * @param  int $iTimeout expiration of cache
63
-     * @return mixed
64
-     */
65
-    public function get(string $sName, int &$iFlags = null, int $iTimeout = 0)
66
-    {
67
-        return parent::get($sName);
68
-    }
56
+	/**
57
+	 * get a value
58
+	 *
59
+	 * @access public
60
+	 * @param  string $sName name of the session
61
+	 * @param  int $iFlags flags
62
+	 * @param  int $iTimeout expiration of cache
63
+	 * @return mixed
64
+	 */
65
+	public function get(string $sName, int &$iFlags = null, int $iTimeout = 0)
66
+	{
67
+		return parent::get($sName);
68
+	}
69 69
 
70
-    /**
71
-     * set a value
72
-     *
73
-     * @access public
74
-     * @param  string $sName name of the session
75
-     * @param  mixed $mValue value of this sesion var
76
-     * @param  int $iFlag unused
77
-     * @param  int $iExpire expiration of cache
78
-     * @return \Venus\lib\Cache\Apc
79
-     */
80
-    public function set(string $sName, $mValue, int $iFlag = 0, int $iExpire = false)
81
-    {
82
-        if ($iExpire === false) {
70
+	/**
71
+	 * set a value
72
+	 *
73
+	 * @access public
74
+	 * @param  string $sName name of the session
75
+	 * @param  mixed $mValue value of this sesion var
76
+	 * @param  int $iFlag unused
77
+	 * @param  int $iExpire expiration of cache
78
+	 * @return \Venus\lib\Cache\Apc
79
+	 */
80
+	public function set(string $sName, $mValue, int $iFlag = 0, int $iExpire = false)
81
+	{
82
+		if ($iExpire === false) {
83 83
 
84
-            return parent::set($sName, $mValue);
85
-        }
86
-        else {
84
+			return parent::set($sName, $mValue);
85
+		}
86
+		else {
87 87
 
88
-            return parent::setex($sName, $iExpire, $mValue);
89
-        }
90
-    }
88
+			return parent::setex($sName, $iExpire, $mValue);
89
+		}
90
+	}
91 91
 
92
-    /**
93
-     * flush the cache
94
-     *
95
-     * @access public
96
-     * @return mixed
97
-     */
98
-    public function flush()
99
-    {
100
-        return false;
101
-    }
92
+	/**
93
+	 * flush the cache
94
+	 *
95
+	 * @access public
96
+	 * @return mixed
97
+	 */
98
+	public function flush()
99
+	{
100
+		return false;
101
+	}
102 102
 
103
-    /**
104
-     * delete a value
105
-     *
106
-     * @access public
107
-     * @param  string $sName name of the session
108
-     * @return mixed
109
-     */
110
-    public function delete(string $sName)
111
-    {
112
-        return $this->del($sName);
113
-    }
103
+	/**
104
+	 * delete a value
105
+	 *
106
+	 * @access public
107
+	 * @param  string $sName name of the session
108
+	 * @return mixed
109
+	 */
110
+	public function delete(string $sName)
111
+	{
112
+		return $this->del($sName);
113
+	}
114 114
 
115
-    /**
116
-     * close the redis connecction
117
-     *
118
-     * @access public
119
-     * @return mixed
120
-     */
121
-    public function __sleep()
122
-    {
123
-        $this->close();
124
-    }
115
+	/**
116
+	 * close the redis connecction
117
+	 *
118
+	 * @access public
119
+	 * @return mixed
120
+	 */
121
+	public function __sleep()
122
+	{
123
+		$this->close();
124
+	}
125 125
 
126
-    /**
127
-     * add
128
-     *
129
-     * @access public
130
-     * @param  string $sName name of the session
131
-     * @param  mixed $mValue value of this sesion var
132
-     * @param  int $iFlag unused
133
-     * @param  int $iExpire expiration of cache
134
-     * @return mixed
135
-     */
136
-    public function add(string $sName, $mValue, int $iExpire = false)
137
-    {
138
-        return $this->set($sName, $mValue, 0, $iExpire);
139
-    }
126
+	/**
127
+	 * add
128
+	 *
129
+	 * @access public
130
+	 * @param  string $sName name of the session
131
+	 * @param  mixed $mValue value of this sesion var
132
+	 * @param  int $iFlag unused
133
+	 * @param  int $iExpire expiration of cache
134
+	 * @return mixed
135
+	 */
136
+	public function add(string $sName, $mValue, int $iExpire = false)
137
+	{
138
+		return $this->set($sName, $mValue, 0, $iExpire);
139
+	}
140 140
 }
Please login to merge, or discard this patch.
bundles/lib/Bash.php 1 patch
Indentation   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -28,126 +28,126 @@
 block discarded – undo
28 28
  */
29 29
 class Bash
30 30
 {
31
-    /**
32
-     * color of the text in the bash
33
-     *
34
-     * @access public
35
-     * @var    array
36
-     */
37
-    public static $_aColorCodes = array(
38
-        'default' => 39,
39
-        'black' => 30,
40
-        'red' => 31,
41
-        'green' => 32,
42
-        'yellow' => 33,
43
-        'blue' => 34,
44
-        'magenta' => 35,
45
-        'cyan' => 36,
46
-        'light gray' => 37,
47
-        'dark gray' => 90,
48
-        'light red' => 91,
49
-        'light green' => 92,
50
-        'light yellow' => 93,
51
-        'light blue' => 94,
52
-        'light magenta' => 95,
53
-        'light cyan' => 96,
54
-        'white' => 97
55
-    );
31
+	/**
32
+	 * color of the text in the bash
33
+	 *
34
+	 * @access public
35
+	 * @var    array
36
+	 */
37
+	public static $_aColorCodes = array(
38
+		'default' => 39,
39
+		'black' => 30,
40
+		'red' => 31,
41
+		'green' => 32,
42
+		'yellow' => 33,
43
+		'blue' => 34,
44
+		'magenta' => 35,
45
+		'cyan' => 36,
46
+		'light gray' => 37,
47
+		'dark gray' => 90,
48
+		'light red' => 91,
49
+		'light green' => 92,
50
+		'light yellow' => 93,
51
+		'light blue' => 94,
52
+		'light magenta' => 95,
53
+		'light cyan' => 96,
54
+		'white' => 97
55
+	);
56 56
 
57
-    /**
58
-     * color of the background in the bash
59
-     *
60
-     * @access public
61
-     * @var    array
62
-     */
63
-    public static $_aBackgroundCodes = array(
64
-        'default' => 49,
65
-        'black' => 40,
66
-        'red' => 41,
67
-        'green' => 42,
68
-        'yellow' => 43,
69
-        'blue' => 44,
70
-        'magenta' => 45,
71
-        'cyan' => 46,
72
-        'light gray' => 47,
73
-        'dark gray' => 100,
74
-        'light red' => 101,
75
-        'light green' => 102,
76
-        'light yellow' => 103,
77
-        'light blue' => 104,
78
-        'light magenta' => 105,
79
-        'light cyan' => 106,
80
-        'white' => 107
81
-    );
57
+	/**
58
+	 * color of the background in the bash
59
+	 *
60
+	 * @access public
61
+	 * @var    array
62
+	 */
63
+	public static $_aBackgroundCodes = array(
64
+		'default' => 49,
65
+		'black' => 40,
66
+		'red' => 41,
67
+		'green' => 42,
68
+		'yellow' => 43,
69
+		'blue' => 44,
70
+		'magenta' => 45,
71
+		'cyan' => 46,
72
+		'light gray' => 47,
73
+		'dark gray' => 100,
74
+		'light red' => 101,
75
+		'light green' => 102,
76
+		'light yellow' => 103,
77
+		'light blue' => 104,
78
+		'light magenta' => 105,
79
+		'light cyan' => 106,
80
+		'white' => 107
81
+	);
82 82
 
83
-    /**
84
-     * color of the decoration code in the bash
85
-     *
86
-     * @access public
87
-     * @var    array
88
-     */
89
-    public static $_aDecorationCodes = array(
90
-        'bold' => '1',
91
-        'dim' => '2',
92
-        'underline' => '4',
93
-        'blink' => '5',
94
-        'reverse' => '7',
95
-        'hidden' => '8'
96
-    );
83
+	/**
84
+	 * color of the decoration code in the bash
85
+	 *
86
+	 * @access public
87
+	 * @var    array
88
+	 */
89
+	public static $_aDecorationCodes = array(
90
+		'bold' => '1',
91
+		'dim' => '2',
92
+		'underline' => '4',
93
+		'blink' => '5',
94
+		'reverse' => '7',
95
+		'hidden' => '8'
96
+	);
97 97
 
98
-    /**
99
-     * set a decoration of the text
100
-     *
101
-     * @access public
102
-     * @param  string $sContent content to around by the style
103
-     * @param  string $sStyleName the name of the style
104
-     * @return string
105
-     */
106
-    public static function setDecoration(string $sContent, string $sStyleName) : string
107
-    {
108
-        return self::_applyCode($sContent, self::$_aBackgroundCodes[$sStyleName]);
109
-    }
98
+	/**
99
+	 * set a decoration of the text
100
+	 *
101
+	 * @access public
102
+	 * @param  string $sContent content to around by the style
103
+	 * @param  string $sStyleName the name of the style
104
+	 * @return string
105
+	 */
106
+	public static function setDecoration(string $sContent, string $sStyleName) : string
107
+	{
108
+		return self::_applyCode($sContent, self::$_aBackgroundCodes[$sStyleName]);
109
+	}
110 110
 
111
-    /**
112
-     * set a color of the background
113
-     *
114
-     * @access public
115
-     * @param  string $sContent content to around by the style
116
-     * @param  string $sColorName the name of the color
117
-     * @return string
118
-     */
119
-    public static function setBackground(string $sContent, string $sColorName) : string
120
-    {
121
-        if (!isset(self::$_aBackgroundCodes[$sColorName])) { $sColorName = 'black'; }
111
+	/**
112
+	 * set a color of the background
113
+	 *
114
+	 * @access public
115
+	 * @param  string $sContent content to around by the style
116
+	 * @param  string $sColorName the name of the color
117
+	 * @return string
118
+	 */
119
+	public static function setBackground(string $sContent, string $sColorName) : string
120
+	{
121
+		if (!isset(self::$_aBackgroundCodes[$sColorName])) { $sColorName = 'black'; }
122 122
 
123
-        return self::_applyCode($sContent, self::$_aBackgroundCodes[$sColorName]);
124
-    }
123
+		return self::_applyCode($sContent, self::$_aBackgroundCodes[$sColorName]);
124
+	}
125 125
 
126
-    /**
127
-     * set a color of the text
128
-     *
129
-     * @access public
130
-     * @param  string $sContent content to around by the style
131
-     * @param  string $sColorName the name of the color
132
-     * @return string
133
-     */
134
-    public static function setColor(string $sContent, string $sColorName) : string
135
-    {
136
-        if (!isset(self::$_aBackgroundCodes[$sColorName])) { $sColorName = 'white'; }
126
+	/**
127
+	 * set a color of the text
128
+	 *
129
+	 * @access public
130
+	 * @param  string $sContent content to around by the style
131
+	 * @param  string $sColorName the name of the color
132
+	 * @return string
133
+	 */
134
+	public static function setColor(string $sContent, string $sColorName) : string
135
+	{
136
+		if (!isset(self::$_aBackgroundCodes[$sColorName])) { $sColorName = 'white'; }
137 137
 
138
-        return self::_applyCode($sContent, self::$_aBackgroundCodes[$sColorName]);
139
-    }
138
+		return self::_applyCode($sContent, self::$_aBackgroundCodes[$sColorName]);
139
+	}
140 140
 
141
-    /**
142
-     * around the text by a color
143
-     *
144
-     * @access private
145
-     * @param  string $sContent content to around by the style
146
-     * @param  string $sCode the name of the code (color or decoration)
147
-     * @return string
148
-     */
149
-    private static function _applyCode(string $sContent, string $sCode) : string
150
-    {
151
-        return "\033[" . $sCode . "m" . $sContent . "\033[0m\n";
152
-    }
141
+	/**
142
+	 * around the text by a color
143
+	 *
144
+	 * @access private
145
+	 * @param  string $sContent content to around by the style
146
+	 * @param  string $sCode the name of the code (color or decoration)
147
+	 * @return string
148
+	 */
149
+	private static function _applyCode(string $sContent, string $sCode) : string
150
+	{
151
+		return "\033[" . $sCode . "m" . $sContent . "\033[0m\n";
152
+	}
153 153
 }
Please login to merge, or discard this patch.
bundles/core/Mother.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@
 block discarded – undo
129 129
 	 * @param  mixed $mOffset
130 130
 	 * @return boolean
131 131
 	 */
132
-    public function offsetExists($mOffset)
132
+	public function offsetExists($mOffset)
133 133
 	{
134 134
 		return $this->__isset($mOffset);
135 135
 	}
Please login to merge, or discard this patch.
bundles/lib/Form/Input.php 1 patch
Indentation   +158 added lines, -158 removed lines patch added patch discarded remove patch
@@ -30,162 +30,162 @@
 block discarded – undo
30 30
  */
31 31
 class Input extends Common
32 32
 {
33
-    /**
34
-     * the name of element
35
-     *
36
-     * @access private
37
-     * @var    string
38
-     */
39
-    private $_sType = null;
40
-
41
-    /**
42
-     * the label of element
43
-     *
44
-     * @access private
45
-     * @var    string
46
-     */
47
-    private $_sLabel = null;
48
-
49
-    /**
50
-     * the value of element
51
-     *
52
-     * @access private
53
-     * @var    string
54
-     */
55
-    private $_sValue = null;
56
-
57
-    /**
58
-     * constructor that it increment (static) for all use
59
-     *
60
-     * @access public
61
-     * @param  string $sName name
62
-     * @param  string $sType type of input
63
-     * @param  string $sLabel label of input
64
-     * @param  string $sValue value of input
65
-     */
66
-    public function __construct(string $sName, string $sType, string $sLabel = null, string $sValue = null)
67
-    {
68
-        $this->setName($sName);
69
-        $this->setType($sType);
70
-        $this->setValue($sValue);
71
-
72
-        if ($sLabel !== null) { $this->setLabel($sLabel); } else { $this->setLabel($sName); }
73
-    }
74
-
75
-    /**
76
-     * get the type
77
-     *
78
-     * @access public
79
-     * @return string
80
-     */
81
-    public function getType() : string
82
-    {
83
-        return $this->_sType;
84
-    }
85
-
86
-    /**
87
-     * set the type
88
-     *
89
-     * @access public
90
-     * @param  string $sType type of input;
91
-     * @return \Venus\lib\Form\Input
92
-     */
93
-    public function setType(string $sType) : Input
94
-    {
95
-        $this->_sType = $sType;
96
-        return $this;
97
-    }
98
-
99
-    /**
100
-     * get the Value
101
-     *
102
-     * @access public
103
-     * @return string
104
-     */
105
-    public function getValue() : string
106
-    {
107
-        return $this->_sValue;
108
-    }
109
-
110
-    /**
111
-     * set the Value
112
-     *
113
-     * @access public
114
-     * @param  string $sValue Value of input;
115
-     * @return \Venus\lib\Form\Input
116
-     */
117
-    public function setValue(string $sValue) : Input
118
-    {
119
-        $this->_sValue = $sValue;
120
-        return $this;
121
-    }
122
-
123
-    /**
124
-     * get the Label
125
-     *
126
-     * @access public
127
-     * @return string
128
-     */
129
-    public function getLabel() : string
130
-    {
131
-        return $this->_sLabel;
132
-    }
133
-
134
-    /**
135
-     * set the Label
136
-     *
137
-     * @access public
138
-     * @param  string $sLabel Label of input;
139
-     * @return \Venus\lib\Form\Input
140
-     */
141
-    public function setLabel(string $sLabel) : Input
142
-    {
143
-        $this->_sLabel = $sLabel;
144
-        return $this;
145
-    }
146
-
147
-    /**
148
-     * if the button is clicked
149
-     *
150
-     * @access public
151
-     * @param  string $sType type of input;
152
-     * @return boolean
153
-     */
154
-    public function isClicked(string $sType) : bool
155
-    {
156
-        if ($this->getType() === 'submit' || $this->getType() === 'button') {
157
-
158
-            if (isset($_POST[$this->getName()])) { return true; }
159
-        }
160
-
161
-        return false;
162
-    }
163
-
164
-    /**
165
-     * get the <html>
166
-     *
167
-     * @access public
168
-     * @return string
169
-     */
170
-    public function fetch() : string
171
-    {
172
-        $sContent = '';
173
-
174
-        if ($this->getType() === 'text' || $this->getType() === 'password' || $this->getType() === 'file'
175
-            || $this->getType() === 'tel' || $this->getType() === 'url' || $this->getType() === 'email'
176
-            || $this->getType() === 'search' || $this->getType() === 'date' || $this->getType() === 'time'
177
-            || $this->getType() === 'datetime' || $this->getType() === 'month' || $this->getType() === 'week'
178
-            || $this->getType() === 'number' || $this->getType() === 'range' || $this->getType() === 'color') {
179
-
180
-            $sContent .= '<label>'.$this->getLabel().'</label> ';
181
-        }
182
-
183
-        $sContent .= '<input type="'.$this->getType().'" name="'.$this->getName().'"';
184
-
185
-        if ($this->getValue() !== null) { $sContent .= ' value="'.$this->getValue().'"'; }
186
-
187
-        $sContent .= '/>';
188
-
189
-        return $sContent;
190
-    }
33
+	/**
34
+	 * the name of element
35
+	 *
36
+	 * @access private
37
+	 * @var    string
38
+	 */
39
+	private $_sType = null;
40
+
41
+	/**
42
+	 * the label of element
43
+	 *
44
+	 * @access private
45
+	 * @var    string
46
+	 */
47
+	private $_sLabel = null;
48
+
49
+	/**
50
+	 * the value of element
51
+	 *
52
+	 * @access private
53
+	 * @var    string
54
+	 */
55
+	private $_sValue = null;
56
+
57
+	/**
58
+	 * constructor that it increment (static) for all use
59
+	 *
60
+	 * @access public
61
+	 * @param  string $sName name
62
+	 * @param  string $sType type of input
63
+	 * @param  string $sLabel label of input
64
+	 * @param  string $sValue value of input
65
+	 */
66
+	public function __construct(string $sName, string $sType, string $sLabel = null, string $sValue = null)
67
+	{
68
+		$this->setName($sName);
69
+		$this->setType($sType);
70
+		$this->setValue($sValue);
71
+
72
+		if ($sLabel !== null) { $this->setLabel($sLabel); } else { $this->setLabel($sName); }
73
+	}
74
+
75
+	/**
76
+	 * get the type
77
+	 *
78
+	 * @access public
79
+	 * @return string
80
+	 */
81
+	public function getType() : string
82
+	{
83
+		return $this->_sType;
84
+	}
85
+
86
+	/**
87
+	 * set the type
88
+	 *
89
+	 * @access public
90
+	 * @param  string $sType type of input;
91
+	 * @return \Venus\lib\Form\Input
92
+	 */
93
+	public function setType(string $sType) : Input
94
+	{
95
+		$this->_sType = $sType;
96
+		return $this;
97
+	}
98
+
99
+	/**
100
+	 * get the Value
101
+	 *
102
+	 * @access public
103
+	 * @return string
104
+	 */
105
+	public function getValue() : string
106
+	{
107
+		return $this->_sValue;
108
+	}
109
+
110
+	/**
111
+	 * set the Value
112
+	 *
113
+	 * @access public
114
+	 * @param  string $sValue Value of input;
115
+	 * @return \Venus\lib\Form\Input
116
+	 */
117
+	public function setValue(string $sValue) : Input
118
+	{
119
+		$this->_sValue = $sValue;
120
+		return $this;
121
+	}
122
+
123
+	/**
124
+	 * get the Label
125
+	 *
126
+	 * @access public
127
+	 * @return string
128
+	 */
129
+	public function getLabel() : string
130
+	{
131
+		return $this->_sLabel;
132
+	}
133
+
134
+	/**
135
+	 * set the Label
136
+	 *
137
+	 * @access public
138
+	 * @param  string $sLabel Label of input;
139
+	 * @return \Venus\lib\Form\Input
140
+	 */
141
+	public function setLabel(string $sLabel) : Input
142
+	{
143
+		$this->_sLabel = $sLabel;
144
+		return $this;
145
+	}
146
+
147
+	/**
148
+	 * if the button is clicked
149
+	 *
150
+	 * @access public
151
+	 * @param  string $sType type of input;
152
+	 * @return boolean
153
+	 */
154
+	public function isClicked(string $sType) : bool
155
+	{
156
+		if ($this->getType() === 'submit' || $this->getType() === 'button') {
157
+
158
+			if (isset($_POST[$this->getName()])) { return true; }
159
+		}
160
+
161
+		return false;
162
+	}
163
+
164
+	/**
165
+	 * get the <html>
166
+	 *
167
+	 * @access public
168
+	 * @return string
169
+	 */
170
+	public function fetch() : string
171
+	{
172
+		$sContent = '';
173
+
174
+		if ($this->getType() === 'text' || $this->getType() === 'password' || $this->getType() === 'file'
175
+			|| $this->getType() === 'tel' || $this->getType() === 'url' || $this->getType() === 'email'
176
+			|| $this->getType() === 'search' || $this->getType() === 'date' || $this->getType() === 'time'
177
+			|| $this->getType() === 'datetime' || $this->getType() === 'month' || $this->getType() === 'week'
178
+			|| $this->getType() === 'number' || $this->getType() === 'range' || $this->getType() === 'color') {
179
+
180
+			$sContent .= '<label>'.$this->getLabel().'</label> ';
181
+		}
182
+
183
+		$sContent .= '<input type="'.$this->getType().'" name="'.$this->getName().'"';
184
+
185
+		if ($this->getValue() !== null) { $sContent .= ' value="'.$this->getValue().'"'; }
186
+
187
+		$sContent .= '/>';
188
+
189
+		return $sContent;
190
+	}
191 191
 }
Please login to merge, or discard this patch.
bundles/lib/Form/Container.php 1 patch
Indentation   +203 added lines, -203 removed lines patch added patch discarded remove patch
@@ -33,207 +33,207 @@
 block discarded – undo
33 33
  */
34 34
 class Container
35 35
 {
36
-    /**
37
-     * complete view
38
-     *
39
-     * @access private
40
-     * @var    string
41
-     */
42
-    private $_sView = null;
43
-
44
-    /**
45
-     * form library with its entity
46
-     *
47
-     * @access private
48
-     * @var    Form
49
-     */
50
-    private $_oForm = null;
51
-
52
-    /**
53
-     * Block the save in the entity if you don't call handleRequest
54
-     *
55
-     * @access private
56
-     * @var    bool
57
-     */
58
-    private $_bHandleRequestActivate = false;
59
-
60
-    /**
61
-     * Request of the formular
62
-     *
63
-     * @access private
64
-     * @var    array
65
-     */
66
-    private $_aRequest = null;
67
-
68
-    /**
69
-     * get the Value
70
-     *
71
-     * @access public
72
-     * @return \stdClass
73
-     */
74
-    public function createView() : \stdClass
75
-    {
76
-        $oView = new \stdClass;
77
-        $oView->form = $this->_sView;
78
-        $oView->form_start = $this->_oForm->getFormInObject()->start;
79
-        $oView->form_end = $this->_oForm->getFormInObject()->end;
80
-        $oView->form_row = array();
81
-
82
-        foreach ($this->_oForm->getFormInObject()->form as $sKey => $mValue) {
83
-
84
-            if ($mValue instanceof Container) {
85
-
86
-                $oNewForm = $mValue->createView();
87
-                $oView->form_row[$sKey] = $oNewForm->form_row;
88
-            } else {
89
-
90
-               $oView->form_row[$sKey] = $mValue;
91
-            }
92
-        }
93
-
94
-        return $oView;
95
-    }
96
-
97
-    /**
98
-     * set the Value
99
-     *
100
-     * @access public
101
-     * @param  string $sView Display of form;
102
-     * @return \Venus\lib\Form\Container
103
-     */
104
-    public function setView(string $sView) : Container
105
-    {
106
-        $this->_sView = $sView;
107
-        return $this;
108
-    }
109
-
110
-    /**
111
-     * handle the request to do many actions on it
112
-     *
113
-     * @access public
114
-     * @param  array $aRequest request like $_POST
115
-     * @return bool
116
-     */
117
-    public function handleRequest(array $aRequest) : bool
118
-    {
119
-        if (!count($_POST)) { return true; }
120
-
121
-        // Validation
122
-        foreach ($this->_oForm->getElement() as $sKey => $sValue) {
123
-
124
-            if (!$sValue instanceof self && !$this->_validate($sValue)) {
125
-
126
-                return false;
127
-            }
128
-        }
129
-
130
-        // Save
131
-        if ($this->_oForm->getIdEntity() > 0 && $this->_oForm->getSynchronizeEntity() !== null && count($aRequest) > 0) {
132
-
133
-            $sModelName = str_replace('Entity', 'Model', $this->_oForm->getSynchronizeEntity());
134
-            $oModel = new $sModelName;
135
-
136
-            $oEntity = new $this->_oForm->getSynchronizeEntity();
137
-            $sPrimaryKey = LibEntity::getPrimaryKeyNameWithoutMapping($oEntity);
138
-            $sMethodName = 'set_'.$sPrimaryKey;
139
-
140
-            call_user_func_array(array(&$oEntity, $sMethodName), array($this->_oForm->getIdEntity()));
141
-
142
-            foreach ($this->_oForm->getElement() as $sKey => $sValue) {
143
-
144
-                $sMethodName = 'set_'.$sValue->getName().'';
145
-                call_user_func_array(array(&$oEntity, $sMethodName), array($aRequest[$sValue->getName()]));
146
-            }
147
-
148
-            $oEntity->save();
149
-        } else if ($this->_oForm->getSynchronizeEntity() !== null && isset($aRequest) && count($aRequest) > 0) {
150
-
151
-            $oEntity = new $this->_oForm->_sSynchronizeEntity;
152
-
153
-            foreach ($this->_oForm->getElement() as $sKey => $sValue) {
154
-
155
-                $sMethodName = 'set_'.$sValue->getName().'';
156
-                call_user_func_array(array(&$oEntity, $sMethodName), array($aRequest[$sValue->getName()]));
157
-            }
158
-
159
-            $this->_oForm->setIdEntityCreated($oEntity->save());
160
-        }
161
-
162
-        $this->_bHandleRequestActivate = true;
163
-        $this->_aRequest = $aRequest;
164
-        return true;
165
-    }
166
-
167
-    /**
168
-     * set Form lib with its entity
169
-     *
170
-     * @access public
171
-     * @param  Form $oForm request like $_POST
172
-     * @return \Venus\lib\Form\Container
173
-     */
174
-    public function setForm(Form $oForm) : Container
175
-    {
176
-        $this->_oForm = $oForm;
177
-        return $this;
178
-    }
179
-
180
-    /**
181
-     * if this form is validate and save
182
-     *
183
-     * @access public
184
-     * @return boolean
185
-     */
186
-    public function isValid() : bool
187
-    {
188
-        if ($this->_bHandleRequestActivate === true) { return true; } else { return false; }
189
-    }
190
-
191
-    /**
192
-     * if this form is validate and save
193
-     *
194
-     * @access public
195
-     * @return boolean
196
-     */
197
-    public function isSubmitted() : bool
198
-    {
199
-        if (isset($_POST['validform'.$this->_oForm->getFormNumber()]) && $_POST['validform'.$this->_oForm->getFormNumber()] == 1) {
200
-
201
-            return true;
202
-        } else {
203
-
204
-            return false;
205
-        }
206
-    }
207
-
208
-    /**
209
-     * if this form is validate and save
210
-     *
211
-     * @access public
212
-     * @param  string $sElementName element name what we want test the click
213
-     * @return boolean
214
-     */
215
-    public function isClicked(string $sElementName) : bool
216
-    {
217
-        if (isset($_POST[$sElementName]) && $_POST[$sElementName]) { return true; } else { return false; }
218
-    }
219
-
220
-    /**
221
-     * if the element is valide or not (with the constraint)
222
-     *
223
-     * @access private
224
-     * @param  object $oElement element of formular
225
-     * @return boolean
226
-     */
227
-    private function _validate($oElement) : bool
228
-    {
229
-        foreach ($oElement->getConstraint() as $oConstraint) {
230
-
231
-            if (!$oConstraint->validate($_POST[$oElement->getName()])) {
232
-
233
-                return false;
234
-            }
235
-        }
236
-
237
-        return true;
238
-    }
36
+	/**
37
+	 * complete view
38
+	 *
39
+	 * @access private
40
+	 * @var    string
41
+	 */
42
+	private $_sView = null;
43
+
44
+	/**
45
+	 * form library with its entity
46
+	 *
47
+	 * @access private
48
+	 * @var    Form
49
+	 */
50
+	private $_oForm = null;
51
+
52
+	/**
53
+	 * Block the save in the entity if you don't call handleRequest
54
+	 *
55
+	 * @access private
56
+	 * @var    bool
57
+	 */
58
+	private $_bHandleRequestActivate = false;
59
+
60
+	/**
61
+	 * Request of the formular
62
+	 *
63
+	 * @access private
64
+	 * @var    array
65
+	 */
66
+	private $_aRequest = null;
67
+
68
+	/**
69
+	 * get the Value
70
+	 *
71
+	 * @access public
72
+	 * @return \stdClass
73
+	 */
74
+	public function createView() : \stdClass
75
+	{
76
+		$oView = new \stdClass;
77
+		$oView->form = $this->_sView;
78
+		$oView->form_start = $this->_oForm->getFormInObject()->start;
79
+		$oView->form_end = $this->_oForm->getFormInObject()->end;
80
+		$oView->form_row = array();
81
+
82
+		foreach ($this->_oForm->getFormInObject()->form as $sKey => $mValue) {
83
+
84
+			if ($mValue instanceof Container) {
85
+
86
+				$oNewForm = $mValue->createView();
87
+				$oView->form_row[$sKey] = $oNewForm->form_row;
88
+			} else {
89
+
90
+			   $oView->form_row[$sKey] = $mValue;
91
+			}
92
+		}
93
+
94
+		return $oView;
95
+	}
96
+
97
+	/**
98
+	 * set the Value
99
+	 *
100
+	 * @access public
101
+	 * @param  string $sView Display of form;
102
+	 * @return \Venus\lib\Form\Container
103
+	 */
104
+	public function setView(string $sView) : Container
105
+	{
106
+		$this->_sView = $sView;
107
+		return $this;
108
+	}
109
+
110
+	/**
111
+	 * handle the request to do many actions on it
112
+	 *
113
+	 * @access public
114
+	 * @param  array $aRequest request like $_POST
115
+	 * @return bool
116
+	 */
117
+	public function handleRequest(array $aRequest) : bool
118
+	{
119
+		if (!count($_POST)) { return true; }
120
+
121
+		// Validation
122
+		foreach ($this->_oForm->getElement() as $sKey => $sValue) {
123
+
124
+			if (!$sValue instanceof self && !$this->_validate($sValue)) {
125
+
126
+				return false;
127
+			}
128
+		}
129
+
130
+		// Save
131
+		if ($this->_oForm->getIdEntity() > 0 && $this->_oForm->getSynchronizeEntity() !== null && count($aRequest) > 0) {
132
+
133
+			$sModelName = str_replace('Entity', 'Model', $this->_oForm->getSynchronizeEntity());
134
+			$oModel = new $sModelName;
135
+
136
+			$oEntity = new $this->_oForm->getSynchronizeEntity();
137
+			$sPrimaryKey = LibEntity::getPrimaryKeyNameWithoutMapping($oEntity);
138
+			$sMethodName = 'set_'.$sPrimaryKey;
139
+
140
+			call_user_func_array(array(&$oEntity, $sMethodName), array($this->_oForm->getIdEntity()));
141
+
142
+			foreach ($this->_oForm->getElement() as $sKey => $sValue) {
143
+
144
+				$sMethodName = 'set_'.$sValue->getName().'';
145
+				call_user_func_array(array(&$oEntity, $sMethodName), array($aRequest[$sValue->getName()]));
146
+			}
147
+
148
+			$oEntity->save();
149
+		} else if ($this->_oForm->getSynchronizeEntity() !== null && isset($aRequest) && count($aRequest) > 0) {
150
+
151
+			$oEntity = new $this->_oForm->_sSynchronizeEntity;
152
+
153
+			foreach ($this->_oForm->getElement() as $sKey => $sValue) {
154
+
155
+				$sMethodName = 'set_'.$sValue->getName().'';
156
+				call_user_func_array(array(&$oEntity, $sMethodName), array($aRequest[$sValue->getName()]));
157
+			}
158
+
159
+			$this->_oForm->setIdEntityCreated($oEntity->save());
160
+		}
161
+
162
+		$this->_bHandleRequestActivate = true;
163
+		$this->_aRequest = $aRequest;
164
+		return true;
165
+	}
166
+
167
+	/**
168
+	 * set Form lib with its entity
169
+	 *
170
+	 * @access public
171
+	 * @param  Form $oForm request like $_POST
172
+	 * @return \Venus\lib\Form\Container
173
+	 */
174
+	public function setForm(Form $oForm) : Container
175
+	{
176
+		$this->_oForm = $oForm;
177
+		return $this;
178
+	}
179
+
180
+	/**
181
+	 * if this form is validate and save
182
+	 *
183
+	 * @access public
184
+	 * @return boolean
185
+	 */
186
+	public function isValid() : bool
187
+	{
188
+		if ($this->_bHandleRequestActivate === true) { return true; } else { return false; }
189
+	}
190
+
191
+	/**
192
+	 * if this form is validate and save
193
+	 *
194
+	 * @access public
195
+	 * @return boolean
196
+	 */
197
+	public function isSubmitted() : bool
198
+	{
199
+		if (isset($_POST['validform'.$this->_oForm->getFormNumber()]) && $_POST['validform'.$this->_oForm->getFormNumber()] == 1) {
200
+
201
+			return true;
202
+		} else {
203
+
204
+			return false;
205
+		}
206
+	}
207
+
208
+	/**
209
+	 * if this form is validate and save
210
+	 *
211
+	 * @access public
212
+	 * @param  string $sElementName element name what we want test the click
213
+	 * @return boolean
214
+	 */
215
+	public function isClicked(string $sElementName) : bool
216
+	{
217
+		if (isset($_POST[$sElementName]) && $_POST[$sElementName]) { return true; } else { return false; }
218
+	}
219
+
220
+	/**
221
+	 * if the element is valide or not (with the constraint)
222
+	 *
223
+	 * @access private
224
+	 * @param  object $oElement element of formular
225
+	 * @return boolean
226
+	 */
227
+	private function _validate($oElement) : bool
228
+	{
229
+		foreach ($oElement->getConstraint() as $oConstraint) {
230
+
231
+			if (!$oConstraint->validate($_POST[$oElement->getName()])) {
232
+
233
+				return false;
234
+			}
235
+		}
236
+
237
+		return true;
238
+	}
239 239
 }
Please login to merge, or discard this patch.
bundles/lib/Cache/Mock.php 1 patch
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -30,69 +30,69 @@
 block discarded – undo
30 30
  */
31 31
 class Mock implements CacheInterface
32 32
 {
33
-    /**
34
-     * get a value
35
-     *
36
-     * @access public
37
-     * @param  string $sName name of the session
38
-     * @param  int $iFlags flags
39
-     * @param  int $iTimeout expiration of cache
40
-     * @return boolean
41
-     */
42
-    public function get(string $sName, int&$iFlags = null, int $iTimeout = 0)
43
-    {
44
-        return false;
45
-    }
33
+	/**
34
+	 * get a value
35
+	 *
36
+	 * @access public
37
+	 * @param  string $sName name of the session
38
+	 * @param  int $iFlags flags
39
+	 * @param  int $iTimeout expiration of cache
40
+	 * @return boolean
41
+	 */
42
+	public function get(string $sName, int&$iFlags = null, int $iTimeout = 0)
43
+	{
44
+		return false;
45
+	}
46 46
 
47
-    /**
48
-     * set a value
49
-     *
50
-     * @access public
51
-     * @param  string $sName name of the session
52
-     * @param  mixed $mValue value of this sesion var
53
-     * @param  int $iFlag unused
54
-     * @param  int $iExpire expiration of cache
55
-     * @return boolean
56
-     */
57
-    public function set(string $sName, $mValue, int $iFlag = 0, int $iExpire = false)
58
-    {
59
-        return true;
60
-    }
47
+	/**
48
+	 * set a value
49
+	 *
50
+	 * @access public
51
+	 * @param  string $sName name of the session
52
+	 * @param  mixed $mValue value of this sesion var
53
+	 * @param  int $iFlag unused
54
+	 * @param  int $iExpire expiration of cache
55
+	 * @return boolean
56
+	 */
57
+	public function set(string $sName, $mValue, int $iFlag = 0, int $iExpire = false)
58
+	{
59
+		return true;
60
+	}
61 61
 
62
-    /**
63
-     * flush the cache
64
-     *
65
-     * @access public
66
-     * @return boolean
67
-     */
68
-    public function flush()
69
-    {
70
-        return false;
71
-    }
62
+	/**
63
+	 * flush the cache
64
+	 *
65
+	 * @access public
66
+	 * @return boolean
67
+	 */
68
+	public function flush()
69
+	{
70
+		return false;
71
+	}
72 72
 
73
-    /**
74
-     * delete a value
75
-     *
76
-     * @access public
77
-     * @param  string $sName name of the session
78
-     * @return boolean
79
-     */
80
-    public function delete(string $sName)
81
-    {
82
-        return false;
83
-    }
73
+	/**
74
+	 * delete a value
75
+	 *
76
+	 * @access public
77
+	 * @param  string $sName name of the session
78
+	 * @return boolean
79
+	 */
80
+	public function delete(string $sName)
81
+	{
82
+		return false;
83
+	}
84 84
 
85
-    /**
86
-     * add
87
-     *
88
-     * @access public
89
-     * @param  string $sName name of the session
90
-     * @param  mixed $mValue value of this sesion var
91
-     * @param  int $iExpire expiration of cache
92
-     * @return boolean
93
-     */
94
-    public function add($sName, $mValue, $iExpire = false)
95
-    {
96
-        return true;
97
-    }
85
+	/**
86
+	 * add
87
+	 *
88
+	 * @access public
89
+	 * @param  string $sName name of the session
90
+	 * @param  mixed $mValue value of this sesion var
91
+	 * @param  int $iExpire expiration of cache
92
+	 * @return boolean
93
+	 */
94
+	public function add($sName, $mValue, $iExpire = false)
95
+	{
96
+		return true;
97
+	}
98 98
 }
Please login to merge, or discard this patch.
bundles/lib/Cache/File.php 1 patch
Indentation   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -30,125 +30,125 @@
 block discarded – undo
30 30
  */
31 31
 class File implements CacheInterface
32 32
 {
33
-    /**
34
-     * var containe this folder of cache
35
-     *
36
-     * @access private
37
-     * @var    string
38
-     */
39
-    private $_sFolder = '';
40
-
41
-    /**
42
-     * constructor
43
-     *
44
-     * @access public
45
-     */
46
-    public function __construct()
47
-    {
48
-        $this->_sFolder = str_replace('bundles'.DIRECTORY_SEPARATOR.'lib'.DIRECTORY_SEPARATOR.'Cache', CACHE_DIR, __DIR__).DIRECTORY_SEPARATOR;
49
-    }
50
-
51
-    /**
52
-     * set a value
53
-     *
54
-     * @access public
55
-     * @param  string $sName name of the session
56
-     * @param  mixed $mValue value of this sesion var
57
-     * @param  int $iFlag flags
58
-     * @param  int $iExpire expiration of cache
59
-     * @return \Venus\lib\Cache\File
60
-     */
61
-    public function set(string $sName, $mValue, int $iFlag, int $iExpire)
62
-    {
63
-        file_put_contents($this->_sFolder.$this->_getSubDirectory($sName).md5($sName).'.fil.cac', serialize($mValue));
64
-        return $this;
65
-    }
66
-
67
-    /**
68
-     * get a value
69
-     *
70
-     * @access public
71
-     * @param  string $sName name of the session
72
-     * @param  int $iFlags flags
73
-     * @param  int $iTimeout expiration of cache
74
-     * @return mixed
75
-     */
76
-    public function get(string $sName, int &$iFlags = null, int $iTimeout = 0)
77
-    {
78
-        if ($iTimeout > 0 && file_exists($this->_sFolder.$this->_getSubDirectory($sName).md5($sName).'.fil.cac')
79
-            && time() - filemtime($this->_sFolder.$this->_getSubDirectory($sName).md5($sName).'.fil.cac') > $iTimeout) {
80
-
81
-            unlink($this->_sFolder.$this->_getSubDirectory($sName).md5($sName).'.fil.cac');
82
-        }
83
-
84
-        if (file_exists($this->_sFolder.$this->_getSubDirectory($sName).md5($sName).'.fil.cac')) {
85
-
86
-            return unserialize(file_get_contents($this->_sFolder . $this->_getSubDirectory($sName) . md5($sName) . '.fil.cac'));
87
-        } else {
88
-
89
-            return false;
90
-        }
91
-    }
92
-
93
-    /**
94
-     * delete a value
95
-     *
96
-     * @access public
97
-     * @param  string $sName name of the session
98
-     * @return mixed
99
-     */
100
-    public function delete(string $sName)
101
-    {
102
-        return unlink($this->_sFolder.$this->_getSubDirectory($sName).md5($sName).'.fil.cac');
103
-    }
104
-
105
-    /**
106
-     * flush the cache
107
-     *
108
-     * @access public
109
-     * @param  string $sName name of the session
110
-     * @return mixed
111
-     */
112
-    public function flush()
113
-    {
114
-        $this->_removeDirectory($this->_sFolder);
115
-    }
116
-
117
-    /**
118
-     *
119
-     *
120
-     * @access public
121
-     * @param  string $sName name of the session
122
-     * @return mixed
123
-     */
124
-    private function _getSubDirectory($sName)
125
-    {
126
-        if (!file_exists($this->_sFolder.substr(md5($sName), 0, 2).DIRECTORY_SEPARATOR.substr(md5($sName), 2, 2))) {
127
-
128
-            mkdir($this->_sFolder.substr(md5($sName), 0, 2).DIRECTORY_SEPARATOR.substr(md5($sName), 2, 2), 0777, true);
129
-        }
130
-
131
-        return substr(md5($sName), 0, 2).DIRECTORY_SEPARATOR.substr(md5($sName), 2, 2).DIRECTORY_SEPARATOR;
132
-    }
133
-
134
-    /**
135
-     * remove a directory recursivly
136
-     *
137
-     * @access private
138
-     * @param  string $sName nom du répertoire
139
-     * @return void
140
-     */
141
-    private function _removeDirectory($sName)
142
-    {
143
-        if ($rDirectory = opendir($sName)) {
144
-
145
-            while (($sFile = readdir($rDirectory)) !== false) {
146
-
147
-                if ($sFile > '0' && filetype($sName.$sFile) == "file") { unlink($sName.$sFile); } elseif ($sFile > '0' && filetype($sName.$sFile) == "dir") { remove_dir($sName.$sFile."\\"); }
148
-            }
149
-
150
-            closedir($rDirectory);
151
-            rmdir($sName);
152
-        }
153
-    }
33
+	/**
34
+	 * var containe this folder of cache
35
+	 *
36
+	 * @access private
37
+	 * @var    string
38
+	 */
39
+	private $_sFolder = '';
40
+
41
+	/**
42
+	 * constructor
43
+	 *
44
+	 * @access public
45
+	 */
46
+	public function __construct()
47
+	{
48
+		$this->_sFolder = str_replace('bundles'.DIRECTORY_SEPARATOR.'lib'.DIRECTORY_SEPARATOR.'Cache', CACHE_DIR, __DIR__).DIRECTORY_SEPARATOR;
49
+	}
50
+
51
+	/**
52
+	 * set a value
53
+	 *
54
+	 * @access public
55
+	 * @param  string $sName name of the session
56
+	 * @param  mixed $mValue value of this sesion var
57
+	 * @param  int $iFlag flags
58
+	 * @param  int $iExpire expiration of cache
59
+	 * @return \Venus\lib\Cache\File
60
+	 */
61
+	public function set(string $sName, $mValue, int $iFlag, int $iExpire)
62
+	{
63
+		file_put_contents($this->_sFolder.$this->_getSubDirectory($sName).md5($sName).'.fil.cac', serialize($mValue));
64
+		return $this;
65
+	}
66
+
67
+	/**
68
+	 * get a value
69
+	 *
70
+	 * @access public
71
+	 * @param  string $sName name of the session
72
+	 * @param  int $iFlags flags
73
+	 * @param  int $iTimeout expiration of cache
74
+	 * @return mixed
75
+	 */
76
+	public function get(string $sName, int &$iFlags = null, int $iTimeout = 0)
77
+	{
78
+		if ($iTimeout > 0 && file_exists($this->_sFolder.$this->_getSubDirectory($sName).md5($sName).'.fil.cac')
79
+			&& time() - filemtime($this->_sFolder.$this->_getSubDirectory($sName).md5($sName).'.fil.cac') > $iTimeout) {
80
+
81
+			unlink($this->_sFolder.$this->_getSubDirectory($sName).md5($sName).'.fil.cac');
82
+		}
83
+
84
+		if (file_exists($this->_sFolder.$this->_getSubDirectory($sName).md5($sName).'.fil.cac')) {
85
+
86
+			return unserialize(file_get_contents($this->_sFolder . $this->_getSubDirectory($sName) . md5($sName) . '.fil.cac'));
87
+		} else {
88
+
89
+			return false;
90
+		}
91
+	}
92
+
93
+	/**
94
+	 * delete a value
95
+	 *
96
+	 * @access public
97
+	 * @param  string $sName name of the session
98
+	 * @return mixed
99
+	 */
100
+	public function delete(string $sName)
101
+	{
102
+		return unlink($this->_sFolder.$this->_getSubDirectory($sName).md5($sName).'.fil.cac');
103
+	}
104
+
105
+	/**
106
+	 * flush the cache
107
+	 *
108
+	 * @access public
109
+	 * @param  string $sName name of the session
110
+	 * @return mixed
111
+	 */
112
+	public function flush()
113
+	{
114
+		$this->_removeDirectory($this->_sFolder);
115
+	}
116
+
117
+	/**
118
+	 *
119
+	 *
120
+	 * @access public
121
+	 * @param  string $sName name of the session
122
+	 * @return mixed
123
+	 */
124
+	private function _getSubDirectory($sName)
125
+	{
126
+		if (!file_exists($this->_sFolder.substr(md5($sName), 0, 2).DIRECTORY_SEPARATOR.substr(md5($sName), 2, 2))) {
127
+
128
+			mkdir($this->_sFolder.substr(md5($sName), 0, 2).DIRECTORY_SEPARATOR.substr(md5($sName), 2, 2), 0777, true);
129
+		}
130
+
131
+		return substr(md5($sName), 0, 2).DIRECTORY_SEPARATOR.substr(md5($sName), 2, 2).DIRECTORY_SEPARATOR;
132
+	}
133
+
134
+	/**
135
+	 * remove a directory recursivly
136
+	 *
137
+	 * @access private
138
+	 * @param  string $sName nom du répertoire
139
+	 * @return void
140
+	 */
141
+	private function _removeDirectory($sName)
142
+	{
143
+		if ($rDirectory = opendir($sName)) {
144
+
145
+			while (($sFile = readdir($rDirectory)) !== false) {
146
+
147
+				if ($sFile > '0' && filetype($sName.$sFile) == "file") { unlink($sName.$sFile); } elseif ($sFile > '0' && filetype($sName.$sFile) == "dir") { remove_dir($sName.$sFile."\\"); }
148
+			}
149
+
150
+			closedir($rDirectory);
151
+			rmdir($sName);
152
+		}
153
+	}
154 154
 }
Please login to merge, or discard this patch.
bundles/lib/Debug.php 1 patch
Indentation   +412 added lines, -412 removed lines patch added patch discarded remove patch
@@ -34,418 +34,418 @@
 block discarded – undo
34 34
  */
35 35
 class Debug extends AbstractLogger
36 36
 {
37
-    /**
38
-     * variable to activate or not the debug
39
-     * @var boolean
40
-     */
41
-    private static $_bActivateDebug = false;
42
-
43
-    /**
44
-     * variable to activate or not the error
45
-     * @var boolean
46
-     */
47
-    private static $_bActivateError = false;
48
-
49
-    /**
50
-     * variable to activate or not the exception
51
-     * @var boolean
52
-     */
53
-    private static $_bActivateException = false;
54
-
55
-    /**
56
-     * variable to activate or not the debug
57
-     * @var boolean
58
-     */
59
-    private static $_sFileLog = null;
60
-
61
-    /**
62
-     * first or not activation
63
-     * @var boolean
64
-     */
65
-    private static $_bFirstActivation = true;
66
-
67
-    /**
68
-     * kind of report log
69
-     * @var string error_log|screen|all
70
-     */
71
-    private static $_sKindOfReportLog = 'error_log';
72
-
73
-    /**
74
-     * instance of logger
75
-     * @var \Venus\lib\Debug
76
-     */
77
-    private static $_oInstance;
37
+	/**
38
+	 * variable to activate or not the debug
39
+	 * @var boolean
40
+	 */
41
+	private static $_bActivateDebug = false;
42
+
43
+	/**
44
+	 * variable to activate or not the error
45
+	 * @var boolean
46
+	 */
47
+	private static $_bActivateError = false;
48
+
49
+	/**
50
+	 * variable to activate or not the exception
51
+	 * @var boolean
52
+	 */
53
+	private static $_bActivateException = false;
54
+
55
+	/**
56
+	 * variable to activate or not the debug
57
+	 * @var boolean
58
+	 */
59
+	private static $_sFileLog = null;
60
+
61
+	/**
62
+	 * first or not activation
63
+	 * @var boolean
64
+	 */
65
+	private static $_bFirstActivation = true;
66
+
67
+	/**
68
+	 * kind of report log
69
+	 * @var string error_log|screen|all
70
+	 */
71
+	private static $_sKindOfReportLog = 'error_log';
72
+
73
+	/**
74
+	 * instance of logger
75
+	 * @var \Venus\lib\Debug
76
+	 */
77
+	private static $_oInstance;
78 78
  
79
-    /**
80
-     * Send back the isntance or create it
81
-     * 
82
-     * @access public
83
-     */
84
-    public static function getInstance() : Debug
85
-    {    
86
-        if (!(self::$_oInstance instanceof self)) { self::$_oInstance = new self(); }
79
+	/**
80
+	 * Send back the isntance or create it
81
+	 * 
82
+	 * @access public
83
+	 */
84
+	public static function getInstance() : Debug
85
+	{    
86
+		if (!(self::$_oInstance instanceof self)) { self::$_oInstance = new self(); }
87 87
  
88
-        return self::$_oInstance;
89
-    }
90
-
91
-    /**
92
-     * activate debug
93
-     *
94
-     * @access public
95
-     * @return void
96
-     */
97
-    public static function activateDebug()
98
-    {
99
-        if (self::$_bFirstActivation === true) {
100
-
101
-            self::_setFileNameInErrorFile();
102
-            self::$_bFirstActivation = false;
103
-        }
104
-
105
-        self::_initLogFile();
106
-        self::$_bActivateDebug = true;
107
-        self::activateError(E_ALL);
108
-        self::activateException(E_ALL);
109
-    }
110
-
111
-    /**
112
-     * activate debug
113
-     *
114
-     * @access public
115
-     * @return void
116
-     */
117
-    public static function deactivateDebug()
118
-    {
119
-        self::$_bActivateDebug = false;
120
-    }
121
-
122
-    /**
123
-     * check if debug is activate or not
124
-     *
125
-     * @access public
126
-     * @return boolean
127
-     */
128
-    public static function isDebug() : bool
129
-    {
130
-        return self::$_bActivateDebug;
131
-    }
132
-
133
-    /**
134
-     * activate error reporting
135
-     *
136
-     * @access public
137
-     * @param  int $iLevel level of error
138
-     * @return void
139
-     */
140
-    public static function activateError($iLevel)
141
-    {
142
-        if (self::$_bFirstActivation === true) {
143
-
144
-            self::_setFileNameInErrorFile();
145
-            self::$_bFirstActivation = false;
146
-        }
147
-
148
-        self::_initLogFile();
149
-        self::$_bActivateError = true;
150
-
151
-        error_reporting($iLevel);
152
-
153
-        set_error_handler(function ($iErrNo, $sErrStr, $sErrFile, $iErrLine)
154
-        {
155
-            $aContext = array('file' => $sErrFile, 'line' => $iErrLine);
156
-
157
-            $sType = self::getTranslateErrorCode($iErrNo);
158
-
159
-            self::getInstance()->$sType($sErrStr, $aContext);
160
-
161
-            return true;
162
-        }, $iLevel);
163
-
164
-        register_shutdown_function(function()
165
-        {
166
-            if (null !== ($aLastError = error_get_last())) {
167
-
168
-                $aContext = array('file' => $aLastError['file'], 'line' => $aLastError['line']);
169
-
170
-                $sType = self::getTranslateErrorCode($aLastError['type']);
171
-
172
-                self::getInstance()->$sType($aLastError['message'], $aContext);
173
-            }
174
-        });
175
-    }
176
-
177
-    /**
178
-     * activate error reporting
179
-     *
180
-     * @access public
181
-     * @return void
182
-    */
183
-    public static function deactivateError()
184
-    {
185
-        self::$_bActivateError = false;
186
-    }
187
-
188
-    /**
189
-     * check if error reporting is activate or not
190
-     *
191
-     * @access public
192
-     * @return boolean
193
-     */
194
-    public static function isError() : bool
195
-    {
196
-        return self::$_bActivateError;
197
-    }
198
-
199
-
200
-    /**
201
-     * activate Exception
202
-     *
203
-     * @access public
204
-     * @param  int $iLevel level of error
205
-     * @return void
206
-     */
207
-    public static function activateException(int $iLevel)
208
-    {
209
-        if (self::$_bFirstActivation === true) {
210
-
211
-            self::_setFileNameInErrorFile();
212
-            self::$_bFirstActivation = false;
213
-        }
214
-
215
-        self::_initLogFile();
216
-        self::$_bActivateException = true;
217
-
218
-        set_exception_handler(function (\Exception $oException)
219
-        {
220
-            $aContext = array('file' => $oException->getFile(), 'line' => $oException->getLine());
221
-            self::getInstance()->critical($oException->getMessage(), $aContext);
222
-        });
223
-    }
224
-
225
-    /**
226
-     * activate Exception
227
-     *
228
-     * @access public
229
-     * @return void
230
-     */
231
-    public static function deactivateException()
232
-    {
233
-        self::$_bActivateException = false;
234
-    }
235
-
236
-    /**
237
-     * check if Exception is activate or not
238
-     *
239
-     * @access public
240
-     * @return boolean
241
-     */
242
-    public static function isException() : bool
243
-    {
244
-        return self::$_bActivateException;
245
-    }
246
-
247
-    /**
248
-     * set the kind of report Log
249
-     *
250
-     * @access public
251
-     * @param  string $sKindOfReportLog
252
-     * @return void
253
-     */
254
-    public static function setKindOfReportLog(string $sKindOfReportLog)
255
-    {
256
-        if ($sKindOfReportLog === 'screen' || $sKindOfReportLog === 'all') { self::$_sKindOfReportLog = $sKindOfReportLog; }
257
-        else { self::$_sKindOfReportLog = 'error_log'; }
258
-    }
259
-
260
-    /**
261
-     * get the kind of report Log
262
-     *
263
-     * @access public
264
-     * @return string
265
-     */
266
-    public static function getKindOfReportLog() : string
267
-    {
268
-        return self::$_sKindOfReportLog;
269
-    }
270
-
271
-    /**
272
-     * get the code by LogLevel adapt to the PSR-3
273
-     *
274
-     * @access public
275
-     * @param  int $iCode
276
-     * @return string
277
-     */
278
-    public static function getTranslateErrorCode(int $iCode) : string
279
-    {
280
-        if ($iCode === 1 && $iCode === 16 && $iCode === 256 && $iCode === 4096) { return LogLevel::ERROR; }
281
-        else if ($iCode === 2 && $iCode === 32 && $iCode === 128 && $iCode === 512) { return LogLevel::WARNING; }
282
-        else if ($iCode === 4 && $iCode === 64) { return LogLevel::EMERGENCY; }
283
-        else if ($iCode === 8 && $iCode === 1024) { return LogLevel::NOTICE; }
284
-        else if ($iCode === 2048 && $iCode === 8192 && $iCode === 16384) { return LogLevel::INFO; }
285
-        else return LogLevel::DEBUG;
286
-    }
287
-
288
-    /**
289
-     * System is unusable.
290
-     *
291
-     * @param string $message
292
-     * @param array $context
293
-     * @return null
294
-     */
295
-    public function emergency($message, array $context = array())
296
-    {
297
-        $this->log(LogLevel::EMERGENCY, $message, $context);
298
-    }
299
-
300
-    /**
301
-     * Action must be taken immediately.
302
-     *
303
-     * Example: Entire website down, database unavailable, etc. This should
304
-     * trigger the SMS alerts and wake you up.
305
-     *
306
-     * @param string $message
307
-     * @param array $context
308
-     * @return null
309
-    */
310
-    public function alert($message, array $context = array())
311
-    {
312
-        $this->log(LogLevel::ALERT, $message, $context);
313
-    }
314
-
315
-    /**
316
-     * Critical conditions.
317
-     *
318
-     * Example: Application component unavailable, unexpected exception.
319
-     *
320
-     * @param string $message
321
-     * @param array $context
322
-     * @return null
323
-    */
324
-    public function critical($message, array $context = array())
325
-    {
326
-        $this->log(LogLevel::CRITICAL, $message, $context);
327
-    }
328
-
329
-    /**
330
-     * Runtime errors that do not require immediate action but should typically
331
-     * be logged and monitored.
332
-     *
333
-     * @param string $message
334
-     * @param array $context
335
-     * @return null
336
-    */
337
-    public function error($message, array $context = array())
338
-    {
339
-        $this->log(LogLevel::ERROR, $message, $context);
340
-    }
341
-
342
-    /**
343
-     * Exceptional occurrences that are not errors.
344
-     *
345
-     * Example: Use of deprecated APIs, poor use of an API, undesirable things
346
-     * that are not necessarily wrong.
347
-     *
348
-     * @param string $message
349
-     * @param array $context
350
-     * @return null
351
-    */
352
-    public function warning($message, array $context = array())
353
-    {
354
-        $this->log(LogLevel::WARNING, $message, $context);
355
-    }
356
-
357
-    /**
358
-     * Normal but significant events.
359
-     *
360
-     * @param string $message
361
-     * @param array $context
362
-     * @return null
363
-    */
364
-    public function notice($message, array $context = array())
365
-    {
366
-        $this->log(LogLevel::NOTICE, $message, $context);
367
-    }
368
-
369
-    /**
370
-     * Interesting events.
371
-     *
372
-     * Example: User logs in, SQL logs.
373
-     *
374
-     * @param string $message
375
-     * @param array $context
376
-     * @return null
377
-    */
378
-    public function info($message, array $context = array())
379
-    {
380
-        $this->log(LogLevel::INFO, $message, $context);
381
-    }
382
-
383
-    /**
384
-     * Detailed debug information.
385
-     *
386
-     * @param string $message
387
-     * @param array $context
388
-     * @return null
389
-    */
390
-    public function debug($message, array $context = array())
391
-    {
392
-        $this->log(LogLevel::DEBUG, $message, $context);
393
-    }
394
-
395
-    /**
396
-     * set the name of the called
397
-     *
398
-     * @access public
399
-     * @return void
400
-     */
401
-    private static function _setFileNameInErrorFile()
402
-    {
403
-        /**
404
-         * We see if it's a cli call or a web call
405
-         */
406
-
407
-        if (defined('BASH_CALLED')) {
408
-
409
-            error_log(Bash::setColor('############### '.BASH_CALLED.' ###############', 'cyan'));
410
-        }
411
-        else {
412
-
413
-            if (isset($_SERVER['HTTP_HOST']) && isset($_SERVER['REQUEST_URI'])) {
414
-                error_log(Bash::setColor('############### ' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . ' ###############', 'cyan'));
415
-            }
416
-        }
417
-    }
418
-
419
-    /**
420
-     * init the log file (error_log)
421
-     *
422
-     * @access private
423
-     * @return void
424
-     */
425
-    private static function _initLogFile()
426
-    {
427
-        self::$_sFileLog = str_replace(DIRECTORY_SEPARATOR.'bundles'.DIRECTORY_SEPARATOR.'lib', '', __DIR__).DIRECTORY_SEPARATOR.
428
-            "data".DIRECTORY_SEPARATOR."log".DIRECTORY_SEPARATOR."php-error.log";
429
-
430
-        ini_set("log_errors", 1);
431
-        ini_set("error_log", self::$_sFileLog);
432
-
433
-        if (file_exists(self::$_sFileLog) === false) { file_put_contents(self::$_sFileLog, ''); }
434
-    }
435
-
436
-    /**
437
-     * constructor in private for the singleton
438
-     *
439
-     * @access private
440
-     * @return \Venus\lib\Debug
441
-     */
442
-    private function __construct() {}
443
-
444
-    /**
445
-     * not allowed to clone a object
446
-     *
447
-     * @access private
448
-     * @return \Venus\lib\Debug
449
-     */
450
-    private function __clone() {}
88
+		return self::$_oInstance;
89
+	}
90
+
91
+	/**
92
+	 * activate debug
93
+	 *
94
+	 * @access public
95
+	 * @return void
96
+	 */
97
+	public static function activateDebug()
98
+	{
99
+		if (self::$_bFirstActivation === true) {
100
+
101
+			self::_setFileNameInErrorFile();
102
+			self::$_bFirstActivation = false;
103
+		}
104
+
105
+		self::_initLogFile();
106
+		self::$_bActivateDebug = true;
107
+		self::activateError(E_ALL);
108
+		self::activateException(E_ALL);
109
+	}
110
+
111
+	/**
112
+	 * activate debug
113
+	 *
114
+	 * @access public
115
+	 * @return void
116
+	 */
117
+	public static function deactivateDebug()
118
+	{
119
+		self::$_bActivateDebug = false;
120
+	}
121
+
122
+	/**
123
+	 * check if debug is activate or not
124
+	 *
125
+	 * @access public
126
+	 * @return boolean
127
+	 */
128
+	public static function isDebug() : bool
129
+	{
130
+		return self::$_bActivateDebug;
131
+	}
132
+
133
+	/**
134
+	 * activate error reporting
135
+	 *
136
+	 * @access public
137
+	 * @param  int $iLevel level of error
138
+	 * @return void
139
+	 */
140
+	public static function activateError($iLevel)
141
+	{
142
+		if (self::$_bFirstActivation === true) {
143
+
144
+			self::_setFileNameInErrorFile();
145
+			self::$_bFirstActivation = false;
146
+		}
147
+
148
+		self::_initLogFile();
149
+		self::$_bActivateError = true;
150
+
151
+		error_reporting($iLevel);
152
+
153
+		set_error_handler(function ($iErrNo, $sErrStr, $sErrFile, $iErrLine)
154
+		{
155
+			$aContext = array('file' => $sErrFile, 'line' => $iErrLine);
156
+
157
+			$sType = self::getTranslateErrorCode($iErrNo);
158
+
159
+			self::getInstance()->$sType($sErrStr, $aContext);
160
+
161
+			return true;
162
+		}, $iLevel);
163
+
164
+		register_shutdown_function(function()
165
+		{
166
+			if (null !== ($aLastError = error_get_last())) {
167
+
168
+				$aContext = array('file' => $aLastError['file'], 'line' => $aLastError['line']);
169
+
170
+				$sType = self::getTranslateErrorCode($aLastError['type']);
171
+
172
+				self::getInstance()->$sType($aLastError['message'], $aContext);
173
+			}
174
+		});
175
+	}
176
+
177
+	/**
178
+	 * activate error reporting
179
+	 *
180
+	 * @access public
181
+	 * @return void
182
+	 */
183
+	public static function deactivateError()
184
+	{
185
+		self::$_bActivateError = false;
186
+	}
187
+
188
+	/**
189
+	 * check if error reporting is activate or not
190
+	 *
191
+	 * @access public
192
+	 * @return boolean
193
+	 */
194
+	public static function isError() : bool
195
+	{
196
+		return self::$_bActivateError;
197
+	}
198
+
199
+
200
+	/**
201
+	 * activate Exception
202
+	 *
203
+	 * @access public
204
+	 * @param  int $iLevel level of error
205
+	 * @return void
206
+	 */
207
+	public static function activateException(int $iLevel)
208
+	{
209
+		if (self::$_bFirstActivation === true) {
210
+
211
+			self::_setFileNameInErrorFile();
212
+			self::$_bFirstActivation = false;
213
+		}
214
+
215
+		self::_initLogFile();
216
+		self::$_bActivateException = true;
217
+
218
+		set_exception_handler(function (\Exception $oException)
219
+		{
220
+			$aContext = array('file' => $oException->getFile(), 'line' => $oException->getLine());
221
+			self::getInstance()->critical($oException->getMessage(), $aContext);
222
+		});
223
+	}
224
+
225
+	/**
226
+	 * activate Exception
227
+	 *
228
+	 * @access public
229
+	 * @return void
230
+	 */
231
+	public static function deactivateException()
232
+	{
233
+		self::$_bActivateException = false;
234
+	}
235
+
236
+	/**
237
+	 * check if Exception is activate or not
238
+	 *
239
+	 * @access public
240
+	 * @return boolean
241
+	 */
242
+	public static function isException() : bool
243
+	{
244
+		return self::$_bActivateException;
245
+	}
246
+
247
+	/**
248
+	 * set the kind of report Log
249
+	 *
250
+	 * @access public
251
+	 * @param  string $sKindOfReportLog
252
+	 * @return void
253
+	 */
254
+	public static function setKindOfReportLog(string $sKindOfReportLog)
255
+	{
256
+		if ($sKindOfReportLog === 'screen' || $sKindOfReportLog === 'all') { self::$_sKindOfReportLog = $sKindOfReportLog; }
257
+		else { self::$_sKindOfReportLog = 'error_log'; }
258
+	}
259
+
260
+	/**
261
+	 * get the kind of report Log
262
+	 *
263
+	 * @access public
264
+	 * @return string
265
+	 */
266
+	public static function getKindOfReportLog() : string
267
+	{
268
+		return self::$_sKindOfReportLog;
269
+	}
270
+
271
+	/**
272
+	 * get the code by LogLevel adapt to the PSR-3
273
+	 *
274
+	 * @access public
275
+	 * @param  int $iCode
276
+	 * @return string
277
+	 */
278
+	public static function getTranslateErrorCode(int $iCode) : string
279
+	{
280
+		if ($iCode === 1 && $iCode === 16 && $iCode === 256 && $iCode === 4096) { return LogLevel::ERROR; }
281
+		else if ($iCode === 2 && $iCode === 32 && $iCode === 128 && $iCode === 512) { return LogLevel::WARNING; }
282
+		else if ($iCode === 4 && $iCode === 64) { return LogLevel::EMERGENCY; }
283
+		else if ($iCode === 8 && $iCode === 1024) { return LogLevel::NOTICE; }
284
+		else if ($iCode === 2048 && $iCode === 8192 && $iCode === 16384) { return LogLevel::INFO; }
285
+		else return LogLevel::DEBUG;
286
+	}
287
+
288
+	/**
289
+	 * System is unusable.
290
+	 *
291
+	 * @param string $message
292
+	 * @param array $context
293
+	 * @return null
294
+	 */
295
+	public function emergency($message, array $context = array())
296
+	{
297
+		$this->log(LogLevel::EMERGENCY, $message, $context);
298
+	}
299
+
300
+	/**
301
+	 * Action must be taken immediately.
302
+	 *
303
+	 * Example: Entire website down, database unavailable, etc. This should
304
+	 * trigger the SMS alerts and wake you up.
305
+	 *
306
+	 * @param string $message
307
+	 * @param array $context
308
+	 * @return null
309
+	 */
310
+	public function alert($message, array $context = array())
311
+	{
312
+		$this->log(LogLevel::ALERT, $message, $context);
313
+	}
314
+
315
+	/**
316
+	 * Critical conditions.
317
+	 *
318
+	 * Example: Application component unavailable, unexpected exception.
319
+	 *
320
+	 * @param string $message
321
+	 * @param array $context
322
+	 * @return null
323
+	 */
324
+	public function critical($message, array $context = array())
325
+	{
326
+		$this->log(LogLevel::CRITICAL, $message, $context);
327
+	}
328
+
329
+	/**
330
+	 * Runtime errors that do not require immediate action but should typically
331
+	 * be logged and monitored.
332
+	 *
333
+	 * @param string $message
334
+	 * @param array $context
335
+	 * @return null
336
+	 */
337
+	public function error($message, array $context = array())
338
+	{
339
+		$this->log(LogLevel::ERROR, $message, $context);
340
+	}
341
+
342
+	/**
343
+	 * Exceptional occurrences that are not errors.
344
+	 *
345
+	 * Example: Use of deprecated APIs, poor use of an API, undesirable things
346
+	 * that are not necessarily wrong.
347
+	 *
348
+	 * @param string $message
349
+	 * @param array $context
350
+	 * @return null
351
+	 */
352
+	public function warning($message, array $context = array())
353
+	{
354
+		$this->log(LogLevel::WARNING, $message, $context);
355
+	}
356
+
357
+	/**
358
+	 * Normal but significant events.
359
+	 *
360
+	 * @param string $message
361
+	 * @param array $context
362
+	 * @return null
363
+	 */
364
+	public function notice($message, array $context = array())
365
+	{
366
+		$this->log(LogLevel::NOTICE, $message, $context);
367
+	}
368
+
369
+	/**
370
+	 * Interesting events.
371
+	 *
372
+	 * Example: User logs in, SQL logs.
373
+	 *
374
+	 * @param string $message
375
+	 * @param array $context
376
+	 * @return null
377
+	 */
378
+	public function info($message, array $context = array())
379
+	{
380
+		$this->log(LogLevel::INFO, $message, $context);
381
+	}
382
+
383
+	/**
384
+	 * Detailed debug information.
385
+	 *
386
+	 * @param string $message
387
+	 * @param array $context
388
+	 * @return null
389
+	 */
390
+	public function debug($message, array $context = array())
391
+	{
392
+		$this->log(LogLevel::DEBUG, $message, $context);
393
+	}
394
+
395
+	/**
396
+	 * set the name of the called
397
+	 *
398
+	 * @access public
399
+	 * @return void
400
+	 */
401
+	private static function _setFileNameInErrorFile()
402
+	{
403
+		/**
404
+		 * We see if it's a cli call or a web call
405
+		 */
406
+
407
+		if (defined('BASH_CALLED')) {
408
+
409
+			error_log(Bash::setColor('############### '.BASH_CALLED.' ###############', 'cyan'));
410
+		}
411
+		else {
412
+
413
+			if (isset($_SERVER['HTTP_HOST']) && isset($_SERVER['REQUEST_URI'])) {
414
+				error_log(Bash::setColor('############### ' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . ' ###############', 'cyan'));
415
+			}
416
+		}
417
+	}
418
+
419
+	/**
420
+	 * init the log file (error_log)
421
+	 *
422
+	 * @access private
423
+	 * @return void
424
+	 */
425
+	private static function _initLogFile()
426
+	{
427
+		self::$_sFileLog = str_replace(DIRECTORY_SEPARATOR.'bundles'.DIRECTORY_SEPARATOR.'lib', '', __DIR__).DIRECTORY_SEPARATOR.
428
+			"data".DIRECTORY_SEPARATOR."log".DIRECTORY_SEPARATOR."php-error.log";
429
+
430
+		ini_set("log_errors", 1);
431
+		ini_set("error_log", self::$_sFileLog);
432
+
433
+		if (file_exists(self::$_sFileLog) === false) { file_put_contents(self::$_sFileLog, ''); }
434
+	}
435
+
436
+	/**
437
+	 * constructor in private for the singleton
438
+	 *
439
+	 * @access private
440
+	 * @return \Venus\lib\Debug
441
+	 */
442
+	private function __construct() {}
443
+
444
+	/**
445
+	 * not allowed to clone a object
446
+	 *
447
+	 * @access private
448
+	 * @return \Venus\lib\Debug
449
+	 */
450
+	private function __clone() {}
451 451
 }
Please login to merge, or discard this patch.
bundles/core/Controller.php 1 patch
Indentation   +133 added lines, -133 removed lines patch added patch discarded remove patch
@@ -43,138 +43,138 @@
 block discarded – undo
43 43
 abstract class Controller extends Mother 
44 44
 {
45 45
 
46
-    /**
47
-     * Cache to know if a model was initialize or not because we must initialize it just one time by script
48
-     * 
49
-     * @access private
50
-     * @var    array
51
-     */
52
-    private static $_aInitialize = array();
46
+	/**
47
+	 * Cache to know if a model was initialize or not because we must initialize it just one time by script
48
+	 * 
49
+	 * @access private
50
+	 * @var    array
51
+	 */
52
+	private static $_aInitialize = array();
53 53
     
54
-    /**
55
-     * Constructor
56
-     *
57
-     * @access public
58
-     */
59
-    public function __construct()
60
-    {
61
-        $aClass = explode('\\', get_called_class());
62
-        $sClassName = $aClass[count($aClass) - 1];
63
-        $sNamespaceName = preg_replace('/\\\\'.$sClassName.'$/', '', get_called_class());
64
-
65
-        if (isset($sClassName)) {
66
-
67
-            $sNamespaceBaseName = str_replace('\Controller', '', $sNamespaceName);
68
-            $sDefaultModel = $sNamespaceBaseName.'\Model\\'.$sClassName;
69
-            $sDefaultView = str_replace('\\', DIRECTORY_SEPARATOR, str_replace('Venus\\', '\\', $sNamespaceBaseName)).DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'View'.DIRECTORY_SEPARATOR.$sClassName.'.tpl';
70
-            $sDefaultLayout = str_replace('\\', DIRECTORY_SEPARATOR, str_replace('Venus\\', '\\', $sNamespaceBaseName)).DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'View'.DIRECTORY_SEPARATOR.'Layout.tpl';
71
-
72
-            $this->model = function() use ($sDefaultModel) { return new $sDefaultModel; };
73
-
74
-            $this->view = function() use ($sDefaultView) { return Vendor::getVendor('Apollina\Template', $sDefaultView); };
75
-
76
-            $this->layout = function() use ($sDefaultLayout) { return Vendor::getVendor('Apollina\Template', $sDefaultLayout, true); };
77
-
78
-            $this->layout->assign('model', $sDefaultView);
79
-        }
80
-
81
-        $this->form = function() { return new Form(); };
82
-        $this->security = function() { return new Security(); };
83
-        $this->router = function() { return new Router; };
84
-        $this->mail = function() { return new Mail; };
85
-        $this->session = function() { return new Session; };
86
-        $this->translator = function() { return new I18n; };
87
-        $this->url = function() { return new UrlManager; };
88
-        $this->cookie = function() { return new Cookie; };
89
-        $this->di = function() { return new Di; };
90
-        $this->request = function() { return new Request; };
91
-
92
-        /**
93
-         * Trigger on a model to initialize it. You could fill entity with it.
94
-         */
95
-        if (method_exists(get_called_class(), 'initialize')) {
96
-
97
-            if (!isset(self::$_aInitialize[get_called_class()])) {
98
-
99
-                static::initialize();
100
-                self::$_aInitialize[get_called_class()] = true;
101
-            }
102
-        }
103
-
104
-        /**
105
-         * Trigger on a model to initialize it every time you construct it
106
-         */
107
-        if (method_exists(get_called_class(), 'onConstruct')) { static::onConstruct(); }
108
-    }
109
-
110
-    /**
111
-     * redirection HTTP
112
-     *
113
-     * @access public
114
-     * @param  string $sUrl url for the redirection
115
-     * @param int $iHttpCode code of the http request
116
-     * @return void
117
-     */
118
-    public function redirect(string $sUrl, int $iHttpCode = 301)
119
-    {
120
-        if ($iHttpCode === 301) { header('Status: 301 Moved Permanently', false, 301); }
121
-        else if ($iHttpCode === 302) { header('Status: Moved Temporarily', false, 301); }
122
-
123
-        header('Location: '.$sUrl);
124
-        exit;
125
-    }
126
-
127
-    /**
128
-     * call an other action as you call action with URL/Cli
129
-     *
130
-     * @access public
131
-     * @param  string $sUri uri for the redirection
132
-     * @param  array $aParams parameters
133
-     * @return void
134
-     */
135
-    public function forward(string $sUri, array $aParams = array())
136
-    {
137
-        $this->router->runByFoward($sUri, $aParams);
138
-    }
139
-
140
-    /**
141
-     * call the 404 Not Found page
142
-     *
143
-     * @access public
144
-     * @return void
145
-     */
146
-    public function notFound()
147
-    {
148
-        $$this->router->runHttpErrorPage(404);
149
-    }
150
-
151
-    /**
152
-     * call the 403 Forbidden page
153
-     *
154
-     * @access public
155
-     * @return void
156
-     */
157
-    public function forbidden()
158
-    {
159
-        $$this->router->runHttpErrorPage(403);
160
-    }
161
-
162
-    /**
163
-     * get a property
164
-     *
165
-     * @access public
166
-     * @param  unknown_type $mKey
167
-     * @return void
168
-     */
169
-    public function __get($mKey)
170
-    {
171
-        if (isset($this->di) && property_exists($this, 'di')) {
172
-
173
-            $mDi = $this->di->get($mKey);
174
-
175
-            if (isset($mDi) && $mDi !== false) { return $mDi; }
176
-        }
177
-
178
-        return parent::__get($mKey);
179
-    }
54
+	/**
55
+	 * Constructor
56
+	 *
57
+	 * @access public
58
+	 */
59
+	public function __construct()
60
+	{
61
+		$aClass = explode('\\', get_called_class());
62
+		$sClassName = $aClass[count($aClass) - 1];
63
+		$sNamespaceName = preg_replace('/\\\\'.$sClassName.'$/', '', get_called_class());
64
+
65
+		if (isset($sClassName)) {
66
+
67
+			$sNamespaceBaseName = str_replace('\Controller', '', $sNamespaceName);
68
+			$sDefaultModel = $sNamespaceBaseName.'\Model\\'.$sClassName;
69
+			$sDefaultView = str_replace('\\', DIRECTORY_SEPARATOR, str_replace('Venus\\', '\\', $sNamespaceBaseName)).DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'View'.DIRECTORY_SEPARATOR.$sClassName.'.tpl';
70
+			$sDefaultLayout = str_replace('\\', DIRECTORY_SEPARATOR, str_replace('Venus\\', '\\', $sNamespaceBaseName)).DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'View'.DIRECTORY_SEPARATOR.'Layout.tpl';
71
+
72
+			$this->model = function() use ($sDefaultModel) { return new $sDefaultModel; };
73
+
74
+			$this->view = function() use ($sDefaultView) { return Vendor::getVendor('Apollina\Template', $sDefaultView); };
75
+
76
+			$this->layout = function() use ($sDefaultLayout) { return Vendor::getVendor('Apollina\Template', $sDefaultLayout, true); };
77
+
78
+			$this->layout->assign('model', $sDefaultView);
79
+		}
80
+
81
+		$this->form = function() { return new Form(); };
82
+		$this->security = function() { return new Security(); };
83
+		$this->router = function() { return new Router; };
84
+		$this->mail = function() { return new Mail; };
85
+		$this->session = function() { return new Session; };
86
+		$this->translator = function() { return new I18n; };
87
+		$this->url = function() { return new UrlManager; };
88
+		$this->cookie = function() { return new Cookie; };
89
+		$this->di = function() { return new Di; };
90
+		$this->request = function() { return new Request; };
91
+
92
+		/**
93
+		 * Trigger on a model to initialize it. You could fill entity with it.
94
+		 */
95
+		if (method_exists(get_called_class(), 'initialize')) {
96
+
97
+			if (!isset(self::$_aInitialize[get_called_class()])) {
98
+
99
+				static::initialize();
100
+				self::$_aInitialize[get_called_class()] = true;
101
+			}
102
+		}
103
+
104
+		/**
105
+		 * Trigger on a model to initialize it every time you construct it
106
+		 */
107
+		if (method_exists(get_called_class(), 'onConstruct')) { static::onConstruct(); }
108
+	}
109
+
110
+	/**
111
+	 * redirection HTTP
112
+	 *
113
+	 * @access public
114
+	 * @param  string $sUrl url for the redirection
115
+	 * @param int $iHttpCode code of the http request
116
+	 * @return void
117
+	 */
118
+	public function redirect(string $sUrl, int $iHttpCode = 301)
119
+	{
120
+		if ($iHttpCode === 301) { header('Status: 301 Moved Permanently', false, 301); }
121
+		else if ($iHttpCode === 302) { header('Status: Moved Temporarily', false, 301); }
122
+
123
+		header('Location: '.$sUrl);
124
+		exit;
125
+	}
126
+
127
+	/**
128
+	 * call an other action as you call action with URL/Cli
129
+	 *
130
+	 * @access public
131
+	 * @param  string $sUri uri for the redirection
132
+	 * @param  array $aParams parameters
133
+	 * @return void
134
+	 */
135
+	public function forward(string $sUri, array $aParams = array())
136
+	{
137
+		$this->router->runByFoward($sUri, $aParams);
138
+	}
139
+
140
+	/**
141
+	 * call the 404 Not Found page
142
+	 *
143
+	 * @access public
144
+	 * @return void
145
+	 */
146
+	public function notFound()
147
+	{
148
+		$$this->router->runHttpErrorPage(404);
149
+	}
150
+
151
+	/**
152
+	 * call the 403 Forbidden page
153
+	 *
154
+	 * @access public
155
+	 * @return void
156
+	 */
157
+	public function forbidden()
158
+	{
159
+		$$this->router->runHttpErrorPage(403);
160
+	}
161
+
162
+	/**
163
+	 * get a property
164
+	 *
165
+	 * @access public
166
+	 * @param  unknown_type $mKey
167
+	 * @return void
168
+	 */
169
+	public function __get($mKey)
170
+	{
171
+		if (isset($this->di) && property_exists($this, 'di')) {
172
+
173
+			$mDi = $this->di->get($mKey);
174
+
175
+			if (isset($mDi) && $mDi !== false) { return $mDi; }
176
+		}
177
+
178
+		return parent::__get($mKey);
179
+	}
180 180
 }
Please login to merge, or discard this patch.