Skip to content

Commit

Permalink
Merge pull request #47 from darkalchemy/master
Browse files Browse the repository at this point in the history
replace create_function with anonymous function #46
  • Loading branch information
darkalchemy committed Mar 7, 2018
2 parents bb3445f + df3ada8 commit 9ffbe46
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Torrent.php
Expand Up @@ -753,7 +753,7 @@ protected static function set_error($exception, $message = false)
*/
protected static function announce_list($announce, $merge = [])
{
return array_map(create_function('$a', 'return (array) $a;'), array_merge((array) $announce, (array) $merge));
return array_map(function($a) {return (array) $a;}, array_merge((array) $announce, (array) $merge));
}

/** Get the first announce url in a list
Expand Down Expand Up @@ -886,7 +886,9 @@ private function file($file, $piece_length)
private function files($files, $piece_length)
{
sort($files);
usort($files, create_function('$a,$b', 'return strrpos($a,DIRECTORY_SEPARATOR)-strrpos($b,DIRECTORY_SEPARATOR);'));
usort($files, function($a, $b) {
return strrpos($a,DIRECTORY_SEPARATOR)-strrpos($b,DIRECTORY_SEPARATOR);
});
$first = current($files);
if (!self::is_url($first)) {
$files = array_map('realpath', $files);
Expand Down

0 comments on commit 9ffbe46

Please sign in to comment.