aboutsummaryrefslogtreecommitdiff
path: root/bridges/PlantUMLReleasesBridge.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/PlantUMLReleasesBridge.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/PlantUMLReleasesBridge.php')
-rw-r--r--bridges/PlantUMLReleasesBridge.php71
1 files changed, 37 insertions, 34 deletions
diff --git a/bridges/PlantUMLReleasesBridge.php b/bridges/PlantUMLReleasesBridge.php
index fbf9211b..bc1cca20 100644
--- a/bridges/PlantUMLReleasesBridge.php
+++ b/bridges/PlantUMLReleasesBridge.php
@@ -5,42 +5,45 @@
* @author nicolas-delsaux
*
*/
-class PlantUMLReleasesBridge extends BridgeAbstract {
- const MAINTAINER = 'Riduidel';
- const NAME = 'PlantUML Releases';
- const AUTHOR = 'PlantUML team';
- const URI = 'https://plantuml.com/changes';
+class PlantUMLReleasesBridge extends BridgeAbstract
+{
+ const MAINTAINER = 'Riduidel';
+ const NAME = 'PlantUML Releases';
+ const AUTHOR = 'PlantUML team';
+ const URI = 'https://plantuml.com/changes';
- const CACHE_TIMEOUT = 7200; // 2h
- const DESCRIPTION = 'PlantUML releases bridge, showing for each release the changelog';
- const ITEM_LIMIT = 10;
+ const CACHE_TIMEOUT = 7200; // 2h
+ const DESCRIPTION = 'PlantUML releases bridge, showing for each release the changelog';
+ const ITEM_LIMIT = 10;
- public function getURI() {
- return self::URI;
- }
+ public function getURI()
+ {
+ return self::URI;
+ }
- public function collectData() {
- $html = defaultLinkTo(getSimpleHTMLDOM($this->getURI()), self::URI);
+ public function collectData()
+ {
+ $html = defaultLinkTo(getSimpleHTMLDOM($this->getURI()), self::URI);
- $num_items = 0;
- $main = $html->find('div[id=root]', 0);
- foreach ($main->find('h2') as $release) {
- // Limit to $ITEM_LIMIT number of results
- if ($num_items++ >= self::ITEM_LIMIT) {
- break;
- }
- $item = array();
- $item['author'] = self::AUTHOR;
- $release_text = $release->innertext;
- if (preg_match('/(.+) \((.*)\)/', $release_text, $matches)) {
- $item['title'] = $matches[1];
- $item['timestamp'] = preg_replace('/(\d+) (\w{3})\w*, (\d+)/', '${1} ${2} ${3}', $matches[2]);
- } else {
- $item['title'] = $release_text;
- }
- $item['uri'] = $this->getURI();
- $item['content'] = $release->next_sibling();
- $this->items[] = $item;
- }
- }
+ $num_items = 0;
+ $main = $html->find('div[id=root]', 0);
+ foreach ($main->find('h2') as $release) {
+ // Limit to $ITEM_LIMIT number of results
+ if ($num_items++ >= self::ITEM_LIMIT) {
+ break;
+ }
+ $item = [];
+ $item['author'] = self::AUTHOR;
+ $release_text = $release->innertext;
+ if (preg_match('/(.+) \((.*)\)/', $release_text, $matches)) {
+ $item['title'] = $matches[1];
+ $item['timestamp'] = preg_replace('/(\d+) (\w{3})\w*, (\d+)/', '${1} ${2} ${3}', $matches[2]);
+ } else {
+ $item['title'] = $release_text;
+ }
+ $item['uri'] = $this->getURI();
+ $item['content'] = $release->next_sibling();
+ $this->items[] = $item;
+ }
+ }
}