Added another front page space for Yaffs info. Added roave security for composer.
[yaffs-website] / web / core / lib / Drupal / Component / Uuid / Uuid.php
1 <?php
2
3 namespace Drupal\Component\Uuid;
4
5 /**
6  * UUID Helper methods.
7  */
8 class Uuid {
9
10   /**
11    * The pattern used to validate a UUID string.
12    */
13   const VALID_PATTERN = '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}';
14
15   /**
16    * Checks whether a string appears to be in the format of a UUID.
17    *
18    * Implementations should not implement validation, since UUIDs should be in
19    * a consistent format across all implementations.
20    *
21    * @param string $uuid
22    *   The string to test.
23    *
24    * @return bool
25    *   TRUE if the string is well formed, FALSE otherwise.
26    */
27   public static function isValid($uuid) {
28     return (bool) preg_match('/^' . self::VALID_PATTERN . '$/', $uuid);
29   }
30
31 }