aboutsummaryrefslogtreecommitdiff
path: root/bridges/DilbertBridge.php
diff options
context:
space:
mode:
authorGravatar Dag <me@dvikan.no> 2022-07-01 15:10:30 +0200
committerGravatar GitHub <noreply@github.com> 2022-07-01 15:10:30 +0200
commit4f75591060d95208a301bc6bf460d875631b29cc (patch)
tree4e37d86840e8d990a563ba75d3de6f84a53cc2de /bridges/DilbertBridge.php
parent66568e3a39c61546c09a47a5688914a0bdf3c60c (diff)
downloadrss-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/DilbertBridge.php')
-rw-r--r--bridges/DilbertBridge.php59
1 files changed, 30 insertions, 29 deletions
diff --git a/bridges/DilbertBridge.php b/bridges/DilbertBridge.php
index 827355d5..cd509ea4 100644
--- a/bridges/DilbertBridge.php
+++ b/bridges/DilbertBridge.php
@@ -1,35 +1,36 @@
<?php
-class DilbertBridge extends BridgeAbstract {
- const MAINTAINER = 'kranack';
- const NAME = 'Dilbert Daily Strip';
- const URI = 'https://dilbert.com';
- const CACHE_TIMEOUT = 21600; // 6h
- const DESCRIPTION = 'The Unofficial Dilbert Daily Comic Strip';
+class DilbertBridge extends BridgeAbstract
+{
+ const MAINTAINER = 'kranack';
+ const NAME = 'Dilbert Daily Strip';
+ const URI = 'https://dilbert.com';
+ const CACHE_TIMEOUT = 21600; // 6h
+ const DESCRIPTION = 'The Unofficial Dilbert Daily Comic Strip';
- public function collectData(){
+ public function collectData()
+ {
+ $html = getSimpleHTMLDOM(self::URI);
- $html = getSimpleHTMLDOM(self::URI);
+ foreach ($html->find('section.comic-item') as $element) {
+ $img = $element->find('img', 0);
+ $link = $element->find('a', 0);
+ $comic = $img->src;
+ $title = $img->alt;
+ $url = $link->href;
+ $date = substr(strrchr($url, '/'), 1);
+ if (empty($title)) {
+ $title = 'Dilbert Comic Strip on ' . $date;
+ }
+ $date = strtotime($date);
- foreach($html->find('section.comic-item') as $element) {
-
- $img = $element->find('img', 0);
- $link = $element->find('a', 0);
- $comic = $img->src;
- $title = $img->alt;
- $url = $link->href;
- $date = substr(strrchr($url, '/'), 1);
- if (empty($title))
- $title = 'Dilbert Comic Strip on ' . $date;
- $date = strtotime($date);
-
- $item = array();
- $item['uri'] = $url;
- $item['title'] = $title;
- $item['author'] = 'Scott Adams';
- $item['timestamp'] = $date;
- $item['content'] = '<img src="' . $comic . '" alt="' . $img->alt . '" />';
- $this->items[] = $item;
- }
- }
+ $item = [];
+ $item['uri'] = $url;
+ $item['title'] = $title;
+ $item['author'] = 'Scott Adams';
+ $item['timestamp'] = $date;
+ $item['content'] = '<img src="' . $comic . '" alt="' . $img->alt . '" />';
+ $this->items[] = $item;
+ }
+ }
}