ex

Fork of mbed-os-example-mbed5-blinky by mbed-os-examples

Revision:
44:c1d8923072ba
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dumi_doc-master/schema/vendor/justinrainbow/json-schema/src/JsonSchema/Rfc3339.php	Tue Jul 18 16:27:22 2017 +0800
@@ -0,0 +1,29 @@
+<?php
+
+namespace JsonSchema;
+
+class Rfc3339
+{
+    const REGEX = '/(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})(\.\d+)?(Z|([+-]\d{2}):?(\d{2}))/';
+
+    /**
+     * Try creating a DateTime instance
+     *
+     * @param string $string
+     * @return \DateTime|null
+     */
+    public static function createFromString($string)
+    {
+        if (!preg_match(self::REGEX, strtoupper($string), $matches)) {
+            return null;
+        }
+
+        $dateAndTime = $matches[1];
+        $microseconds = $matches[2] ?: '.000000';
+        $timeZone = 'Z' !== $matches[3] ? $matches[4] . ':' . $matches[5] : '+00:00';
+
+        $dateTime = \DateTime::createFromFormat('Y-m-d\TH:i:s.uP', $dateAndTime . $microseconds . $timeZone, new \DateTimeZone('UTC'));
+
+        return $dateTime ?: null;
+    }
+}