Ben Ramsey
67665bf107
Build the time generator when setting the calculator
2020-03-09 17:08:23 -05:00
Ben Ramsey
57e3ce9dd7
Fix Psalm errors resulting from changes introduced in 3.9.4
2020-03-07 15:22:00 -06:00
Ben Ramsey
836de4ece5
Allow setting the node provider on the FeatureSet
2020-02-29 23:51:00 -06:00
Ben Ramsey
aaccc850a1
Use strict argument validation for collections
...
This resolves #106
2020-02-23 00:50:00 -06:00
Ben Ramsey
0bff9e8660
Add NameGeneratorInterface and generators for v3 and v5 UUIDs
2020-02-08 13:12:20 -06:00
Marco Pivetta
a252f29847
Import used functions and constants via use statement to disallow ambiguity for compiler/static-analysis
...
As documented in https://wiki.php.net/rfc/use_global_elements , the engine (by default) does a local namespace
lookup, then falls back to global namespace when first calling a global function referenced in namespaced code,
unless that function is referenced via fully qualified name (FQN).
By using the FQN, the actual symbol can be looked up at compile-time, both by the PHP engine and by static analysis
tooling, allowing for compiler (in particular) optimizations to replace known hot-path functions with specialized opcodes.
Sadly, no actual benchmark at hand: the improvements can be minimal or massive, depending on where this library is
used (tight loops being most relevant).
2020-02-03 13:15:35 -06:00
Ben Ramsey
5fa4eb4f17
Add fromDateTime() to create version 1 UUIDs from DateTime instances
...
Fixes #28
2020-02-03 00:48:41 -06:00
Ben Ramsey
a8d52100de
Support microtime in returned DateTimeInterface instances
...
Fixes #90 and supersedes #93 .
2020-01-19 23:21:48 -06:00
Ben Ramsey
72a2312f62
Support generation of version 2 (DCE Security) UUIDs
2020-01-18 12:14:01 -06:00
Ben Ramsey
b52fff6b52
Build number and time converters when setting calculator
2020-01-18 12:14:01 -06:00
Ben Ramsey
12a2b0680d
Add individual concrete classes for each version of RFC 4122 UUID
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
c80ad2606f
Deprecate degraded UUIDs; they are no longer necessary
2020-01-18 12:13:59 -06:00
Ben Ramsey
63942c393d
Remove Gmp converters; the generic converters are preferred
2020-01-18 12:13:58 -06:00
Ben Ramsey
3546a86f7d
Deprecate BigNumberConverter and BigNumberTimeConverter
2020-01-18 12:13:58 -06:00
Ben Ramsey
4d1db4d090
Clean up class naming conventions
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
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
Massimiliano Arione
5459113b81
add typehints and return types
2020-01-18 12:13:10 -06:00
André Filipe
bdfbf64a10
Removed some else/elseif and added some early returns to make the code a little easier to read, nothing changes on the big picture
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
André Filipe
84fe6cf755
Removed some else/elseif and added some early returns to make the code a little easier to read, nothing changes on the big picture
2019-11-30 15:10:48 -08:00
Emir Beganovic
fb1cd7a944
Cleanup: Update and add missing docblocks, remove unused imports
...
Just a bit of house keeping for the sake of code cleanliness.
2015-10-05 10:18:21 +02:00
Ben Ramsey
e6f97dc8ab
Add docblocks for classes and interfaces in top-level Ramsey\Uuid namespace
2015-09-27 18:58:50 -05:00
Scrutinizer Auto-Fixer
f59b447603
Scrutinizer Auto-Fixes
...
This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
2015-08-13 15:32:44 +00:00
Aztech
bbce46dabe
Add option to enable PeclUuidTimeGenerator via FeatureSet
2015-07-28 22:20:04 +02:00
Aztech
0cd74639cf
Enable use of custom TimeGenerator implementations
...
- Removes now unnecessary `timeConverter` and `timeProvider`
properties, setters, and getters in both FeatureSet and
UuidFactory as those are now exclusively used by the default
TimeGenerator
- Adds a `setTimeGenerator` method on UuidFactory to override the
default time generator
2015-07-28 22:16:29 +02:00
Aztech
e2047199cd
Remove redundant method call
2015-07-27 11:14:20 -05: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
dfbf8b8098
Abstract time generation into family of TimeGeneratorInterface classes
2015-07-27 11:14:20 -05:00
Ben Ramsey
b3ef99a2e9
Move RandomGeneratorInterface and RandomGeneratorFactory to Generator NS
2015-07-16 09:54:04 -05:00
Ben Ramsey
e006f669ad
Adding common docblock file header
2015-07-15 13:59:52 -05:00
Ben Ramsey
d67c3490a8
Change namespace to "Ramsey"; closes #48
2015-04-25 12:11:37 -05:00
Ben Ramsey
958643e7b6
Introduce Provider namespace and move Node and Time classes into it
2014-11-08 16:16:44 -05:00
Ben Ramsey
90fd1531d0
Fixing PSR2 standards violations reported by PHP_CodeSniffer
2014-11-08 15:50:04 -05:00
Ben Ramsey
cd2d09c356
Introduce Converter namespace and move Number and Time classes into it
2014-11-08 14:43:09 -05:00
Thibaud Fabre
c07988fe31
Refactor codecs to remove duplication
2014-11-08 15:00:58 +01:00
Thibaud Fabre
84123b2060
Remove all env related logic from factory
...
Defers all environment related decisions to factory initialization
All behavior is customizable through DI, but all deps are initialized to proper default instances
Removes static factory configuration
2014-11-08 12:41:40 +01:00