diff options
author | 2022-07-01 15:10:30 +0200 | |
---|---|---|
committer | 2022-07-01 15:10:30 +0200 | |
commit | 4f75591060d95208a301bc6bf460d875631b29cc (patch) | |
tree | 4e37d86840e8d990a563ba75d3de6f84a53cc2de /bridges/SpottschauBridge.php | |
parent | 66568e3a39c61546c09a47a5688914a0bdf3c60c (diff) | |
download | rss-bridge-4f75591060d95208a301bc6bf460d875631b29cc.tar.gz rss-bridge-4f75591060d95208a301bc6bf460d875631b29cc.tar.zst rss-bridge-4f75591060d95208a301bc6bf460d875631b29cc.zip |
Reformat codebase v4 (#2872)
Reformat code base to PSR12
Co-authored-by: rssbridge <noreply@github.com>
Diffstat (limited to 'bridges/SpottschauBridge.php')
-rw-r--r-- | bridges/SpottschauBridge.php | 59 |
1 files changed, 31 insertions, 28 deletions
diff --git a/bridges/SpottschauBridge.php b/bridges/SpottschauBridge.php index c9d1952f..a2720274 100644 --- a/bridges/SpottschauBridge.php +++ b/bridges/SpottschauBridge.php @@ -1,39 +1,42 @@ <?php -class SpottschauBridge extends BridgeAbstract { - const NAME = 'Härringers Spottschau Bridge'; - const URI = 'https://spottschau.com/'; - const DESCRIPTION = 'Der Fußball-Comic'; - const MAINTAINER = 'sal0max'; - const PARAMETERS = array(); - const CACHE_TIMEOUT = 3600; // 1 hour +class SpottschauBridge extends BridgeAbstract +{ + const NAME = 'Härringers Spottschau Bridge'; + const URI = 'https://spottschau.com/'; + const DESCRIPTION = 'Der Fußball-Comic'; + const MAINTAINER = 'sal0max'; + const PARAMETERS = []; - public function collectData() { - $html = getSimpleHTMLDOM(self::URI); + const CACHE_TIMEOUT = 3600; // 1 hour - $item = array(); - $item['uri'] = urljoin(self::URI, $html->find('div.strip>a', 0)->attr['href']); - $item['title'] = $html->find('div.text>h2', 0)->innertext; + public function collectData() + { + $html = getSimpleHTMLDOM(self::URI); - $date = preg_replace('/.*, /', '', $item['title']); - $date = preg_replace('/\\d\\d\\.\\//', '', $date); - try { - $item['timestamp'] = DateTime::createFromFormat('d.m.y', $date) - ->setTimezone(new DateTimeZone('Europe/Berlin')) - ->setTime(0, 0) - ->getTimestamp(); - } catch (Throwable $ignored) { - $item['timestamp'] = null; - } + $item = []; + $item['uri'] = urljoin(self::URI, $html->find('div.strip>a', 0)->attr['href']); + $item['title'] = $html->find('div.text>h2', 0)->innertext; - $image = $html->find('div.strip>a>img', 0); - $imageUrl = urljoin(self::URI, $image->attr['src']); - $imageAlt = $image->attr['alt']; + $date = preg_replace('/.*, /', '', $item['title']); + $date = preg_replace('/\\d\\d\\.\\//', '', $date); + try { + $item['timestamp'] = DateTime::createFromFormat('d.m.y', $date) + ->setTimezone(new DateTimeZone('Europe/Berlin')) + ->setTime(0, 0) + ->getTimestamp(); + } catch (Throwable $ignored) { + $item['timestamp'] = null; + } - $item['content'] = <<<EOD + $image = $html->find('div.strip>a>img', 0); + $imageUrl = urljoin(self::URI, $image->attr['src']); + $imageAlt = $image->attr['alt']; + + $item['content'] = <<<EOD <img src="{$imageUrl}" alt="{$imageAlt}"/> <br/> EOD; - $this->items[] = $item; - } + $this->items[] = $item; + } } |