This repository was archived by the owner on Oct 15, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -26,26 +26,29 @@ class Filter
2626
2727
2828 /**
29- * Creates a new filter.
29+ * Creates a new filter. If $tag or $operator is empty, an empty Filter is returned.
3030 * @param string $tag Tag to be searched for. Like artist, title,...
3131 * @param string $operator Comparison operator. Like ==, contains, ~=,...
3232 * @param string $value The value to search for. Unescaped.
3333 */
34- public function __construct (string $ tag , string $ operator , string $ value )
34+ public function __construct (string $ tag = "" , string $ operator = "" , string $ value = "" )
3535 {
3636 $ this ->and ($ tag , $ operator , $ value );
3737 }
3838
3939
4040 /**
41- * Used to chain multiple filters together with a logical AND.
41+ * Used to chain multiple filters together with a logical AND. If $tag or $operator is empty, the condition is not added to the Filter.
4242 * @param string $tag
4343 * @param string $operator
4444 * @param string $value
4545 * @return $this
4646 */
4747 public function and (string $ tag , string $ operator , string $ value ): Filter
4848 {
49+
50+ if ($ tag === "" || $ operator === "" ){ return $ this ; }
51+
4952 if ($ value === "" ){
5053 $ value = "'' " ;
5154 }else {
You can’t perform that action at this time.
0 commit comments