/**
  *
  */
 public function parse()
 {
     foreach ($this->vendors as $vendor) {
         $vendorRows = explode(self::PACKAGE_SEPARATOR, $vendor);
         $vendorInfos = explode(self::INFO_SEPARATOR, $vendorRows[0]);
         $vendorId = $this->database->addVendor($vendorInfos[0], $vendorInfos[1], $vendorInfos[2]);
         for ($i = 1; $i < count($vendorRows); $i++) {
             $packageInfos = explode(self::INFO_SEPARATOR, $vendorRows[$i]);
             $this->database->addPackage($vendorId, $packageInfos[0], $packageInfos[1], DataChecker::advance($packageInfos[2]));
         }
     }
 }
Example #2
0
 /**
  * Cli controller
  */
 public function SearchCli()
 {
     global $argc;
     global $argv;
     $cli = new Cli($argc, $argv);
     $fileparser = new FileParser($cli->getFilename());
     $fileparser->parse();
     $database = Database::getInstance();
     $vendors = $database->findPackages($cli->getLocation(), $cli->getDate(), $cli->getCovers());
     $view = new Result();
     $view->displaySearchResults($vendors);
 }