2021-06-27 11:19:26 +00:00
|
|
|
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace OCA\GPodderSync\Core\SubscriptionChange;
|
|
|
|
|
|
|
|
class SubscriptionChangesReader {
|
|
|
|
|
|
|
|
/**
|
2021-07-13 19:36:34 +00:00
|
|
|
* @param array $urls
|
|
|
|
* @param bool $subscribed
|
2021-06-27 11:19:26 +00:00
|
|
|
*
|
2021-07-13 19:36:34 +00:00
|
|
|
* @return SubscriptionChange[]
|
2021-06-27 11:19:26 +00:00
|
|
|
*/
|
2021-07-13 19:36:34 +00:00
|
|
|
public static function mapToSubscriptionsChanges(array $urls, bool $subscribed): array {
|
2021-06-27 11:19:26 +00:00
|
|
|
$subscriptionChanges = [];
|
2021-12-09 19:19:35 +00:00
|
|
|
$urls = array_filter($urls, function(string $url) {return filter_var($url, FILTER_VALIDATE_URL) !== false; });
|
2021-07-13 19:36:34 +00:00
|
|
|
foreach ($urls as $url) {
|
2021-06-27 11:19:26 +00:00
|
|
|
$subscriptionChanges[] = new SubscriptionChange($url, $subscribed);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $subscriptionChanges;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|