Commit Graph

63 Commits

Author SHA1 Message Date
Ben Ramsey a8d52100de Support microtime in returned DateTimeInterface instances
Fixes #90 and supersedes #93.
2020-01-19 23:21:48 -06:00
Ben Ramsey 268e66aad8 Add static Uuid::uuid2() method 2020-01-18 14:14:47 -06:00
Ben Ramsey 8202946225 Add NilUuid concrete class to represent nil UUIDs 2020-01-18 12:14:01 -06:00
Ben Ramsey d21a3e3875 Add tests to ensure static methods return specific UUID types 2020-01-18 12:14:01 -06:00
Ben Ramsey 5d1f106882 Rename Validator\Validator to Validator\GenericValidator 2020-01-18 12:14:00 -06:00
Ben Ramsey 2ad77d9ca7 Remove CalculatorInterface as a Uuid constructor parameter 2020-01-18 12:14:00 -06:00
Ben Ramsey 360261d617 Deprecate all the fields methods on UuidInterface and Uuid 2020-01-18 12:14:00 -06:00
Ben Ramsey 10624f64a1 Change return type of Uuid::getFields() to FieldsInterface 2020-01-18 12:14:00 -06:00
Ben Ramsey c11c023796 Address static analysis issues and add additional tests 2020-01-18 12:13:59 -06:00
Ben Ramsey f5cfb5f57d Split known v3 and v5 UUID tests into providers 2020-01-18 12:13:59 -06:00
Ben Ramsey d543895369 Return string integers instead of int integers 2020-01-18 12:13:58 -06:00
Ben Ramsey 63942c393d Remove Gmp converters; the generic converters are preferred 2020-01-18 12:13:58 -06:00
Ben Ramsey ebaa04a6b2 Improve coverage and unit tests for fields, GUIDs, and nonstandard UUIDs 2020-01-18 12:13:57 -06:00
Ben Ramsey 70eace9086 Introduce separate classes to handle nonstandard UUIDs 2020-01-18 12:13:57 -06:00
Ben Ramsey d6ed9b3832 Introduce separate class support for GUIDs 2020-01-18 12:13:57 -06:00
Ben Ramsey d4dd45e908 Apply fields functionality to Uuid class 2020-01-18 12:13:57 -06:00
Ben Ramsey 12896f06db Use internal exceptions
Fixes #254
2020-01-18 12:13:55 -06:00
Ben Ramsey 0d7b8c2b7a Update coding style to include PSR-12, among other options
This also includes heavy use of slevomat/coding-standard to apply
various checks to the code, based on maintainer (me) preference.
2020-01-18 12:13:55 -06:00
Ben Ramsey 0721630ba4 Refactor converters to uniformly accept and return string values 2020-01-18 12:13:09 -06:00
Ben Ramsey 81f0f9a9b4 Clean-up tests and use PHPStan max level for tests 2020-01-18 12:13:09 -06:00
Carlos Barrero 650cb9f545 Change getDateTime to DateTimeInterface 2020-01-18 12:13:09 -06:00
Julian Ecknig 4de1348099 Add GmpConverter and GmpTimeConverter 2020-01-18 12:13:09 -06:00
Bradyn Poulsen 3cf759ad05 Migrate isValid() to Validator and ValidatorInterface
* Maintain backwards compatibility with the former Uuid::isValid() and
  Uuid::VALID_PATTERN
* Remove the assert statements in favor of str_replace and preg_match
* Make the validator a featureset of the factory
* Remove old suggestion about locations of constants
* Remove argument count assertions
* Remove VALID_PATTERN from Uuid
2020-01-18 12:13:08 -06:00
SignpostMarv 0030399564 Increase PHPStan levels and update code to resolve issues found 2020-01-18 12:13:08 -06:00
Martin Hujer ca2629767d Require phpstan and correct issues found up to level 2
* issues found by phpstan L0
* issues found by phpstan L1
* issues found by phpstan L2 in src/
* issues found by phpstan L2 in tests/
2020-01-18 12:13:08 -06:00
Ben Ramsey 5d7ee63f1c Update dev requirements and test suite for PHP 7+ only 2020-01-18 12:13:07 -06:00
Martin Hujer 049d5acf7a Use ::class constants where possible
It helps with refactorings and static analysis, because you can easily
tell if the class is missing or not.
2020-01-18 12:13:07 -06:00
Ben Ramsey 231027100a Increase microseconds in another test to ensure enough time passes 2019-12-06 14:54:08 -08:00
Ben Ramsey 9e48187656 Add slightly more sleep to ensure timestamps don't collide 2019-12-04 17:09:13 -08:00
Ben Ramsey 64ba9a2767 Clean up code according to PhpStorm inspections report 2019-11-30 13:14:52 -08:00
Lee Boynton 2804748423 Don't allow UUIDs to have trailing newline 2018-05-02 18:54:33 +01:00
Ben Peachey dbb9a8b6d1 Changes all usage in Tests of getMock with getMockBuilder. 2017-10-17 12:46:25 +02:00
Davis Peixoto 46071e69a1 173 - Expose UUID versions - Alternative 1
https://github.com/ramsey/uuid/issues/173

Creating constants on Uuid object, so they can be used as
- Uuid::UUID_TYPE_TIME
- Uuid::UUID_TYPE_RANDOM

# Alternative 1
Create constants on Uuid class

Signed-off-by: Davis Peixoto <davis.peixoto@gmail.com>
2017-08-03 21:12:10 -03:00
Davis Peixoto 0915c7bdc2 173 - Expose UUID versions - Alternative 1
https://github.com/ramsey/uuid/issues/173

Creating constants on Uuid object, so they can be used as
- UUID::UUID_TYPE_TIME
- UUID::UUID_TYPE_RANDOM

# Alternative 1
Create constants on Uuid class

Signed-off-by: Davis Peixoto <davis.peixoto@gmail.com>
2017-08-02 08:55:26 -03:00
Massimiliano Arione a2647abc14 add a specific exception for invalid UUID string 2017-03-11 10:52:53 +01:00
Ben Ramsey 2f7d4ff00f Add tests for uuid3() and uuid4() to test behavior for empty strings 2017-02-02 15:30:40 -06:00
Jessica Mauerhan 65cc76f721 remove extra ; causing PHPCBF to fail 2016-10-02 10:27:23 -04:00
Jessica Mauerhan 58dd3dd249 Add failing test cases for case issue (GH Issue #131) 2016-09-30 15:55:04 -04:00
Andreas Möller 7ff6fff06d Fix: Move tests one up 2016-09-15 08:31:27 +02:00
Ben Ramsey f5e96b6af7 Restructure tests 2015-10-03 10:59:44 -05:00
Ben Ramsey e99347f70d Merge pull request #77 from aztech-forks/master
Improve GUID support
2015-08-28 09:36:45 -05:00
Aztech 4c35be716a Remove message assertion -- cannot pass in both 32 and 64 bits envs 2015-08-14 23:26:15 +02:00
Aztech 8c699ecfec Fix exception message assertion in tests 2015-08-14 23:10:23 +02:00
Aztech 958468d95b Detect host endianness when building codec 2015-08-14 22:24:16 +02:00
Aztech d3535feb50 Use host dependant endianness in GUID string codec 2015-08-14 21:57:59 +02:00
Aztech 8974c76bf6 Refactor TimeGeneratorInterface
- Remove UuidFactory from signature
- Remove setters on UuidFactory to prevent inconsistencies (a new feature set and factory should be used instead)
- Update tests to reflect those changes
2015-07-27 11:14:20 -05:00
Ben Ramsey 9092d16213 Have UuidInterface extend from JsonSerializable and cover it with a test 2015-07-16 11:36:05 -05:00
Ben Ramsey b3ef99a2e9 Move RandomGeneratorInterface and RandomGeneratorFactory to Generator NS 2015-07-16 09:54:04 -05:00
Ben Ramsey 40636ca922 Fix "Undefined variable: usec" error in test 2015-06-21 19:38:38 -05:00
Ben Ramsey d67c3490a8 Change namespace to "Ramsey"; closes #48 2015-04-25 12:11:37 -05:00