public function is_file_excluded(\SplFileInfo $file) { $exclude_string = implode('|', $this->get_excludes_for_regex()); $file_path_no_root = str_ireplace(trailingslashit(Path::get_root()), '', wp_normalize_path($file->getPathname())); if ($exclude_string && preg_match('(' . $exclude_string . ')', $file_path_no_root)) { return true; } return false; }