Changeset 1717487
- Timestamp:
- 08/22/2017 10:47:24 AM (9 years ago)
- Location:
- ing-psp/trunk
- Files:
-
- 69 added
- 4 deleted
- 29 edited
-
ing-php/LICENSE (modified) (2 diffs)
-
ing-php/composer.json (modified) (1 diff)
-
ing-php/composer.lock (modified) (40 diffs)
-
ing-php/src/Client.php (modified) (2 diffs)
-
ing-php/src/Client/EndpointResolver.php (added)
-
ing-php/src/Ginger.php (modified) (3 diffs)
-
ing-php/src/Order.php (modified) (1 diff)
-
ing-php/src/Order/OrderLine.php (modified) (1 diff)
-
ing-php/src/Order/Transaction.php (modified) (1 diff)
-
ing-php/src/Order/Transaction/Status.php (modified) (3 diffs)
-
ing-php/tests/Client (added)
-
ing-php/tests/Client/EndpointResolverTest.php (added)
-
ing-php/tests/ClientTest.php (modified) (1 diff)
-
ing-php/tests/GingerTest.php (modified) (2 diffs)
-
ing-php/tests/Order/Transaction/StatusTest.php (modified) (7 diffs)
-
ing-php/vendor/autoload.php (modified) (1 diff)
-
ing-php/vendor/bin/uuid (deleted)
-
ing-php/vendor/composer/ClassLoader.php (modified) (6 diffs)
-
ing-php/vendor/composer/LICENSE (modified) (1 diff)
-
ing-php/vendor/composer/autoload_psr4.php (modified) (2 diffs)
-
ing-php/vendor/composer/autoload_real.php (modified) (4 diffs)
-
ing-php/vendor/composer/autoload_static.php (modified) (6 diffs)
-
ing-php/vendor/composer/installed.json (modified) (40 diffs)
-
ing-php/vendor/ramsey/uuid/CHANGELOG.md (modified) (1 diff)
-
ing-php/vendor/ramsey/uuid/CONTRIBUTING.md (modified) (2 diffs)
-
ing-php/vendor/ramsey/uuid/LICENSE (modified) (1 diff)
-
ing-php/vendor/ramsey/uuid/README.md (modified) (4 diffs)
-
ing-php/vendor/ramsey/uuid/bin (deleted)
-
ing-php/vendor/ramsey/uuid/composer.json (modified) (3 diffs)
-
ing-php/vendor/ramsey/uuid/src/BinaryUtils.php (added)
-
ing-php/vendor/ramsey/uuid/src/Builder (added)
-
ing-php/vendor/ramsey/uuid/src/Builder/DefaultUuidBuilder.php (added)
-
ing-php/vendor/ramsey/uuid/src/Builder/DegradedUuidBuilder.php (added)
-
ing-php/vendor/ramsey/uuid/src/Builder/UuidBuilderInterface.php (added)
-
ing-php/vendor/ramsey/uuid/src/Codec (added)
-
ing-php/vendor/ramsey/uuid/src/Codec/CodecInterface.php (added)
-
ing-php/vendor/ramsey/uuid/src/Codec/GuidStringCodec.php (added)
-
ing-php/vendor/ramsey/uuid/src/Codec/OrderedTimeCodec.php (added)
-
ing-php/vendor/ramsey/uuid/src/Codec/StringCodec.php (added)
-
ing-php/vendor/ramsey/uuid/src/Codec/TimestampFirstCombCodec.php (added)
-
ing-php/vendor/ramsey/uuid/src/Codec/TimestampLastCombCodec.php (added)
-
ing-php/vendor/ramsey/uuid/src/Console (deleted)
-
ing-php/vendor/ramsey/uuid/src/Converter (added)
-
ing-php/vendor/ramsey/uuid/src/Converter/Number (added)
-
ing-php/vendor/ramsey/uuid/src/Converter/Number/BigNumberConverter.php (added)
-
ing-php/vendor/ramsey/uuid/src/Converter/Number/DegradedNumberConverter.php (added)
-
ing-php/vendor/ramsey/uuid/src/Converter/NumberConverterInterface.php (added)
-
ing-php/vendor/ramsey/uuid/src/Converter/Time (added)
-
ing-php/vendor/ramsey/uuid/src/Converter/Time/BigNumberTimeConverter.php (added)
-
ing-php/vendor/ramsey/uuid/src/Converter/Time/DegradedTimeConverter.php (added)
-
ing-php/vendor/ramsey/uuid/src/Converter/Time/PhpTimeConverter.php (added)
-
ing-php/vendor/ramsey/uuid/src/Converter/TimeConverterInterface.php (added)
-
ing-php/vendor/ramsey/uuid/src/DegradedUuid.php (added)
-
ing-php/vendor/ramsey/uuid/src/Doctrine (deleted)
-
ing-php/vendor/ramsey/uuid/src/Exception/InvalidUuidStringException.php (added)
-
ing-php/vendor/ramsey/uuid/src/Exception/UnsatisfiedDependencyException.php (modified) (1 diff)
-
ing-php/vendor/ramsey/uuid/src/Exception/UnsupportedOperationException.php (modified) (1 diff)
-
ing-php/vendor/ramsey/uuid/src/FeatureSet.php (added)
-
ing-php/vendor/ramsey/uuid/src/Generator (added)
-
ing-php/vendor/ramsey/uuid/src/Generator/CombGenerator.php (added)
-
ing-php/vendor/ramsey/uuid/src/Generator/DefaultTimeGenerator.php (added)
-
ing-php/vendor/ramsey/uuid/src/Generator/MtRandGenerator.php (added)
-
ing-php/vendor/ramsey/uuid/src/Generator/OpenSslGenerator.php (added)
-
ing-php/vendor/ramsey/uuid/src/Generator/PeclUuidRandomGenerator.php (added)
-
ing-php/vendor/ramsey/uuid/src/Generator/PeclUuidTimeGenerator.php (added)
-
ing-php/vendor/ramsey/uuid/src/Generator/RandomBytesGenerator.php (added)
-
ing-php/vendor/ramsey/uuid/src/Generator/RandomGeneratorFactory.php (added)
-
ing-php/vendor/ramsey/uuid/src/Generator/RandomGeneratorInterface.php (added)
-
ing-php/vendor/ramsey/uuid/src/Generator/RandomLibAdapter.php (added)
-
ing-php/vendor/ramsey/uuid/src/Generator/SodiumRandomGenerator.php (added)
-
ing-php/vendor/ramsey/uuid/src/Generator/TimeGeneratorFactory.php (added)
-
ing-php/vendor/ramsey/uuid/src/Generator/TimeGeneratorInterface.php (added)
-
ing-php/vendor/ramsey/uuid/src/Provider (added)
-
ing-php/vendor/ramsey/uuid/src/Provider/Node (added)
-
ing-php/vendor/ramsey/uuid/src/Provider/Node/FallbackNodeProvider.php (added)
-
ing-php/vendor/ramsey/uuid/src/Provider/Node/RandomNodeProvider.php (added)
-
ing-php/vendor/ramsey/uuid/src/Provider/Node/SystemNodeProvider.php (added)
-
ing-php/vendor/ramsey/uuid/src/Provider/NodeProviderInterface.php (added)
-
ing-php/vendor/ramsey/uuid/src/Provider/Time (added)
-
ing-php/vendor/ramsey/uuid/src/Provider/Time/FixedTimeProvider.php (added)
-
ing-php/vendor/ramsey/uuid/src/Provider/Time/SystemTimeProvider.php (added)
-
ing-php/vendor/ramsey/uuid/src/Provider/TimeProviderInterface.php (added)
-
ing-php/vendor/ramsey/uuid/src/Uuid.php (modified) (31 diffs)
-
ing-php/vendor/ramsey/uuid/src/UuidFactory.php (added)
-
ing-php/vendor/ramsey/uuid/src/UuidFactoryInterface.php (added)
-
ing-php/vendor/ramsey/uuid/src/UuidInterface.php (added)
-
ing-php/vendor/vlucas (added)
-
ing-php/vendor/vlucas/phpdotenv (added)
-
ing-php/vendor/vlucas/phpdotenv/LICENSE.txt (added)
-
ing-php/vendor/vlucas/phpdotenv/composer.json (added)
-
ing-php/vendor/vlucas/phpdotenv/src (added)
-
ing-php/vendor/vlucas/phpdotenv/src/Dotenv.php (added)
-
ing-php/vendor/vlucas/phpdotenv/src/Exception (added)
-
ing-php/vendor/vlucas/phpdotenv/src/Exception/ExceptionInterface.php (added)
-
ing-php/vendor/vlucas/phpdotenv/src/Exception/InvalidCallbackException.php (added)
-
ing-php/vendor/vlucas/phpdotenv/src/Exception/InvalidFileException.php (added)
-
ing-php/vendor/vlucas/phpdotenv/src/Exception/InvalidPathException.php (added)
-
ing-php/vendor/vlucas/phpdotenv/src/Exception/ValidationException.php (added)
-
ing-php/vendor/vlucas/phpdotenv/src/Loader.php (added)
-
ing-php/vendor/vlucas/phpdotenv/src/Validator.php (added)
-
ingpsp.php (modified) (3 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ing-psp/trunk/ing-php/LICENSE
r1600658 r1717487 1 The MIT License (MIT) 1 MIT License 2 2 3 Copyright (c) 201 5 Ginger Payments3 Copyright (c) 2017 ING Bank N.V. 4 4 5 5 Permission is hereby granted, free of charge, to any person obtaining a copy … … 20 20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 21 SOFTWARE. 22 -
ing-psp/trunk/ing-php/composer.json
r1654867 r1717487 23 23 "mathiasverraes/classfunctions": "~1.1", 24 24 "ronanguilloux/isocodes": "~1.1", 25 "ramsey/uuid": "~ 2.8",25 "ramsey/uuid": "~3.6", 26 26 "nesbot/carbon": "~1.16", 27 27 "alcohol/iso3166": "~3.0", 28 28 "symfony/translation": "~2.8", 29 "symfony/yaml": "~2.8" 29 "symfony/yaml": "~2.8", 30 "vlucas/phpdotenv": "^2.4" 30 31 }, 31 32 "require-dev": { -
ing-psp/trunk/ing-php/composer.lock
r1654867 r1717487 5 5 "This file is @generated automatically" 6 6 ], 7 "hash": "bb52aa110922e71473a063377cd1a156", 8 "content-hash": "ef15ab1b05dd60446be04fca0b393822", 7 "content-hash": "5bbd3ee173ee1b3a5ded021f6b70e37f", 9 8 "packages": [ 10 9 { … … 61 60 ], 62 61 "abandoned": "league/iso3166", 63 "time": "2015-09-04 14:14:03"62 "time": "2015-09-04T14:14:03+00:00" 64 63 }, 65 64 { … … 116 115 "validation" 117 116 ], 118 "time": "2016-10-31 12:09:54"117 "time": "2016-10-31T12:09:54+00:00" 119 118 }, 120 119 { … … 168 167 "web service" 169 168 ], 170 "time": "2016-07-15 19:28:39"169 "time": "2016-07-15T19:28:39+00:00" 171 170 }, 172 171 { … … 219 218 ], 220 219 "description": "Provides a simple API and specification that abstracts away the details of HTTP into a single PHP function.", 221 "time": "2015-05-20 03:37:09"220 "time": "2015-05-20T03:37:09+00:00" 222 221 }, 223 222 { … … 269 268 "stream" 270 269 ], 271 "time": "2014-10-12 19:18:40"270 "time": "2014-10-12T19:18:40+00:00" 272 271 }, 273 272 { … … 320 319 "utilities" 321 320 ], 322 "time": "2014-07-28 14:39:20"321 "time": "2014-07-28T14:39:20+00:00" 323 322 }, 324 323 { … … 367 366 "time" 368 367 ], 369 "time": "2015-11-04 20:07:17"368 "time": "2015-11-04T20:07:17+00:00" 370 369 }, 371 370 { … … 415 414 "random" 416 415 ], 417 "time": "2017-03-13 16:27:32"416 "time": "2017-03-13T16:27:32+00:00" 418 417 }, 419 418 { 420 419 "name": "ramsey/uuid", 421 "version": " 2.9.0",420 "version": "3.6.1", 422 421 "source": { 423 422 "type": "git", 424 423 "url": "https://github.com/ramsey/uuid.git", 425 "reference": " b2ef4dd9584268d73f92f752a62bc24cd534dc9a"426 }, 427 "dist": { 428 "type": "zip", 429 "url": "https://api.github.com/repos/ramsey/uuid/zipball/ b2ef4dd9584268d73f92f752a62bc24cd534dc9a",430 "reference": " b2ef4dd9584268d73f92f752a62bc24cd534dc9a",424 "reference": "4ae32dd9ab8860a4bbd750ad269cba7f06f7934e" 425 }, 426 "dist": { 427 "type": "zip", 428 "url": "https://api.github.com/repos/ramsey/uuid/zipball/4ae32dd9ab8860a4bbd750ad269cba7f06f7934e", 429 "reference": "4ae32dd9ab8860a4bbd750ad269cba7f06f7934e", 431 430 "shasum": "" 432 431 }, 433 432 "require": { 434 433 "paragonie/random_compat": "^1.0|^2.0", 435 "php": " >=5.3.3"434 "php": "^5.4 || ^7.0" 436 435 }, 437 436 "replace": { … … 439 438 }, 440 439 "require-dev": { 441 "doctrine/dbal": ">=2.3", 440 "apigen/apigen": "^4.1", 441 "codeception/aspect-mock": "^1.0 | ^2.0", 442 "doctrine/annotations": "~1.2.0", 443 "goaop/framework": "1.0.0-alpha.2 | ^1.0 | ^2.1", 444 "ircmaxell/random-lib": "^1.1", 442 445 "jakub-onderka/php-parallel-lint": "^0.9.0", 443 "moontoast/math": "~1.1", 444 "phpunit/phpunit": "~4.1|~5.0", 445 "satooshi/php-coveralls": "~0.6", 446 "squizlabs/php_codesniffer": "^2.3", 447 "symfony/console": "~2.3|~3.0" 446 "mockery/mockery": "^0.9.4", 447 "moontoast/math": "^1.1", 448 "php-mock/php-mock-phpunit": "^0.3|^1.1", 449 "phpunit/phpunit": "^4.7|>=5.0 <5.4", 450 "satooshi/php-coveralls": "^0.6.1", 451 "squizlabs/php_codesniffer": "^2.3" 448 452 }, 449 453 "suggest": { 450 "doctrine/dbal": "Allow the use of a UUID as doctrine field type.", 451 "moontoast/math": "Support for converting UUID to 128-bit integer (in string form).", 452 "symfony/console": "Support for use of the bin/uuid command line tool." 453 }, 454 "bin": [ 455 "bin/uuid" 456 ], 457 "type": "library", 454 "ext-libsodium": "Provides the PECL libsodium extension for use with the SodiumRandomGenerator", 455 "ext-uuid": "Provides the PECL UUID extension for use with the PeclUuidTimeGenerator and PeclUuidRandomGenerator", 456 "ircmaxell/random-lib": "Provides RandomLib for use with the RandomLibAdapter", 457 "moontoast/math": "Provides support for converting UUID to 128-bit integer (in string form).", 458 "ramsey/uuid-console": "A console application for generating UUIDs with ramsey/uuid", 459 "ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type." 460 }, 461 "type": "library", 462 "extra": { 463 "branch-alias": { 464 "dev-master": "3.x-dev" 465 } 466 }, 458 467 "autoload": { 459 468 "psr-4": { 460 "R humsaa\\Uuid\\": "src/"469 "Ramsey\\Uuid\\": "src/" 461 470 } 462 471 }, … … 471 480 }, 472 481 { 482 "name": "Thibaud Fabre", 483 "email": "thibaud@aztech.io" 484 }, 485 { 473 486 "name": "Ben Ramsey", 474 "homepage": "http://benramsey.com" 475 } 476 ], 477 "description": "A PHP 5.3+ library for generating RFC 4122 version 1, 3, 4, and 5 universally unique identifiers (UUID).", 487 "email": "ben@benramsey.com", 488 "homepage": "https://benramsey.com" 489 } 490 ], 491 "description": "Formerly rhumsaa/uuid. A PHP 5.4+ library for generating RFC 4122 version 1, 3, 4, and 5 universally unique identifiers (UUID).", 478 492 "homepage": "https://github.com/ramsey/uuid", 479 493 "keywords": [ … … 482 496 "uuid" 483 497 ], 484 "time": "201 6-03-22 18:20:19"498 "time": "2017-03-26T20:37:53+00:00" 485 499 }, 486 500 { … … 526 540 ], 527 541 "description": "A lightweight implementation of CommonJS Promises/A for PHP", 528 "time": "2016-05-03 17:50:52"542 "time": "2016-05-03T17:50:52+00:00" 529 543 }, 530 544 { … … 606 620 "zipcode" 607 621 ], 608 "time": "2015-06-22 19:37:41"622 "time": "2015-06-22T19:37:41+00:00" 609 623 }, 610 624 { … … 665 679 "shim" 666 680 ], 667 "time": "2016-05-18 14:26:46"681 "time": "2016-05-18T14:26:46+00:00" 668 682 }, 669 683 { … … 729 743 "description": "Symfony Translation Component", 730 744 "homepage": "https://symfony.com", 731 "time": "2016-10-18 04:28:30"745 "time": "2016-10-18T04:28:30+00:00" 732 746 }, 733 747 { … … 778 792 "description": "Symfony Yaml Component", 779 793 "homepage": "https://symfony.com", 780 "time": "2016-10-21 20:59:10" 794 "time": "2016-10-21T20:59:10+00:00" 795 }, 796 { 797 "name": "vlucas/phpdotenv", 798 "version": "v2.4.0", 799 "source": { 800 "type": "git", 801 "url": "https://github.com/vlucas/phpdotenv.git", 802 "reference": "3cc116adbe4b11be5ec557bf1d24dc5e3a21d18c" 803 }, 804 "dist": { 805 "type": "zip", 806 "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/3cc116adbe4b11be5ec557bf1d24dc5e3a21d18c", 807 "reference": "3cc116adbe4b11be5ec557bf1d24dc5e3a21d18c", 808 "shasum": "" 809 }, 810 "require": { 811 "php": ">=5.3.9" 812 }, 813 "require-dev": { 814 "phpunit/phpunit": "^4.8 || ^5.0" 815 }, 816 "type": "library", 817 "extra": { 818 "branch-alias": { 819 "dev-master": "2.4-dev" 820 } 821 }, 822 "autoload": { 823 "psr-4": { 824 "Dotenv\\": "src/" 825 } 826 }, 827 "notification-url": "https://packagist.org/downloads/", 828 "license": [ 829 "BSD-3-Clause-Attribution" 830 ], 831 "authors": [ 832 { 833 "name": "Vance Lucas", 834 "email": "vance@vancelucas.com", 835 "homepage": "http://www.vancelucas.com" 836 } 837 ], 838 "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", 839 "keywords": [ 840 "dotenv", 841 "env", 842 "environment" 843 ], 844 "time": "2016-09-01T10:05:43+00:00" 781 845 } 782 846 ], … … 834 898 "instantiate" 835 899 ], 836 "time": "2015-06-14 21:17:01"900 "time": "2015-06-14T21:17:01+00:00" 837 901 }, 838 902 { … … 879 943 "test" 880 944 ], 881 "time": "2015-05-11 14:41:42"945 "time": "2015-05-11T14:41:42+00:00" 882 946 }, 883 947 { … … 944 1008 "testing" 945 1009 ], 946 "time": "2016-05-22 21:52:33"1010 "time": "2016-05-22T21:52:33+00:00" 947 1011 }, 948 1012 { … … 998 1062 "static analysis" 999 1063 ], 1000 "time": "2015-12-27 11:43:31"1064 "time": "2015-12-27T11:43:31+00:00" 1001 1065 }, 1002 1066 { … … 1043 1107 ], 1044 1108 "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", 1045 "time": "2016-09-30 07:12:33"1109 "time": "2016-09-30T07:12:33+00:00" 1046 1110 }, 1047 1111 { … … 1090 1154 } 1091 1155 ], 1092 "time": "2016-06-10 07:14:17"1156 "time": "2016-06-10T07:14:17+00:00" 1093 1157 }, 1094 1158 { … … 1152 1216 "stub" 1153 1217 ], 1154 "time": "2016-06-07 08:13:47"1218 "time": "2016-06-07T08:13:47+00:00" 1155 1219 }, 1156 1220 { … … 1214 1278 "xunit" 1215 1279 ], 1216 "time": "2015-10-06 15:47:00"1280 "time": "2015-10-06T15:47:00+00:00" 1217 1281 }, 1218 1282 { … … 1261 1325 "iterator" 1262 1326 ], 1263 "time": "2015-06-21 13:08:43"1327 "time": "2015-06-21T13:08:43+00:00" 1264 1328 }, 1265 1329 { … … 1302 1366 "template" 1303 1367 ], 1304 "time": "2015-06-21 13:50:34"1368 "time": "2015-06-21T13:50:34+00:00" 1305 1369 }, 1306 1370 { … … 1346 1410 "timer" 1347 1411 ], 1348 "time": "2016-05-12 18:03:57"1412 "time": "2016-05-12T18:03:57+00:00" 1349 1413 }, 1350 1414 { … … 1395 1459 "tokenizer" 1396 1460 ], 1397 "time": "2015-09-15 10:49:45"1461 "time": "2015-09-15T10:49:45+00:00" 1398 1462 }, 1399 1463 { … … 1467 1531 "xunit" 1468 1532 ], 1469 "time": "2016-07-21 06:48:14"1533 "time": "2016-07-21T06:48:14+00:00" 1470 1534 }, 1471 1535 { … … 1523 1587 "xunit" 1524 1588 ], 1525 "time": "2015-10-02 06:51:40"1589 "time": "2015-10-02T06:51:40+00:00" 1526 1590 }, 1527 1591 { … … 1587 1651 "equality" 1588 1652 ], 1589 "time": "2015-07-26 15:48:44"1653 "time": "2015-07-26T15:48:44+00:00" 1590 1654 }, 1591 1655 { … … 1639 1703 "diff" 1640 1704 ], 1641 "time": "2015-12-08 07:14:41"1705 "time": "2015-12-08T07:14:41+00:00" 1642 1706 }, 1643 1707 { … … 1689 1753 "hhvm" 1690 1754 ], 1691 "time": "2016-08-18 05:49:44"1755 "time": "2016-08-18T05:49:44+00:00" 1692 1756 }, 1693 1757 { … … 1756 1820 "exporter" 1757 1821 ], 1758 "time": "2016-06-17 09:04:28"1822 "time": "2016-06-17T09:04:28+00:00" 1759 1823 }, 1760 1824 { … … 1807 1871 "global state" 1808 1872 ], 1809 "time": "2015-10-12 03:26:01"1873 "time": "2015-10-12T03:26:01+00:00" 1810 1874 }, 1811 1875 { … … 1860 1924 "description": "Provides functionality to recursively process PHP variables", 1861 1925 "homepage": "http://www.github.com/sebastianbergmann/recursion-context", 1862 "time": "2015-11-11 19:50:13"1926 "time": "2015-11-11T19:50:13+00:00" 1863 1927 }, 1864 1928 { … … 1895 1959 "description": "Library that helps with managing the version number of Git-hosted PHP projects", 1896 1960 "homepage": "https://github.com/sebastianbergmann/version", 1897 "time": "2015-06-21 13:59:46"1961 "time": "2015-06-21T13:59:46+00:00" 1898 1962 }, 1899 1963 { … … 1973 2037 "standards" 1974 2038 ], 1975 "time": "2016-09-01 23:53:02"2039 "time": "2016-09-01T23:53:02+00:00" 1976 2040 }, 1977 2041 { … … 2023 2087 "validate" 2024 2088 ], 2025 "time": "2016-08-09 15:02:57"2089 "time": "2016-08-09T15:02:57+00:00" 2026 2090 } 2027 2091 ], -
ing-psp/trunk/ing-php/src/Client.php
r1654867 r1717487 9 9 use GuzzleHttp\Client as HttpClient; 10 10 use GuzzleHttp\Exception\RequestException; 11 use GingerPayments\Payment\Order\Transaction; 11 12 12 13 final class Client … … 671 672 } 672 673 } 674 675 /** 676 * update the order status to captured 677 * 678 * @param Order $order 679 * @throws OrderNotFoundException 680 * @throws ClientException 681 * @return Transaction 682 */ 683 public function setOrderCapturedStatus(Order $order) 684 { 685 try { 686 return Transaction::fromArray($this->httpClient->post( 687 "orders/".$order->id()."/transactions/".$order->transactions()->current()->id()->toString()."/captures/", 688 [ 689 "timeout" => 30 690 ] 691 )->json() 692 ); 693 } catch (RequestException $exception) { 694 if ($exception->getCode() == 404) { 695 throw new OrderNotFoundException('No order with that ID was found.', 404, $exception); 696 } 697 throw new ClientException( 698 'An error occurred while updating the order: '.$exception->getMessage(), 699 $exception->getCode(), 700 $exception 701 ); 702 } 703 } 704 673 705 } -
ing-psp/trunk/ing-php/src/Ginger.php
r1654939 r1717487 11 11 * The library version. 12 12 */ 13 const CLIENT_VERSION = '1. 2.8';13 const CLIENT_VERSION = '1.3.1'; 14 14 15 15 /** … … 17 17 */ 18 18 const API_VERSION = 'v1'; 19 20 /**21 * API endpoint Ginger Payments22 */23 const ENDPOINT_GINGER = 'https://api.gingerpayments.com/{version}/';24 25 /**26 * API Kassa Compleet endpoint27 */28 const ENDPOINT_KASSA = 'https://api.kassacompleet.nl/{version}/';29 30 /**31 * API endpoint ING32 */33 const ENDPOINT_ING = 'https://api.ing-checkout.com/{version}/';34 35 /**36 * API endpoint EPAY37 */38 const ENDPOINT_EPAY = 'https://api.epay.ing.be/{version}/';39 19 40 20 /** … … 81 61 switch ($product) { 82 62 case 'kassacompleet': 83 $endpoint = self::ENDPOINT_KASSA; 84 break; 63 return (new Client\EndpointResolver())->getEndpointKassa(); 85 64 case 'ingcheckout': 86 $endpoint = self::ENDPOINT_ING; 87 break; 65 return (new Client\EndpointResolver())->getEndpointIng(); 88 66 case 'epay': 89 $endpoint = self::ENDPOINT_EPAY; 90 break; 67 return (new Client\EndpointResolver())->getEndpointEpay(); 91 68 default: 92 $endpoint = self::ENDPOINT_GINGER; 93 break; 69 return (new Client\EndpointResolver())->getEndpointGinger(); 94 70 } 95 return $endpoint;96 71 } 97 72 -
ing-psp/trunk/ing-php/src/Order.php
r1652620 r1717487 13 13 use GingerPayments\Payment\Order\Customer; 14 14 use GingerPayments\Payment\Order\Extra; 15 use R humsaa\Uuid\Uuid;15 use Ramsey\Uuid\Uuid; 16 16 use GingerPayments\Payment\Order\OrderLines; 17 17 -
ing-psp/trunk/ing-php/src/Order/OrderLine.php
r1652620 r1717487 3 3 namespace GingerPayments\Payment\Order; 4 4 5 use R humsaa\Uuid\Uuid;5 use Ramsey\Uuid\Uuid; 6 6 use Assert\Assertion as Guard; 7 7 -
ing-psp/trunk/ing-php/src/Order/Transaction.php
r1600658 r1717487 14 14 use GingerPayments\Payment\Order\Transaction\Status as TransactionStatus; 15 15 use GingerPayments\Payment\Url; 16 use R humsaa\Uuid\Uuid;16 use Ramsey\Uuid\Uuid; 17 17 18 18 final class Transaction -
ing-psp/trunk/ing-php/src/Order/Transaction/Status.php
r1652620 r1717487 20 20 const EXPIRED = 'expired'; 21 21 const ACCEPTED = 'accepted'; 22 const CAPTURED = 'captured'; 22 23 23 24 /** … … 34 35 self::CANCELLED, 35 36 self::EXPIRED, 36 self::ACCEPTED 37 self::ACCEPTED, 38 self::CAPTURED 37 39 ]; 38 40 } … … 101 103 return $this->value === self::ACCEPTED; 102 104 } 105 106 /** 107 * @return bool 108 */ 109 public function isCaptured() 110 { 111 return $this->value === self::CAPTURED; 112 } 103 113 } -
ing-psp/trunk/ing-php/tests/ClientTest.php
r1652620 r1717487 566 566 $this->client->getOrder('123456'); 567 567 } 568 569 /** 570 * @test 571 */ 572 public function itShouldSetOrderStatusToCaptured() 573 { 574 $this->httpClient->shouldReceive('post') 575 ->once() 576 ->andReturn($this->httpResponse); 577 578 $this->httpResponse->shouldReceive('json') 579 ->once() 580 ->andReturn( 581 [ 582 'payment_method' => 'credit-card', 583 'payment_method_details' => [], 584 'id' => '5ac3eb32-384d-4d61-a797-9f44b1cd70e5', 585 'created' => '2015-03-07T20:58:35+0100', 586 'modified' => '2015-03-07T21:58:35+0100', 587 'completed' => '2015-03-07T22:58:35+0100', 588 'status' => 'new', 589 'reason' => 'A great reason', 590 'currency' => 'EUR', 591 'amount' => 100, 592 'expiration_period' => 'P0Y0M0DT1H0M0S', 593 'description' => 'A transaction', 594 'balance' => 'internal', 595 'payment_url' => 'http://www.example.com' 596 ] 597 ); 598 599 $this->assertInstanceOf( 600 'GingerPayments\Payment\Order\Transaction', 601 $this->client->setOrderCapturedStatus($this->createOrderWithTransactionsFormArray()) 602 ); 603 604 } 605 606 /** 607 * @test 608 */ 609 public function itShouldThrowAnOrderNotFoundExceptionWhenSettingCapturedOrderStatus() 610 { 611 $request = m::mock('GuzzleHttp\Message\Request'); 612 $response = m::mock('GuzzleHttp\Message\Response'); 613 $response->shouldReceive('getStatusCode')->andReturn(404); 614 615 $this->httpClient->shouldReceive('post') 616 ->once() 617 ->andThrow(new HttpClientException('Something happened', $request, $response)); 618 619 $this->setExpectedException('GingerPayments\Payment\Client\OrderNotFoundException'); 620 $this->client->setOrderCapturedStatus($this->createOrderWithTransactionsFormArray()); 621 } 622 623 /** 624 * @test 625 */ 626 public function itShouldThrowAClientExceptionWhenSettingCapturedOrderStatus() 627 { 628 $request = m::mock('GuzzleHttp\Message\Request'); 629 630 $this->httpClient->shouldReceive('post') 631 ->once() 632 ->andThrow(new HttpClientException('Something happened', $request)); 633 634 $this->setExpectedException('GingerPayments\Payment\Client\ClientException'); 635 $this->client->setOrderCapturedStatus($this->createOrderWithTransactionsFormArray()); 636 } 637 638 /** 639 * Helper method for creating an order with transactions 640 * 641 * @return Order 642 */ 643 protected function createOrderWithTransactionsFormArray() { 644 $orderData = [ 645 'transactions' => [ 646 [ 647 'payment_method' => 'credit-card', 648 'payment_method_details' => [], 649 'id' => '5ac3eb32-384d-4d61-a797-9f44b1cd70e5', 650 'created' => '2015-03-07T20:58:35+0100', 651 'modified' => '2015-03-07T21:58:35+0100', 652 'completed' => '2015-03-07T22:58:35+0100', 653 'status' => 'new', 654 'reason' => 'A great reason', 655 'currency' => 'EUR', 656 'amount' => 100, 657 'expiration_period' => 'P0Y0M0DT1H0M0S', 658 'description' => 'A transaction', 659 'balance' => 'internal', 660 'payment_url' => 'http://www.example.com' 661 ] 662 ], 663 'amount' => 100, 664 'currency' => 'EUR', 665 'id' => 'c384b47e-7a5e-4c91-ab65-c4eed7f26e85', 666 'expiration_period' => 'PT10M', 667 'merchant_order_id' => '123', 668 'description' => "Test", 669 'return_url' => "http://example.com", 670 ]; 671 return Order::fromArray($orderData); 672 } 673 568 674 } -
ing-psp/trunk/ing-php/tests/GingerTest.php
r1600658 r1717487 4 4 5 5 use GingerPayments\Payment\Ginger; 6 use GingerPayments\Payment\Client\EndpointResolver; 6 7 7 8 final class GingerTest extends \PHPUnit_Framework_TestCase … … 21 22 $httpClient = $reflectionProperty->getValue($client); 22 23 $this->assertEquals( 23 str_replace('{version}', Ginger::API_VERSION, Ginger::ENDPOINT_GINGER),24 str_replace('{version}', Ginger::API_VERSION, EndpointResolver::ENDPOINT_GINGER), 24 25 $httpClient->getBaseUrl() 25 26 ); -
ing-psp/trunk/ing-php/tests/Order/Transaction/StatusTest.php
r1600658 r1717487 21 21 $this->assertFalse($status->isCancelled()); 22 22 $this->assertFalse($status->isExpired()); 23 $this->assertFalse($status->isCaptured()); 23 24 } 24 25 … … 37 38 $this->assertFalse($status->isCancelled()); 38 39 $this->assertFalse($status->isExpired()); 40 $this->assertFalse($status->isCaptured()); 39 41 } 40 42 … … 53 55 $this->assertFalse($status->isCancelled()); 54 56 $this->assertFalse($status->isExpired()); 57 $this->assertFalse($status->isCaptured()); 55 58 } 56 59 … … 69 72 $this->assertFalse($status->isCancelled()); 70 73 $this->assertFalse($status->isExpired()); 74 $this->assertFalse($status->isCaptured()); 71 75 } 72 76 … … 85 89 $this->assertFalse($status->isCancelled()); 86 90 $this->assertFalse($status->isExpired()); 91 $this->assertFalse($status->isCaptured()); 87 92 } 88 93 … … 101 106 $this->assertTrue($status->isCancelled()); 102 107 $this->assertFalse($status->isExpired()); 108 $this->assertFalse($status->isCaptured()); 103 109 } 104 110 … … 117 123 $this->assertFalse($status->isCancelled()); 118 124 $this->assertTrue($status->isExpired()); 125 $this->assertFalse($status->isCaptured()); 126 } 127 128 /** 129 * @test 130 */ 131 public function itShouldBeCaptured() 132 { 133 $status = Status::fromString(Status::CAPTURED); 134 135 $this->assertFalse($status->isNew()); 136 $this->assertFalse($status->isPending()); 137 $this->assertFalse($status->isProcessing()); 138 $this->assertFalse($status->isError()); 139 $this->assertFalse($status->isCompleted()); 140 $this->assertFalse($status->isCancelled()); 141 $this->assertFalse($status->isExpired()); 142 $this->assertTrue($status->isCaptured()); 119 143 } 120 144 } -
ing-psp/trunk/ing-php/vendor/autoload.php
r1654939 r1717487 5 5 require_once __DIR__ . '/composer/autoload_real.php'; 6 6 7 return ComposerAutoloaderInit 186755da5bcf4416de0a652990838664::getLoader();7 return ComposerAutoloaderInit9600c984af2e5421cbc08b8cdee73f69::getLoader(); -
ing-psp/trunk/ing-php/vendor/composer/ClassLoader.php
r1600658 r1717487 56 56 private $classMapAuthoritative = false; 57 57 private $missingClasses = array(); 58 private $apcuPrefix; 58 59 59 60 public function getPrefixes() … … 273 274 274 275 /** 276 * APCu prefix to use to cache found/not-found classes, if the extension is enabled. 277 * 278 * @param string|null $apcuPrefix 279 */ 280 public function setApcuPrefix($apcuPrefix) 281 { 282 $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null; 283 } 284 285 /** 286 * The APCu prefix in use, or null if APCu caching is not enabled. 287 * 288 * @return string|null 289 */ 290 public function getApcuPrefix() 291 { 292 return $this->apcuPrefix; 293 } 294 295 /** 275 296 * Registers this instance as an autoloader. 276 297 * … … 314 335 public function findFile($class) 315 336 { 316 // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731317 if ('\\' == $class[0]) {318 $class = substr($class, 1);319 }320 321 337 // class map lookup 322 338 if (isset($this->classMap[$class])) { … … 326 342 return false; 327 343 } 344 if (null !== $this->apcuPrefix) { 345 $file = apcu_fetch($this->apcuPrefix.$class, $hit); 346 if ($hit) { 347 return $file; 348 } 349 } 328 350 329 351 $file = $this->findFileWithExtension($class, '.php'); … … 334 356 } 335 357 358 if (null !== $this->apcuPrefix) { 359 apcu_add($this->apcuPrefix.$class, $file); 360 } 361 336 362 if (false === $file) { 337 363 // Remember that this class does not exist. … … 349 375 $first = $class[0]; 350 376 if (isset($this->prefixLengthsPsr4[$first])) { 351 foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) { 352 if (0 === strpos($class, $prefix)) { 353 foreach ($this->prefixDirsPsr4[$prefix] as $dir) { 377 $subPath = $class; 378 while (false !== $lastPos = strrpos($subPath, '\\')) { 379 $subPath = substr($subPath, 0, $lastPos); 380 $search = $subPath.'\\'; 381 if (isset($this->prefixDirsPsr4[$search])) { 382 foreach ($this->prefixDirsPsr4[$search] as $dir) { 383 $length = $this->prefixLengthsPsr4[$first][$search]; 354 384 if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { 355 385 return $file; -
ing-psp/trunk/ing-php/vendor/composer/LICENSE
r1600658 r1717487 1 1 2 Copyright (c) 2016Nils Adermann, Jordi Boggiano2 Copyright (c) Nils Adermann, Jordi Boggiano 3 3 4 4 Permission is hereby granted, free of charge, to any person obtaining a copy -
ing-psp/trunk/ing-php/vendor/composer/autoload_psr4.php
r1600658 r1717487 12 12 'Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'), 13 13 'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'), 14 'Rhumsaa\\Uuid\\' => array($vendorDir . '/ramsey/uuid/src'),15 14 'React\\Promise\\' => array($vendorDir . '/react/promise/src'), 15 'Ramsey\\Uuid\\' => array($vendorDir . '/ramsey/uuid/src'), 16 16 'GuzzleHttp\\Stream\\' => array($vendorDir . '/guzzlehttp/streams/src'), 17 17 'GuzzleHttp\\Ring\\' => array($vendorDir . '/guzzlehttp/ringphp/src'), … … 19 19 'GingerPayments\\Payment\\Tests\\' => array($baseDir . '/tests'), 20 20 'GingerPayments\\Payment\\' => array($baseDir . '/src'), 21 'Dotenv\\' => array($vendorDir . '/vlucas/phpdotenv/src'), 21 22 'Doctrine\\Instantiator\\' => array($vendorDir . '/doctrine/instantiator/src/Doctrine/Instantiator'), 22 23 'Carbon\\' => array($vendorDir . '/nesbot/carbon/src/Carbon'), -
ing-psp/trunk/ing-php/vendor/composer/autoload_real.php
r1654939 r1717487 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit 186755da5bcf4416de0a6529908386645 class ComposerAutoloaderInit9600c984af2e5421cbc08b8cdee73f69 6 6 { 7 7 private static $loader; … … 20 20 } 21 21 22 spl_autoload_register(array('ComposerAutoloaderInit 186755da5bcf4416de0a652990838664', 'loadClassLoader'), true, true);22 spl_autoload_register(array('ComposerAutoloaderInit9600c984af2e5421cbc08b8cdee73f69', 'loadClassLoader'), true, true); 23 23 self::$loader = $loader = new \Composer\Autoload\ClassLoader(); 24 spl_autoload_unregister(array('ComposerAutoloaderInit 186755da5bcf4416de0a652990838664', 'loadClassLoader'));24 spl_autoload_unregister(array('ComposerAutoloaderInit9600c984af2e5421cbc08b8cdee73f69', 'loadClassLoader')); 25 25 26 $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') ;26 $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); 27 27 if ($useStaticLoader) { 28 28 require_once __DIR__ . '/autoload_static.php'; 29 29 30 call_user_func(\Composer\Autoload\ComposerStaticInit 186755da5bcf4416de0a652990838664::getInitializer($loader));30 call_user_func(\Composer\Autoload\ComposerStaticInit9600c984af2e5421cbc08b8cdee73f69::getInitializer($loader)); 31 31 } else { 32 32 $map = require __DIR__ . '/autoload_namespaces.php'; … … 49 49 50 50 if ($useStaticLoader) { 51 $includeFiles = Composer\Autoload\ComposerStaticInit 186755da5bcf4416de0a652990838664::$files;51 $includeFiles = Composer\Autoload\ComposerStaticInit9600c984af2e5421cbc08b8cdee73f69::$files; 52 52 } else { 53 53 $includeFiles = require __DIR__ . '/autoload_files.php'; 54 54 } 55 55 foreach ($includeFiles as $fileIdentifier => $file) { 56 composerRequire 186755da5bcf4416de0a652990838664($fileIdentifier, $file);56 composerRequire9600c984af2e5421cbc08b8cdee73f69($fileIdentifier, $file); 57 57 } 58 58 … … 61 61 } 62 62 63 function composerRequire 186755da5bcf4416de0a652990838664($fileIdentifier, $file)63 function composerRequire9600c984af2e5421cbc08b8cdee73f69($fileIdentifier, $file) 64 64 { 65 65 if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { -
ing-psp/trunk/ing-php/vendor/composer/autoload_static.php
r1654939 r1717487 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit 186755da5bcf4416de0a6529908386647 class ComposerStaticInit9600c984af2e5421cbc08b8cdee73f69 8 8 { 9 9 public static $files = array ( … … 33 33 'R' => 34 34 array ( 35 'Rhumsaa\\Uuid\\' => 13,36 35 'React\\Promise\\' => 14, 36 'Ramsey\\Uuid\\' => 12, 37 37 ), 38 38 'G' => … … 46 46 'D' => 47 47 array ( 48 'Dotenv\\' => 7, 48 49 'Doctrine\\Instantiator\\' => 22, 49 50 ), … … 81 82 0 => __DIR__ . '/..' . '/symfony/translation', 82 83 ), 83 'Rhumsaa\\Uuid\\' => 84 'React\\Promise\\' => 85 array ( 86 0 => __DIR__ . '/..' . '/react/promise/src', 87 ), 88 'Ramsey\\Uuid\\' => 84 89 array ( 85 90 0 => __DIR__ . '/..' . '/ramsey/uuid/src', 86 91 ), 87 'React\\Promise\\' =>88 array (89 0 => __DIR__ . '/..' . '/react/promise/src',90 ),91 92 'GuzzleHttp\\Stream\\' => 92 93 array ( … … 108 109 array ( 109 110 0 => __DIR__ . '/../..' . '/src', 111 ), 112 'Dotenv\\' => 113 array ( 114 0 => __DIR__ . '/..' . '/vlucas/phpdotenv/src', 110 115 ), 111 116 'Doctrine\\Instantiator\\' => … … 921 926 { 922 927 return \Closure::bind(function () use ($loader) { 923 $loader->prefixLengthsPsr4 = ComposerStaticInit 186755da5bcf4416de0a652990838664::$prefixLengthsPsr4;924 $loader->prefixDirsPsr4 = ComposerStaticInit 186755da5bcf4416de0a652990838664::$prefixDirsPsr4;925 $loader->prefixesPsr0 = ComposerStaticInit 186755da5bcf4416de0a652990838664::$prefixesPsr0;926 $loader->classMap = ComposerStaticInit 186755da5bcf4416de0a652990838664::$classMap;928 $loader->prefixLengthsPsr4 = ComposerStaticInit9600c984af2e5421cbc08b8cdee73f69::$prefixLengthsPsr4; 929 $loader->prefixDirsPsr4 = ComposerStaticInit9600c984af2e5421cbc08b8cdee73f69::$prefixDirsPsr4; 930 $loader->prefixesPsr0 = ComposerStaticInit9600c984af2e5421cbc08b8cdee73f69::$prefixesPsr0; 931 $loader->classMap = ComposerStaticInit9600c984af2e5421cbc08b8cdee73f69::$classMap; 927 932 928 933 }, null, ClassLoader::class); -
ing-psp/trunk/ing-php/vendor/composer/installed.json
r1654867 r1717487 22 22 "phpunit/phpunit": "~4.6" 23 23 }, 24 "time": "2015-09-04 14:14:03",24 "time": "2015-09-04T14:14:03+00:00", 25 25 "type": "library", 26 26 "extra": { … … 80 80 "phpunit/phpunit": "@stable" 81 81 }, 82 "time": "2016-10-31 12:09:54",82 "time": "2016-10-31T12:09:54+00:00", 83 83 "type": "library", 84 84 "installation-source": "dist", … … 132 132 "php": ">=5.4.0" 133 133 }, 134 "time": "2016-05-03 17:50:52",134 "time": "2016-05-03T17:50:52+00:00", 135 135 "type": "library", 136 136 "extra": { … … 181 181 "phpunit/phpunit": "~4.0" 182 182 }, 183 "time": "2014-10-12 19:18:40",183 "time": "2014-10-12T19:18:40+00:00", 184 184 "type": "library", 185 185 "extra": { … … 239 239 "ext-curl": "Guzzle will use specific adapters if cURL is present" 240 240 }, 241 "time": "2015-05-20 03:37:09",241 "time": "2015-05-20T03:37:09+00:00", 242 242 "type": "library", 243 243 "extra": { … … 288 288 "phpunit/phpunit": "^4.0" 289 289 }, 290 "time": "2016-07-15 19:28:39",290 "time": "2016-07-15T19:28:39+00:00", 291 291 "type": "library", 292 292 "installation-source": "dist", … … 340 340 "phpunit/phpunit": "4.*" 341 341 }, 342 "time": "2014-07-28 14:39:20",342 "time": "2014-07-28T14:39:20+00:00", 343 343 "type": "library", 344 344 "extra": { … … 393 393 "ext-mbstring": "For best performance" 394 394 }, 395 "time": "2016-05-18 14:26:46",395 "time": "2016-05-18T14:26:46+00:00", 396 396 "type": "library", 397 397 "extra": { … … 466 466 "symfony/yaml": "" 467 467 }, 468 "time": "2016-10-18 04:28:30",468 "time": "2016-10-18T04:28:30+00:00", 469 469 "type": "library", 470 470 "extra": { … … 521 521 "phpunit/phpunit": "~4.0|~5.0" 522 522 }, 523 "time": "2015-11-04 20:07:17",523 "time": "2015-11-04T20:07:17+00:00", 524 524 "type": "library", 525 525 "installation-source": "dist", … … 572 572 "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." 573 573 }, 574 "time": "2017-03-13 16:27:32",574 "time": "2017-03-13T16:27:32+00:00", 575 575 "type": "library", 576 576 "installation-source": "dist", … … 600 600 { 601 601 "name": "ramsey/uuid", 602 "version": " 2.9.0",603 "version_normalized": " 2.9.0.0",602 "version": "3.6.1", 603 "version_normalized": "3.6.1.0", 604 604 "source": { 605 605 "type": "git", 606 606 "url": "https://github.com/ramsey/uuid.git", 607 "reference": " b2ef4dd9584268d73f92f752a62bc24cd534dc9a"608 }, 609 "dist": { 610 "type": "zip", 611 "url": "https://api.github.com/repos/ramsey/uuid/zipball/ b2ef4dd9584268d73f92f752a62bc24cd534dc9a",612 "reference": " b2ef4dd9584268d73f92f752a62bc24cd534dc9a",607 "reference": "4ae32dd9ab8860a4bbd750ad269cba7f06f7934e" 608 }, 609 "dist": { 610 "type": "zip", 611 "url": "https://api.github.com/repos/ramsey/uuid/zipball/4ae32dd9ab8860a4bbd750ad269cba7f06f7934e", 612 "reference": "4ae32dd9ab8860a4bbd750ad269cba7f06f7934e", 613 613 "shasum": "" 614 614 }, 615 615 "require": { 616 616 "paragonie/random_compat": "^1.0|^2.0", 617 "php": " >=5.3.3"617 "php": "^5.4 || ^7.0" 618 618 }, 619 619 "replace": { … … 621 621 }, 622 622 "require-dev": { 623 "doctrine/dbal": ">=2.3", 623 "apigen/apigen": "^4.1", 624 "codeception/aspect-mock": "^1.0 | ^2.0", 625 "doctrine/annotations": "~1.2.0", 626 "goaop/framework": "1.0.0-alpha.2 | ^1.0 | ^2.1", 627 "ircmaxell/random-lib": "^1.1", 624 628 "jakub-onderka/php-parallel-lint": "^0.9.0", 625 "moontoast/math": "~1.1", 626 "phpunit/phpunit": "~4.1|~5.0", 627 "satooshi/php-coveralls": "~0.6", 628 "squizlabs/php_codesniffer": "^2.3", 629 "symfony/console": "~2.3|~3.0" 629 "mockery/mockery": "^0.9.4", 630 "moontoast/math": "^1.1", 631 "php-mock/php-mock-phpunit": "^0.3|^1.1", 632 "phpunit/phpunit": "^4.7|>=5.0 <5.4", 633 "satooshi/php-coveralls": "^0.6.1", 634 "squizlabs/php_codesniffer": "^2.3" 630 635 }, 631 636 "suggest": { 632 "doctrine/dbal": "Allow the use of a UUID as doctrine field type.", 633 "moontoast/math": "Support for converting UUID to 128-bit integer (in string form).", 634 "symfony/console": "Support for use of the bin/uuid command line tool." 635 }, 636 "time": "2016-03-22 18:20:19", 637 "bin": [ 638 "bin/uuid" 639 ], 640 "type": "library", 637 "ext-libsodium": "Provides the PECL libsodium extension for use with the SodiumRandomGenerator", 638 "ext-uuid": "Provides the PECL UUID extension for use with the PeclUuidTimeGenerator and PeclUuidRandomGenerator", 639 "ircmaxell/random-lib": "Provides RandomLib for use with the RandomLibAdapter", 640 "moontoast/math": "Provides support for converting UUID to 128-bit integer (in string form).", 641 "ramsey/uuid-console": "A console application for generating UUIDs with ramsey/uuid", 642 "ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type." 643 }, 644 "time": "2017-03-26T20:37:53+00:00", 645 "type": "library", 646 "extra": { 647 "branch-alias": { 648 "dev-master": "3.x-dev" 649 } 650 }, 641 651 "installation-source": "dist", 642 652 "autoload": { 643 653 "psr-4": { 644 "R humsaa\\Uuid\\": "src/"654 "Ramsey\\Uuid\\": "src/" 645 655 } 646 656 }, … … 655 665 }, 656 666 { 667 "name": "Thibaud Fabre", 668 "email": "thibaud@aztech.io" 669 }, 670 { 657 671 "name": "Ben Ramsey", 658 "homepage": "http://benramsey.com" 659 } 660 ], 661 "description": "A PHP 5.3+ library for generating RFC 4122 version 1, 3, 4, and 5 universally unique identifiers (UUID).", 672 "email": "ben@benramsey.com", 673 "homepage": "https://benramsey.com" 674 } 675 ], 676 "description": "Formerly rhumsaa/uuid. A PHP 5.4+ library for generating RFC 4122 version 1, 3, 4, and 5 universally unique identifiers (UUID).", 662 677 "homepage": "https://github.com/ramsey/uuid", 663 678 "keywords": [ … … 700 715 "sllh/iso-codes-validator": "For Symfony or Silex integration with ease" 701 716 }, 702 "time": "2015-06-22 19:37:41",717 "time": "2015-06-22T19:37:41+00:00", 703 718 "type": "library", 704 719 "extra": { … … 750 765 }, 751 766 { 767 "name": "vlucas/phpdotenv", 768 "version": "v2.4.0", 769 "version_normalized": "2.4.0.0", 770 "source": { 771 "type": "git", 772 "url": "https://github.com/vlucas/phpdotenv.git", 773 "reference": "3cc116adbe4b11be5ec557bf1d24dc5e3a21d18c" 774 }, 775 "dist": { 776 "type": "zip", 777 "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/3cc116adbe4b11be5ec557bf1d24dc5e3a21d18c", 778 "reference": "3cc116adbe4b11be5ec557bf1d24dc5e3a21d18c", 779 "shasum": "" 780 }, 781 "require": { 782 "php": ">=5.3.9" 783 }, 784 "require-dev": { 785 "phpunit/phpunit": "^4.8 || ^5.0" 786 }, 787 "time": "2016-09-01T10:05:43+00:00", 788 "type": "library", 789 "extra": { 790 "branch-alias": { 791 "dev-master": "2.4-dev" 792 } 793 }, 794 "installation-source": "dist", 795 "autoload": { 796 "psr-4": { 797 "Dotenv\\": "src/" 798 } 799 }, 800 "notification-url": "https://packagist.org/downloads/", 801 "license": [ 802 "BSD-3-Clause-Attribution" 803 ], 804 "authors": [ 805 { 806 "name": "Vance Lucas", 807 "email": "vance@vancelucas.com", 808 "homepage": "http://www.vancelucas.com" 809 } 810 ], 811 "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", 812 "keywords": [ 813 "dotenv", 814 "env", 815 "environment" 816 ] 817 }, 818 { 752 819 "name": "hamcrest/hamcrest-php", 753 820 "version": "v1.2.2", … … 776 843 "satooshi/php-coveralls": "dev-master" 777 844 }, 778 "time": "2015-05-11 14:41:42",845 "time": "2015-05-11T14:41:42+00:00", 779 846 "type": "library", 780 847 "installation-source": "dist", … … 819 886 "phpunit/phpunit": "~4.0" 820 887 }, 821 "time": "2016-05-22 21:52:33",888 "time": "2016-05-22T21:52:33+00:00", 822 889 "type": "library", 823 890 "extra": { … … 885 952 "sebastian/version": "^1.0.1" 886 953 }, 887 "time": "2016-08-09 15:02:57",954 "time": "2016-08-09T15:02:57+00:00", 888 955 "type": "library", 889 956 "extra": { … … 936 1003 "phpunit/phpunit": "^4.6" 937 1004 }, 938 "time": "2015-12-27 11:43:31",1005 "time": "2015-12-27T11:43:31+00:00", 939 1006 "type": "library", 940 1007 "extra": { … … 994 1061 "phpunit/phpunit": "^5.2||^4.8.24" 995 1062 }, 996 "time": "2016-06-10 07:14:17",1063 "time": "2016-06-10T07:14:17+00:00", 997 1064 "type": "library", 998 1065 "extra": { … … 1045 1112 "phpunit/phpunit": "^4.4" 1046 1113 }, 1047 "time": "2016-09-30 07:12:33",1114 "time": "2016-09-30T07:12:33+00:00", 1048 1115 "type": "library", 1049 1116 "installation-source": "dist", … … 1089 1156 "phpunit/phpunit": "~4.2" 1090 1157 }, 1091 "time": "2015-09-15 10:49:45",1158 "time": "2015-09-15T10:49:45+00:00", 1092 1159 "type": "library", 1093 1160 "extra": { … … 1136 1203 "php": ">=5.3.9" 1137 1204 }, 1138 "time": "2016-10-21 20:59:10",1205 "time": "2016-10-21T20:59:10+00:00", 1139 1206 "type": "library", 1140 1207 "extra": { … … 1184 1251 "shasum": "" 1185 1252 }, 1186 "time": "2015-06-21 13:59:46",1253 "time": "2015-06-21T13:59:46+00:00", 1187 1254 "type": "library", 1188 1255 "installation-source": "dist", … … 1230 1297 "ext-uopz": "*" 1231 1298 }, 1232 "time": "2015-10-12 03:26:01",1299 "time": "2015-10-12T03:26:01+00:00", 1233 1300 "type": "library", 1234 1301 "extra": { … … 1280 1347 "phpunit/phpunit": "~4.4" 1281 1348 }, 1282 "time": "2015-11-11 19:50:13",1349 "time": "2015-11-11T19:50:13+00:00", 1283 1350 "type": "library", 1284 1351 "extra": { … … 1337 1404 "phpunit/phpunit": "~4.4" 1338 1405 }, 1339 "time": "2016-06-17 09:04:28",1406 "time": "2016-06-17T09:04:28+00:00", 1340 1407 "type": "library", 1341 1408 "extra": { … … 1404 1471 "phpunit/phpunit": "^4.8 || ^5.0" 1405 1472 }, 1406 "time": "2016-08-18 05:49:44",1473 "time": "2016-08-18T05:49:44+00:00", 1407 1474 "type": "library", 1408 1475 "extra": { … … 1456 1523 "phpunit/phpunit": "~4.8" 1457 1524 }, 1458 "time": "2015-12-08 07:14:41",1525 "time": "2015-12-08T07:14:41+00:00", 1459 1526 "type": "library", 1460 1527 "extra": { … … 1512 1579 "phpunit/phpunit": "~4.4" 1513 1580 }, 1514 "time": "2015-07-26 15:48:44",1581 "time": "2015-07-26T15:48:44+00:00", 1515 1582 "type": "library", 1516 1583 "extra": { … … 1573 1640 "php": ">=5.3.3" 1574 1641 }, 1575 "time": "2015-06-21 13:50:34",1642 "time": "2015-06-21T13:50:34+00:00", 1576 1643 "type": "library", 1577 1644 "installation-source": "dist", … … 1623 1690 "squizlabs/php_codesniffer": "~2.0" 1624 1691 }, 1625 "time": "2015-06-14 21:17:01",1692 "time": "2015-06-14T21:17:01+00:00", 1626 1693 "type": "library", 1627 1694 "extra": { … … 1681 1748 "ext-soap": "*" 1682 1749 }, 1683 "time": "2015-10-02 06:51:40",1750 "time": "2015-10-02T06:51:40+00:00", 1684 1751 "type": "library", 1685 1752 "extra": { … … 1733 1800 "phpunit/phpunit": "~4|~5" 1734 1801 }, 1735 "time": "2016-05-12 18:03:57",1802 "time": "2016-05-12T18:03:57+00:00", 1736 1803 "type": "library", 1737 1804 "installation-source": "dist", … … 1776 1843 "php": ">=5.3.3" 1777 1844 }, 1778 "time": "2015-06-21 13:08:43",1845 "time": "2015-06-21T13:08:43+00:00", 1779 1846 "type": "library", 1780 1847 "extra": { … … 1839 1906 "ext-xmlwriter": "*" 1840 1907 }, 1841 "time": "2015-10-06 15:47:00",1908 "time": "2015-10-06T15:47:00+00:00", 1842 1909 "type": "library", 1843 1910 "extra": { … … 1896 1963 "phpspec/phpspec": "^2.0" 1897 1964 }, 1898 "time": "2016-06-07 08:13:47",1965 "time": "2016-06-07T08:13:47+00:00", 1899 1966 "type": "library", 1900 1967 "extra": { … … 1974 2041 "phpunit/php-invoker": "~1.1" 1975 2042 }, 1976 "time": "2016-07-21 06:48:14",2043 "time": "2016-07-21T06:48:14+00:00", 1977 2044 "bin": [ 1978 2045 "phpunit" … … 2033 2100 "phpunit/phpunit": "~4.0" 2034 2101 }, 2035 "time": "2016-09-01 23:53:02",2102 "time": "2016-09-01T23:53:02+00:00", 2036 2103 "bin": [ 2037 2104 "scripts/phpcs", -
ing-psp/trunk/ing-php/vendor/ramsey/uuid/CHANGELOG.md
r1600658 r1717487 1 # Rhumsaa\Uuid Changelog 1 # ramsey/uuid Changelog 2 3 ## 3.6.1 4 5 _Released: 2017-03-26_ 6 7 * Optimize UUID string decoding [#164](https://github.com/ramsey/uuid/pull/164) 8 9 ## 3.6.0 10 11 _Released: 2017-03-18_ 12 13 * Add `InvalidUuidStringException`, thrown when attempting to decode an invalid string UUID; this does not introduce any BC issues, since the new exception inherits from the previously used `InvalidArgumentException` [#162](https://github.com/ramsey/uuid/pull/162) 14 * Improve memory usage when generating large quantities of UUIDs (use `str_pad()` and `dechex()` instead of `sprintf()`) [#160](https://github.com/ramsey/uuid/pull/160) 15 * Minor test and documentation updates 16 17 ## 3.5.2 18 19 _Released: 2016-11-22_ 20 21 * Improved test coverage. 22 23 ## 3.5.1 24 25 _Released: 2016-10-02_ 26 27 * Fixed issue where same UUIDs were not treated as equal with mixed case ([#131](https://github.com/ramsey/uuid/issues/131), [#137](https://github.com/ramsey/uuid/pull/137)). 28 * Test cleanup. 29 30 ## 3.5.0 31 32 _Released: 2016-08-02_ 33 34 * Add `OrderedTimeCodec` to store UUID in an optimized way for InnoDB ([#117](https://github.com/ramsey/uuid/issues/117), [#118](https://github.com/ramsey/uuid/pull/118)). 35 * Fixed `RandomNodeProvider` to prevent invalid node generation ([#129](https://github.com/ramsey/uuid/pull/129)). 36 * Cache failed attempt to retrieve system node to avoid multiple system calls ([#107](https://github.com/ramsey/uuid/issues/107), [#121](https://github.com/ramsey/uuid/pull/121)). 37 * Various test improvements. 38 39 ## 3.4.1 40 41 _Released: 2016-04-23_ 42 43 * Fixed test that violated a PHP CodeSniffer rule, breaking the build. 44 45 ## 3.4.0 46 47 _Released: 2016-04-23_ 48 49 * Add `TimestampFirstCombCodec` and `TimestampLastCombCodec` codecs. 50 * Improve logic of `CombGenerator` for COMB sequential UUIDs. 51 * Significantly improved test coverage. 52 53 ## 3.3.0 54 55 _Released: 2016-03-22_ 56 57 * Drop the use of OpenSSL as a fallback and use [paragonie/random_compat][] to support RandomBytesGenerator in versions of PHP earlier than 7.0. This addresses and fixes the [collision issue][]. 58 * Improved test coverage. 59 * Update code to conduct to version 1.4 of the Contributor Covenant. 60 61 ## 3.2.0 62 63 _Released: 2016-02-17_ 64 65 * Add random generator option for use for the PECL libsodium extension. 66 * Updates to test infrastructure. 67 68 ## 3.1.0 69 70 _Released: 2015-12-17_ 71 72 * Uuid objects now may be properly serialized/unserialized. 73 * Update build environments for testing on Travis CI. 74 75 ## 3.0.1 76 77 _Released: 2015-10-21_ 78 79 * Add project [Contributor Code of Conduct](https://github.com/ramsey/uuid/blob/master/CONDUCT.md) 80 * Modify Travis CI builds to run tests on multiple CPU architectures 81 * Clean up code, tests, and documentation 82 83 ## 3.0.0 84 85 _Released: 2015-09-28_ 86 87 The 3.0.0 release represents a significant step for the ramsey/uuid library. While the simple and familiar API used in previous versions remains intact, this release provides greater flexibility to integrators, including the ability to inject your own number generators, UUID codecs, node and time providers, and more. 88 89 * BREAK: The root namespace for this package has changed from "Rhumsaa" to "Ramsey." In most cases, simply making this change in your applications is the only upgrade path you will need. Everything else should work as expected. 90 * BREAK: The UUID [Doctrine field type](http://doctrine-dbal.readthedocs.org/en/latest/reference/types.html) has been moved to [ramsey/uuid-doctrine](https://github.com/ramsey/uuid-doctrine). 91 * BREAK: The `uuid` console application has been moved to [ramsey/uuid-console](https://github.com/ramsey/uuid-console). 92 * BREAK: The `Uuid::VERSION` package version constant has been removed. 93 * See also the release notes for [3.0.0-alpha1][300-alpha1], [3.0.0-alpha2][300-alpha2], [3.0.0-alpha3][300-alpha3], and [3.0.0-beta1][300-beta1]. 94 95 [300-alpha1]: https://github.com/ramsey/uuid/blob/master/CHANGELOG.md#300-alpha1 96 [300-alpha2]: https://github.com/ramsey/uuid/blob/master/CHANGELOG.md#300-alpha2 97 [300-alpha3]: https://github.com/ramsey/uuid/blob/master/CHANGELOG.md#300-alpha3 98 [300-beta1]: https://github.com/ramsey/uuid/blob/master/CHANGELOG.md#300-beta1 99 100 ## 3.0.0-beta1 101 102 _Released: 2015-08-31_ 103 104 * Improve GUID support to ensure that: 105 * On little endian (LE) architectures, the byte order of the first three fields is LE. 106 * On big endian (BE) architectures, it is the same as a GUID. 107 * String representation is always the same. 108 * Fix exception message for `DegradedNumberConverter::fromHex()`. 109 * Add Scrutinizer configuration to run code-quality builds through Scrutinizer. 110 * Auto-fix Scrutinizer issues. 111 * Fix support URLs in composer.json to point to the correct GitHub repository. 112 113 ## 3.0.0-alpha3 114 115 _Released: 2015-07-28_ 116 117 * Time generator improvements: 118 * Enabled use of custom TimeGenerator implementations. 119 * BREAK: Removed now unnecessary `timeConverter` and `timeProvider` properties, setters, and getters in both `FeatureSet` and `UuidFactory` as those are now exclusively used by the default `TimeGenerator`. 120 * Added a `setTimeGenerator` method on `UuidFactory` to override the default time generator. 121 * Add option to enable `PeclUuidTimeGenerator` via `FeatureSet`. 122 123 ## 3.0.0-alpha2 124 125 _Released: 2015-07-28_ 126 127 * BREAK: Removed `PeclUuidFactory` in favor of using pecl-uuid with generators. 128 * NEW: Refactored time-based (version 1) UUIDs into a `TimeGeneratorInterface` to allow for other sources to generate version 1 UUIDs in this library. 129 * NEW: Added `PeclUuidTimeGenerator` and `PeclUuidRandomGenerator` for creating version 1 or version 4 UUIDs using the pecl-uuid extension. 130 * NEW: Add `RandomBytesGenerator` for use with PHP 7. ramsey/uuid will default to use this generator when running on PHP 7. 131 * `RandomLibAdapter` now defaults to a medium-strength generator with [ircmaxell/random-lib](https://github.com/ircmaxell/RandomLib). This is configurable, so other generator strengths may be used. 132 * Migrated to the Travis CI container-based infrastructure for builds. 133 * Documentation updates and corrections. 134 135 ## 3.0.0-alpha1 136 137 _Released: 2015-07-16_ 138 139 * BREAK: The root namespace for this package has changed from "Rhumsaa" to "Ramsey." In most cases, simply making this change in your applications is the only upgrade path you will need. Everything else should work as expected. 140 * BREAK: The UUID [Doctrine field type](http://doctrine-dbal.readthedocs.org/en/latest/reference/types.html) has been moved to [ramsey/uuid-doctrine](https://github.com/ramsey/uuid-doctrine). 141 * BREAK: The `uuid` console application has been moved to [ramsey/uuid-console](https://github.com/ramsey/uuid-console). 142 * BREAK: The `Uuid::VERSION` package version constant has been removed. 143 * NEW: The `Uuid` class is no longer marked as `final`. Everything is now based around interfaces and factories, allowing you to use this package as a base to implement other kinds of UUIDs with different dependencies. 144 * NEW: Through setting dependencies on `UuidFactory` and/or extending `FeatureSet`, you may override any package defaults, injecting your own dependencies. 145 * NEW: For random number generation, in addition to `OpenSslGenerator` (used if `openssl_random_pseudo_bytes()` is present) and the fallback `MtRandGenerator`, you may use the bundled `CombGenerator` for sequential UUIDs or the `RandomLibAdapter` if using [ircmaxell/random-lib](https://github.com/ircmaxell/RandomLib). 146 * NEW: In addition to the default UUID generation, this library also supports GUID generation by configuring a `FeatureSet` to use GUIDs. 147 * NEW: While the interface to create UUIDs hasn't changed, if using this package on a 32-bit system, you will now receive an object of type `DegradedUuid` (which extends `Uuid`, which implements `UuidInterface`). 148 * NEW: All UUIDs are now [JsonSerializable](http://php.net/JsonSerializable). 2 149 3 150 ## 2.9.0 -
ing-psp/trunk/ing-php/vendor/ramsey/uuid/CONTRIBUTING.md
r1600658 r1717487 15 15 You can find help and discussion in the following places: 16 16 17 * Gitter chat: <https://gitter.im/ramsey/uuid>18 17 * GitHub Issues: <https://github.com/ramsey/uuid/issues> 19 18 * Wiki: <https://github.com/ramsey/uuid/wiki> … … 57 56 58 57 ``` 59 ./vendor/bin/parallel-lint src tests 60 ./vendor/bin/phpunit --coverage-text 61 ./vendor/bin/phpcs src --standard=psr2 -sp 58 composer test 62 59 ``` 60 61 ### Locally Test With Emulated MIPS Architecture 62 63 The following commands use [Vagrant](https://www.vagrantup.com/) to start an Ubuntu VM, install necessary dependencies, and then run the `util/run-tests.sh` script that will download a Docker image emulating the MIPS architecture. This is especially helpful for testing UUID generation in a big-endian environment. 64 65 ``` 66 vagrant init ubuntu/trusty64 67 vagrant up 68 vagrant ssh 69 sudo apt-get install docker.io qemu-user-static php5-cli php5-curl 70 cd /vagrant 71 curl -sS https://getcomposer.org/installer | php 72 php composer.phar install --no-interaction --prefer-dist 73 mkdir -p build/logs 74 ARCH=mips PHP_VERSION=5.6.14 TRAVIS_BUILD_DIR=/vagrant ./util/run-tests.sh 75 ``` -
ing-psp/trunk/ing-php/vendor/ramsey/uuid/LICENSE
r1600658 r1717487 1 Copyright (c) 201 3-2014 Ben Ramsey <http://benramsey.com>1 Copyright (c) 2012-2017 Ben Ramsey <ben@benramsey.com> 2 2 3 3 Permission is hereby granted, free of charge, to any person obtaining a copy -
ing-psp/trunk/ing-php/vendor/ramsey/uuid/README.md
r1600658 r1717487 1 # Rhumsaa\Uuid for PHP1 # ramsey/uuid 2 2 3 [](https://travis-ci.org/ramsey/uuid) 4 [](https://coveralls.io/r/ramsey/uuid) 5 [](https://packagist.org/packages/rhumsaa/uuid) 6 [](https://packagist.org/packages/rhumsaa/uuid) 7 [](https://packagist.org/packages/rhumsaa/uuid) 8 [](http://hhvm.h4cc.de/package/rhumsaa/uuid) 3 _NOTICE: Formerly known as `rhumsaa/uuid`, The package and namespace names have changed to `ramsey/uuid` and `Ramsey\Uuid`, respectively._ 9 4 10 This project adheres to a [Contributor Code of Conduct](https://github.com/ramsey/uuid/blob/master/CODE_OF_CONDUCT.md). By participating in this project and its community, you are expected to uphold this code. 5 [![Source Code][badge-source]][source] 6 [![Latest Version][badge-release]][release] 7 [![Software License][badge-license]][license] 8 [![Build Status][badge-build]][build] 9 [![Coverage Status][badge-coverage]][coverage] 10 [![Total Downloads][badge-downloads]][downloads] 11 12 ramsey/uuid is a PHP 5.4+ library for generating and working with [RFC 4122][rfc4122] version 1, 3, 4, and 5 universally unique identifiers (UUID). 13 14 This project adheres to a [Contributor Code of Conduct][conduct]. By participating in this project and its community, you are expected to uphold this code. 15 11 16 12 17 ## About 13 18 14 Rhumsaa\Uuid is a PHP 5.3+ library for generating and working with15 [RFC 4122][rfc4122] version 1, 3, 4, and 5 universally unique identifiers (UUID).16 17 19 From [Wikipedia](http://en.wikipedia.org/wiki/Universally_unique_identifier): 18 20 19 > The intent of UUIDs is to enable distributed systems to uniquely identify 20 > information without significant central coordination. In this context the word 21 > unique should be taken to mean "practically unique" rather than "guaranteed 22 > unique". Since the identifiers have a finite size, it is possible for two 23 > differing items to share the same identifier. The identifier size and 24 > generation process need to be selected so as to make this sufficiently 25 > improbable in practice. Anyone can create a UUID and use it to identify 26 > something with reasonable confidence that the same identifier will never be 27 > unintentionally created by anyone to identify something else. Information 28 > labeled with UUIDs can therefore be later combined into a single database 29 > without needing to resolve identifier (ID) conflicts. 21 > The intent of UUIDs is to enable distributed systems to uniquely identify information without significant central coordination. In this context the word unique should be taken to mean "practically unique" rather than "guaranteed unique". Since the identifiers have a finite size, it is possible for two differing items to share the same identifier. The identifier size and generation process need to be selected so as to make this sufficiently improbable in practice. Anyone can create a UUID and use it to identify something with reasonable confidence that the same identifier will never be unintentionally created by anyone to identify something else. Information labeled with UUIDs can therefore be later combined into a single database without needing to resolve identifier (ID) conflicts. 30 22 31 Much inspiration for this library came from the [Java][javauuid] and 32 [Python][pyuuid] UUID libraries. 23 Much inspiration for this library came from the [Java][javauuid] and [Python][pyuuid] UUID libraries. 33 24 34 ## API Documentation35 25 36 The [latest class API documentation][apidocs] is available online. This project 37 uses [ApiGen](http://apigen.org/) to generate this documentation. To 38 generate the documentation on your own, run `apigen` from the root of the project. 39 This will generate documentation in the `build/apidocs/` folder. 26 ## Installation 27 28 The preferred method of installation is via [Packagist][] and [Composer][]. Run the following command to install the package and add it as a requirement to your project's `composer.json`: 29 30 ```bash 31 composer require ramsey/uuid 32 ``` 33 34 35 ## Upgrading from 2.x to 3.x 36 37 While we have made significant internal changes to the library, we have made every effort to ensure a seamless upgrade path from the 2.x series of this library to 3.x. 38 39 One major breaking change is the transition from the `Rhumsaa` root namespace to `Ramsey`. In most cases, all you will need is to change the namespace to `Ramsey` in your code, and everything will "just work." 40 41 Here are full details on the breaking changes to the public API of this library: 42 43 1. All namespace references of `Rhumsaa` have changed to `Ramsey`. Simply change the namespace to `Ramsey` in your code and everything should work. 44 2. The console application has moved to [ramsey/uuid-console](https://packagist.org/packages/ramsey/uuid-console). If using the console functionality, use Composer to require `ramsey/uuid-console`. 45 3. The Doctrine field type mapping has moved to [ramsey/uuid-doctrine](https://packagist.org/packages/ramsey/uuid-doctrine). If using the Doctrine functionality, use Composer to require `ramsey/uuid-doctrine`. 46 47 48 ## What to do if you see a "rhumsaa/uuid is abandoned" message 49 50 When installing your project's dependencies using Composer, you might see the following message: 51 52 ``` 53 Package rhumsaa/uuid is abandoned, you should avoid using it. Use ramsey/uuid instead. 54 ``` 55 56 Don't panic. Simply execute the following commands with Composer: 57 58 ``` bash 59 composer remove rhumsaa/uuid 60 composer require ramsey/uuid=^2.9 61 ``` 62 63 After doing so, you will have the latest ramsey/uuid package in the 2.x series, and there will be no need to modify any code; the namespace in the 2.x series is still `Rhumsaa`. 64 40 65 41 66 ## Requirements 42 67 43 Some methods in this library have requirements due to integer size restrictions 44 on 32-bit and 64-bit builds of PHP. A 64-bit build of PHP and the [Moontoast\Math][] 45 library are recommended. However, this library is designed to work on 32-bit 46 builds of PHP without Moontoast\Math, with some degraded functionality. Please 47 check the API documentation for more information. 68 Some methods in this library have requirements due to integer size restrictions on 32-bit and 64-bit builds of PHP. A 64-bit build of PHP and the [Moontoast\Math][] library are recommended. However, this library is designed to work on 32-bit builds of PHP without Moontoast\Math, with some degraded functionality. Please check the API documentation for more information. 48 69 49 If a particular requirement is not present, then a `Rhumsaa\Uuid\Exception\UnsatisfiedDependencyException` 50 is thrown, allowing one to catch a bad call in an environment where the call is 51 not supported and gracefully degrade. 70 If a particular requirement is not present, then an `UnsatisfiedDependencyException` is thrown, allowing one to catch a bad call in an environment where the call is not supported and gracefully degrade. 71 72 73 ## API documentation 74 75 The [latest class API documentation][apidocs] is available online. 76 77 This project uses [ApiGen](http://apigen.org/) to generate this documentation. To generate the documentation on your own, install dev dependencies and run the following command from the root of the project: 78 79 ``` 80 composer build-docs 81 ``` 82 83 This will generate documentation in the `build/apidocs/` folder. 84 52 85 53 86 ## Examples 87 88 See the [cookbook on the wiki][wiki-cookbook] for more examples and approaches to specific use-cases. 54 89 55 90 ```php … … 57 92 require 'vendor/autoload.php'; 58 93 59 use R humsaa\Uuid\Uuid;60 use R humsaa\Uuid\Exception\UnsatisfiedDependencyException;94 use Ramsey\Uuid\Uuid; 95 use Ramsey\Uuid\Exception\UnsatisfiedDependencyException; 61 96 62 97 try { … … 64 99 // Generate a version 1 (time-based) UUID object 65 100 $uuid1 = Uuid::uuid1(); 66 echo $uuid1->toString() . "\n"; // e4eaaaf2-d142-11e1-b3e4-080027620cdd101 echo $uuid1->toString() . "\n"; // i.e. e4eaaaf2-d142-11e1-b3e4-080027620cdd 67 102 68 103 // Generate a version 3 (name-based and hashed with MD5) UUID object 69 104 $uuid3 = Uuid::uuid3(Uuid::NAMESPACE_DNS, 'php.net'); 70 echo $uuid3->toString() . "\n"; // 11a38b9a-b3da-360f-9353-a5a725514269105 echo $uuid3->toString() . "\n"; // i.e. 11a38b9a-b3da-360f-9353-a5a725514269 71 106 72 107 // Generate a version 4 (random) UUID object 73 108 $uuid4 = Uuid::uuid4(); 74 echo $uuid4->toString() . "\n"; // 25769c6c-d34d-4bfe-ba98-e0ee856f3e7a109 echo $uuid4->toString() . "\n"; // i.e. 25769c6c-d34d-4bfe-ba98-e0ee856f3e7a 75 110 76 111 // Generate a version 5 (name-based and hashed with SHA1) UUID object 77 112 $uuid5 = Uuid::uuid5(Uuid::NAMESPACE_DNS, 'php.net'); 78 echo $uuid5->toString() . "\n"; // c4a760a8-dbcf-5254-a0d9-6a4474bd1b62113 echo $uuid5->toString() . "\n"; // i.e. c4a760a8-dbcf-5254-a0d9-6a4474bd1b62 79 114 80 115 } catch (UnsatisfiedDependencyException $e) { … … 87 122 ``` 88 123 89 ## Installation90 124 91 The preferred method of installation is via [Packagist][] and [Composer][]. Run 92 the following command to install the package and add it as a requirement to 93 `composer.json`: 125 ## Contributing 94 126 95 ```bash 96 composer.phar require "ramsey/uuid=~2.8" 97 ``` 127 Contributions are welcome! Please read [CONTRIBUTING][] for details. 128 129 130 ## Copyright and license 131 132 The ramsey/uuid library is copyright © [Ben Ramsey](https://benramsey.com/) and licensed for use under the MIT License (MIT). Please see [LICENSE][] for more information. 133 98 134 99 135 100 136 [rfc4122]: http://tools.ietf.org/html/rfc4122 137 [conduct]: https://github.com/ramsey/uuid/blob/master/CODE_OF_CONDUCT.md 101 138 [javauuid]: http://docs.oracle.com/javase/6/docs/api/java/util/UUID.html 102 139 [pyuuid]: http://docs.python.org/3/library/uuid.html 103 140 [packagist]: https://packagist.org/packages/ramsey/uuid 104 141 [composer]: http://getcomposer.org/ 105 [moontoast\math]: https://github.com/moontoast/math 106 [apidocs]: http://docs.benramsey.com/ramsey-uuid/2.8/ 142 [moontoast\math]: https://packagist.org/packages/moontoast/math 143 [apidocs]: http://docs.benramsey.com/ramsey-uuid/latest/ 144 [wiki-cookbook]: https://github.com/ramsey/uuid/wiki/Ramsey%5CUuid-Cookbook 145 [contributing]: https://github.com/ramsey/uuid/blob/master/CONTRIBUTING.md 146 147 [badge-source]: https://img.shields.io/badge/source-ramsey/uuid-blue.svg?style=flat-square 148 [badge-release]: https://img.shields.io/packagist/v/ramsey/uuid.svg?style=flat-square 149 [badge-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square 150 [badge-build]: https://img.shields.io/travis/ramsey/uuid/master.svg?style=flat-square 151 [badge-coverage]: https://img.shields.io/coveralls/ramsey/uuid/master.svg?style=flat-square 152 [badge-downloads]: https://img.shields.io/packagist/dt/ramsey/uuid.svg?style=flat-square 153 154 [source]: https://github.com/ramsey/uuid 155 [release]: https://packagist.org/packages/ramsey/uuid 156 [license]: https://github.com/ramsey/uuid/blob/master/LICENSE 157 [build]: https://travis-ci.org/ramsey/uuid 158 [coverage]: https://coveralls.io/r/ramsey/uuid?branch=master 159 [downloads]: https://packagist.org/packages/ramsey/uuid -
ing-psp/trunk/ing-php/vendor/ramsey/uuid/composer.json
r1600658 r1717487 1 1 { 2 2 "name": "ramsey/uuid", 3 "description": " A PHP 5.3+ library for generating RFC 4122 version 1, 3, 4, and 5 universally unique identifiers (UUID).",3 "description": "Formerly rhumsaa/uuid. A PHP 5.4+ library for generating RFC 4122 version 1, 3, 4, and 5 universally unique identifiers (UUID).", 4 4 "type": "library", 5 5 "keywords": ["uuid", "identifier", "guid"], … … 9 9 { 10 10 "name": "Ben Ramsey", 11 "homepage": "http://benramsey.com" 11 "email": "ben@benramsey.com", 12 "homepage": "https://benramsey.com" 12 13 }, 13 14 { 14 15 "name": "Marijn Huizendveld", 15 16 "email": "marijn.huizendveld@gmail.com" 17 }, 18 { 19 "name": "Thibaud Fabre", 20 "email": "thibaud@aztech.io" 16 21 } 17 22 ], … … 21 26 }, 22 27 "require": { 23 "php": " >=5.3.3",28 "php": "^5.4 || ^7.0", 24 29 "paragonie/random_compat": "^1.0|^2.0" 25 30 }, 26 31 "require-dev": { 27 "moontoast/math": "~1.1", 28 "symfony/console": "~2.3|~3.0", 29 "doctrine/dbal": ">=2.3", 30 "phpunit/phpunit": "~4.1|~5.0", 31 "satooshi/php-coveralls": "~0.6", 32 "moontoast/math": "^1.1", 33 "ircmaxell/random-lib": "^1.1", 34 "phpunit/phpunit": "^4.7|>=5.0 <5.4", 32 35 "squizlabs/php_codesniffer": "^2.3", 33 "jakub-onderka/php-parallel-lint": "^0.9.0" 36 "jakub-onderka/php-parallel-lint": "^0.9.0", 37 "satooshi/php-coveralls": "^0.6.1", 38 "apigen/apigen": "^4.1", 39 "mockery/mockery": "^0.9.4", 40 "goaop/framework": "1.0.0-alpha.2 | ^1.0 | ^2.1", 41 "doctrine/annotations": "~1.2.0", 42 "codeception/aspect-mock": "^1.0 | ^2.0", 43 "php-mock/php-mock-phpunit": "^0.3|^1.1" 34 44 }, 35 "bin": ["bin/uuid"],36 45 "suggest": { 37 "moontoast/math": "Support for converting UUID to 128-bit integer (in string form).", 38 "symfony/console": "Support for use of the bin/uuid command line tool.", 39 "doctrine/dbal": "Allow the use of a UUID as doctrine field type." 46 "ircmaxell/random-lib": "Provides RandomLib for use with the RandomLibAdapter", 47 "ext-libsodium": "Provides the PECL libsodium extension for use with the SodiumRandomGenerator", 48 "ext-uuid": "Provides the PECL UUID extension for use with the PeclUuidTimeGenerator and PeclUuidRandomGenerator", 49 "moontoast/math": "Provides support for converting UUID to 128-bit integer (in string form).", 50 "ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type.", 51 "ramsey/uuid-console": "A console application for generating UUIDs with ramsey/uuid" 40 52 }, 41 53 "autoload": { 42 "psr-4": {"Rhumsaa\\Uuid\\": "src/"} 54 "psr-4": {"Ramsey\\Uuid\\": "src/"} 55 }, 56 "autoload-dev": { 57 "psr-4": {"Ramsey\\Uuid\\Test\\": "tests/"} 43 58 }, 44 59 "replace": { 45 60 "rhumsaa/uuid": "self.version" 61 }, 62 "extra": { 63 "branch-alias": { 64 "dev-master": "3.x-dev" 65 } 66 }, 67 "scripts": { 68 "lint": "parallel-lint src tests", 69 "phpunit": "phpunit --verbose --colors=always", 70 "phpcs": "phpcs src tests --standard=psr2 -sp --colors", 71 "test": [ 72 "@lint", 73 "@phpunit", 74 "@phpcs" 75 ], 76 "build-docs": "apigen generate --source='src' --destination='build/apidocs' --template-theme='bootstrap' --deprecated --todo" 46 77 } 47 78 } -
ing-psp/trunk/ing-php/vendor/ramsey/uuid/src/Exception/UnsatisfiedDependencyException.php
r1600658 r1717487 1 1 <?php 2 2 /** 3 * This file is part of the Rhumsaa\Uuid library3 * This file is part of the ramsey/uuid library 4 4 * 5 5 * For the full copyright and license information, please view the LICENSE 6 6 * file that was distributed with this source code. 7 7 * 8 * @copyright Copyright (c) 2013-2014 Ben Ramsey <http://benramsey.com>8 * @copyright Copyright (c) Ben Ramsey <ben@benramsey.com> 9 9 * @license http://opensource.org/licenses/MIT MIT 10 * @link https://benramsey.com/projects/ramsey-uuid/ Documentation 11 * @link https://packagist.org/packages/ramsey/uuid Packagist 12 * @link https://github.com/ramsey/uuid GitHub 10 13 */ 11 14 12 namespace R humsaa\Uuid\Exception;15 namespace Ramsey\Uuid\Exception; 13 16 14 17 /** -
ing-psp/trunk/ing-php/vendor/ramsey/uuid/src/Exception/UnsupportedOperationException.php
r1600658 r1717487 1 1 <?php 2 2 /** 3 * This file is part of the Rhumsaa\Uuid library3 * This file is part of the ramsey/uuid library 4 4 * 5 5 * For the full copyright and license information, please view the LICENSE 6 6 * file that was distributed with this source code. 7 7 * 8 * @copyright Copyright (c) 2013-2014 Ben Ramsey <http://benramsey.com>8 * @copyright Copyright (c) Ben Ramsey <ben@benramsey.com> 9 9 * @license http://opensource.org/licenses/MIT MIT 10 * @link https://benramsey.com/projects/ramsey-uuid/ Documentation 11 * @link https://packagist.org/packages/ramsey/uuid Packagist 12 * @link https://github.com/ramsey/uuid GitHub 10 13 */ 11 14 12 namespace R humsaa\Uuid\Exception;15 namespace Ramsey\Uuid\Exception; 13 16 14 17 /** -
ing-psp/trunk/ing-php/vendor/ramsey/uuid/src/Uuid.php
r1600658 r1717487 1 1 <?php 2 2 /** 3 * This file is part of the Rhumsaa\Uuid library3 * This file is part of the ramsey/uuid library 4 4 * 5 5 * For the full copyright and license information, please view the LICENSE 6 6 * file that was distributed with this source code. 7 7 * 8 * @copyright Copyright (c) 2013-2014 Ben Ramsey <http://benramsey.com>8 * @copyright Copyright (c) Ben Ramsey <ben@benramsey.com> 9 9 * @license http://opensource.org/licenses/MIT MIT 10 * @link https://benramsey.com/projects/ramsey-uuid/ Documentation 11 * @link https://packagist.org/packages/ramsey/uuid Packagist 12 * @link https://github.com/ramsey/uuid GitHub 10 13 */ 11 14 12 namespace Rhumsaa\Uuid; 13 14 use InvalidArgumentException; 15 namespace Ramsey\Uuid; 16 17 use Ramsey\Uuid\Converter\NumberConverterInterface; 18 use Ramsey\Uuid\Codec\CodecInterface; 19 use Ramsey\Uuid\Exception\UnsupportedOperationException; 15 20 16 21 /** 17 * Represents a universally unique identifier (UUID), according to RFC 4122 22 * Represents a universally unique identifier (UUID), according to RFC 4122. 18 23 * 19 24 * This class provides immutable UUID objects (the Uuid class) and the static … … 30 35 * @link http://docs.oracle.com/javase/6/docs/api/java/util/UUID.html 31 36 */ 32 final class Uuid 37 class Uuid implements UuidInterface 33 38 { 34 39 /** … … 92 97 93 98 /** 94 * Version of the Rhumsaa\Uuid package 95 */ 96 const VERSION = '2.8.3'; 97 98 /** 99 * For testing, 64-bit system override; if true, treat the system as 32-bit 100 * 101 * @var bool 102 */ 103 public static $force32Bit = false; 104 105 /** 106 * For testing, Moontoast\Math\BigNumber override; if true, treat as if 107 * BigNumber is not available 108 * 109 * @var bool 110 */ 111 public static $forceNoBigNumber = false; 112 113 /** 114 * For testing, random_bytes() override; if true, treat as 115 * if random_bytes() is not available 116 * 117 * @var bool 118 */ 119 public static $forceNoRandomBytes = false; 120 121 /** 122 * For testing, sets time of day to a static, known value 99 * The factory to use when creating UUIDs. 100 * @var UuidFactoryInterface 101 */ 102 private static $factory = null; 103 104 /** 105 * The codec to use when encoding or decoding UUID strings. 106 * @var CodecInterface 107 */ 108 protected $codec; 109 110 /** 111 * The fields that make up this UUID. 112 * 113 * This is initialized to the nil value. 123 114 * 124 115 * @var array 125 */ 126 public static $timeOfDayTest; 127 128 /** 129 * For testing, system override to ignore generating node from hardware 130 * 131 * @var bool 132 */ 133 public static $ignoreSystemNode = false; 134 135 /** 136 * The fields that make up this UUID 137 * 138 * This is initialized to the nil value. 139 * 140 * @var array 141 * @link Rhumsaa.Uuid.Uuid.html#method_getFields 116 * @see UuidInterface::getFieldsHex() 142 117 */ 143 118 protected $fields = array( … … 151 126 152 127 /** 128 * The number converter to use for converting hex values to/from integers. 129 * @var NumberConverterInterface 130 */ 131 protected $converter; 132 133 /** 153 134 * Creates a universally unique identifier (UUID) from an array of fields. 154 135 * 155 * Protected to prevent direct instantiation. Use static methods to create 156 * UUIDs. 157 * 158 * @param array $fields 159 * @link Rhumsaa.Uuid.Uuid.html#method_getFields 160 */ 161 protected function __construct(array $fields) 162 { 136 * Unless you're making advanced use of this library to generate identifiers 137 * that deviate from RFC 4122, you probably do not want to instantiate a 138 * UUID directly. Use the static methods, instead: 139 * 140 * ``` 141 * use Ramsey\Uuid\Uuid; 142 * 143 * $timeBasedUuid = Uuid::uuid1(); 144 * $namespaceMd5Uuid = Uuid::uuid3(Uuid::NAMESPACE_URL, 'http://php.net/'); 145 * $randomUuid = Uuid::uuid4(); 146 * $namespaceSha1Uuid = Uuid::uuid5(Uuid::NAMESPACE_URL, 'http://php.net/'); 147 * ``` 148 * 149 * @param array $fields An array of fields from which to construct a UUID; 150 * see {@see \Ramsey\Uuid\UuidInterface::getFieldsHex()} for array structure. 151 * @param NumberConverterInterface $converter The number converter to use 152 * for converting hex values to/from integers. 153 * @param CodecInterface $codec The codec to use when encoding or decoding 154 * UUID strings. 155 */ 156 public function __construct( 157 array $fields, 158 NumberConverterInterface $converter, 159 CodecInterface $codec 160 ) { 163 161 $this->fields = $fields; 162 $this->codec = $codec; 163 $this->converter = $converter; 164 164 } 165 165 166 166 /** 167 167 * Converts this UUID object to a string when the object is used in any 168 * string context 168 * string context. 169 169 * 170 170 * @return string … … 177 177 178 178 /** 179 * Compares this UUID with the specified UUID. 180 * 181 * The first of two UUIDs is greater than the second if the most 182 * significant field in which the UUIDs differ is greater for the first 183 * UUID. 184 * 185 * Q. What's the value of being able to sort UUIDs?<br> 186 * A. Use them as keys in a B-Tree or similar mapping. 187 * 188 * @param Uuid $uuid UUID to which this UUID is to be compared 189 * @return int -1, 0 or 1 as this UUID is less than, equal to, or greater than $uuid 190 */ 191 public function compareTo(Uuid $uuid) 192 { 193 $comparison = null; 194 195 if ($this->getMostSignificantBitsHex() < $uuid->getMostSignificantBitsHex()) { 179 * Converts this UUID object to a string when the object is serialized 180 * with `json_encode()` 181 * 182 * @return string 183 * @link http://php.net/manual/en/class.jsonserializable.php 184 */ 185 public function jsonSerialize() 186 { 187 return $this->toString(); 188 } 189 190 /** 191 * Converts this UUID object to a string when the object is serialized 192 * with `serialize()` 193 * 194 * @return string 195 * @link http://php.net/manual/en/class.serializable.php 196 */ 197 public function serialize() 198 { 199 return $this->toString(); 200 } 201 202 /** 203 * Re-constructs the object from its serialized form. 204 * 205 * @param string $serialized 206 * @link http://php.net/manual/en/class.serializable.php 207 */ 208 public function unserialize($serialized) 209 { 210 $uuid = self::fromString($serialized); 211 $this->codec = $uuid->codec; 212 $this->converter = $uuid->converter; 213 $this->fields = $uuid->fields; 214 } 215 216 public function compareTo(UuidInterface $other) 217 { 218 $comparison = 0; 219 220 if ($this->getMostSignificantBitsHex() < $other->getMostSignificantBitsHex()) { 196 221 $comparison = -1; 197 } elseif ($this->getMostSignificantBitsHex() > $ uuid->getMostSignificantBitsHex()) {222 } elseif ($this->getMostSignificantBitsHex() > $other->getMostSignificantBitsHex()) { 198 223 $comparison = 1; 199 } elseif ($this->getLeastSignificantBitsHex() < $ uuid->getLeastSignificantBitsHex()) {224 } elseif ($this->getLeastSignificantBitsHex() < $other->getLeastSignificantBitsHex()) { 200 225 $comparison = -1; 201 } elseif ($this->getLeastSignificantBitsHex() > $ uuid->getLeastSignificantBitsHex()) {226 } elseif ($this->getLeastSignificantBitsHex() > $other->getLeastSignificantBitsHex()) { 202 227 $comparison = 1; 203 } else {204 $comparison = 0;205 228 } 206 229 … … 208 231 } 209 232 210 /** 211 * Compares this object to the specified object. 212 * 213 * The result is true if and only if the argument is not null, is a UUID 214 * object, has the same variant, and contains the same value, bit for bit, 215 * as this UUID. 216 * 217 * @param object $obj 218 * @return bool True if $obj is equal to this UUID 219 */ 220 public function equals($obj) 221 { 222 if (!($obj instanceof Uuid)) { 233 public function equals($other) 234 { 235 if (!($other instanceof UuidInterface)) { 223 236 return false; 224 237 } 225 238 226 return ($this->compareTo($obj) == 0); 227 } 228 229 /** 230 * Returns the UUID as a 16-byte string (containing the six integer fields 231 * in big-endian byte order) 232 * 233 * @return string 234 */ 239 return ($this->compareTo($other) == 0); 240 } 241 235 242 public function getBytes() 236 243 { 237 $bytes = ''; 238 239 foreach (range(-2, -32, 2) as $step) { 240 $bytes = chr(hexdec(substr($this->getHex(), $step, 2))) . $bytes; 241 } 242 243 return $bytes; 244 return $this->codec->encodeBinary($this); 244 245 } 245 246 … … 255 256 } 256 257 257 /**258 * Returns the high field of the clock sequence multiplexed with the variant259 * (bits 65-72 of the UUID).260 *261 * @return string Hexadecimal value of clock_seq_hi_and_reserved262 */263 258 public function getClockSeqHiAndReservedHex() 264 259 { … … 276 271 } 277 272 278 /**279 * Returns the low field of the clock sequence (bits 73-80 of the UUID).280 *281 * @return string Hexadecimal value of clock_seq_low282 */283 273 public function getClockSeqLowHex() 284 274 { … … 308 298 } 309 299 310 /**311 * Returns the clock sequence value associated with this UUID.312 *313 * @return string Hexadecimal value of clock sequence314 */315 300 public function getClockSequenceHex() 316 301 { … … 318 303 } 319 304 320 /** 321 * Returns a PHP DateTime object representing the timestamp associated 322 * with this UUID. 323 * 324 * The timestamp value is only meaningful in a time-based UUID, which 325 * has version type 1. If this UUID is not a time-based UUID then 326 * this method throws UnsupportedOperationException. 327 * 328 * @return \DateTime A PHP DateTime representation of the date 329 * @throws Exception\UnsupportedOperationException If this UUID is not a version 1 UUID 330 * @throws Exception\UnsatisfiedDependencyException if called on a 32-bit system 331 * and Moontoast\Math\BigNumber is not present 332 */ 305 public function getNumberConverter() 306 { 307 return $this->converter; 308 } 309 333 310 public function getDateTime() 334 311 { 335 312 if ($this->getVersion() != 1) { 336 throw new Exception\UnsupportedOperationException('Not a time-based UUID'); 337 } 338 339 if (self::is64BitSystem()) { 340 $unixTime = ($this->getTimestamp() - 0x01b21dd213814000) / 1e7; 341 $unixTime = number_format($unixTime, 0, '', ''); 342 } elseif (self::hasBigNumber()) { 343 $time = \Moontoast\Math\BigNumber::baseConvert($this->getTimestampHex(), 16, 10); 344 $ts = new \Moontoast\Math\BigNumber($time, 20); 345 $ts->subtract('122192928000000000'); 346 $ts->divide('10000000.0'); 347 $ts->round(); 348 $unixTime = $ts->getValue(); 349 } else { 350 throw new Exception\UnsatisfiedDependencyException( 351 'When calling ' . __METHOD__ . ' on a 32-bit system, ' 352 . 'Moontoast\Math\BigNumber must be present in order ' 353 . 'to extract DateTime from version 1 UUIDs' 354 ); 355 } 313 throw new UnsupportedOperationException('Not a time-based UUID'); 314 } 315 316 $unixTime = ($this->getTimestamp() - 0x01b21dd213814000) / 1e7; 317 $unixTime = number_format($unixTime, 0, '', ''); 356 318 357 319 return new \DateTime("@{$unixTime}"); … … 374 336 * 375 337 * @return array The UUID fields represented as integer values 376 * @throws Exception\UnsatisfiedDependencyException if called on a 32-bit system377 338 * @link http://tools.ietf.org/html/rfc4122#section-4.1.2 378 339 */ 379 340 public function getFields() 380 341 { 381 if (!self::is64BitSystem()) {382 throw new Exception\UnsatisfiedDependencyException(383 'Cannot call ' . __METHOD__ . ' on a 32-bit system, since some '384 . 'values overflow the system max integer value'385 . '; consider calling getFieldsHex instead'386 );387 }388 389 342 return array( 390 343 'time_low' => $this->getTimeLow(), … … 397 350 } 398 351 399 /**400 * Returns an array of the fields of this UUID, with keys named according401 * to the RFC 4122 names for the fields.402 *403 * * **time_low**: The low field of the timestamp, an unsigned 32-bit integer404 * * **time_mid**: The middle field of the timestamp, an unsigned 16-bit integer405 * * **time_hi_and_version**: The high field of the timestamp multiplexed with406 * the version number, an unsigned 16-bit integer407 * * **clock_seq_hi_and_reserved**: The high field of the clock sequence408 * multiplexed with the variant, an unsigned 8-bit integer409 * * **clock_seq_low**: The low field of the clock sequence, an unsigned410 * 8-bit integer411 * * **node**: The spatially unique node identifier, an unsigned 48-bit412 * integer413 *414 * @return array The UUID fields represented as hexadecimal values415 */416 352 public function getFieldsHex() 417 353 { … … 419 355 } 420 356 421 /**422 * Returns the hexadecimal value of the UUID423 *424 * @return string425 */426 357 public function getHex() 427 358 { … … 429 360 } 430 361 431 /**432 * Returns the integer value of the UUID, represented as a BigNumber433 *434 * @return \Moontoast\Math\BigNumber BigNumber representation of the unsigned 128-bit integer value435 * @throws Exception\UnsatisfiedDependencyException if Moontoast\Math\BigNumber is not present436 */437 362 public function getInteger() 438 363 { 439 if (!self::hasBigNumber()) { 440 throw new Exception\UnsatisfiedDependencyException( 441 'Cannot call ' . __METHOD__ . ' without support for large ' 442 . 'integers, since integer is an unsigned ' 443 . '128-bit integer; Moontoast\Math\BigNumber is required' 444 . '; consider calling getHex instead' 445 ); 446 } 447 448 $number = \Moontoast\Math\BigNumber::baseConvert( 449 $this->getHex(), 450 16, 451 10 452 ); 453 454 return new \Moontoast\Math\BigNumber($number); 455 } 456 457 /** 458 * Returns the least significant 64 bits of this UUID's 128 bit value 459 * 460 * @return \Moontoast\Math\BigNumber BigNumber representation of the unsigned 64-bit integer value 461 * @throws Exception\UnsatisfiedDependencyException if Moontoast\Math\BigNumber is not present 364 return $this->converter->fromHex($this->getHex()); 365 } 366 367 /** 368 * Returns the least significant 64 bits of this UUID's 128 bit value. 369 * 370 * @return mixed Converted representation of the unsigned 64-bit integer value 462 371 */ 463 372 public function getLeastSignificantBits() 464 373 { 465 if (!self::hasBigNumber()) { 466 throw new Exception\UnsatisfiedDependencyException( 467 'Cannot call ' . __METHOD__ . ' without support for large ' 468 . 'integers, since least significant bits is an unsigned ' 469 . '64-bit integer; Moontoast\Math\BigNumber is required' 470 . '; consider calling getLeastSignificantBitsHex instead' 471 ); 472 } 473 474 $number = \Moontoast\Math\BigNumber::baseConvert( 475 $this->getLeastSignificantBitsHex(), 476 16, 477 10 478 ); 479 480 return new \Moontoast\Math\BigNumber($number); 481 } 482 483 /** 484 * Returns the least significant 64 bits of this UUID's 128 bit value 485 * 486 * @return string Hexadecimal value of least significant bits 487 */ 374 return $this->converter->fromHex($this->getLeastSignificantBitsHex()); 375 } 376 488 377 public function getLeastSignificantBitsHex() 489 378 { … … 497 386 498 387 /** 499 * Returns the most significant 64 bits of this UUID's 128 bit value 500 * 501 * @return \Moontoast\Math\BigNumber BigNumber representation of the unsigned 64-bit integer value 502 * @throws Exception\UnsatisfiedDependencyException if Moontoast\Math\BigNumber is not present 388 * Returns the most significant 64 bits of this UUID's 128 bit value. 389 * 390 * @return mixed Converted representation of the unsigned 64-bit integer value 503 391 */ 504 392 public function getMostSignificantBits() 505 393 { 506 if (!self::hasBigNumber()) { 507 throw new Exception\UnsatisfiedDependencyException( 508 'Cannot call ' . __METHOD__ . ' without support for large ' 509 . 'integers, since most significant bits is an unsigned ' 510 . '64-bit integer; Moontoast\Math\BigNumber is required' 511 . '; consider calling getMostSignificantBitsHex instead' 512 ); 513 } 514 515 $number = \Moontoast\Math\BigNumber::baseConvert( 516 $this->getMostSignificantBitsHex(), 517 16, 518 10 519 ); 520 521 return new \Moontoast\Math\BigNumber($number); 522 } 523 524 /** 525 * Returns the most significant 64 bits of this UUID's 128 bit value 526 * 527 * @return string Hexadecimal value of most significant bits 528 */ 394 return $this->converter->fromHex($this->getMostSignificantBitsHex()); 395 } 396 529 397 public function getMostSignificantBitsHex() 530 398 { … … 560 428 * @return int Unsigned 48-bit integer value of node 561 429 * @link http://tools.ietf.org/html/rfc4122#section-4.1.6 562 * @throws Exception\UnsatisfiedDependencyException if called on a 32-bit system563 430 */ 564 431 public function getNode() 565 432 { 566 if (!self::is64BitSystem()) {567 throw new Exception\UnsatisfiedDependencyException(568 'Cannot call ' . __METHOD__ . ' on a 32-bit system, since node '569 . 'is an unsigned 48-bit integer and can overflow the system '570 . 'max integer value'571 . '; consider calling getNodeHex instead'572 );573 }574 575 433 return hexdec($this->getNodeHex()); 576 434 } 577 435 578 /**579 * Returns the node value associated with this UUID580 *581 * For UUID version 1, the node field consists of an IEEE 802 MAC582 * address, usually the host address. For systems with multiple IEEE583 * 802 addresses, any available one can be used. The lowest addressed584 * octet (octet number 10) contains the global/local bit and the585 * unicast/multicast bit, and is the first octet of the address586 * transmitted on an 802.3 LAN.587 *588 * For systems with no IEEE address, a randomly or pseudo-randomly589 * generated value may be used; see RFC 4122, Section 4.5. The590 * multicast bit must be set in such addresses, in order that they591 * will never conflict with addresses obtained from network cards.592 *593 * For UUID version 3 or 5, the node field is a 48-bit value constructed594 * from a name as described in RFC 4122, Section 4.3.595 *596 * For UUID version 4, the node field is a randomly or pseudo-randomly597 * generated 48-bit value as described in RFC 4122, Section 4.4.598 *599 * @return string Hexadecimal value of node600 * @link http://tools.ietf.org/html/rfc4122#section-4.1.6601 */602 436 public function getNodeHex() 603 437 { … … 616 450 } 617 451 618 /**619 * Returns the high field of the timestamp multiplexed with the version620 * number (bits 49-64 of the UUID).621 *622 * @return string Hexadecimal value of time_hi_and_version623 */624 452 public function getTimeHiAndVersionHex() 625 453 { … … 631 459 * 632 460 * @return int Unsigned 32-bit integer value of time_low 633 * @throws Exception\UnsatisfiedDependencyException if called on a 32-bit system634 461 */ 635 462 public function getTimeLow() 636 463 { 637 if (!self::is64BitSystem()) {638 throw new Exception\UnsatisfiedDependencyException(639 'Cannot call ' . __METHOD__ . ' on a 32-bit system, since time_low '640 . 'is an unsigned 32-bit integer and can overflow the system '641 . 'max integer value'642 . '; consider calling getTimeLowHex instead'643 );644 }645 646 464 return hexdec($this->getTimeLowHex()); 647 465 } 648 466 649 /**650 * Returns the low field of the timestamp (the first 32 bits of the UUID).651 *652 * @return string Hexadecimal value of time_low653 */654 467 public function getTimeLowHex() 655 468 { … … 667 480 } 668 481 669 /**670 * Returns the middle field of the timestamp (bits 33-48 of the UUID).671 *672 * @return string Hexadecimal value of time_mid673 */674 482 public function getTimeMidHex() 675 483 { … … 678 486 679 487 /** 680 * The timestamp value associated with this UUID488 * Returns the timestamp value associated with this UUID. 681 489 * 682 490 * The 60 bit timestamp value is constructed from the time_low, … … 690 498 * 691 499 * @return int Unsigned 60-bit integer value of the timestamp 692 * @throws Exception\UnsupportedOperationException If this UUID is not a version 1 UUID 693 * @throws Exception\UnsatisfiedDependencyException if called on a 32-bit system 500 * @throws UnsupportedOperationException If this UUID is not a version 1 UUID 694 501 * @link http://tools.ietf.org/html/rfc4122#section-4.1.4 695 502 */ … … 697 504 { 698 505 if ($this->getVersion() != 1) { 699 throw new Exception\UnsupportedOperationException('Not a time-based UUID'); 700 } 701 702 if (!self::is64BitSystem()) { 703 throw new Exception\UnsatisfiedDependencyException( 704 'Cannot call ' . __METHOD__ . ' on a 32-bit system, since timestamp ' 705 . 'is an unsigned 60-bit integer and can overflow the system ' 706 . 'max integer value' 707 . '; consider calling getTimestampHex instead' 708 ); 506 throw new UnsupportedOperationException('Not a time-based UUID'); 709 507 } 710 508 … … 712 510 } 713 511 714 /**715 * The timestamp value associated with this UUID716 *717 * The 60 bit timestamp value is constructed from the time_low,718 * time_mid, and time_hi fields of this UUID. The resulting719 * timestamp is measured in 100-nanosecond units since midnight,720 * October 15, 1582 UTC.721 *722 * The timestamp value is only meaningful in a time-based UUID, which723 * has version type 1. If this UUID is not a time-based UUID then724 * this method throws UnsupportedOperationException.725 *726 * @return string Hexadecimal value of the timestamp727 * @throws Exception\UnsupportedOperationException If this UUID is not a version 1 UUID728 * @link http://tools.ietf.org/html/rfc4122#section-4.1.4729 */730 512 public function getTimestampHex() 731 513 { 732 514 if ($this->getVersion() != 1) { 733 throw new Exception\UnsupportedOperationException('Not a time-based UUID');515 throw new UnsupportedOperationException('Not a time-based UUID'); 734 516 } 735 517 … … 742 524 } 743 525 744 /**745 * Returns the string representation of the UUID as a URN.746 *747 * @return string748 * @link http://en.wikipedia.org/wiki/Uniform_Resource_Name749 */750 526 public function getUrn() 751 527 { … … 753 529 } 754 530 755 /**756 * Returns the variant number associated with this UUID.757 *758 * The variant number describes the layout of the UUID. The variant759 * number has the following meaning:760 *761 * * 0 - Reserved for NCS backward compatibility762 * * 2 - The RFC 4122 variant (used by this class)763 * * 6 - Reserved, Microsoft Corporation backward compatibility764 * * 7 - Reserved for future definition765 *766 * @return int767 * @link http://tools.ietf.org/html/rfc4122#section-4.1.1768 */769 531 public function getVariant() 770 532 { … … 783 545 } 784 546 785 /**786 * The version number associated with this UUID. The version787 * number describes how this UUID was generated.788 *789 * The version number has the following meaning:790 *791 * * 1 - Time-based UUID792 * * 2 - DCE security UUID793 * * 3 - Name-based UUID hashed with MD5794 * * 4 - Randomly generated UUID795 * * 5 - Name-based UUID hashed with SHA-1796 *797 * Returns null if this UUID is not an RFC 4122 variant, since version798 * is only meaningful for this variant.799 *800 * @return int|null801 * @link http://tools.ietf.org/html/rfc4122#section-4.1.3802 */803 547 public function getVersion() 804 548 { … … 810 554 } 811 555 812 /**813 * Converts this UUID into a string representation814 *815 * @return string816 */817 556 public function toString() 818 557 { 819 return vsprintf( 820 '%08s-%04s-%04s-%02s%02s-%012s', 821 $this->fields 822 ); 558 return $this->codec->encode($this); 559 } 560 561 /** 562 * Returns the currently set factory used to create UUIDs. 563 * 564 * @return UuidFactoryInterface 565 */ 566 public static function getFactory() 567 { 568 if (!self::$factory) { 569 self::$factory = new UuidFactory(); 570 } 571 572 return self::$factory; 573 } 574 575 /** 576 * Sets the factory used to create UUIDs. 577 * 578 * @param UuidFactoryInterface $factory 579 */ 580 public static function setFactory(UuidFactoryInterface $factory) 581 { 582 self::$factory = $factory; 823 583 } 824 584 … … 827 587 * 828 588 * @param string $bytes 829 * @return Uuid 830 * @throws InvalidArgumentException If the $bytes string does not contain 16 characters 589 * @return UuidInterface 831 590 */ 832 591 public static function fromBytes($bytes) 833 592 { 834 if (strlen($bytes) !== 16) { 835 throw new InvalidArgumentException('$bytes string should contain 16 characters.'); 836 } 837 838 $uuid = ''; 839 foreach (range(0, 15) as $step) { 840 $uuid .= sprintf('%02x', ord($bytes[$step])); 841 842 if (in_array($step, array(3, 5, 7, 9))) { 843 $uuid .= '-'; 844 } 845 } 846 847 return Uuid::fromString($uuid); 848 } 849 850 /** 851 * Creates a UUID from the string standard representation as described 852 * in the toString() method. 593 return self::getFactory()->fromBytes($bytes); 594 } 595 596 /** 597 * Creates a UUID from the string standard representation. 853 598 * 854 599 * @param string $name A string that specifies a UUID 855 * @return Uuid 856 * @throws InvalidArgumentException If the $name isn't a valid UUID 600 * @return UuidInterface 857 601 */ 858 602 public static function fromString($name) 859 603 { 860 $nameParsed = str_replace(array('urn:', 'uuid:', '{', '}', '-'), '', $name); 861 862 // We have stripped out the dashes and are breaking up the string using 863 // substr(). In this way, we can accept a full hex value that doesn't 864 // contain dashes. 865 $components = array( 866 substr($nameParsed, 0, 8), 867 substr($nameParsed, 8, 4), 868 substr($nameParsed, 12, 4), 869 substr($nameParsed, 16, 4), 870 substr($nameParsed, 20), 871 ); 872 $nameParsed = implode('-', $components); 873 874 if (!self::isValid($nameParsed)) { 875 throw new InvalidArgumentException('Invalid UUID string: ' . $name); 876 } 877 878 $fields = array( 879 'time_low' => sprintf('%08s', $components[0]), 880 'time_mid' => sprintf('%04s', $components[1]), 881 'time_hi_and_version' => sprintf('%04s', $components[2]), 882 'clock_seq_hi_and_reserved' => sprintf('%02s', substr($components[3], 0, 2)), 883 'clock_seq_low' => sprintf('%02s', substr($components[3], 2)), 884 'node' => sprintf('%012s', $components[4]), 885 ); 886 887 return new self($fields); 888 } 889 890 /** 891 * Creates a UUID from either the UUID as a 128-bit integer string or a Moontoast\Math\BigNumber object. 892 * 893 * @param string|\Moontoast\Math\BigNumber $integer String/BigNumber representation of UUID integer 894 * @throws Exception\UnsatisfiedDependencyException If Moontoast\Math\BigNumber is not present 895 * @return \Rhumsaa\Uuid\Uuid 604 return self::getFactory()->fromString($name); 605 } 606 607 /** 608 * Creates a UUID from a 128-bit integer string. 609 * 610 * @param string $integer String representation of 128-bit integer 611 * @return UuidInterface 896 612 */ 897 613 public static function fromInteger($integer) 898 614 { 899 if (!self::hasBigNumber()) { 900 throw new Exception\UnsatisfiedDependencyException( 901 'Cannot call ' . __METHOD__ . ' without support for large ' 902 . 'integers, since integer is an unsigned ' 903 . '128-bit integer; Moontoast\Math\BigNumber is required. ' 904 ); 905 } 906 907 if (!$integer instanceof \Moontoast\Math\BigNumber) { 908 $integer = new \Moontoast\Math\BigNumber($integer); 909 } 910 911 $hex = \Moontoast\Math\BigNumber::baseConvert($integer, 10, 16); 912 $hex = str_pad($hex, 32, '0', STR_PAD_LEFT); 913 914 return self::fromString($hex); 915 } 916 917 /** 918 * Check if a string is a valid uuid 919 * 920 * @param string $uuid The uuid to test 615 return self::getFactory()->fromInteger($integer); 616 } 617 618 /** 619 * Check if a string is a valid UUID. 620 * 621 * @param string $uuid The string UUID to test 921 622 * @return boolean 922 623 */ … … 932 633 return false; 933 634 } 635 934 636 return true; 935 637 } … … 937 639 /** 938 640 * Generate a version 1 UUID from a host ID, sequence number, and the current time. 939 * If $node is not given, we will attempt to obtain the local hardware 940 * address. If $clockSeq is given, it is used as the sequence number; 941 * otherwise a random 14-bit sequence number is chosen. 942 * 943 * @param int|string $node A 48-bit number representing the hardware 944 * address. This number may be represented as 945 * an integer or a hexadecimal string. 641 * 642 * @param int|string $node A 48-bit number representing the hardware address 643 * This number may be represented as an integer or a hexadecimal string. 946 644 * @param int $clockSeq A 14-bit number used to help avoid duplicates that 947 * could arise when the clock is set backwards in time 948 * or if the node ID changes. 949 * @return Uuid 950 * @throws InvalidArgumentException if the $node is invalid 645 * could arise when the clock is set backwards in time or if the node ID 646 * changes. 647 * @return UuidInterface 951 648 */ 952 649 public static function uuid1($node = null, $clockSeq = null) 953 650 { 954 if ($node === null && !self::$ignoreSystemNode) { 955 $node = self::getNodeFromSystem(); 956 } 957 958 // if $node is still null (couldn't get from system), randomly generate 959 // a node value, according to RFC 4122, Section 4.5 960 if ($node === null) { 961 $node = sprintf('%06x%06x', mt_rand(0, 1 << 24), mt_rand(0, 1 << 24)); 962 } 963 964 // Convert the node to hex, if it is still an integer 965 if (is_int($node)) { 966 $node = sprintf('%012x', $node); 967 } 968 969 if (ctype_xdigit($node) && strlen($node) <= 12) { 970 $node = strtolower(sprintf('%012s', $node)); 971 } else { 972 throw new InvalidArgumentException('Invalid node value'); 973 } 974 975 if ($clockSeq === null) { 976 // Not using "stable storage"; see RFC 4122, Section 4.2.1.1 977 $clockSeq = mt_rand(0, 1 << 14); 978 } 979 980 // Create a 60-bit time value as a count of 100-nanosecond intervals 981 // since 00:00:00.00, 15 October 1582 982 if (self::$timeOfDayTest === null) { 983 $timeOfDay = gettimeofday(); 984 } else { 985 $timeOfDay = self::$timeOfDayTest; 986 } 987 $uuidTime = self::calculateUuidTime($timeOfDay['sec'], $timeOfDay['usec']); 988 989 // Set the version number to 1 990 $timeHi = hexdec($uuidTime['hi']) & 0x0fff; 991 $timeHi &= ~(0xf000); 992 $timeHi |= 1 << 12; 993 994 // Set the variant to RFC 4122 995 $clockSeqHi = ($clockSeq >> 8) & 0x3f; 996 $clockSeqHi &= ~(0xc0); 997 $clockSeqHi |= 0x80; 998 999 $fields = array( 1000 'time_low' => $uuidTime['low'], 1001 'time_mid' => $uuidTime['mid'], 1002 'time_hi_and_version' => sprintf('%04x', $timeHi), 1003 'clock_seq_hi_and_reserved' => sprintf('%02x', $clockSeqHi), 1004 'clock_seq_low' => sprintf('%02x', $clockSeq & 0xff), 1005 'node' => $node, 1006 ); 1007 1008 return new self($fields); 1009 } 1010 1011 /** 1012 * Generate a version 3 UUID based on the MD5 hash of a namespace identifier (which 1013 * is a UUID) and a name (which is a string). 1014 * 1015 * @param Uuid|string $ns The UUID namespace in which to create the named UUID 651 return self::getFactory()->uuid1($node, $clockSeq); 652 } 653 654 /** 655 * Generate a version 3 UUID based on the MD5 hash of a namespace identifier 656 * (which is a UUID) and a name (which is a string). 657 * 658 * @param string $ns The UUID namespace in which to create the named UUID 1016 659 * @param string $name The name to create a UUID for 1017 * @return Uuid 660 * @return UuidInterface 1018 661 */ 1019 662 public static function uuid3($ns, $name) 1020 663 { 1021 if (!($ns instanceof Uuid)) { 1022 $ns = self::fromString($ns); 1023 } 1024 1025 $hash = md5($ns->getBytes() . $name); 1026 1027 return self::uuidFromHashedName($hash, 3); 664 return self::getFactory()->uuid3($ns, $name); 1028 665 } 1029 666 … … 1031 668 * Generate a version 4 (random) UUID. 1032 669 * 1033 * @return Uuid 670 * @return UuidInterface 1034 671 */ 1035 672 public static function uuid4() 1036 673 { 1037 $bytes = self::generateBytes(16); 1038 1039 // When converting the bytes to hex, it turns into a 32-character 1040 // hexadecimal string that looks a lot like an MD5 hash, so at this 1041 // point, we can just pass it to uuidFromHashedName. 1042 $hex = bin2hex($bytes); 1043 return self::uuidFromHashedName($hex, 4); 1044 } 1045 1046 /** 1047 * Generate a version 5 UUID based on the SHA-1 hash of a namespace identifier (which 1048 * is a UUID) and a name (which is a string). 1049 * 1050 * @param Uuid|string $ns The UUID namespace in which to create the named UUID 674 return self::getFactory()->uuid4(); 675 } 676 677 /** 678 * Generate a version 5 UUID based on the SHA-1 hash of a namespace 679 * identifier (which is a UUID) and a name (which is a string). 680 * 681 * @param string $ns The UUID namespace in which to create the named UUID 1051 682 * @param string $name The name to create a UUID for 1052 * @return Uuid 683 * @return UuidInterface 1053 684 */ 1054 685 public static function uuid5($ns, $name) 1055 686 { 1056 if (!($ns instanceof Uuid)) { 1057 $ns = self::fromString($ns); 1058 } 1059 1060 $hash = sha1($ns->getBytes() . $name); 1061 1062 return self::uuidFromHashedName($hash, 5); 1063 } 1064 1065 /** 1066 * Calculates the UUID time fields from a UNIX timestamp 1067 * 1068 * UUID time is a 60-bit time value as a count of 100-nanosecond intervals 1069 * since 00:00:00.00, 15 October 1582. 1070 * 1071 * @param int $sec Seconds since the Unix Epoch 1072 * @param int $usec Microseconds 1073 * @return array 1074 * @throws Exception\UnsatisfiedDependencyException if called on a 32-bit system 1075 * and Moontoast\Math\BigNumber is not present 1076 */ 1077 protected static function calculateUuidTime($sec, $usec) 1078 { 1079 if (self::is64BitSystem()) { 1080 // 0x01b21dd213814000 is the number of 100-ns intervals between the 1081 // UUID epoch 1582-10-15 00:00:00 and the Unix epoch 1970-01-01 00:00:00. 1082 $uuidTime = ($sec * 10000000) + ($usec * 10) + 0x01b21dd213814000; 1083 1084 return array( 1085 'low' => sprintf('%08x', $uuidTime & 0xffffffff), 1086 'mid' => sprintf('%04x', ($uuidTime >> 32) & 0xffff), 1087 'hi' => sprintf('%04x', ($uuidTime >> 48) & 0x0fff), 1088 ); 1089 } 1090 1091 if (self::hasBigNumber()) { 1092 $uuidTime = new \Moontoast\Math\BigNumber('0'); 1093 1094 $sec = new \Moontoast\Math\BigNumber($sec); 1095 $sec->multiply('10000000'); 1096 1097 $usec = new \Moontoast\Math\BigNumber($usec); 1098 $usec->multiply('10'); 1099 1100 $uuidTime->add($sec) 1101 ->add($usec) 1102 ->add('122192928000000000'); 1103 1104 $uuidTimeHex = sprintf('%016s', $uuidTime->convertToBase(16)); 1105 1106 return array( 1107 'low' => substr($uuidTimeHex, 8), 1108 'mid' => substr($uuidTimeHex, 4, 4), 1109 'hi' => substr($uuidTimeHex, 0, 4), 1110 ); 1111 } 1112 1113 throw new Exception\UnsatisfiedDependencyException( 1114 'When calling ' . __METHOD__ . ' on a 32-bit system, ' 1115 . 'Moontoast\Math\BigNumber must be present' 1116 ); 1117 } 1118 1119 /** 1120 * Returns the network interface configuration for the system 1121 * 1122 * @todo Needs evaluation and possibly modification to ensure this works 1123 * well across multiple platforms. 1124 * @codeCoverageIgnore 1125 */ 1126 protected static function getIfconfig() 1127 { 1128 ob_start(); 1129 switch (strtoupper(substr(php_uname('a'), 0, 3))) { 1130 case 'WIN': 1131 passthru('ipconfig /all 2>&1'); 1132 break; 1133 case 'DAR': 1134 passthru('ifconfig 2>&1'); 1135 break; 1136 case 'LIN': 1137 default: 1138 passthru('netstat -ie 2>&1'); 1139 break; 1140 } 1141 1142 return ob_get_clean(); 1143 } 1144 1145 /** 1146 * Get the hardware address as a 48-bit positive integer. If all attempts to 1147 * obtain the hardware address fail, we choose a random 48-bit number with 1148 * its eighth bit set to 1 as recommended in RFC 4122. "Hardware address" 1149 * means the MAC address of a network interface, and on a machine with 1150 * multiple network interfaces the MAC address of any one of them may be 1151 * returned. 1152 * 1153 * @return string 1154 */ 1155 protected static function getNodeFromSystem() 1156 { 1157 static $node = null; 1158 1159 if ($node !== null) { 1160 return $node; 1161 } 1162 1163 $pattern = '/[^:]([0-9A-Fa-f]{2}([:-])[0-9A-Fa-f]{2}(\2[0-9A-Fa-f]{2}){4})[^:]/'; 1164 $matches = array(); 1165 1166 // Search the ifconfig output for all MAC addresses and return 1167 // the first one found 1168 if (preg_match_all($pattern, self::getIfconfig(), $matches, PREG_PATTERN_ORDER)) { 1169 $node = $matches[1][0]; 1170 $node = str_replace(':', '', $node); 1171 $node = str_replace('-', '', $node); 1172 } 1173 1174 return $node; 1175 } 1176 1177 /** 1178 * Returns true if the system has Moontoast\Math\BigNumber 1179 * 1180 * @return bool 1181 */ 1182 protected static function hasBigNumber() 1183 { 1184 return (class_exists('Moontoast\Math\BigNumber') && !self::$forceNoBigNumber); 1185 } 1186 1187 /** 1188 * Returns true if the system has random_bytes() 1189 * 1190 * @return bool 1191 */ 1192 protected static function hasRandomBytes() 1193 { 1194 return (function_exists('random_bytes') && !self::$forceNoRandomBytes); 1195 } 1196 1197 /** 1198 * Returns true if the system is 64-bit, false otherwise 1199 * 1200 * @return bool 1201 */ 1202 protected static function is64BitSystem() 1203 { 1204 return (PHP_INT_SIZE == 8 && !self::$force32Bit); 1205 } 1206 1207 /** 1208 * Returns a version 3 or 5 UUID based on the hash (md5 or sha1) of a 1209 * namespace identifier (which is a UUID) and a name (which is a string) 1210 * 1211 * @param string $hash The hash to use when creating the UUID 1212 * @param int $version The UUID version to be generated 1213 * @return Uuid 1214 */ 1215 protected static function uuidFromHashedName($hash, $version) 1216 { 1217 // Set the version number 1218 $timeHi = hexdec(substr($hash, 12, 4)) & 0x0fff; 1219 $timeHi &= ~(0xf000); 1220 $timeHi |= $version << 12; 1221 1222 // Set the variant to RFC 4122 1223 $clockSeqHi = hexdec(substr($hash, 16, 2)) & 0x3f; 1224 $clockSeqHi &= ~(0xc0); 1225 $clockSeqHi |= 0x80; 1226 1227 $fields = array( 1228 'time_low' => substr($hash, 0, 8), 1229 'time_mid' => substr($hash, 8, 4), 1230 'time_hi_and_version' => sprintf('%04x', $timeHi), 1231 'clock_seq_hi_and_reserved' => sprintf('%02x', $clockSeqHi), 1232 'clock_seq_low' => substr($hash, 18, 2), 1233 'node' => substr($hash, 20, 12), 1234 ); 1235 1236 return new self($fields); 1237 } 1238 1239 /** 1240 * Generates random bytes for use in version 4 UUIDs 1241 * 1242 * @param int $length 1243 * @return string 1244 */ 1245 private static function generateBytes($length) 1246 { 1247 if (self::hasRandomBytes()) { 1248 return random_bytes($length); 1249 } 1250 1251 $bytes = ''; 1252 for ($i = 1; $i <= $length; $i++) { 1253 $bytes = chr(mt_rand(0, 255)) . $bytes; 1254 } 1255 1256 return $bytes; 687 return self::getFactory()->uuid5($ns, $name); 1257 688 } 1258 689 } -
ing-psp/trunk/ingpsp.php
r1693714 r1717487 1 1 <?php 2 2 3 /** 3 4 * Plugin Name: ING PSP 4 5 * Plugin URI: https://www.ing.nl/ 5 6 * Description: ING WooCommerce plugin for ING Kassa Compleet and ING ePay markets. 6 * Version: 1.2. 47 * Version: 1.2.5 7 8 * Author: Ginger Payments 8 9 * Author URI: https://www.gingerpayments.com/ … … 19 20 * Define ING PSP plugin version 20 21 */ 21 define('INGPSP_PLUGIN_VERSION', 'WooCommerce v1.2. 4');22 define('INGPSP_PLUGIN_VERSION', 'WooCommerce v1.2.5'); 22 23 23 24 add_action('plugins_loaded', 'woocommerce_ingpsp_init', 0); … … 125 126 add_filter('woocommerce_payment_gateways', 'woocommerce_add_ingpsp'); 126 127 add_action('woocommerce_api_callback', array(new woocommerce_ingpsp(), 'handle_callback')); 128 129 function register_shipped_order_status() 130 { 131 register_post_status('wc-shipped', array( 132 'label' => 'Shipped', 133 'public' => true, 134 'exclude_from_search' => false, 135 'show_in_admin_all_list' => true, 136 'show_in_admin_status_list' => true, 137 'label_count' => _n_noop('Shipped <span class="count">(%s)</span>', 'Shipped <span class="count">(%s)</span>') 138 )); 139 } 140 141 add_action('init', 'register_shipped_order_status'); 142 143 144 function add_shipped_to_order_statuses($order_statuses) 145 { 146 $new_order_statuses = array(); 147 foreach ($order_statuses as $key => $status) { 148 149 $new_order_statuses[$key] = $status; 150 if ('wc-processing' === $key) { 151 $new_order_statuses['wc-shipped'] = 'Shipped'; 152 } 153 } 154 return $new_order_statuses; 155 } 156 157 add_filter('wc_order_statuses', 'add_shipped_to_order_statuses'); 158 159 add_action('woocommerce_update_order', 'ship_an_order'); 160 127 161 load_plugin_textdomain(WC_Ingpsp_Helper::DOMAIN, false, basename(dirname(__FILE__)).'/languages'); 162 163 function ship_an_order($order_id) 164 { 165 $order = wc_get_order($order_id); 166 167 if ($order && $order->get_status() == 'shipped' && $order->get_payment_method() == 'ingpsp_klarna') { 168 $settings = get_option('woocommerce_ingpsp_settings'); 169 170 $apiKey = ($settings['test_api_key']) ? $settings['test_api_key'] : $settings['api_key']; 171 if (strlen($apiKey) > 0) { 172 try { 173 $ginger = \GingerPayments\Payment\Ginger::createClient($apiKey, $settings['psp_product']); 174 if ($settings['bundle_cacert'] == 'yes') { 175 $ginger->useBundledCA(); 176 } 177 } catch (Exception $exception) { 178 WC_Admin_Notices::add_custom_notice('ingpsp-error', $exception->getMessage()); 179 } 180 } 181 182 try { 183 $id = get_post_meta($order_id, 'ginger_order_id', true); 184 $ginger->setOrderCapturedStatus($ginger->getOrder($id)); 185 } catch (\Exception $exception) { 186 WC_Admin_Notices::add_custom_notice('ingpsp-error', $exception->getMessage()); 187 } 188 } 189 190 } 191 128 192 } -
ing-psp/trunk/readme.txt
r1693714 r1717487 5 5 Requires at least: 4.0 6 6 Tested up to: 4.8 7 Stable tag: 1.2. 47 Stable tag: 1.2.5 8 8 License: The MIT License (MIT) 9 9 License URI: https://opensource.org/licenses/MIT … … 104 104 == Changelog == 105 105 106 = 1.2.5 = 107 * Updated ing-php library to v1.3.1 108 * Implemented Klarna automatic order capturing 109 * Some other fixes 110 106 111 = 1.2.4 = 107 112 * Added localisation support
Note: See TracChangeset
for help on using the changeset viewer.