Plugin Directory

Changeset 1717487


Ignore:
Timestamp:
08/22/2017 10:47:24 AM (9 years ago)
Author:
ingpsp
Message:

ING PSP WooCommerce Plugin v1.2.5

Location:
ing-psp/trunk
Files:
69 added
4 deleted
29 edited

Legend:

Unmodified
Added
Removed
  • ing-psp/trunk/ing-php/LICENSE

    r1600658 r1717487  
    1 The MIT License (MIT)
     1MIT License
    22
    3 Copyright (c) 2015 Ginger Payments
     3Copyright (c) 2017 ING Bank N.V.
    44
    55Permission is hereby granted, free of charge, to any person obtaining a copy
     
    2020OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    2121SOFTWARE.
    22 
  • ing-psp/trunk/ing-php/composer.json

    r1654867 r1717487  
    2323        "mathiasverraes/classfunctions": "~1.1",
    2424        "ronanguilloux/isocodes": "~1.1",
    25         "ramsey/uuid": "~2.8",
     25        "ramsey/uuid": "~3.6",
    2626        "nesbot/carbon": "~1.16",
    2727        "alcohol/iso3166": "~3.0",
    2828        "symfony/translation": "~2.8",
    29         "symfony/yaml": "~2.8"
     29        "symfony/yaml": "~2.8",
     30        "vlucas/phpdotenv": "^2.4"
    3031    },
    3132    "require-dev": {
  • ing-psp/trunk/ing-php/composer.lock

    r1654867 r1717487  
    55        "This file is @generated automatically"
    66    ],
    7     "hash": "bb52aa110922e71473a063377cd1a156",
    8     "content-hash": "ef15ab1b05dd60446be04fca0b393822",
     7    "content-hash": "5bbd3ee173ee1b3a5ded021f6b70e37f",
    98    "packages": [
    109        {
     
    6160            ],
    6261            "abandoned": "league/iso3166",
    63             "time": "2015-09-04 14:14:03"
     62            "time": "2015-09-04T14:14:03+00:00"
    6463        },
    6564        {
     
    116115                "validation"
    117116            ],
    118             "time": "2016-10-31 12:09:54"
     117            "time": "2016-10-31T12:09:54+00:00"
    119118        },
    120119        {
     
    168167                "web service"
    169168            ],
    170             "time": "2016-07-15 19:28:39"
     169            "time": "2016-07-15T19:28:39+00:00"
    171170        },
    172171        {
     
    219218            ],
    220219            "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"
    222221        },
    223222        {
     
    269268                "stream"
    270269            ],
    271             "time": "2014-10-12 19:18:40"
     270            "time": "2014-10-12T19:18:40+00:00"
    272271        },
    273272        {
     
    320319                "utilities"
    321320            ],
    322             "time": "2014-07-28 14:39:20"
     321            "time": "2014-07-28T14:39:20+00:00"
    323322        },
    324323        {
     
    367366                "time"
    368367            ],
    369             "time": "2015-11-04 20:07:17"
     368            "time": "2015-11-04T20:07:17+00:00"
    370369        },
    371370        {
     
    415414                "random"
    416415            ],
    417             "time": "2017-03-13 16:27:32"
     416            "time": "2017-03-13T16:27:32+00:00"
    418417        },
    419418        {
    420419            "name": "ramsey/uuid",
    421             "version": "2.9.0",
     420            "version": "3.6.1",
    422421            "source": {
    423422                "type": "git",
    424423                "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",
    431430                "shasum": ""
    432431            },
    433432            "require": {
    434433                "paragonie/random_compat": "^1.0|^2.0",
    435                 "php": ">=5.3.3"
     434                "php": "^5.4 || ^7.0"
    436435            },
    437436            "replace": {
     
    439438            },
    440439            "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",
    442445                "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"
    448452            },
    449453            "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            },
    458467            "autoload": {
    459468                "psr-4": {
    460                     "Rhumsaa\\Uuid\\": "src/"
     469                    "Ramsey\\Uuid\\": "src/"
    461470                }
    462471            },
     
    471480                },
    472481                {
     482                    "name": "Thibaud Fabre",
     483                    "email": "thibaud@aztech.io"
     484                },
     485                {
    473486                    "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).",
    478492            "homepage": "https://github.com/ramsey/uuid",
    479493            "keywords": [
     
    482496                "uuid"
    483497            ],
    484             "time": "2016-03-22 18:20:19"
     498            "time": "2017-03-26T20:37:53+00:00"
    485499        },
    486500        {
     
    526540            ],
    527541            "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"
    529543        },
    530544        {
     
    606620                "zipcode"
    607621            ],
    608             "time": "2015-06-22 19:37:41"
     622            "time": "2015-06-22T19:37:41+00:00"
    609623        },
    610624        {
     
    665679                "shim"
    666680            ],
    667             "time": "2016-05-18 14:26:46"
     681            "time": "2016-05-18T14:26:46+00:00"
    668682        },
    669683        {
     
    729743            "description": "Symfony Translation Component",
    730744            "homepage": "https://symfony.com",
    731             "time": "2016-10-18 04:28:30"
     745            "time": "2016-10-18T04:28:30+00:00"
    732746        },
    733747        {
     
    778792            "description": "Symfony Yaml Component",
    779793            "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"
    781845        }
    782846    ],
     
    834898                "instantiate"
    835899            ],
    836             "time": "2015-06-14 21:17:01"
     900            "time": "2015-06-14T21:17:01+00:00"
    837901        },
    838902        {
     
    879943                "test"
    880944            ],
    881             "time": "2015-05-11 14:41:42"
     945            "time": "2015-05-11T14:41:42+00:00"
    882946        },
    883947        {
     
    9441008                "testing"
    9451009            ],
    946             "time": "2016-05-22 21:52:33"
     1010            "time": "2016-05-22T21:52:33+00:00"
    9471011        },
    9481012        {
     
    9981062                "static analysis"
    9991063            ],
    1000             "time": "2015-12-27 11:43:31"
     1064            "time": "2015-12-27T11:43:31+00:00"
    10011065        },
    10021066        {
     
    10431107            ],
    10441108            "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"
    10461110        },
    10471111        {
     
    10901154                }
    10911155            ],
    1092             "time": "2016-06-10 07:14:17"
     1156            "time": "2016-06-10T07:14:17+00:00"
    10931157        },
    10941158        {
     
    11521216                "stub"
    11531217            ],
    1154             "time": "2016-06-07 08:13:47"
     1218            "time": "2016-06-07T08:13:47+00:00"
    11551219        },
    11561220        {
     
    12141278                "xunit"
    12151279            ],
    1216             "time": "2015-10-06 15:47:00"
     1280            "time": "2015-10-06T15:47:00+00:00"
    12171281        },
    12181282        {
     
    12611325                "iterator"
    12621326            ],
    1263             "time": "2015-06-21 13:08:43"
     1327            "time": "2015-06-21T13:08:43+00:00"
    12641328        },
    12651329        {
     
    13021366                "template"
    13031367            ],
    1304             "time": "2015-06-21 13:50:34"
     1368            "time": "2015-06-21T13:50:34+00:00"
    13051369        },
    13061370        {
     
    13461410                "timer"
    13471411            ],
    1348             "time": "2016-05-12 18:03:57"
     1412            "time": "2016-05-12T18:03:57+00:00"
    13491413        },
    13501414        {
     
    13951459                "tokenizer"
    13961460            ],
    1397             "time": "2015-09-15 10:49:45"
     1461            "time": "2015-09-15T10:49:45+00:00"
    13981462        },
    13991463        {
     
    14671531                "xunit"
    14681532            ],
    1469             "time": "2016-07-21 06:48:14"
     1533            "time": "2016-07-21T06:48:14+00:00"
    14701534        },
    14711535        {
     
    15231587                "xunit"
    15241588            ],
    1525             "time": "2015-10-02 06:51:40"
     1589            "time": "2015-10-02T06:51:40+00:00"
    15261590        },
    15271591        {
     
    15871651                "equality"
    15881652            ],
    1589             "time": "2015-07-26 15:48:44"
     1653            "time": "2015-07-26T15:48:44+00:00"
    15901654        },
    15911655        {
     
    16391703                "diff"
    16401704            ],
    1641             "time": "2015-12-08 07:14:41"
     1705            "time": "2015-12-08T07:14:41+00:00"
    16421706        },
    16431707        {
     
    16891753                "hhvm"
    16901754            ],
    1691             "time": "2016-08-18 05:49:44"
     1755            "time": "2016-08-18T05:49:44+00:00"
    16921756        },
    16931757        {
     
    17561820                "exporter"
    17571821            ],
    1758             "time": "2016-06-17 09:04:28"
     1822            "time": "2016-06-17T09:04:28+00:00"
    17591823        },
    17601824        {
     
    18071871                "global state"
    18081872            ],
    1809             "time": "2015-10-12 03:26:01"
     1873            "time": "2015-10-12T03:26:01+00:00"
    18101874        },
    18111875        {
     
    18601924            "description": "Provides functionality to recursively process PHP variables",
    18611925            "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"
    18631927        },
    18641928        {
     
    18951959            "description": "Library that helps with managing the version number of Git-hosted PHP projects",
    18961960            "homepage": "https://github.com/sebastianbergmann/version",
    1897             "time": "2015-06-21 13:59:46"
     1961            "time": "2015-06-21T13:59:46+00:00"
    18981962        },
    18991963        {
     
    19732037                "standards"
    19742038            ],
    1975             "time": "2016-09-01 23:53:02"
     2039            "time": "2016-09-01T23:53:02+00:00"
    19762040        },
    19772041        {
     
    20232087                "validate"
    20242088            ],
    2025             "time": "2016-08-09 15:02:57"
     2089            "time": "2016-08-09T15:02:57+00:00"
    20262090        }
    20272091    ],
  • ing-psp/trunk/ing-php/src/Client.php

    r1654867 r1717487  
    99use GuzzleHttp\Client as HttpClient;
    1010use GuzzleHttp\Exception\RequestException;
     11use GingerPayments\Payment\Order\Transaction;
    1112
    1213final class Client
     
    671672        }
    672673    }
     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   
    673705}
  • ing-psp/trunk/ing-php/src/Ginger.php

    r1654939 r1717487  
    1111     * The library version.
    1212     */
    13     const CLIENT_VERSION = '1.2.8';
     13    const CLIENT_VERSION = '1.3.1';
    1414
    1515    /**
     
    1717     */
    1818    const API_VERSION = 'v1';
    19 
    20     /**
    21      * API endpoint Ginger Payments
    22      */
    23     const ENDPOINT_GINGER = 'https://api.gingerpayments.com/{version}/';
    24 
    25     /**
    26      * API Kassa Compleet endpoint
    27      */
    28     const ENDPOINT_KASSA = 'https://api.kassacompleet.nl/{version}/';
    29 
    30     /**
    31      * API endpoint ING
    32      */
    33     const ENDPOINT_ING = 'https://api.ing-checkout.com/{version}/';
    34 
    35     /**
    36      * API endpoint EPAY
    37      */
    38     const ENDPOINT_EPAY = 'https://api.epay.ing.be/{version}/';
    3919
    4020    /**
     
    8161        switch ($product) {
    8262            case 'kassacompleet':
    83                 $endpoint = self::ENDPOINT_KASSA;
    84                 break;
     63                return (new Client\EndpointResolver())->getEndpointKassa();
    8564            case 'ingcheckout':
    86                 $endpoint = self::ENDPOINT_ING;
    87                 break;
     65                return (new Client\EndpointResolver())->getEndpointIng();
    8866            case 'epay':
    89                 $endpoint = self::ENDPOINT_EPAY;
    90                 break;
     67                return (new Client\EndpointResolver())->getEndpointEpay();
    9168            default:
    92                 $endpoint = self::ENDPOINT_GINGER;
    93                 break;
     69                return (new Client\EndpointResolver())->getEndpointGinger();
    9470        }
    95         return $endpoint;
    9671    }
    9772
  • ing-psp/trunk/ing-php/src/Order.php

    r1652620 r1717487  
    1313use GingerPayments\Payment\Order\Customer;
    1414use GingerPayments\Payment\Order\Extra;
    15 use Rhumsaa\Uuid\Uuid;
     15use Ramsey\Uuid\Uuid;
    1616use GingerPayments\Payment\Order\OrderLines;
    1717
  • ing-psp/trunk/ing-php/src/Order/OrderLine.php

    r1652620 r1717487  
    33namespace GingerPayments\Payment\Order;
    44
    5 use Rhumsaa\Uuid\Uuid;
     5use Ramsey\Uuid\Uuid;
    66use Assert\Assertion as Guard;
    77
  • ing-psp/trunk/ing-php/src/Order/Transaction.php

    r1600658 r1717487  
    1414use GingerPayments\Payment\Order\Transaction\Status as TransactionStatus;
    1515use GingerPayments\Payment\Url;
    16 use Rhumsaa\Uuid\Uuid;
     16use Ramsey\Uuid\Uuid;
    1717
    1818final class Transaction
  • ing-psp/trunk/ing-php/src/Order/Transaction/Status.php

    r1652620 r1717487  
    2020    const EXPIRED = 'expired';
    2121    const ACCEPTED = 'accepted';
     22    const CAPTURED = 'captured';
    2223
    2324    /**
     
    3435            self::CANCELLED,
    3536            self::EXPIRED,
    36             self::ACCEPTED
     37            self::ACCEPTED,
     38            self::CAPTURED
    3739        ];
    3840    }
     
    101103        return $this->value === self::ACCEPTED;
    102104    }
     105   
     106    /**
     107     * @return bool
     108     */
     109    public function isCaptured()
     110    {
     111        return $this->value === self::CAPTURED;
     112    }
    103113}
  • ing-psp/trunk/ing-php/tests/ClientTest.php

    r1652620 r1717487  
    566566        $this->client->getOrder('123456');
    567567    }
     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   
    568674}
  • ing-psp/trunk/ing-php/tests/GingerTest.php

    r1600658 r1717487  
    44
    55use GingerPayments\Payment\Ginger;
     6use GingerPayments\Payment\Client\EndpointResolver;
    67
    78final class GingerTest extends \PHPUnit_Framework_TestCase
     
    2122        $httpClient = $reflectionProperty->getValue($client);
    2223        $this->assertEquals(
    23             str_replace('{version}', Ginger::API_VERSION, Ginger::ENDPOINT_GINGER),
     24            str_replace('{version}', Ginger::API_VERSION, EndpointResolver::ENDPOINT_GINGER),
    2425            $httpClient->getBaseUrl()
    2526        );
  • ing-psp/trunk/ing-php/tests/Order/Transaction/StatusTest.php

    r1600658 r1717487  
    2121        $this->assertFalse($status->isCancelled());
    2222        $this->assertFalse($status->isExpired());
     23        $this->assertFalse($status->isCaptured());
    2324    }
    2425
     
    3738        $this->assertFalse($status->isCancelled());
    3839        $this->assertFalse($status->isExpired());
     40        $this->assertFalse($status->isCaptured());
    3941    }
    4042
     
    5355        $this->assertFalse($status->isCancelled());
    5456        $this->assertFalse($status->isExpired());
     57        $this->assertFalse($status->isCaptured());
    5558    }
    5659
     
    6972        $this->assertFalse($status->isCancelled());
    7073        $this->assertFalse($status->isExpired());
     74        $this->assertFalse($status->isCaptured());
    7175    }
    7276
     
    8589        $this->assertFalse($status->isCancelled());
    8690        $this->assertFalse($status->isExpired());
     91        $this->assertFalse($status->isCaptured());
    8792    }
    8893
     
    101106        $this->assertTrue($status->isCancelled());
    102107        $this->assertFalse($status->isExpired());
     108        $this->assertFalse($status->isCaptured());
    103109    }
    104110
     
    117123        $this->assertFalse($status->isCancelled());
    118124        $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());
    119143    }
    120144}
  • ing-psp/trunk/ing-php/vendor/autoload.php

    r1654939 r1717487  
    55require_once __DIR__ . '/composer/autoload_real.php';
    66
    7 return ComposerAutoloaderInit186755da5bcf4416de0a652990838664::getLoader();
     7return ComposerAutoloaderInit9600c984af2e5421cbc08b8cdee73f69::getLoader();
  • ing-psp/trunk/ing-php/vendor/composer/ClassLoader.php

    r1600658 r1717487  
    5656    private $classMapAuthoritative = false;
    5757    private $missingClasses = array();
     58    private $apcuPrefix;
    5859
    5960    public function getPrefixes()
     
    273274
    274275    /**
     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    /**
    275296     * Registers this instance as an autoloader.
    276297     *
     
    314335    public function findFile($class)
    315336    {
    316         // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
    317         if ('\\' == $class[0]) {
    318             $class = substr($class, 1);
    319         }
    320 
    321337        // class map lookup
    322338        if (isset($this->classMap[$class])) {
     
    326342            return false;
    327343        }
     344        if (null !== $this->apcuPrefix) {
     345            $file = apcu_fetch($this->apcuPrefix.$class, $hit);
     346            if ($hit) {
     347                return $file;
     348            }
     349        }
    328350
    329351        $file = $this->findFileWithExtension($class, '.php');
     
    334356        }
    335357
     358        if (null !== $this->apcuPrefix) {
     359            apcu_add($this->apcuPrefix.$class, $file);
     360        }
     361
    336362        if (false === $file) {
    337363            // Remember that this class does not exist.
     
    349375        $first = $class[0];
    350376        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];
    354384                        if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
    355385                            return $file;
  • ing-psp/trunk/ing-php/vendor/composer/LICENSE

    r1600658 r1717487  
    11
    2 Copyright (c) 2016 Nils Adermann, Jordi Boggiano
     2Copyright (c) Nils Adermann, Jordi Boggiano
    33
    44Permission is hereby granted, free of charge, to any person obtaining a copy
  • ing-psp/trunk/ing-php/vendor/composer/autoload_psr4.php

    r1600658 r1717487  
    1212    'Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'),
    1313    'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'),
    14     'Rhumsaa\\Uuid\\' => array($vendorDir . '/ramsey/uuid/src'),
    1514    'React\\Promise\\' => array($vendorDir . '/react/promise/src'),
     15    'Ramsey\\Uuid\\' => array($vendorDir . '/ramsey/uuid/src'),
    1616    'GuzzleHttp\\Stream\\' => array($vendorDir . '/guzzlehttp/streams/src'),
    1717    'GuzzleHttp\\Ring\\' => array($vendorDir . '/guzzlehttp/ringphp/src'),
     
    1919    'GingerPayments\\Payment\\Tests\\' => array($baseDir . '/tests'),
    2020    'GingerPayments\\Payment\\' => array($baseDir . '/src'),
     21    'Dotenv\\' => array($vendorDir . '/vlucas/phpdotenv/src'),
    2122    'Doctrine\\Instantiator\\' => array($vendorDir . '/doctrine/instantiator/src/Doctrine/Instantiator'),
    2223    'Carbon\\' => array($vendorDir . '/nesbot/carbon/src/Carbon'),
  • ing-psp/trunk/ing-php/vendor/composer/autoload_real.php

    r1654939 r1717487  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInit186755da5bcf4416de0a652990838664
     5class ComposerAutoloaderInit9600c984af2e5421cbc08b8cdee73f69
    66{
    77    private static $loader;
     
    2020        }
    2121
    22         spl_autoload_register(array('ComposerAutoloaderInit186755da5bcf4416de0a652990838664', 'loadClassLoader'), true, true);
     22        spl_autoload_register(array('ComposerAutoloaderInit9600c984af2e5421cbc08b8cdee73f69', 'loadClassLoader'), true, true);
    2323        self::$loader = $loader = new \Composer\Autoload\ClassLoader();
    24         spl_autoload_unregister(array('ComposerAutoloaderInit186755da5bcf4416de0a652990838664', 'loadClassLoader'));
     24        spl_autoload_unregister(array('ComposerAutoloaderInit9600c984af2e5421cbc08b8cdee73f69', 'loadClassLoader'));
    2525
    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());
    2727        if ($useStaticLoader) {
    2828            require_once __DIR__ . '/autoload_static.php';
    2929
    30             call_user_func(\Composer\Autoload\ComposerStaticInit186755da5bcf4416de0a652990838664::getInitializer($loader));
     30            call_user_func(\Composer\Autoload\ComposerStaticInit9600c984af2e5421cbc08b8cdee73f69::getInitializer($loader));
    3131        } else {
    3232            $map = require __DIR__ . '/autoload_namespaces.php';
     
    4949
    5050        if ($useStaticLoader) {
    51             $includeFiles = Composer\Autoload\ComposerStaticInit186755da5bcf4416de0a652990838664::$files;
     51            $includeFiles = Composer\Autoload\ComposerStaticInit9600c984af2e5421cbc08b8cdee73f69::$files;
    5252        } else {
    5353            $includeFiles = require __DIR__ . '/autoload_files.php';
    5454        }
    5555        foreach ($includeFiles as $fileIdentifier => $file) {
    56             composerRequire186755da5bcf4416de0a652990838664($fileIdentifier, $file);
     56            composerRequire9600c984af2e5421cbc08b8cdee73f69($fileIdentifier, $file);
    5757        }
    5858
     
    6161}
    6262
    63 function composerRequire186755da5bcf4416de0a652990838664($fileIdentifier, $file)
     63function composerRequire9600c984af2e5421cbc08b8cdee73f69($fileIdentifier, $file)
    6464{
    6565    if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  • ing-psp/trunk/ing-php/vendor/composer/autoload_static.php

    r1654939 r1717487  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInit186755da5bcf4416de0a652990838664
     7class ComposerStaticInit9600c984af2e5421cbc08b8cdee73f69
    88{
    99    public static $files = array (
     
    3333        'R' =>
    3434        array (
    35             'Rhumsaa\\Uuid\\' => 13,
    3635            'React\\Promise\\' => 14,
     36            'Ramsey\\Uuid\\' => 12,
    3737        ),
    3838        'G' =>
     
    4646        'D' =>
    4747        array (
     48            'Dotenv\\' => 7,
    4849            'Doctrine\\Instantiator\\' => 22,
    4950        ),
     
    8182            0 => __DIR__ . '/..' . '/symfony/translation',
    8283        ),
    83         'Rhumsaa\\Uuid\\' =>
     84        'React\\Promise\\' =>
     85        array (
     86            0 => __DIR__ . '/..' . '/react/promise/src',
     87        ),
     88        'Ramsey\\Uuid\\' =>
    8489        array (
    8590            0 => __DIR__ . '/..' . '/ramsey/uuid/src',
    8691        ),
    87         'React\\Promise\\' =>
    88         array (
    89             0 => __DIR__ . '/..' . '/react/promise/src',
    90         ),
    9192        'GuzzleHttp\\Stream\\' =>
    9293        array (
     
    108109        array (
    109110            0 => __DIR__ . '/../..' . '/src',
     111        ),
     112        'Dotenv\\' =>
     113        array (
     114            0 => __DIR__ . '/..' . '/vlucas/phpdotenv/src',
    110115        ),
    111116        'Doctrine\\Instantiator\\' =>
     
    921926    {
    922927        return \Closure::bind(function () use ($loader) {
    923             $loader->prefixLengthsPsr4 = ComposerStaticInit186755da5bcf4416de0a652990838664::$prefixLengthsPsr4;
    924             $loader->prefixDirsPsr4 = ComposerStaticInit186755da5bcf4416de0a652990838664::$prefixDirsPsr4;
    925             $loader->prefixesPsr0 = ComposerStaticInit186755da5bcf4416de0a652990838664::$prefixesPsr0;
    926             $loader->classMap = ComposerStaticInit186755da5bcf4416de0a652990838664::$classMap;
     928            $loader->prefixLengthsPsr4 = ComposerStaticInit9600c984af2e5421cbc08b8cdee73f69::$prefixLengthsPsr4;
     929            $loader->prefixDirsPsr4 = ComposerStaticInit9600c984af2e5421cbc08b8cdee73f69::$prefixDirsPsr4;
     930            $loader->prefixesPsr0 = ComposerStaticInit9600c984af2e5421cbc08b8cdee73f69::$prefixesPsr0;
     931            $loader->classMap = ComposerStaticInit9600c984af2e5421cbc08b8cdee73f69::$classMap;
    927932
    928933        }, null, ClassLoader::class);
  • ing-psp/trunk/ing-php/vendor/composer/installed.json

    r1654867 r1717487  
    2222            "phpunit/phpunit": "~4.6"
    2323        },
    24         "time": "2015-09-04 14:14:03",
     24        "time": "2015-09-04T14:14:03+00:00",
    2525        "type": "library",
    2626        "extra": {
     
    8080            "phpunit/phpunit": "@stable"
    8181        },
    82         "time": "2016-10-31 12:09:54",
     82        "time": "2016-10-31T12:09:54+00:00",
    8383        "type": "library",
    8484        "installation-source": "dist",
     
    132132            "php": ">=5.4.0"
    133133        },
    134         "time": "2016-05-03 17:50:52",
     134        "time": "2016-05-03T17:50:52+00:00",
    135135        "type": "library",
    136136        "extra": {
     
    181181            "phpunit/phpunit": "~4.0"
    182182        },
    183         "time": "2014-10-12 19:18:40",
     183        "time": "2014-10-12T19:18:40+00:00",
    184184        "type": "library",
    185185        "extra": {
     
    239239            "ext-curl": "Guzzle will use specific adapters if cURL is present"
    240240        },
    241         "time": "2015-05-20 03:37:09",
     241        "time": "2015-05-20T03:37:09+00:00",
    242242        "type": "library",
    243243        "extra": {
     
    288288            "phpunit/phpunit": "^4.0"
    289289        },
    290         "time": "2016-07-15 19:28:39",
     290        "time": "2016-07-15T19:28:39+00:00",
    291291        "type": "library",
    292292        "installation-source": "dist",
     
    340340            "phpunit/phpunit": "4.*"
    341341        },
    342         "time": "2014-07-28 14:39:20",
     342        "time": "2014-07-28T14:39:20+00:00",
    343343        "type": "library",
    344344        "extra": {
     
    393393            "ext-mbstring": "For best performance"
    394394        },
    395         "time": "2016-05-18 14:26:46",
     395        "time": "2016-05-18T14:26:46+00:00",
    396396        "type": "library",
    397397        "extra": {
     
    466466            "symfony/yaml": ""
    467467        },
    468         "time": "2016-10-18 04:28:30",
     468        "time": "2016-10-18T04:28:30+00:00",
    469469        "type": "library",
    470470        "extra": {
     
    521521            "phpunit/phpunit": "~4.0|~5.0"
    522522        },
    523         "time": "2015-11-04 20:07:17",
     523        "time": "2015-11-04T20:07:17+00:00",
    524524        "type": "library",
    525525        "installation-source": "dist",
     
    572572            "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
    573573        },
    574         "time": "2017-03-13 16:27:32",
     574        "time": "2017-03-13T16:27:32+00:00",
    575575        "type": "library",
    576576        "installation-source": "dist",
     
    600600    {
    601601        "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",
    604604        "source": {
    605605            "type": "git",
    606606            "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",
    613613            "shasum": ""
    614614        },
    615615        "require": {
    616616            "paragonie/random_compat": "^1.0|^2.0",
    617             "php": ">=5.3.3"
     617            "php": "^5.4 || ^7.0"
    618618        },
    619619        "replace": {
     
    621621        },
    622622        "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",
    624628            "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"
    630635        },
    631636        "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        },
    641651        "installation-source": "dist",
    642652        "autoload": {
    643653            "psr-4": {
    644                 "Rhumsaa\\Uuid\\": "src/"
     654                "Ramsey\\Uuid\\": "src/"
    645655            }
    646656        },
     
    655665            },
    656666            {
     667                "name": "Thibaud Fabre",
     668                "email": "thibaud@aztech.io"
     669            },
     670            {
    657671                "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).",
    662677        "homepage": "https://github.com/ramsey/uuid",
    663678        "keywords": [
     
    700715            "sllh/iso-codes-validator": "For Symfony or Silex integration with ease"
    701716        },
    702         "time": "2015-06-22 19:37:41",
     717        "time": "2015-06-22T19:37:41+00:00",
    703718        "type": "library",
    704719        "extra": {
     
    750765    },
    751766    {
     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    {
    752819        "name": "hamcrest/hamcrest-php",
    753820        "version": "v1.2.2",
     
    776843            "satooshi/php-coveralls": "dev-master"
    777844        },
    778         "time": "2015-05-11 14:41:42",
     845        "time": "2015-05-11T14:41:42+00:00",
    779846        "type": "library",
    780847        "installation-source": "dist",
     
    819886            "phpunit/phpunit": "~4.0"
    820887        },
    821         "time": "2016-05-22 21:52:33",
     888        "time": "2016-05-22T21:52:33+00:00",
    822889        "type": "library",
    823890        "extra": {
     
    885952            "sebastian/version": "^1.0.1"
    886953        },
    887         "time": "2016-08-09 15:02:57",
     954        "time": "2016-08-09T15:02:57+00:00",
    888955        "type": "library",
    889956        "extra": {
     
    9361003            "phpunit/phpunit": "^4.6"
    9371004        },
    938         "time": "2015-12-27 11:43:31",
     1005        "time": "2015-12-27T11:43:31+00:00",
    9391006        "type": "library",
    9401007        "extra": {
     
    9941061            "phpunit/phpunit": "^5.2||^4.8.24"
    9951062        },
    996         "time": "2016-06-10 07:14:17",
     1063        "time": "2016-06-10T07:14:17+00:00",
    9971064        "type": "library",
    9981065        "extra": {
     
    10451112            "phpunit/phpunit": "^4.4"
    10461113        },
    1047         "time": "2016-09-30 07:12:33",
     1114        "time": "2016-09-30T07:12:33+00:00",
    10481115        "type": "library",
    10491116        "installation-source": "dist",
     
    10891156            "phpunit/phpunit": "~4.2"
    10901157        },
    1091         "time": "2015-09-15 10:49:45",
     1158        "time": "2015-09-15T10:49:45+00:00",
    10921159        "type": "library",
    10931160        "extra": {
     
    11361203            "php": ">=5.3.9"
    11371204        },
    1138         "time": "2016-10-21 20:59:10",
     1205        "time": "2016-10-21T20:59:10+00:00",
    11391206        "type": "library",
    11401207        "extra": {
     
    11841251            "shasum": ""
    11851252        },
    1186         "time": "2015-06-21 13:59:46",
     1253        "time": "2015-06-21T13:59:46+00:00",
    11871254        "type": "library",
    11881255        "installation-source": "dist",
     
    12301297            "ext-uopz": "*"
    12311298        },
    1232         "time": "2015-10-12 03:26:01",
     1299        "time": "2015-10-12T03:26:01+00:00",
    12331300        "type": "library",
    12341301        "extra": {
     
    12801347            "phpunit/phpunit": "~4.4"
    12811348        },
    1282         "time": "2015-11-11 19:50:13",
     1349        "time": "2015-11-11T19:50:13+00:00",
    12831350        "type": "library",
    12841351        "extra": {
     
    13371404            "phpunit/phpunit": "~4.4"
    13381405        },
    1339         "time": "2016-06-17 09:04:28",
     1406        "time": "2016-06-17T09:04:28+00:00",
    13401407        "type": "library",
    13411408        "extra": {
     
    14041471            "phpunit/phpunit": "^4.8 || ^5.0"
    14051472        },
    1406         "time": "2016-08-18 05:49:44",
     1473        "time": "2016-08-18T05:49:44+00:00",
    14071474        "type": "library",
    14081475        "extra": {
     
    14561523            "phpunit/phpunit": "~4.8"
    14571524        },
    1458         "time": "2015-12-08 07:14:41",
     1525        "time": "2015-12-08T07:14:41+00:00",
    14591526        "type": "library",
    14601527        "extra": {
     
    15121579            "phpunit/phpunit": "~4.4"
    15131580        },
    1514         "time": "2015-07-26 15:48:44",
     1581        "time": "2015-07-26T15:48:44+00:00",
    15151582        "type": "library",
    15161583        "extra": {
     
    15731640            "php": ">=5.3.3"
    15741641        },
    1575         "time": "2015-06-21 13:50:34",
     1642        "time": "2015-06-21T13:50:34+00:00",
    15761643        "type": "library",
    15771644        "installation-source": "dist",
     
    16231690            "squizlabs/php_codesniffer": "~2.0"
    16241691        },
    1625         "time": "2015-06-14 21:17:01",
     1692        "time": "2015-06-14T21:17:01+00:00",
    16261693        "type": "library",
    16271694        "extra": {
     
    16811748            "ext-soap": "*"
    16821749        },
    1683         "time": "2015-10-02 06:51:40",
     1750        "time": "2015-10-02T06:51:40+00:00",
    16841751        "type": "library",
    16851752        "extra": {
     
    17331800            "phpunit/phpunit": "~4|~5"
    17341801        },
    1735         "time": "2016-05-12 18:03:57",
     1802        "time": "2016-05-12T18:03:57+00:00",
    17361803        "type": "library",
    17371804        "installation-source": "dist",
     
    17761843            "php": ">=5.3.3"
    17771844        },
    1778         "time": "2015-06-21 13:08:43",
     1845        "time": "2015-06-21T13:08:43+00:00",
    17791846        "type": "library",
    17801847        "extra": {
     
    18391906            "ext-xmlwriter": "*"
    18401907        },
    1841         "time": "2015-10-06 15:47:00",
     1908        "time": "2015-10-06T15:47:00+00:00",
    18421909        "type": "library",
    18431910        "extra": {
     
    18961963            "phpspec/phpspec": "^2.0"
    18971964        },
    1898         "time": "2016-06-07 08:13:47",
     1965        "time": "2016-06-07T08:13:47+00:00",
    18991966        "type": "library",
    19001967        "extra": {
     
    19742041            "phpunit/php-invoker": "~1.1"
    19752042        },
    1976         "time": "2016-07-21 06:48:14",
     2043        "time": "2016-07-21T06:48:14+00:00",
    19772044        "bin": [
    19782045            "phpunit"
     
    20332100            "phpunit/phpunit": "~4.0"
    20342101        },
    2035         "time": "2016-09-01 23:53:02",
     2102        "time": "2016-09-01T23:53:02+00:00",
    20362103        "bin": [
    20372104            "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
     87The 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).
    2149
    3150## 2.9.0
  • ing-psp/trunk/ing-php/vendor/ramsey/uuid/CONTRIBUTING.md

    r1600658 r1717487  
    1515You can find help and discussion in the following places:
    1616
    17 * Gitter chat: <https://gitter.im/ramsey/uuid>
    1817* GitHub Issues: <https://github.com/ramsey/uuid/issues>
    1918* Wiki: <https://github.com/ramsey/uuid/wiki>
     
    5756
    5857```
    59 ./vendor/bin/parallel-lint src tests
    60 ./vendor/bin/phpunit --coverage-text
    61 ./vendor/bin/phpcs src --standard=psr2 -sp
     58composer test
    6259```
     60
     61### Locally Test With Emulated MIPS Architecture
     62
     63The 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```
     66vagrant init ubuntu/trusty64
     67vagrant up
     68vagrant ssh
     69sudo apt-get install docker.io qemu-user-static php5-cli php5-curl
     70cd /vagrant
     71curl -sS https://getcomposer.org/installer | php
     72php composer.phar install --no-interaction --prefer-dist
     73mkdir -p build/logs
     74ARCH=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) 2013-2014 Ben Ramsey <http://benramsey.com>
     1Copyright (c) 2012-2017 Ben Ramsey <ben@benramsey.com>
    22
    33Permission 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 PHP
     1# ramsey/uuid
    22
    3 [![Build Status](https://travis-ci.org/ramsey/uuid.png?branch=master)](https://travis-ci.org/ramsey/uuid)
    4 [![Coverage Status](https://coveralls.io/repos/ramsey/uuid/badge.png)](https://coveralls.io/r/ramsey/uuid)
    5 [![Latest Stable Version](https://poser.pugx.org/rhumsaa/uuid/v/stable.png)](https://packagist.org/packages/rhumsaa/uuid)
    6 [![Latest Unstable Version](https://poser.pugx.org/rhumsaa/uuid/v/unstable.png)](https://packagist.org/packages/rhumsaa/uuid)
    7 [![Total Downloads](https://poser.pugx.org/rhumsaa/uuid/downloads.png)](https://packagist.org/packages/rhumsaa/uuid)
    8 [![HHVM Status](http://hhvm.h4cc.de/badge/rhumsaa/uuid.png)](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._
    94
    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
     12ramsey/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
     14This 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
    1116
    1217## About
    1318
    14 Rhumsaa\Uuid is a PHP 5.3+ library for generating and working with
    15 [RFC 4122][rfc4122] version 1, 3, 4, and 5 universally unique identifiers (UUID).
    16 
    1719From [Wikipedia](http://en.wikipedia.org/wiki/Universally_unique_identifier):
    1820
    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.
    3022
    31 Much inspiration for this library came from the [Java][javauuid] and
    32 [Python][pyuuid] UUID libraries.
     23Much inspiration for this library came from the [Java][javauuid] and [Python][pyuuid] UUID libraries.
    3324
    34 ## API Documentation
    3525
    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
     28The 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
     31composer require ramsey/uuid
     32```
     33
     34
     35## Upgrading from 2.x to 3.x
     36
     37While 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
     39One 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
     41Here are full details on the breaking changes to the public API of this library:
     42
     431. All namespace references of `Rhumsaa` have changed to `Ramsey`. Simply change the namespace to `Ramsey` in your code and everything should work.
     442. 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`.
     453. 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
     50When installing your project's dependencies using Composer, you might see the following message:
     51
     52```
     53Package rhumsaa/uuid is abandoned, you should avoid using it. Use ramsey/uuid instead.
     54```
     55
     56Don't panic. Simply execute the following commands with Composer:
     57
     58``` bash
     59composer remove rhumsaa/uuid
     60composer require ramsey/uuid=^2.9
     61```
     62
     63After 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
    4065
    4166## Requirements
    4267
    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.
     68Some 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.
    4869
    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.
     70If 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
     75The [latest class API documentation][apidocs] is available online.
     76
     77This 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```
     80composer build-docs
     81```
     82
     83This will generate documentation in the `build/apidocs/` folder.
     84
    5285
    5386## Examples
     87
     88See the [cookbook on the wiki][wiki-cookbook] for more examples and approaches to specific use-cases.
    5489
    5590```php
     
    5792require 'vendor/autoload.php';
    5893
    59 use Rhumsaa\Uuid\Uuid;
    60 use Rhumsaa\Uuid\Exception\UnsatisfiedDependencyException;
     94use Ramsey\Uuid\Uuid;
     95use Ramsey\Uuid\Exception\UnsatisfiedDependencyException;
    6196
    6297try {
     
    6499    // Generate a version 1 (time-based) UUID object
    65100    $uuid1 = Uuid::uuid1();
    66     echo $uuid1->toString() . "\n"; // e4eaaaf2-d142-11e1-b3e4-080027620cdd
     101    echo $uuid1->toString() . "\n"; // i.e. e4eaaaf2-d142-11e1-b3e4-080027620cdd
    67102
    68103    // Generate a version 3 (name-based and hashed with MD5) UUID object
    69104    $uuid3 = Uuid::uuid3(Uuid::NAMESPACE_DNS, 'php.net');
    70     echo $uuid3->toString() . "\n"; // 11a38b9a-b3da-360f-9353-a5a725514269
     105    echo $uuid3->toString() . "\n"; // i.e. 11a38b9a-b3da-360f-9353-a5a725514269
    71106
    72107    // Generate a version 4 (random) UUID object
    73108    $uuid4 = Uuid::uuid4();
    74     echo $uuid4->toString() . "\n"; // 25769c6c-d34d-4bfe-ba98-e0ee856f3e7a
     109    echo $uuid4->toString() . "\n"; // i.e. 25769c6c-d34d-4bfe-ba98-e0ee856f3e7a
    75110
    76111    // Generate a version 5 (name-based and hashed with SHA1) UUID object
    77112    $uuid5 = Uuid::uuid5(Uuid::NAMESPACE_DNS, 'php.net');
    78     echo $uuid5->toString() . "\n"; // c4a760a8-dbcf-5254-a0d9-6a4474bd1b62
     113    echo $uuid5->toString() . "\n"; // i.e. c4a760a8-dbcf-5254-a0d9-6a4474bd1b62
    79114
    80115} catch (UnsatisfiedDependencyException $e) {
     
    87122```
    88123
    89 ## Installation
    90124
    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
    94126
    95 ```bash
    96 composer.phar require "ramsey/uuid=~2.8"
    97 ```
     127Contributions are welcome! Please read [CONTRIBUTING][] for details.
     128
     129
     130## Copyright and license
     131
     132The 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
    98134
    99135
    100136[rfc4122]: http://tools.ietf.org/html/rfc4122
     137[conduct]: https://github.com/ramsey/uuid/blob/master/CODE_OF_CONDUCT.md
    101138[javauuid]: http://docs.oracle.com/javase/6/docs/api/java/util/UUID.html
    102139[pyuuid]: http://docs.python.org/3/library/uuid.html
    103140[packagist]: https://packagist.org/packages/ramsey/uuid
    104141[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  
    11{
    22    "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).",
    44    "type": "library",
    55    "keywords": ["uuid", "identifier", "guid"],
     
    99        {
    1010            "name": "Ben Ramsey",
    11             "homepage": "http://benramsey.com"
     11            "email": "ben@benramsey.com",
     12            "homepage": "https://benramsey.com"
    1213        },
    1314        {
    1415            "name": "Marijn Huizendveld",
    1516            "email": "marijn.huizendveld@gmail.com"
     17        },
     18        {
     19            "name": "Thibaud Fabre",
     20            "email": "thibaud@aztech.io"
    1621        }
    1722    ],
     
    2126    },
    2227    "require": {
    23         "php": ">=5.3.3",
     28        "php": "^5.4 || ^7.0",
    2429        "paragonie/random_compat": "^1.0|^2.0"
    2530    },
    2631    "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",
    3235        "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"
    3444    },
    35     "bin": ["bin/uuid"],
    3645    "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"
    4052    },
    4153    "autoload": {
    42         "psr-4": {"Rhumsaa\\Uuid\\": "src/"}
     54        "psr-4": {"Ramsey\\Uuid\\": "src/"}
     55    },
     56    "autoload-dev": {
     57        "psr-4": {"Ramsey\\Uuid\\Test\\": "tests/"}
    4358    },
    4459    "replace": {
    4560        "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"
    4677    }
    4778}
  • ing-psp/trunk/ing-php/vendor/ramsey/uuid/src/Exception/UnsatisfiedDependencyException.php

    r1600658 r1717487  
    11<?php
    22/**
    3  * This file is part of the Rhumsaa\Uuid library
     3 * This file is part of the ramsey/uuid library
    44 *
    55 * For the full copyright and license information, please view the LICENSE
    66 * file that was distributed with this source code.
    77 *
    8  * @copyright Copyright (c) 2013-2014 Ben Ramsey <http://benramsey.com>
     8 * @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
    99 * @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
    1013 */
    1114
    12 namespace Rhumsaa\Uuid\Exception;
     15namespace Ramsey\Uuid\Exception;
    1316
    1417/**
  • ing-psp/trunk/ing-php/vendor/ramsey/uuid/src/Exception/UnsupportedOperationException.php

    r1600658 r1717487  
    11<?php
    22/**
    3  * This file is part of the Rhumsaa\Uuid library
     3 * This file is part of the ramsey/uuid library
    44 *
    55 * For the full copyright and license information, please view the LICENSE
    66 * file that was distributed with this source code.
    77 *
    8  * @copyright Copyright (c) 2013-2014 Ben Ramsey <http://benramsey.com>
     8 * @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
    99 * @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
    1013 */
    1114
    12 namespace Rhumsaa\Uuid\Exception;
     15namespace Ramsey\Uuid\Exception;
    1316
    1417/**
  • ing-psp/trunk/ing-php/vendor/ramsey/uuid/src/Uuid.php

    r1600658 r1717487  
    11<?php
    22/**
    3  * This file is part of the Rhumsaa\Uuid library
     3 * This file is part of the ramsey/uuid library
    44 *
    55 * For the full copyright and license information, please view the LICENSE
    66 * file that was distributed with this source code.
    77 *
    8  * @copyright Copyright (c) 2013-2014 Ben Ramsey <http://benramsey.com>
     8 * @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
    99 * @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
    1013 */
    1114
    12 namespace Rhumsaa\Uuid;
    13 
    14 use InvalidArgumentException;
     15namespace Ramsey\Uuid;
     16
     17use Ramsey\Uuid\Converter\NumberConverterInterface;
     18use Ramsey\Uuid\Codec\CodecInterface;
     19use Ramsey\Uuid\Exception\UnsupportedOperationException;
    1520
    1621/**
    17  * Represents a universally unique identifier (UUID), according to RFC 4122
     22 * Represents a universally unique identifier (UUID), according to RFC 4122.
    1823 *
    1924 * This class provides immutable UUID objects (the Uuid class) and the static
     
    3035 * @link http://docs.oracle.com/javase/6/docs/api/java/util/UUID.html
    3136 */
    32 final class Uuid
     37class Uuid implements UuidInterface
    3338{
    3439    /**
     
    9297
    9398    /**
    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.
    123114     *
    124115     * @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()
    142117     */
    143118    protected $fields = array(
     
    151126
    152127    /**
     128     * The number converter to use for converting hex values to/from integers.
     129     * @var NumberConverterInterface
     130     */
     131    protected $converter;
     132
     133    /**
    153134     * Creates a universally unique identifier (UUID) from an array of fields.
    154135     *
    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    ) {
    163161        $this->fields = $fields;
     162        $this->codec = $codec;
     163        $this->converter = $converter;
    164164    }
    165165
    166166    /**
    167167     * Converts this UUID object to a string when the object is used in any
    168      * string context
     168     * string context.
    169169     *
    170170     * @return string
     
    177177
    178178    /**
    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()) {
    196221            $comparison = -1;
    197         } elseif ($this->getMostSignificantBitsHex() > $uuid->getMostSignificantBitsHex()) {
     222        } elseif ($this->getMostSignificantBitsHex() > $other->getMostSignificantBitsHex()) {
    198223            $comparison = 1;
    199         } elseif ($this->getLeastSignificantBitsHex() < $uuid->getLeastSignificantBitsHex()) {
     224        } elseif ($this->getLeastSignificantBitsHex() < $other->getLeastSignificantBitsHex()) {
    200225            $comparison = -1;
    201         } elseif ($this->getLeastSignificantBitsHex() > $uuid->getLeastSignificantBitsHex()) {
     226        } elseif ($this->getLeastSignificantBitsHex() > $other->getLeastSignificantBitsHex()) {
    202227            $comparison = 1;
    203         } else {
    204             $comparison = 0;
    205228        }
    206229
     
    208231    }
    209232
    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)) {
    223236            return false;
    224237        }
    225238
    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
    235242    public function getBytes()
    236243    {
    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);
    244245    }
    245246
     
    255256    }
    256257
    257     /**
    258      * Returns the high field of the clock sequence multiplexed with the variant
    259      * (bits 65-72 of the UUID).
    260      *
    261      * @return string Hexadecimal value of clock_seq_hi_and_reserved
    262      */
    263258    public function getClockSeqHiAndReservedHex()
    264259    {
     
    276271    }
    277272
    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_low
    282      */
    283273    public function getClockSeqLowHex()
    284274    {
     
    308298    }
    309299
    310     /**
    311      * Returns the clock sequence value associated with this UUID.
    312      *
    313      * @return string Hexadecimal value of clock sequence
    314      */
    315300    public function getClockSequenceHex()
    316301    {
     
    318303    }
    319304
    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
    333310    public function getDateTime()
    334311    {
    335312        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, '', '');
    356318
    357319        return new \DateTime("@{$unixTime}");
     
    374336     *
    375337     * @return array The UUID fields represented as integer values
    376      * @throws Exception\UnsatisfiedDependencyException if called on a 32-bit system
    377338     * @link http://tools.ietf.org/html/rfc4122#section-4.1.2
    378339     */
    379340    public function getFields()
    380341    {
    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 
    389342        return array(
    390343            'time_low' => $this->getTimeLow(),
     
    397350    }
    398351
    399     /**
    400      * Returns an array of the fields of this UUID, with keys named according
    401      * to the RFC 4122 names for the fields.
    402      *
    403      * * **time_low**: The low field of the timestamp, an unsigned 32-bit integer
    404      * * **time_mid**: The middle field of the timestamp, an unsigned 16-bit integer
    405      * * **time_hi_and_version**: The high field of the timestamp multiplexed with
    406      *   the version number, an unsigned 16-bit integer
    407      * * **clock_seq_hi_and_reserved**: The high field of the clock sequence
    408      *   multiplexed with the variant, an unsigned 8-bit integer
    409      * * **clock_seq_low**: The low field of the clock sequence, an unsigned
    410      *   8-bit integer
    411      * * **node**: The spatially unique node identifier, an unsigned 48-bit
    412      *   integer
    413      *
    414      * @return array The UUID fields represented as hexadecimal values
    415      */
    416352    public function getFieldsHex()
    417353    {
     
    419355    }
    420356
    421     /**
    422      * Returns the hexadecimal value of the UUID
    423      *
    424      * @return string
    425      */
    426357    public function getHex()
    427358    {
     
    429360    }
    430361
    431     /**
    432      * Returns the integer value of the UUID, represented as a BigNumber
    433      *
    434      * @return \Moontoast\Math\BigNumber BigNumber representation of the unsigned 128-bit integer value
    435      * @throws Exception\UnsatisfiedDependencyException if Moontoast\Math\BigNumber is not present
    436      */
    437362    public function getInteger()
    438363    {
    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
    462371     */
    463372    public function getLeastSignificantBits()
    464373    {
    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
    488377    public function getLeastSignificantBitsHex()
    489378    {
     
    497386
    498387    /**
    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
    503391     */
    504392    public function getMostSignificantBits()
    505393    {
    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
    529397    public function getMostSignificantBitsHex()
    530398    {
     
    560428     * @return int Unsigned 48-bit integer value of node
    561429     * @link http://tools.ietf.org/html/rfc4122#section-4.1.6
    562      * @throws Exception\UnsatisfiedDependencyException if called on a 32-bit system
    563430     */
    564431    public function getNode()
    565432    {
    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 
    575433        return hexdec($this->getNodeHex());
    576434    }
    577435
    578     /**
    579      * Returns the node value associated with this UUID
    580      *
    581      * For UUID version 1, the node field consists of an IEEE 802 MAC
    582      * address, usually the host address. For systems with multiple IEEE
    583      * 802 addresses, any available one can be used. The lowest addressed
    584      * octet (octet number 10) contains the global/local bit and the
    585      * unicast/multicast bit, and is the first octet of the address
    586      * transmitted on an 802.3 LAN.
    587      *
    588      * For systems with no IEEE address, a randomly or pseudo-randomly
    589      * generated value may be used; see RFC 4122, Section 4.5. The
    590      * multicast bit must be set in such addresses, in order that they
    591      * 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 constructed
    594      * 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-randomly
    597      * generated 48-bit value as described in RFC 4122, Section 4.4.
    598      *
    599      * @return string Hexadecimal value of node
    600      * @link http://tools.ietf.org/html/rfc4122#section-4.1.6
    601      */
    602436    public function getNodeHex()
    603437    {
     
    616450    }
    617451
    618     /**
    619      * Returns the high field of the timestamp multiplexed with the version
    620      * number (bits 49-64 of the UUID).
    621      *
    622      * @return string Hexadecimal value of time_hi_and_version
    623      */
    624452    public function getTimeHiAndVersionHex()
    625453    {
     
    631459     *
    632460     * @return int Unsigned 32-bit integer value of time_low
    633      * @throws Exception\UnsatisfiedDependencyException if called on a 32-bit system
    634461     */
    635462    public function getTimeLow()
    636463    {
    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 
    646464        return hexdec($this->getTimeLowHex());
    647465    }
    648466
    649     /**
    650      * Returns the low field of the timestamp (the first 32 bits of the UUID).
    651      *
    652      * @return string Hexadecimal value of time_low
    653      */
    654467    public function getTimeLowHex()
    655468    {
     
    667480    }
    668481
    669     /**
    670      * Returns the middle field of the timestamp (bits 33-48 of the UUID).
    671      *
    672      * @return string Hexadecimal value of time_mid
    673      */
    674482    public function getTimeMidHex()
    675483    {
     
    678486
    679487    /**
    680      * The timestamp value associated with this UUID
     488     * Returns the timestamp value associated with this UUID.
    681489     *
    682490     * The 60 bit timestamp value is constructed from the time_low,
     
    690498     *
    691499     * @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
    694501     * @link http://tools.ietf.org/html/rfc4122#section-4.1.4
    695502     */
     
    697504    {
    698505        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');
    709507        }
    710508
     
    712510    }
    713511
    714     /**
    715      * The timestamp value associated with this UUID
    716      *
    717      * The 60 bit timestamp value is constructed from the time_low,
    718      * time_mid, and time_hi fields of this UUID. The resulting
    719      * 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, which
    723      * has version type 1. If this UUID is not a time-based UUID then
    724      * this method throws UnsupportedOperationException.
    725      *
    726      * @return string Hexadecimal value of the timestamp
    727      * @throws Exception\UnsupportedOperationException If this UUID is not a version 1 UUID
    728      * @link http://tools.ietf.org/html/rfc4122#section-4.1.4
    729      */
    730512    public function getTimestampHex()
    731513    {
    732514        if ($this->getVersion() != 1) {
    733             throw new Exception\UnsupportedOperationException('Not a time-based UUID');
     515            throw new UnsupportedOperationException('Not a time-based UUID');
    734516        }
    735517
     
    742524    }
    743525
    744     /**
    745      * Returns the string representation of the UUID as a URN.
    746      *
    747      * @return string
    748      * @link http://en.wikipedia.org/wiki/Uniform_Resource_Name
    749      */
    750526    public function getUrn()
    751527    {
     
    753529    }
    754530
    755     /**
    756      * Returns the variant number associated with this UUID.
    757      *
    758      * The variant number describes the layout of the UUID. The variant
    759      * number has the following meaning:
    760      *
    761      * * 0 - Reserved for NCS backward compatibility
    762      * * 2 - The RFC 4122 variant (used by this class)
    763      * * 6 - Reserved, Microsoft Corporation backward compatibility
    764      * * 7 - Reserved for future definition
    765      *
    766      * @return int
    767      * @link http://tools.ietf.org/html/rfc4122#section-4.1.1
    768      */
    769531    public function getVariant()
    770532    {
     
    783545    }
    784546
    785     /**
    786      * The version number associated with this UUID. The version
    787      * number describes how this UUID was generated.
    788      *
    789      * The version number has the following meaning:
    790      *
    791      * * 1 - Time-based UUID
    792      * * 2 - DCE security UUID
    793      * * 3 - Name-based UUID hashed with MD5
    794      * * 4 - Randomly generated UUID
    795      * * 5 - Name-based UUID hashed with SHA-1
    796      *
    797      * Returns null if this UUID is not an RFC 4122 variant, since version
    798      * is only meaningful for this variant.
    799      *
    800      * @return int|null
    801      * @link http://tools.ietf.org/html/rfc4122#section-4.1.3
    802      */
    803547    public function getVersion()
    804548    {
     
    810554    }
    811555
    812     /**
    813      * Converts this UUID into a string representation
    814      *
    815      * @return string
    816      */
    817556    public function toString()
    818557    {
    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;
    823583    }
    824584
     
    827587     *
    828588     * @param string $bytes
    829      * @return Uuid
    830      * @throws InvalidArgumentException If the $bytes string does not contain 16 characters
     589     * @return UuidInterface
    831590     */
    832591    public static function fromBytes($bytes)
    833592    {
    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.
    853598     *
    854599     * @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
    857601     */
    858602    public static function fromString($name)
    859603    {
    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
    896612     */
    897613    public static function fromInteger($integer)
    898614    {
    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
    921622     * @return boolean
    922623     */
     
    932633            return false;
    933634        }
     635
    934636        return true;
    935637    }
     
    937639    /**
    938640     * 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.
    946644     * @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
    951648     */
    952649    public static function uuid1($node = null, $clockSeq = null)
    953650    {
    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
    1016659     * @param string $name The name to create a UUID for
    1017      * @return Uuid
     660     * @return UuidInterface
    1018661     */
    1019662    public static function uuid3($ns, $name)
    1020663    {
    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);
    1028665    }
    1029666
     
    1031668     * Generate a version 4 (random) UUID.
    1032669     *
    1033      * @return Uuid
     670     * @return UuidInterface
    1034671     */
    1035672    public static function uuid4()
    1036673    {
    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
    1051682     * @param string $name The name to create a UUID for
    1052      * @return Uuid
     683     * @return UuidInterface
    1053684     */
    1054685    public static function uuid5($ns, $name)
    1055686    {
    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);
    1257688    }
    1258689}
  • ing-psp/trunk/ingpsp.php

    r1693714 r1717487  
    11<?php
     2
    23/**
    34 * Plugin Name: ING PSP
    45 * Plugin URI: https://www.ing.nl/
    56 * Description: ING WooCommerce plugin for ING Kassa Compleet and ING ePay markets.
    6  * Version: 1.2.4
     7 * Version: 1.2.5
    78 * Author: Ginger Payments
    89 * Author URI: https://www.gingerpayments.com/
     
    1920 * Define ING PSP plugin version
    2021 */
    21 define('INGPSP_PLUGIN_VERSION', 'WooCommerce v1.2.4');
     22define('INGPSP_PLUGIN_VERSION', 'WooCommerce v1.2.5');
    2223
    2324add_action('plugins_loaded', 'woocommerce_ingpsp_init', 0);
     
    125126    add_filter('woocommerce_payment_gateways', 'woocommerce_add_ingpsp');
    126127    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
    127161    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
    128192}
  • ing-psp/trunk/readme.txt

    r1693714 r1717487  
    55Requires at least: 4.0
    66Tested up to: 4.8
    7 Stable tag: 1.2.4
     7Stable tag: 1.2.5
    88License: The MIT License (MIT)
    99License URI: https://opensource.org/licenses/MIT
     
    104104== Changelog ==
    105105
     106= 1.2.5 =
     107* Updated ing-php library to v1.3.1
     108* Implemented Klarna automatic order capturing
     109* Some other fixes
     110
    106111= 1.2.4 =
    107112* Added localisation support
Note: See TracChangeset for help on using the changeset viewer.