@@ -29,7 +29,7 @@ |
||
29 | 29 | /** |
30 | 30 | * @param $dom |
31 | 31 | * @param $data |
32 | - * @return bool|\DOMElement |
|
32 | + * @return \DOMNode |
|
33 | 33 | */ |
34 | 34 | protected function generateXmlElement(\DOMDocument $dom, $data ) |
35 | 35 | { |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * |
18 | 18 | * @param array $content |
19 | 19 | */ |
20 | - public function __construct ($content = []) |
|
20 | + public function __construct($content = []) |
|
21 | 21 | { |
22 | 22 | parent::__construct($content); |
23 | 23 | $this->setContent($content); |
@@ -31,30 +31,30 @@ discard block |
||
31 | 31 | * @param $data |
32 | 32 | * @return bool|\DOMElement |
33 | 33 | */ |
34 | - protected function generateXmlElement(\DOMDocument $dom, $data ) |
|
34 | + protected function generateXmlElement(\DOMDocument $dom, $data) |
|
35 | 35 | { |
36 | - if ( empty( $data['name'] ) ) |
|
36 | + if (empty($data['name'])) |
|
37 | 37 | return false; |
38 | 38 | |
39 | 39 | // Create the element |
40 | - $element_value = ( ! empty( $data['value'] ) ) ? $data['value'] : null; |
|
41 | - $element = $dom->createElement( $data['name'], $element_value ); |
|
40 | + $element_value = (!empty($data['value'])) ? $data['value'] : null; |
|
41 | + $element = $dom->createElement($data['name'], $element_value); |
|
42 | 42 | |
43 | 43 | // Add any attributes |
44 | - if ( ! empty( $data['attributes'] ) && is_array( $data['attributes'] ) ) { |
|
45 | - foreach ( $data['attributes'] as $attribute_key => $attribute_value ) { |
|
46 | - $element->setAttribute( $attribute_key, $attribute_value ); |
|
44 | + if (!empty($data['attributes']) && is_array($data['attributes'])) { |
|
45 | + foreach ($data['attributes'] as $attribute_key => $attribute_value) { |
|
46 | + $element->setAttribute($attribute_key, $attribute_value); |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
50 | 50 | // Any other items in the data array should be child elements |
51 | - foreach ( $data as $data_key => $child_data ) { |
|
52 | - if ( ! is_numeric( $data_key ) ) |
|
51 | + foreach ($data as $data_key => $child_data) { |
|
52 | + if (!is_numeric($data_key)) |
|
53 | 53 | continue; |
54 | 54 | |
55 | - $child = $this->generateXmlElement( $dom, $child_data ); |
|
56 | - if ( $child ) |
|
57 | - $element->appendChild( $child ); |
|
55 | + $child = $this->generateXmlElement($dom, $child_data); |
|
56 | + if ($child) |
|
57 | + $element->appendChild($child); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | return $element; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $doc->encoding = 'UTF-8'; |
75 | 75 | $child = $this->generateXmlElement($doc, $content); |
76 | 76 | |
77 | - if ( $child ) { |
|
77 | + if ($child) { |
|
78 | 78 | $doc->appendChild($child); |
79 | 79 | } |
80 | 80 |
@@ -33,8 +33,9 @@ discard block |
||
33 | 33 | */ |
34 | 34 | protected function generateXmlElement(\DOMDocument $dom, $data ) |
35 | 35 | { |
36 | - if ( empty( $data['name'] ) ) |
|
37 | - return false; |
|
36 | + if ( empty( $data['name'] ) ) { |
|
37 | + return false; |
|
38 | + } |
|
38 | 39 | |
39 | 40 | // Create the element |
40 | 41 | $element_value = ( ! empty( $data['value'] ) ) ? $data['value'] : null; |
@@ -49,12 +50,14 @@ discard block |
||
49 | 50 | |
50 | 51 | // Any other items in the data array should be child elements |
51 | 52 | foreach ( $data as $data_key => $child_data ) { |
52 | - if ( ! is_numeric( $data_key ) ) |
|
53 | - continue; |
|
53 | + if ( ! is_numeric( $data_key ) ) { |
|
54 | + continue; |
|
55 | + } |
|
54 | 56 | |
55 | 57 | $child = $this->generateXmlElement( $dom, $child_data ); |
56 | - if ( $child ) |
|
57 | - $element->appendChild( $child ); |
|
58 | + if ( $child ) { |
|
59 | + $element->appendChild( $child ); |
|
60 | + } |
|
58 | 61 | } |
59 | 62 | |
60 | 63 | return $element; |
@@ -111,7 +111,7 @@ |
||
111 | 111 | |
112 | 112 | /** |
113 | 113 | * @param array $roles |
114 | - * @return bool |
|
114 | + * @return null|boolean |
|
115 | 115 | */ |
116 | 116 | public function isPermitted(array $roles) |
117 | 117 | { |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | $headers .= 'Content-Type: multipart/mixed; charset=UTF-8; boundary=' . $boundary . $eol; |
189 | 189 | |
190 | 190 | if (!empty($this->from)) { |
191 | - $headers .= 'From: ' .$this->from . $eol; |
|
191 | + $headers .= 'From: ' . $this->from . $eol; |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | if (!empty($this->replyTo)) { |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | } |
247 | 247 | |
248 | 248 | $body .= 'Content-Transfer-Encoding: base64' . $eol; |
249 | - $body .= 'X-Attachment-Id: ' . rand(1000,99999) . $eol . $eol; |
|
249 | + $body .= 'X-Attachment-Id: ' . rand(1000, 99999) . $eol . $eol; |
|
250 | 250 | $body .= $encodedContent . $eol; |
251 | 251 | |
252 | 252 | } |
@@ -37,13 +37,13 @@ |
||
37 | 37 | |
38 | 38 | switch ($type) { |
39 | 39 | |
40 | - case 'js': |
|
41 | - $pattern = '<script src="%s"></script>'; |
|
42 | - break; |
|
40 | + case 'js': |
|
41 | + $pattern = '<script src="%s"></script>'; |
|
42 | + break; |
|
43 | 43 | |
44 | - case 'css': |
|
45 | - $pattern = '<link rel="stylesheet" type="text/css" href="%s">'; |
|
46 | - break; |
|
44 | + case 'css': |
|
45 | + $pattern = '<link rel="stylesheet" type="text/css" href="%s">'; |
|
46 | + break; |
|
47 | 47 | |
48 | 48 | } |
49 | 49 |
@@ -80,7 +80,7 @@ |
||
80 | 80 | 'line' => $this->_exception->getLine() |
81 | 81 | ]; |
82 | 82 | |
83 | - $trace = $this->_exception->getTrace(); |
|
83 | + $trace = $this->_exception->getTrace(); |
|
84 | 84 | |
85 | 85 | if (isset($trace[0]['line']) && $trace[0]['line'] !== $raiser['line']) { |
86 | 86 | array_unshift($trace, $raiser); |
@@ -2,14 +2,10 @@ |
||
2 | 2 | |
3 | 3 | namespace Faulancer\View; |
4 | 4 | |
5 | -use Faulancer\Exception\ClassNotFoundException; |
|
6 | 5 | use Faulancer\Exception\ConstantMissingException; |
7 | -use Faulancer\Exception\Exception; |
|
8 | 6 | use Faulancer\Exception\FileNotFoundException; |
9 | 7 | use Faulancer\Exception\ViewHelperException; |
10 | -use Faulancer\Exception\ViewHelperIncompatibleException; |
|
11 | 8 | use Faulancer\Service\Config; |
12 | -use Faulancer\Service\ResponseService; |
|
13 | 9 | use Faulancer\ServiceLocator\ServiceLocator; |
14 | 10 | |
15 | 11 | /** |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public function getVariable(string $key) |
158 | 158 | { |
159 | - if(isset($this->variable[$key])) { |
|
159 | + if (isset($this->variable[$key])) { |
|
160 | 160 | return $this->variable[$key]; |
161 | 161 | } |
162 | 162 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | */ |
172 | 172 | public function hasVariable(string $key) :bool |
173 | 173 | { |
174 | - if(isset($this->variable[$key])) { |
|
174 | + if (isset($this->variable[$key])) { |
|
175 | 175 | return true; |
176 | 176 | } |
177 | 177 | |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | */ |
187 | 187 | public function setVariables(array $variables = []) :self |
188 | 188 | { |
189 | - foreach($variables AS $key=>$value) { |
|
189 | + foreach ($variables AS $key=>$value) { |
|
190 | 190 | $this->setVariable($key, $value); |
191 | 191 | } |
192 | 192 | |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | */ |
273 | 273 | public function __call($name, $arguments) |
274 | 274 | { |
275 | - $coreViewHelper = __NAMESPACE__ . '\Helper\\' . ucfirst($name); |
|
275 | + $coreViewHelper = __NAMESPACE__ . '\Helper\\' . ucfirst($name); |
|
276 | 276 | |
277 | 277 | /* |
278 | 278 | if (!empty($this->viewHelpers[$coreViewHelper])) { |
@@ -327,8 +327,8 @@ discard block |
||
327 | 327 | */ |
328 | 328 | public function __destruct() |
329 | 329 | { |
330 | - unset( $this->variable ); |
|
331 | - unset( $this->template ); |
|
330 | + unset($this->variable); |
|
331 | + unset($this->template); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | } |
335 | 335 | \ No newline at end of file |