Skip to content

Commit 1a35a7d

Browse files
Merge pull request chriskacerguis#435 from Tjoosten/master
replace and by &&@
2 parents 2e12be6 + 754e40c commit 1a35a7d

File tree

2 files changed

+90
-90
lines changed

2 files changed

+90
-90
lines changed

application/libraries/Format.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010
class Format {
1111

12-
protected $_data = array(); // Array to convert
12+
protected $_data = []; // Array to convert
1313
protected $_from_type = NULL; // View filename
1414

1515
/**
@@ -45,7 +45,7 @@ public function __construct($data = NULL, $from_type = NULL)
4545
{
4646
if (method_exists($this, '_from_' . $from_type))
4747
{
48-
$data = call_user_func(array($this, '_from_' . $from_type), $data);
48+
$data = call_user_func([$this, '_from_' . $from_type], $data);
4949
}
5050

5151
else
@@ -68,16 +68,16 @@ public function __construct($data = NULL, $from_type = NULL)
6868
public function to_array($data = NULL)
6969
{
7070
// If not just NULL, but nothing is provided
71-
if ($data === NULL and ! func_num_args())
71+
if ($data === NULL && ! func_num_args())
7272
{
7373
$data = $this->_data;
7474
}
7575

76-
$array = array();
76+
$array = [];
7777

7878
foreach ((array) $data as $key => $value)
7979
{
80-
if (is_object($value) or is_array($value))
80+
if (is_object($value) || is_array($value))
8181
{
8282
$array[$key] = $this->to_array($value);
8383
}
@@ -101,7 +101,7 @@ public function to_array($data = NULL)
101101
*/
102102
public function to_xml($data = NULL, $structure = NULL, $basenode = 'xml')
103103
{
104-
if ($data === NULL and ! func_num_args())
104+
if ($data === NULL && ! func_num_args())
105105
{
106106
$data = $this->_data;
107107
}
@@ -118,7 +118,7 @@ public function to_xml($data = NULL, $structure = NULL, $basenode = 'xml')
118118
}
119119

120120
// Force it to be something useful
121-
if ( ! is_array($data) AND ! is_object($data))
121+
if ( ! is_array($data) && ! is_object($data))
122122
{
123123
$data = (array) $data;
124124
}
@@ -191,7 +191,7 @@ public function to_html()
191191
else
192192
{
193193
$headings = array_keys($data);
194-
$data = array($data);
194+
$data = [$data];
195195
}
196196

197197
$ci = get_instance();
@@ -226,7 +226,7 @@ public function to_csv()
226226
else
227227
{
228228
$headings = array_keys($data);
229-
$data = array($data);
229+
$data = [$data];
230230
}
231231

232232
$output = '"'.implode('","', $headings).'"'.PHP_EOL;
@@ -308,7 +308,7 @@ public function to_php()
308308
*/
309309
protected function _from_xml($string)
310310
{
311-
return $string ? (array) simplexml_load_string($string, 'SimpleXMLElement', LIBXML_NOCDATA) : array();
311+
return $string ? (array) simplexml_load_string($string, 'SimpleXMLElement', LIBXML_NOCDATA) : [];
312312
}
313313

314314
/**
@@ -320,7 +320,7 @@ protected function _from_xml($string)
320320
*/
321321
protected function _from_csv($string)
322322
{
323-
$data = array();
323+
$data = [];
324324

325325
// Splits
326326
$rows = explode("\n", trim($string));

0 commit comments

Comments
 (0)