public function parse()
 {
     /**
      * Добавляем валидаторы, которые проверяют возможность обработки
      * данного файла
      */
     $this->addValidator(new SV\TagsValidator($this, ['Booking' => 'Id', 'Event' => 'Id']));
     $result = $this->runValidators();
     if (false === $result['success']) {
         /**
          * test point 1. File validation failed.
          */
         $this->saveImportLog($this->getImportName(), $result['message'], self::STATUS_ERR);
         return;
     }
     $bookingId = $this->getValueByAttribute('Booking', 'Id');
     $code = $this->getValueByAttribute('Event', 'Code');
     $trackingId = $this->getValueByAttribute('EventInfo', 'TrackingId');
     $event = new SM\Event();
     $event->setExternalId($trackingId);
     $event->setInternalId($bookingId);
     $event->setEventCode($code);
     $event->setFilename($this->_filename);
     $event->setCheckSum(md5_file($this->_filename));
     $event->setSystemName(self::SYSTEM_TOOL);
     if (false == $this->getEventsByShipmentId($trackingId)) {
         $event->setStatus(self::STATUS_EVENT_READY);
     } else {
         $lastEvent = $this->getLastEventByExternalId($trackingId);
         if (null !== $lastEvent->getTransferredAt()) {
             $lastTransferred = false;
             //т.к. нам надо установить временной интервал задержки, то добавим эту конструкцию
             $now = new \DateTime();
             $diff = $now->diff($lastEvent->getTransferredAt());
             $interval = (int) $diff->format('%i');
             if ($interval > self::TIME_LIMIT_FOR_TRANSFER_MINUTES) {
                 $lastTransferred = true;
             }
             if (true === $lastTransferred) {
                 $event->setStatus(self::STATUS_EVENT_READY);
                 $event->setDescription("Last event ID " . $lastEvent->getId() . ",sent at " . $lastEvent->getConfirmationAt()->format('Y/m/d H:i'));
             } else {
                 $event->setStatus(self::STATUS_LAST_EVENT_NOT_SEND);
                 $event->setDescription("Time left less then " . self::TIME_LIMIT_FOR_TRANSFER_MINUTES);
             }
         } else {
             $event->setStatus(self::STATUS_LAST_EVENT_NOT_SEND);
             $event->setDescription("Last event ID " . $lastEvent->getId() . " didn't send");
         }
     }
     $event->setExternalCreatedAt($this->getDateByAttribute('Event', 'DateTime'));
     $event->setConfirmationAt(new \DateTime());
     $event->setOccurredAt(new \DateTime());
     $event->setDestinationPath($this->getDistinationPath());
     $this->_em->persist($event);
     $this->_em->flush();
     $this->_em->clear();
     $this->clear();
 }