veilleTechno finie
This commit is contained in:
@@ -3,11 +3,11 @@
|
||||
class RSSArticleManager {
|
||||
|
||||
private $tabURL = array(
|
||||
"http://fetchrss.com/rss/6213baca199e171a5d6eacc26213babd69097e19dd230f73.xml",
|
||||
"http://fetchrss.com/rss/6213baca199e171a5d6eacc26214b2ca9bb3286594306764.xml",
|
||||
"http://fetchrss.com/rss/6213baca199e171a5d6eacc26214b5c20a15a160ea326d82.xml",
|
||||
"http://fetchrss.com/rss/6213baca199e171a5d6eacc26214b6fd3f6eb80141637472.xml",
|
||||
"http://fetchrss.com/rss/6213baca199e171a5d6eacc26214b7ac82763a37db6639c4.xml"
|
||||
"http://fetchrss.com/rss/623835ee6d0a996f7618ae846238378f6d0a996f7618ae87.xml",
|
||||
"http://fetchrss.com/rss/623835ee6d0a996f7618ae8462383827e86268469f11a067.xml",
|
||||
"http://fetchrss.com/rss/623835ee6d0a996f7618ae84623839cd96c8cc470d178c42.xml",
|
||||
"http://fetchrss.com/rss/623835ee6d0a996f7618ae8462383a1596930474967f6092.xml",
|
||||
"http://fetchrss.com/rss/623835ee6d0a996f7618ae8462383a9e3d886a00a16a2d32.xml"
|
||||
);
|
||||
|
||||
public function __construct() {
|
||||
@@ -26,6 +26,25 @@ class RSSArticleManager {
|
||||
return $tabArticle;
|
||||
}
|
||||
|
||||
public function createNArticles(int $a) : array {
|
||||
$tabArticle = array();
|
||||
$rtabArticle = array();
|
||||
|
||||
foreach ($this->tabURL as $u) {
|
||||
$rss = simplexml_load_file($u);
|
||||
foreach ($rss->channel->item as $item){
|
||||
$desc = "";
|
||||
array_push($tabArticle, new RSSArticle($item->title, date_create($item->pubDate), $item->link));
|
||||
}
|
||||
}
|
||||
|
||||
for($i = 0; $i < $a; ++$i) {
|
||||
$rtabArticle[$i] = $tabArticle[$i];
|
||||
}
|
||||
|
||||
return $rtabArticle;
|
||||
}
|
||||
|
||||
public function sortArticles(array $a) : array {
|
||||
$tab = $a;
|
||||
usort($tab, function($firstArticle, $secondArticle) { //sorting method of all articles
|
||||
|
Reference in New Issue
Block a user