original_string: public function reverseTransform($value)
      {
          if (null === $value) {
              return;
          }
          if (!\is_string($value)) {
              throw new UnexpectedTypeException($value, 'string');
          }
          if ('' === $value) {
              return;
          }
          if (!$this->isISO8601($value)) {
              throw new TransformationFailedException('Non ISO 8601 date strings are not supported yet');
          }
          $valuePattern = '/^'.preg_replace('/%([yYmMdDhHiIsSwW])(\w)/', '(?P<$1>\d+)$2', $this->format).'$/';
          if (!preg_match($valuePattern, $value)) {
              throw new TransformationFailedException(sprintf('Value "%s" contains intervals not accepted by format "%s".', $value, $this->format));
          }
          try {
              $dateInterval = new \DateInterval($value);
          } catch (\Exception $e) {
              throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e);
          }
  
          return $dateInterval;
      }
code: public function reverseTransform($value)
      {
          if (null === $value) {
              return;
          }
          if (!\is_string($value)) {
              throw new UnexpectedTypeException($value, 'string');
          }
          if ('' === $value) {
              return;
          }
          if (!$this->isISO8601($value)) {
              throw new TransformationFailedException('Non ISO 8601 date strings are not supported yet');
          }
          $valuePattern = '/^'.preg_replace('/%([yYmMdDhHiIsSwW])(\w)/', '(?P<$1>\d+)$2', $this->format).'$/';
          if (!preg_match($valuePattern, $value)) {
              throw new TransformationFailedException(sprintf('Value "%s" contains intervals not accepted by format "%s".', $value, $this->format));
          }
          try {
              $dateInterval = new \DateInterval($value);
          } catch (\Exception $e) {
              throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e);
          }
  
          return $dateInterval;
      }
code_tokens: public function reverseTransform ( $ value ) { if ( null === $ value ) { return ; } if ( ! \ is_string ( $ value ) ) { throw new UnexpectedTypeException ( $ value , 'string' ) ; } if ( '' === $ value ) { return ; } if ( ! $ this -> isISO8601 ( $ value ) ) { throw new TransformationFailedException ( 'Non ISO 8601 date strings are not supported yet' ) ; } $ valuePattern = '/^' . preg_replace ( '/%([yYmMdDhHiIsSwW])(\w)/' , '(?P<$1>\d+)$2' , $ this -> format ) . '$/' ; if ( ! preg_match ( $ valuePattern , $ value ) ) { throw new TransformationFailedException ( sprintf ( 'Value "%s" contains intervals not accepted by format "%s".' , $ value , $ this -> format ) ) ; } try { $ dateInterval = new \ DateInterval ( $ value ) ; } catch ( \ Exception $ e ) { throw new TransformationFailedException ( $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e ) ; } return $ dateInterval ; }
docstring: Transforms a date string in the configured format into a DateInterval object.
  
  @param string $value An ISO 8601 or date string like date interval presentation
  
  @return \DateInterval An instance of \DateInterval
  
  @throws UnexpectedTypeException       if the given value is not a string
  @throws TransformationFailedException if the date interval could not be parsed
docstring_tokens: Transforms a date string in the configured format into a DateInterval object .