Esempio n. 1
0
 /**
  * Write the report to the filesystem so we can reuse it
  * at a later stace when we invoke Redbox\Scan\ScanService's scan() method.
  *
  * @param Report\Report|null $report
  * @return bool
  */
 public function write(Report\Report $report = null)
 {
     if ($report) {
         $data = $report->toArray();
         $data = Yaml::dump($data, 99);
         if (@file_put_contents($this->filename, $data) !== false) {
             /* I hate the @ with a passion with if we don't do it the tests will fail */
             return true;
         }
     }
     return false;
 }
Esempio n. 2
0
 /**
  * Write the report to the filesystem so we can reuse it
  * at a later stace when we invoke Redbox\Scan\ScanService's scan() method.
  *
  * @param Report\Report|null $report
  * @return bool
  */
 public function write(Report\Report $report = null)
 {
     if (!$this->handle) {
         return false;
     }
     if ($report) {
         $stream = fopen('php://memory', 'w+');
         if (!$stream) {
             return false;
         }
         $data = $report->toArray();
         $data = Yaml::dump($data, 99);
         fwrite($stream, $data);
         rewind($stream);
         if (ftp_fput($this->handle, $this->filename, $stream, $this->transfer_mode)) {
             return true;
         }
     }
     return false;
 }