コード例 #1
0
ファイル: FileExporter.php プロジェクト: gnumast/nhl
 /**
  * @inheritdoc
  * @throws ExporterException
  */
 public function export()
 {
     $this->validate();
     foreach ($this->game->getEvents() as $event) {
         file_put_contents($this->path, $event->describe() . "\n", FILE_APPEND | LOCK_EX);
     }
 }
コード例 #2
0
ファイル: StdOutExporter.php プロジェクト: gnumast/nhl
 /**
  * @inheritdoc
  * @throws ExporterException
  */
 public function export()
 {
     foreach ($this->game->getEvents() as $event) {
         if (strlen($event->describe()) > 1) {
             $this->command->climate->out($event->describe());
         } else {
             // DEBUG -- If this happens something wasn't parsed properly
             var_dump($event);
         }
     }
 }
コード例 #3
0
ファイル: CSVExporter.php プロジェクト: gnumast/nhl
 /**
  * @inheritdoc
  */
 public function export()
 {
     $this->prepare();
     foreach ($this->game->getEvents() as $event) {
         $filePath = $this->path . DIRECTORY_SEPARATOR . $this->getOption('nameFormat');
         $filePath = str_replace('%EVENTTYPE%', $event->getType(), $filePath);
         if (!file_exists($filePath)) {
             // First write the column headers
             file_put_contents($filePath, implode(',', $this->getHeadersForEvent($event)) . "\n", FILE_APPEND | LOCK_EX);
         }
         file_put_contents($filePath, $this->getEventAsLine($event) . "\n", FILE_APPEND | LOCK_EX);
     }
     return true;
 }