diff options
author | ctrlaltca <ctrlaltca@gmail.com> | 2016-04-04 18:31:02 +0200 |
---|---|---|
committer | ctrlaltca <ctrlaltca@gmail.com> | 2016-04-04 18:31:02 +0200 |
commit | 7e255537404cb6ceb5465589c87897781358bc59 (patch) | |
tree | c6655e104b4be4ced6acaf914c2eee87452d3c4c /demos | |
parent | 0ec0d073c120a2db371dfd4cd6f2a81fd9068676 (diff) | |
parent | ba0b0923f7520d6cd35373679aed963d1318074a (diff) |
Merge pull request #578 from pradosoft/scrutinizer
Misc code fixes suggested by Scrutinizer
Diffstat (limited to 'demos')
-rwxr-xr-x | demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.php | 11 | ||||
-rwxr-xr-x | demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample4.php | 11 |
2 files changed, 16 insertions, 6 deletions
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.php index aeb30609..827558b8 100755 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.php @@ -6,9 +6,14 @@ class Sample4 extends Sample2 { protected function sortData($data,$key) { - $compare = create_function('$a,$b','if ($a["'.$key.'"] == $b["'.$key.'"]) {return 0;}else {return ($a["'.$key.'"] > $b["'.$key.'"]) ? 1 : -1;}'); - usort($data,$compare) ; - return $data ; + usort($data, function($a, $b) use ($key) { + if ($a[$key] == $b[$key]) { + return 0; + } else { + return ($a[$key] > $b[$key]) ? 1 : -1; + } + }); + return $data; } public function sortDataGrid($sender,$param) diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample4.php b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample4.php index 201fc5f9..766e4d55 100755 --- a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample4.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample4.php @@ -6,9 +6,14 @@ class Sample4 extends Sample2 { protected function sortData($data,$key) { - $compare = create_function('$a,$b','if ($a["'.$key.'"] == $b["'.$key.'"]) {return 0;}else {return ($a["'.$key.'"] > $b["'.$key.'"]) ? 1 : -1;}'); - usort($data,$compare) ; - return $data ; + usort($data, function($a, $b) use ($key) { + if ($a[$key] == $b[$key]) { + return 0; + } else { + return ($a[$key] > $b[$key]) ? 1 : -1; + } + }); + return $data; } public function sortDataGrid($sender,$param) |