/**
  * Process the step
  *
  * @param ValidateStepEvent $event
  *
  * @return void
  */
 public function process(ValidateStepEvent $event)
 {
     $filePath = $event->getModel()->getFilePath();
     if (file_exists($filePath) === false) {
         $event->getModel()->setStatus('');
         $event->addViolation('no file found');
     }
 }
 /**
  * Process the step
  *
  * @param ValidateStepEvent $event
  *
  * @return void
  */
 public function process(ValidateStepEvent $event)
 {
     $filePath = $event->getModel()->getFilePath();
     $lines = file($filePath);
     if (empty($lines)) {
         $event->getModel()->setStatus('');
         $event->addViolation('invalid file');
     }
 }
 /**
  * Process the step
  *
  * @param ValidateStepEvent $event
  *
  * @return void
  */
 public function process(ValidateStepEvent $event)
 {
     $filePath = $event->getModel()->getFilePath();
     $destination = $filePath . '.save';
     var_dump('archive: ' . $filePath . '...');
     $r = copy($filePath, $destination);
     if ($r === false) {
         $event->getModel()->setStatus('');
         $event->addViolation('Copy file impossible');
     }
 }
 /**
  * Process the step
  *
  * @param ValidateStepEvent $event
  *
  * @return void
  */
 public function process(ValidateStepEvent $event)
 {
     $filePath = $event->getModel()->getFilePath();
     $handle = fopen($filePath, 'r');
     if ($handle) {
         while (($buffer = fgets($handle, 4096)) !== false) {
             $url = str_replace("\n", "", $buffer);
             var_dump("download:" . $url . "...");
             $file = file_get_contents($url);
             $destination = tempnam(sys_get_temp_dir(), 'nahoy_workflow_example_');
             if (file_put_contents($destination, $file) === false) {
                 // error
             }
         }
         if (!feof($handle)) {
             // error
         }
         fclose($handle);
     }
 }
 public function invalid(ValidateStepEvent $event)
 {
     $event->addViolation('Validation error!');
 }