first commit - working

This commit is contained in:
2022-01-25 19:01:36 +00:00
commit 8f232d80d9
1361 changed files with 140207 additions and 0 deletions

37
src/Models/GitTop100.php Normal file
View File

@ -0,0 +1,37 @@
<?php
namespace Top100stars\Models;
use Top100stars\Interfaces\IGitTop100CSV;
class GitTop100 implements IGitTop100CSV {
private $csv = null;
public function __construct(?string $fileName) {
if ($fileName!=null) $this->loadCSV($fileName);
}
private function loadCSV(string $fileName) {
if (($gestor = fopen($fileName, "r")) !== FALSE) {
$this->csv = [];
while (($datos = fgetcsv($gestor, 1000, ",")) !== FALSE) {
$this->csv[] = $datos;
}
fclose($gestor);
}
}
public function setCSV($csv): IGitTop100CSV
{
$this->csv = $csv;
return $this;
}
public function getCSV(): ?array {
return $this->csv;
}
}