Skip to content

Commit 634bb72

Browse files
committed
:octocat:
1 parent dc92fe4 commit 634bb72

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

examples/Providers/Spotify/MixesDBTrackSearch.php

+7-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function getTracks(
3939

4040
foreach($sets as $name => $set){
4141
// skip by inclusion list
42-
if($this->setContains($name, $find)){
42+
if(!$this->setContains($name, $find)){
4343
continue;
4444
}
4545

@@ -99,9 +99,14 @@ public function getTracks(
9999
* check a string for the occurence of any in the given array of needles
100100
*/
101101
protected function setContains(string $haystack, array $needles):bool{
102+
103+
if(empty($needles)){
104+
return true;
105+
}
106+
102107
$haystack = mb_strtolower($haystack);
103108

104-
return !empty($needles) && str_replace(array_map('mb_strtolower', $needles), '', $haystack) === $haystack;
109+
return str_replace(array_map('mb_strtolower', $needles), '', $haystack) !== $haystack;
105110
}
106111

107112
/**

0 commit comments

Comments
 (0)