@@ -546,8 +546,7 @@ public function readMessage(
546
546
if ($ this ->updateDataStructure ($ device_id )) {
547
547
$ messages_new_array = glob ($ this ->getDevicePathReceive () . "$ message_id. $ message_filter " );
548
548
// Sort based on time, last update on the top
549
- usort ($ messages_new_array , create_function ('$a,$b ' , 'return filemtime($b) - filemtime($a); ' ));
550
-
549
+ usort ($ messages_new_array , function ($ a ,$ b ){ return filemtime ($ b ) - filemtime ($ a );});
551
550
if (count ($ messages_new_array ) > 0 ) {
552
551
foreach ($ messages_new_array as $ message ) {
553
552
$ from = "" ;
@@ -621,8 +620,8 @@ public function readSentStatus(
621
620
if ($ this ->updateDataStructure ($ device_id )) {
622
621
$ messages_new_array = glob ($ message_folder . "$ message_id. $ message_filter " );
623
622
// Sort based on time, last update on the top
624
- usort ($ messages_new_array , create_function ( ' $a,$b ' , ' return filemtime($b) - filemtime($a); ' ) );
625
- if (count ($ messages_new_array ) > 0 ) {
623
+ usort ($ messages_new_array , function ( $ a ,$ b){ return filemtime ($ b ) - filemtime ($ a );} );
624
+ if (count ($ messages_new_array ) > 0 ) {
626
625
foreach ($ messages_new_array as $ message ) {
627
626
$ id = pathinfo ($ message )['filename ' ];
628
627
$ status = pathinfo ($ message )['extension ' ];
@@ -694,8 +693,8 @@ public function getMessagesToSend(
694
693
if ($ this ->updateDataStructure ($ device_id )) {
695
694
$ messages_new_array = glob ($ this ->getDevicePathSend () . "*.NEW " );
696
695
// Sort based on time, older on top
697
- usort ($ messages_new_array , create_function ( ' $a,$b ' , ' return filemtime($a) - filemtime($b); ' ) );
698
- if (count ($ messages_new_array ) > 0 ) {
696
+ usort ($ messages_new_array , function ( $ a ,$ b){ return filemtime ($ a ) - filemtime ($ b );} );
697
+ if (count ($ messages_new_array ) > 0 ) {
699
698
$ result .= "\"messages \": [ " ;
700
699
foreach ($ messages_new_array as $ message_new ) {
701
700
@@ -718,8 +717,8 @@ public function getTimeoutDevices()
718
717
if ($ this ->getDeviceTimeout () > 0 ) {
719
718
$ devices_array = glob ($ this ->getDataPath () . "* " );
720
719
// Sort based on time, older on top
721
- usort ($ devices_array , create_function ( ' $a,$b ' , ' return filemtime($a) - filemtime($b); ' ) );
722
- foreach ($ devices_array as $ device ) {
720
+ usort ($ devices_array , function ( $ a ,$ b){ return filemtime ($ a ) - filemtime ($ b );} );
721
+ foreach ($ devices_array as $ device ) {
723
722
if (is_dir ($ device ) && (". " != $ device ) && (".. " != $ device )) {
724
723
$ last_update = filemtime ($ device );
725
724
if (time () > ($ last_update + $ this ->getDeviceTimeout ())) {
@@ -924,4 +923,4 @@ public function apiServer(
924
923
echo $ response ;
925
924
}
926
925
927
- }
926
+ }
0 commit comments