private function extractDateTimeFormat($source, $defaultValue = null)
    {
        $dateTimeFormat = $defaultValue;

        if (preg_match('/DateTime<(?<type>[a-zA-Z0-9\,\.\s\-\:\/\\\]+)>/', $source, $matches)) {
            $dateTimeFormat = $matches['type'];
            if (defined('\DateTime::' . $dateTimeFormat)) {
                $dateTimeFormat = constant('\DateTime::' . $dateTimeFormat);
            }
        }

        return $dateTimeFormat;
    }
private function extractDateTimeFormat($source, $defaultValue = null)
    {
        $dateTimeFormat = $defaultValue;

        if (preg_match('/DateTime<(?<type>[a-zA-Z0-9\,\.\s\-\:\/\\\]+)>/', $source, $matches)) {
            $dateTimeFormat = $matches['type'];
            if (defined('\DateTime::' . $dateTimeFormat)) {
                $dateTimeFormat = constant('\DateTime::' . $dateTimeFormat);
            }
        }

        return $dateTimeFormat;
    }
private function extractDateTimeFormat ( $ source , $ defaultValue = null ) { $ dateTimeFormat = $ defaultValue ; if ( preg_match ( '/DateTime<(?<type>[a-zA-Z0-9\,\.\s\-\:\/\\\]+)>/' , $ source , $ matches ) ) { $ dateTimeFormat = $ matches [ 'type' ] ; if ( defined ( '\DateTime::' . $ dateTimeFormat ) ) { $ dateTimeFormat = constant ( '\DateTime::' . $ dateTimeFormat ) ; } } return $ dateTimeFormat ; }
Extracts specified date time format from given source
If source does not contain any format - returns default value

@param string $source
@param string|null $defaultValue
@return string|null
Extracts specified date time format from given source If source does not contain any format - returns default value