1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-12 11:34:09 +02:00

[core] Backported str_starts_with, str_ends_with and str_contains from php 8 (#2318)

This commit is contained in:
Eugene Molotov
2021-10-30 01:06:04 +05:00
committed by GitHub
parent 9254d14f50
commit b86ed70376
3 changed files with 34 additions and 10 deletions

View File

@@ -47,15 +47,6 @@ class NordbayernBridge extends BridgeAbstract {
)
));
private function startsWith($string, $startString) {
$len = strlen($startString);
return (substr($string, 0, $len) === $startString);
}
private function contains($haystack, $needle) {
return (strpos($haystack, $needle) !== false);
}
private function getUseFullContent($rawContent) {
$content = '';
foreach($rawContent->children as $element) {
@@ -109,7 +100,7 @@ class NordbayernBridge extends BridgeAbstract {
// exclude police reports if descired
if($this->getInput('policeReports') ||
!self::contains($item['content'], 'Hier geht es zu allen aktuellen Polizeimeldungen.')) {
!str_contains($item['content'], 'Hier geht es zu allen aktuellen Polizeimeldungen.')) {
$this->items[] = $item;
}