Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[KilledbyMicrosoftBridge] New Bridge #3960

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions bridges/KilledbyMicrosoftBridge.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

class KilledbyMicrosoftBridge extends BridgeAbstract
{
const NAME = 'Killed by Microsoft Bridge';
const URI = 'https://killedbymicrosoft.info';
const DESCRIPTION = 'Lists recently discontinued Microsoft products';
const MAINTAINER = 'tillcash';

public function collectData()
{
// Fetch JSON data
$json = getContents('https://killedbymicrosoft.info/graveyard.json');

// Decode JSON data
$discontinuedServices = json_decode($json, true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Json::decode


// Sort the array based on dateClose in descending order
usort($discontinuedServices, function($a, $b) {
return strtotime($b['dateClose']) - strtotime($a['dateClose']);
});

// Slice the array to limit the number of items processed
$discontinuedServices = array_slice($discontinuedServices, 0, 15);

// Process each item
foreach ($discontinuedServices as $service) {
// Concatenate service name with dateOpen and dateClose
$title = "{$service['name']} ({$service['dateOpen']} - {$service['dateClose']})";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please dont interpolate variables like this with curly braces. i think it's deprecated in 8.3 or something.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, will summit newly.


$this->items[] = [
'title' => $title,
'uid' => $service['slug'],
'uri' => $service['link'],
'content' => $service['description']
];
}
}
}
Loading