diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2014-02-05 17:05:56 +0100 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2014-02-11 10:50:03 +0100 |
commit | af781bdea7509c3ecd9a7b4902fb7a266dc62c80 (patch) | |
tree | a96d0d290974278e4d97aa56919d45997f9d86a9 /lib | |
parent | 32afdcbefec5793fb28162c456919d2b0be5cfe9 (diff) | |
download | nextcloud-server-af781bdea7509c3ecd9a7b4902fb7a266dc62c80.tar.gz nextcloud-server-af781bdea7509c3ecd9a7b4902fb7a266dc62c80.zip |
fix DI
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/share/searchresultsorter.php | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/private/share/searchresultsorter.php b/lib/private/share/searchresultsorter.php index f81a94c749d..fbf77179097 100644 --- a/lib/private/share/searchresultsorter.php +++ b/lib/private/share/searchresultsorter.php @@ -21,10 +21,10 @@ class SearchResultSorter { * @param $encoding optional, encoding to use, defaults to UTF-8 * @param $log optional, an \OC\Log instance */ - public function __construct($search, $key, $encoding = 'UTF-8', \OC\Log $log = null) { + public function __construct($search, $key, \OC\Log $log = null, $encoding = 'UTF-8') { $this->encoding = $encoding; $this->key = $key; - $this->log = is_null($log) ? new \OC\Log() : $log; + $this->log = $log; $this->search = mb_strtolower($search, $this->encoding); } @@ -35,8 +35,10 @@ class SearchResultSorter { */ public function sort($a, $b) { if(!isset($a[$this->key]) || !isset($b[$this->key])) { - $this->log->error('Sharing dialogue: cannot sort due to missing array key', - array('app' => 'core')); + if(!is_null($this->log)) { + $this->log->error('Sharing dialogue: cannot sort due to ' . + 'missing array key', array('app' => 'core')); + } return 0; } $nameA = mb_strtolower($a[$this->key], $this->encoding); |