/**
  * @param mixed                                            $value
  * @param \AntiMattr\ETL\Transform\TransformationInterface $transformation
  */
 public function bind($value, TransformationInterface $transformation)
 {
     $task = $transformation->getTask();
     $dataContext = $task->getDataContext();
     $currentTransformedRecord = $dataContext->getCurrentTransformedRecord();
     $dataContext->setCurrentTransformedRecord($value);
 }
 /**
  * @param mixed                                                        $value
  * @param \AntiMattr\ETL\Transform\Transformer\TransformationInterface $transformation
  *
  * @return mixed $value
  */
 protected function getFlatValue($value, TransformationInterface $transformation)
 {
     $task = $transformation->getTask();
     $dataContext = $task->getDataContext();
     $currentExtractedRecord = $dataContext->getCurrentExtractedRecord();
     if (!isset($currentExtractedRecord[$this->options['flat_field']])) {
         return;
     }
     return $currentExtractedRecord[$this->options['flat_field']];
 }
 /**
  * @param mixed                                                        $value
  * @param \AntiMattr\ETL\Transform\Transformer\TransformationInterface $transformation
  *
  * @return mixed $value
  *
  * @throws \AntiMattr\ETL\Exception\TransformException
  */
 public function transform($value, TransformationInterface $transformation)
 {
     if (!isset($value)) {
         return isset($this->options['default']) ? $this->options['default'] : null;
     }
     $task = $transformation->getTask();
     $dataContext = $task->getDataContext();
     $date = $dataContext->getStartedAt();
     if (isset($this->options['timezone'])) {
         $date->setTimezone(new \DateTimeZone($this->options['timezone']));
     }
     $format = isset($this->options['format']) ? $this->options['format'] : 'Y-m-d H:i:s';
     return $date->format($format);
 }