├── .codeclimate.yml ├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── composer.json ├── composer.lock ├── phpunit.xml.dist ├── src ├── ArrayHydrator.php └── JsonApiHydrator.php └── tests ├── bootstrap.php ├── fixtures ├── Address.php ├── Call.php ├── Company.php ├── Permission.php ├── Preference.php └── User.php └── unit ├── ArrayHydratorTest.php ├── JsonApiHydratorTest.php └── TestCase.php /.codeclimate.yml: -------------------------------------------------------------------------------- 1 | languages: 2 | PHP: true 3 | 4 | exclude_paths: 5 | - vendor/* 6 | - tests/* 7 | - build/* -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | vendor 2 | .idea 3 | build -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | php: 3 | - 5.6 4 | - 7.1 5 | - 7.2 6 | install: composer install --dev 7 | before_script: 8 | - git config --global user.email "dev.pmill@gmail.com" 9 | - git config --global user.name "pmill" 10 | 11 | after_script: 12 | - php vendor/bin/test-reporter 13 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 pmill 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Doctrine Array to Entity Hydrator 2 | ================ 3 | 4 | Introduction 5 | ------------ 6 | 7 | [![Build Status](https://secure.travis-ci.org/pmill/doctrine-array-hydrator.svg?branch=master)](http://travis-ci.org/pmill/doctrine-array-hydrator) [![Test Coverage](https://scrutinizer-ci.com/g/pmill/doctrine-array-hydrator/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/pmill/doctrine-array-hydrator/) ![Downloads](https://poser.pugx.org/pmill/doctrine-array-hydrator/downloads) 8 | 9 | 10 | A hydrator for doctrine 2 that converts an array to the entity of your choice. 11 | 12 | Installing via Composer 13 | ----------------------- 14 | 15 | The recommended way to install is through 16 | [Composer](http://getcomposer.org). 17 | 18 | composer require pmill/doctrine-array-hydrator 19 | 20 | Example 21 | ------- 22 | 23 | Given this doctrine entity: 24 | 25 | ```PHP 26 | 'Fred Jones', 84 | 'email' => 'fred@example.com', 85 | 'company' => 2, 86 | 'permissions' => [1, 2, 3, 4] 87 | ]; 88 | 89 | $hydrator = new \pmill\Doctrine\Hydrator\ArrayHydrator($entityManager); 90 | $entity = $hydrator->hydrate('App\Entity\User', $data); 91 | ``` 92 | 93 | We can populate user with JSON API resource data 94 | [Documentation](http://jsonapi.org/format/#document-resource-objects) 95 | ```PHP 96 | $data = [ 97 | 'attributes' => [ 98 | 'name' => 'Fred Jones', 99 | 'email' => 'fred@example.com', 100 | ], 101 | 'relationships' => [ 102 | 'company' => [ 103 | 'data' => ['id' => 1, 'type' => 'company'], 104 | ], 105 | 'permissions' => [ 106 | 'data' => [ 107 | ['id' => 1, 'type' => 'permission'], 108 | ['id' => 2, 'type' => 'permission'], 109 | ['id' => 3, 'type' => 'permission'], 110 | ['id' => 4, 'type' => 'permission'], 111 | ['name' => 'New permission'] 112 | ] 113 | ] 114 | ] 115 | ]; 116 | 117 | $hydrator = new \pmill\Doctrine\Hydrator\JsonApiHydrator($entityManager); 118 | $entity = $hydrator->hydrate('App\Entity\User', $data); 119 | ``` 120 | 121 | Copyright 122 | --------- 123 | 124 | Doctrine Array to Entity Hydrator 125 | Copyright (c) 2015 pmill (dev.pmill@gmail.com) 126 | All rights reserved. 127 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pmill/doctrine-array-hydrator", 3 | "description": " An array to entity hydrator for Doctrine 2 entities ", 4 | "keywords": ["php", "doctrine", "hydrator", "array"], 5 | "homepage": "https://github.com/pmill/doctrine-array-hydrator", 6 | "license": "MIT", 7 | "authors": [ 8 | { 9 | "name": "pmill", 10 | "email": "dev.pmill@gmail.com" 11 | } 12 | ], 13 | "require": { 14 | "doctrine/orm": "^2.5" 15 | }, 16 | "require-dev": { 17 | "phpunit/phpunit": "4.8.*", 18 | "mockery/mockery": "^0.9.4", 19 | "codeclimate/php-test-reporter": "dev-master" 20 | }, 21 | "autoload": { 22 | "psr-4": {"pmill\\Doctrine\\Hydrator\\": "src/"} 23 | }, 24 | "autoload-dev": { 25 | "psr-4": { 26 | "pmill\\Doctrine\\Hydrator\\Test\\": "tests/unit/", 27 | "pmill\\Doctrine\\Hydrator\\Test\\Fixture\\": "tests/fixtures/" 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", 5 | "This file is @generated automatically" 6 | ], 7 | "hash": "70d4b33684ae17c7b5ee56fbebab617d", 8 | "content-hash": "42e39dfc259232791c5bb8ab181f1fdd", 9 | "packages": [ 10 | { 11 | "name": "doctrine/annotations", 12 | "version": "v1.2.7", 13 | "source": { 14 | "type": "git", 15 | "url": "https://github.com/doctrine/annotations.git", 16 | "reference": "f25c8aab83e0c3e976fd7d19875f198ccf2f7535" 17 | }, 18 | "dist": { 19 | "type": "zip", 20 | "url": "https://api.github.com/repos/doctrine/annotations/zipball/f25c8aab83e0c3e976fd7d19875f198ccf2f7535", 21 | "reference": "f25c8aab83e0c3e976fd7d19875f198ccf2f7535", 22 | "shasum": "" 23 | }, 24 | "require": { 25 | "doctrine/lexer": "1.*", 26 | "php": ">=5.3.2" 27 | }, 28 | "require-dev": { 29 | "doctrine/cache": "1.*", 30 | "phpunit/phpunit": "4.*" 31 | }, 32 | "type": "library", 33 | "extra": { 34 | "branch-alias": { 35 | "dev-master": "1.3.x-dev" 36 | } 37 | }, 38 | "autoload": { 39 | "psr-0": { 40 | "Doctrine\\Common\\Annotations\\": "lib/" 41 | } 42 | }, 43 | "notification-url": "https://packagist.org/downloads/", 44 | "license": [ 45 | "MIT" 46 | ], 47 | "authors": [ 48 | { 49 | "name": "Roman Borschel", 50 | "email": "roman@code-factory.org" 51 | }, 52 | { 53 | "name": "Benjamin Eberlei", 54 | "email": "kontakt@beberlei.de" 55 | }, 56 | { 57 | "name": "Guilherme Blanco", 58 | "email": "guilhermeblanco@gmail.com" 59 | }, 60 | { 61 | "name": "Jonathan Wage", 62 | "email": "jonwage@gmail.com" 63 | }, 64 | { 65 | "name": "Johannes Schmitt", 66 | "email": "schmittjoh@gmail.com" 67 | } 68 | ], 69 | "description": "Docblock Annotations Parser", 70 | "homepage": "http://www.doctrine-project.org", 71 | "keywords": [ 72 | "annotations", 73 | "docblock", 74 | "parser" 75 | ], 76 | "time": "2015-08-31 12:32:49" 77 | }, 78 | { 79 | "name": "doctrine/cache", 80 | "version": "v1.5.1", 81 | "source": { 82 | "type": "git", 83 | "url": "https://github.com/doctrine/cache.git", 84 | "reference": "2b9cec5a5e722010cbebc91713d4c11eaa064d5e" 85 | }, 86 | "dist": { 87 | "type": "zip", 88 | "url": "https://api.github.com/repos/doctrine/cache/zipball/2b9cec5a5e722010cbebc91713d4c11eaa064d5e", 89 | "reference": "2b9cec5a5e722010cbebc91713d4c11eaa064d5e", 90 | "shasum": "" 91 | }, 92 | "require": { 93 | "php": ">=5.3.2" 94 | }, 95 | "conflict": { 96 | "doctrine/common": ">2.2,<2.4" 97 | }, 98 | "require-dev": { 99 | "phpunit/phpunit": ">=3.7", 100 | "predis/predis": "~1.0", 101 | "satooshi/php-coveralls": "~0.6" 102 | }, 103 | "type": "library", 104 | "extra": { 105 | "branch-alias": { 106 | "dev-master": "1.5.x-dev" 107 | } 108 | }, 109 | "autoload": { 110 | "psr-4": { 111 | "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" 112 | } 113 | }, 114 | "notification-url": "https://packagist.org/downloads/", 115 | "license": [ 116 | "MIT" 117 | ], 118 | "authors": [ 119 | { 120 | "name": "Roman Borschel", 121 | "email": "roman@code-factory.org" 122 | }, 123 | { 124 | "name": "Benjamin Eberlei", 125 | "email": "kontakt@beberlei.de" 126 | }, 127 | { 128 | "name": "Guilherme Blanco", 129 | "email": "guilhermeblanco@gmail.com" 130 | }, 131 | { 132 | "name": "Jonathan Wage", 133 | "email": "jonwage@gmail.com" 134 | }, 135 | { 136 | "name": "Johannes Schmitt", 137 | "email": "schmittjoh@gmail.com" 138 | } 139 | ], 140 | "description": "Caching library offering an object-oriented API for many cache backends", 141 | "homepage": "http://www.doctrine-project.org", 142 | "keywords": [ 143 | "cache", 144 | "caching" 145 | ], 146 | "time": "2015-11-02 18:35:48" 147 | }, 148 | { 149 | "name": "doctrine/collections", 150 | "version": "v1.3.0", 151 | "source": { 152 | "type": "git", 153 | "url": "https://github.com/doctrine/collections.git", 154 | "reference": "6c1e4eef75f310ea1b3e30945e9f06e652128b8a" 155 | }, 156 | "dist": { 157 | "type": "zip", 158 | "url": "https://api.github.com/repos/doctrine/collections/zipball/6c1e4eef75f310ea1b3e30945e9f06e652128b8a", 159 | "reference": "6c1e4eef75f310ea1b3e30945e9f06e652128b8a", 160 | "shasum": "" 161 | }, 162 | "require": { 163 | "php": ">=5.3.2" 164 | }, 165 | "require-dev": { 166 | "phpunit/phpunit": "~4.0" 167 | }, 168 | "type": "library", 169 | "extra": { 170 | "branch-alias": { 171 | "dev-master": "1.2.x-dev" 172 | } 173 | }, 174 | "autoload": { 175 | "psr-0": { 176 | "Doctrine\\Common\\Collections\\": "lib/" 177 | } 178 | }, 179 | "notification-url": "https://packagist.org/downloads/", 180 | "license": [ 181 | "MIT" 182 | ], 183 | "authors": [ 184 | { 185 | "name": "Roman Borschel", 186 | "email": "roman@code-factory.org" 187 | }, 188 | { 189 | "name": "Benjamin Eberlei", 190 | "email": "kontakt@beberlei.de" 191 | }, 192 | { 193 | "name": "Guilherme Blanco", 194 | "email": "guilhermeblanco@gmail.com" 195 | }, 196 | { 197 | "name": "Jonathan Wage", 198 | "email": "jonwage@gmail.com" 199 | }, 200 | { 201 | "name": "Johannes Schmitt", 202 | "email": "schmittjoh@gmail.com" 203 | } 204 | ], 205 | "description": "Collections Abstraction library", 206 | "homepage": "http://www.doctrine-project.org", 207 | "keywords": [ 208 | "array", 209 | "collections", 210 | "iterator" 211 | ], 212 | "time": "2015-04-14 22:21:58" 213 | }, 214 | { 215 | "name": "doctrine/common", 216 | "version": "v2.5.1", 217 | "source": { 218 | "type": "git", 219 | "url": "https://github.com/doctrine/common.git", 220 | "reference": "0009b8f0d4a917aabc971fb089eba80e872f83f9" 221 | }, 222 | "dist": { 223 | "type": "zip", 224 | "url": "https://api.github.com/repos/doctrine/common/zipball/0009b8f0d4a917aabc971fb089eba80e872f83f9", 225 | "reference": "0009b8f0d4a917aabc971fb089eba80e872f83f9", 226 | "shasum": "" 227 | }, 228 | "require": { 229 | "doctrine/annotations": "1.*", 230 | "doctrine/cache": "1.*", 231 | "doctrine/collections": "1.*", 232 | "doctrine/inflector": "1.*", 233 | "doctrine/lexer": "1.*", 234 | "php": ">=5.3.2" 235 | }, 236 | "require-dev": { 237 | "phpunit/phpunit": "~3.7" 238 | }, 239 | "type": "library", 240 | "extra": { 241 | "branch-alias": { 242 | "dev-master": "2.6.x-dev" 243 | } 244 | }, 245 | "autoload": { 246 | "psr-0": { 247 | "Doctrine\\Common\\": "lib/" 248 | } 249 | }, 250 | "notification-url": "https://packagist.org/downloads/", 251 | "license": [ 252 | "MIT" 253 | ], 254 | "authors": [ 255 | { 256 | "name": "Roman Borschel", 257 | "email": "roman@code-factory.org" 258 | }, 259 | { 260 | "name": "Benjamin Eberlei", 261 | "email": "kontakt@beberlei.de" 262 | }, 263 | { 264 | "name": "Guilherme Blanco", 265 | "email": "guilhermeblanco@gmail.com" 266 | }, 267 | { 268 | "name": "Jonathan Wage", 269 | "email": "jonwage@gmail.com" 270 | }, 271 | { 272 | "name": "Johannes Schmitt", 273 | "email": "schmittjoh@gmail.com" 274 | } 275 | ], 276 | "description": "Common Library for Doctrine projects", 277 | "homepage": "http://www.doctrine-project.org", 278 | "keywords": [ 279 | "annotations", 280 | "collections", 281 | "eventmanager", 282 | "persistence", 283 | "spl" 284 | ], 285 | "time": "2015-08-31 13:00:22" 286 | }, 287 | { 288 | "name": "doctrine/dbal", 289 | "version": "v2.5.2", 290 | "source": { 291 | "type": "git", 292 | "url": "https://github.com/doctrine/dbal.git", 293 | "reference": "01dbcbc5cd0a913d751418e635434a18a2f2a75c" 294 | }, 295 | "dist": { 296 | "type": "zip", 297 | "url": "https://api.github.com/repos/doctrine/dbal/zipball/01dbcbc5cd0a913d751418e635434a18a2f2a75c", 298 | "reference": "01dbcbc5cd0a913d751418e635434a18a2f2a75c", 299 | "shasum": "" 300 | }, 301 | "require": { 302 | "doctrine/common": ">=2.4,<2.6-dev", 303 | "php": ">=5.3.2" 304 | }, 305 | "require-dev": { 306 | "phpunit/phpunit": "4.*", 307 | "symfony/console": "2.*" 308 | }, 309 | "suggest": { 310 | "symfony/console": "For helpful console commands such as SQL execution and import of files." 311 | }, 312 | "bin": [ 313 | "bin/doctrine-dbal" 314 | ], 315 | "type": "library", 316 | "extra": { 317 | "branch-alias": { 318 | "dev-master": "2.5.x-dev" 319 | } 320 | }, 321 | "autoload": { 322 | "psr-0": { 323 | "Doctrine\\DBAL\\": "lib/" 324 | } 325 | }, 326 | "notification-url": "https://packagist.org/downloads/", 327 | "license": [ 328 | "MIT" 329 | ], 330 | "authors": [ 331 | { 332 | "name": "Roman Borschel", 333 | "email": "roman@code-factory.org" 334 | }, 335 | { 336 | "name": "Benjamin Eberlei", 337 | "email": "kontakt@beberlei.de" 338 | }, 339 | { 340 | "name": "Guilherme Blanco", 341 | "email": "guilhermeblanco@gmail.com" 342 | }, 343 | { 344 | "name": "Jonathan Wage", 345 | "email": "jonwage@gmail.com" 346 | } 347 | ], 348 | "description": "Database Abstraction Layer", 349 | "homepage": "http://www.doctrine-project.org", 350 | "keywords": [ 351 | "database", 352 | "dbal", 353 | "persistence", 354 | "queryobject" 355 | ], 356 | "time": "2015-09-16 16:29:33" 357 | }, 358 | { 359 | "name": "doctrine/inflector", 360 | "version": "v1.1.0", 361 | "source": { 362 | "type": "git", 363 | "url": "https://github.com/doctrine/inflector.git", 364 | "reference": "90b2128806bfde671b6952ab8bea493942c1fdae" 365 | }, 366 | "dist": { 367 | "type": "zip", 368 | "url": "https://api.github.com/repos/doctrine/inflector/zipball/90b2128806bfde671b6952ab8bea493942c1fdae", 369 | "reference": "90b2128806bfde671b6952ab8bea493942c1fdae", 370 | "shasum": "" 371 | }, 372 | "require": { 373 | "php": ">=5.3.2" 374 | }, 375 | "require-dev": { 376 | "phpunit/phpunit": "4.*" 377 | }, 378 | "type": "library", 379 | "extra": { 380 | "branch-alias": { 381 | "dev-master": "1.1.x-dev" 382 | } 383 | }, 384 | "autoload": { 385 | "psr-0": { 386 | "Doctrine\\Common\\Inflector\\": "lib/" 387 | } 388 | }, 389 | "notification-url": "https://packagist.org/downloads/", 390 | "license": [ 391 | "MIT" 392 | ], 393 | "authors": [ 394 | { 395 | "name": "Roman Borschel", 396 | "email": "roman@code-factory.org" 397 | }, 398 | { 399 | "name": "Benjamin Eberlei", 400 | "email": "kontakt@beberlei.de" 401 | }, 402 | { 403 | "name": "Guilherme Blanco", 404 | "email": "guilhermeblanco@gmail.com" 405 | }, 406 | { 407 | "name": "Jonathan Wage", 408 | "email": "jonwage@gmail.com" 409 | }, 410 | { 411 | "name": "Johannes Schmitt", 412 | "email": "schmittjoh@gmail.com" 413 | } 414 | ], 415 | "description": "Common String Manipulations with regard to casing and singular/plural rules.", 416 | "homepage": "http://www.doctrine-project.org", 417 | "keywords": [ 418 | "inflection", 419 | "pluralize", 420 | "singularize", 421 | "string" 422 | ], 423 | "time": "2015-11-06 14:35:42" 424 | }, 425 | { 426 | "name": "doctrine/instantiator", 427 | "version": "1.0.5", 428 | "source": { 429 | "type": "git", 430 | "url": "https://github.com/doctrine/instantiator.git", 431 | "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" 432 | }, 433 | "dist": { 434 | "type": "zip", 435 | "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", 436 | "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", 437 | "shasum": "" 438 | }, 439 | "require": { 440 | "php": ">=5.3,<8.0-DEV" 441 | }, 442 | "require-dev": { 443 | "athletic/athletic": "~0.1.8", 444 | "ext-pdo": "*", 445 | "ext-phar": "*", 446 | "phpunit/phpunit": "~4.0", 447 | "squizlabs/php_codesniffer": "~2.0" 448 | }, 449 | "type": "library", 450 | "extra": { 451 | "branch-alias": { 452 | "dev-master": "1.0.x-dev" 453 | } 454 | }, 455 | "autoload": { 456 | "psr-4": { 457 | "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" 458 | } 459 | }, 460 | "notification-url": "https://packagist.org/downloads/", 461 | "license": [ 462 | "MIT" 463 | ], 464 | "authors": [ 465 | { 466 | "name": "Marco Pivetta", 467 | "email": "ocramius@gmail.com", 468 | "homepage": "http://ocramius.github.com/" 469 | } 470 | ], 471 | "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", 472 | "homepage": "https://github.com/doctrine/instantiator", 473 | "keywords": [ 474 | "constructor", 475 | "instantiate" 476 | ], 477 | "time": "2015-06-14 21:17:01" 478 | }, 479 | { 480 | "name": "doctrine/lexer", 481 | "version": "v1.0.1", 482 | "source": { 483 | "type": "git", 484 | "url": "https://github.com/doctrine/lexer.git", 485 | "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c" 486 | }, 487 | "dist": { 488 | "type": "zip", 489 | "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c", 490 | "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c", 491 | "shasum": "" 492 | }, 493 | "require": { 494 | "php": ">=5.3.2" 495 | }, 496 | "type": "library", 497 | "extra": { 498 | "branch-alias": { 499 | "dev-master": "1.0.x-dev" 500 | } 501 | }, 502 | "autoload": { 503 | "psr-0": { 504 | "Doctrine\\Common\\Lexer\\": "lib/" 505 | } 506 | }, 507 | "notification-url": "https://packagist.org/downloads/", 508 | "license": [ 509 | "MIT" 510 | ], 511 | "authors": [ 512 | { 513 | "name": "Roman Borschel", 514 | "email": "roman@code-factory.org" 515 | }, 516 | { 517 | "name": "Guilherme Blanco", 518 | "email": "guilhermeblanco@gmail.com" 519 | }, 520 | { 521 | "name": "Johannes Schmitt", 522 | "email": "schmittjoh@gmail.com" 523 | } 524 | ], 525 | "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", 526 | "homepage": "http://www.doctrine-project.org", 527 | "keywords": [ 528 | "lexer", 529 | "parser" 530 | ], 531 | "time": "2014-09-09 13:34:57" 532 | }, 533 | { 534 | "name": "doctrine/orm", 535 | "version": "v2.5.1", 536 | "source": { 537 | "type": "git", 538 | "url": "https://github.com/doctrine/doctrine2.git", 539 | "reference": "e6a83bedbe67579cb0bfb688e982e617943a2945" 540 | }, 541 | "dist": { 542 | "type": "zip", 543 | "url": "https://api.github.com/repos/doctrine/doctrine2/zipball/e6a83bedbe67579cb0bfb688e982e617943a2945", 544 | "reference": "e6a83bedbe67579cb0bfb688e982e617943a2945", 545 | "shasum": "" 546 | }, 547 | "require": { 548 | "doctrine/cache": "~1.4", 549 | "doctrine/collections": "~1.2", 550 | "doctrine/common": ">=2.5-dev,<2.6-dev", 551 | "doctrine/dbal": ">=2.5-dev,<2.6-dev", 552 | "doctrine/instantiator": "~1.0.1", 553 | "ext-pdo": "*", 554 | "php": ">=5.4", 555 | "symfony/console": "~2.5" 556 | }, 557 | "require-dev": { 558 | "phpunit/phpunit": "~4.0", 559 | "satooshi/php-coveralls": "dev-master", 560 | "symfony/yaml": "~2.1" 561 | }, 562 | "suggest": { 563 | "symfony/yaml": "If you want to use YAML Metadata Mapping Driver" 564 | }, 565 | "bin": [ 566 | "bin/doctrine", 567 | "bin/doctrine.php" 568 | ], 569 | "type": "library", 570 | "extra": { 571 | "branch-alias": { 572 | "dev-master": "2.6.x-dev" 573 | } 574 | }, 575 | "autoload": { 576 | "psr-0": { 577 | "Doctrine\\ORM\\": "lib/" 578 | } 579 | }, 580 | "notification-url": "https://packagist.org/downloads/", 581 | "license": [ 582 | "MIT" 583 | ], 584 | "authors": [ 585 | { 586 | "name": "Roman Borschel", 587 | "email": "roman@code-factory.org" 588 | }, 589 | { 590 | "name": "Benjamin Eberlei", 591 | "email": "kontakt@beberlei.de" 592 | }, 593 | { 594 | "name": "Guilherme Blanco", 595 | "email": "guilhermeblanco@gmail.com" 596 | }, 597 | { 598 | "name": "Jonathan Wage", 599 | "email": "jonwage@gmail.com" 600 | } 601 | ], 602 | "description": "Object-Relational-Mapper for PHP", 603 | "homepage": "http://www.doctrine-project.org", 604 | "keywords": [ 605 | "database", 606 | "orm" 607 | ], 608 | "time": "2015-08-31 12:59:39" 609 | }, 610 | { 611 | "name": "symfony/console", 612 | "version": "v2.7.6", 613 | "source": { 614 | "type": "git", 615 | "url": "https://github.com/symfony/console.git", 616 | "reference": "5efd632294c8320ea52492db22292ff853a43766" 617 | }, 618 | "dist": { 619 | "type": "zip", 620 | "url": "https://api.github.com/repos/symfony/console/zipball/5efd632294c8320ea52492db22292ff853a43766", 621 | "reference": "5efd632294c8320ea52492db22292ff853a43766", 622 | "shasum": "" 623 | }, 624 | "require": { 625 | "php": ">=5.3.9" 626 | }, 627 | "require-dev": { 628 | "psr/log": "~1.0", 629 | "symfony/event-dispatcher": "~2.1", 630 | "symfony/process": "~2.1" 631 | }, 632 | "suggest": { 633 | "psr/log": "For using the console logger", 634 | "symfony/event-dispatcher": "", 635 | "symfony/process": "" 636 | }, 637 | "type": "library", 638 | "extra": { 639 | "branch-alias": { 640 | "dev-master": "2.7-dev" 641 | } 642 | }, 643 | "autoload": { 644 | "psr-4": { 645 | "Symfony\\Component\\Console\\": "" 646 | } 647 | }, 648 | "notification-url": "https://packagist.org/downloads/", 649 | "license": [ 650 | "MIT" 651 | ], 652 | "authors": [ 653 | { 654 | "name": "Fabien Potencier", 655 | "email": "fabien@symfony.com" 656 | }, 657 | { 658 | "name": "Symfony Community", 659 | "homepage": "https://symfony.com/contributors" 660 | } 661 | ], 662 | "description": "Symfony Console Component", 663 | "homepage": "https://symfony.com", 664 | "time": "2015-10-20 14:38:46" 665 | } 666 | ], 667 | "packages-dev": [ 668 | { 669 | "name": "codeclimate/php-test-reporter", 670 | "version": "dev-master", 671 | "source": { 672 | "type": "git", 673 | "url": "https://github.com/codeclimate/php-test-reporter.git", 674 | "reference": "892163d67e3bd9c190d43655acb69657da765c7b" 675 | }, 676 | "dist": { 677 | "type": "zip", 678 | "url": "https://api.github.com/repos/codeclimate/php-test-reporter/zipball/892163d67e3bd9c190d43655acb69657da765c7b", 679 | "reference": "892163d67e3bd9c190d43655acb69657da765c7b", 680 | "shasum": "" 681 | }, 682 | "require": { 683 | "ext-curl": "*", 684 | "php": ">=5.3", 685 | "satooshi/php-coveralls": "0.6.*", 686 | "symfony/console": ">=2.0" 687 | }, 688 | "require-dev": { 689 | "ext-xdebug": "*", 690 | "phpunit/phpunit": "3.7.*@stable" 691 | }, 692 | "bin": [ 693 | "composer/bin/test-reporter" 694 | ], 695 | "type": "library", 696 | "extra": { 697 | "branch-alias": { 698 | "dev-master": "0.2.x-dev" 699 | } 700 | }, 701 | "autoload": { 702 | "psr-0": { 703 | "CodeClimate\\Component": "src/", 704 | "CodeClimate\\Bundle": "src/" 705 | } 706 | }, 707 | "notification-url": "https://packagist.org/downloads/", 708 | "license": [ 709 | "MIT" 710 | ], 711 | "authors": [ 712 | { 713 | "name": "Code Climate", 714 | "email": "hello@codeclimate.com", 715 | "homepage": "https://codeclimate.com" 716 | } 717 | ], 718 | "description": "PHP client for reporting test coverage to Code Climate", 719 | "homepage": "https://github.com/codeclimate/php-test-reporter", 720 | "keywords": [ 721 | "codeclimate", 722 | "coverage" 723 | ], 724 | "time": "2015-10-15 14:41:10" 725 | }, 726 | { 727 | "name": "guzzle/guzzle", 728 | "version": "v3.9.3", 729 | "source": { 730 | "type": "git", 731 | "url": "https://github.com/guzzle/guzzle3.git", 732 | "reference": "0645b70d953bc1c067bbc8d5bc53194706b628d9" 733 | }, 734 | "dist": { 735 | "type": "zip", 736 | "url": "https://api.github.com/repos/guzzle/guzzle3/zipball/0645b70d953bc1c067bbc8d5bc53194706b628d9", 737 | "reference": "0645b70d953bc1c067bbc8d5bc53194706b628d9", 738 | "shasum": "" 739 | }, 740 | "require": { 741 | "ext-curl": "*", 742 | "php": ">=5.3.3", 743 | "symfony/event-dispatcher": "~2.1" 744 | }, 745 | "replace": { 746 | "guzzle/batch": "self.version", 747 | "guzzle/cache": "self.version", 748 | "guzzle/common": "self.version", 749 | "guzzle/http": "self.version", 750 | "guzzle/inflection": "self.version", 751 | "guzzle/iterator": "self.version", 752 | "guzzle/log": "self.version", 753 | "guzzle/parser": "self.version", 754 | "guzzle/plugin": "self.version", 755 | "guzzle/plugin-async": "self.version", 756 | "guzzle/plugin-backoff": "self.version", 757 | "guzzle/plugin-cache": "self.version", 758 | "guzzle/plugin-cookie": "self.version", 759 | "guzzle/plugin-curlauth": "self.version", 760 | "guzzle/plugin-error-response": "self.version", 761 | "guzzle/plugin-history": "self.version", 762 | "guzzle/plugin-log": "self.version", 763 | "guzzle/plugin-md5": "self.version", 764 | "guzzle/plugin-mock": "self.version", 765 | "guzzle/plugin-oauth": "self.version", 766 | "guzzle/service": "self.version", 767 | "guzzle/stream": "self.version" 768 | }, 769 | "require-dev": { 770 | "doctrine/cache": "~1.3", 771 | "monolog/monolog": "~1.0", 772 | "phpunit/phpunit": "3.7.*", 773 | "psr/log": "~1.0", 774 | "symfony/class-loader": "~2.1", 775 | "zendframework/zend-cache": "2.*,<2.3", 776 | "zendframework/zend-log": "2.*,<2.3" 777 | }, 778 | "suggest": { 779 | "guzzlehttp/guzzle": "Guzzle 5 has moved to a new package name. The package you have installed, Guzzle 3, is deprecated." 780 | }, 781 | "type": "library", 782 | "extra": { 783 | "branch-alias": { 784 | "dev-master": "3.9-dev" 785 | } 786 | }, 787 | "autoload": { 788 | "psr-0": { 789 | "Guzzle": "src/", 790 | "Guzzle\\Tests": "tests/" 791 | } 792 | }, 793 | "notification-url": "https://packagist.org/downloads/", 794 | "license": [ 795 | "MIT" 796 | ], 797 | "authors": [ 798 | { 799 | "name": "Michael Dowling", 800 | "email": "mtdowling@gmail.com", 801 | "homepage": "https://github.com/mtdowling" 802 | }, 803 | { 804 | "name": "Guzzle Community", 805 | "homepage": "https://github.com/guzzle/guzzle/contributors" 806 | } 807 | ], 808 | "description": "PHP HTTP client. This library is deprecated in favor of https://packagist.org/packages/guzzlehttp/guzzle", 809 | "homepage": "http://guzzlephp.org/", 810 | "keywords": [ 811 | "client", 812 | "curl", 813 | "framework", 814 | "http", 815 | "http client", 816 | "rest", 817 | "web service" 818 | ], 819 | "time": "2015-03-18 18:23:50" 820 | }, 821 | { 822 | "name": "hamcrest/hamcrest-php", 823 | "version": "v1.2.2", 824 | "source": { 825 | "type": "git", 826 | "url": "https://github.com/hamcrest/hamcrest-php.git", 827 | "reference": "b37020aa976fa52d3de9aa904aa2522dc518f79c" 828 | }, 829 | "dist": { 830 | "type": "zip", 831 | "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/b37020aa976fa52d3de9aa904aa2522dc518f79c", 832 | "reference": "b37020aa976fa52d3de9aa904aa2522dc518f79c", 833 | "shasum": "" 834 | }, 835 | "require": { 836 | "php": ">=5.3.2" 837 | }, 838 | "replace": { 839 | "cordoval/hamcrest-php": "*", 840 | "davedevelopment/hamcrest-php": "*", 841 | "kodova/hamcrest-php": "*" 842 | }, 843 | "require-dev": { 844 | "phpunit/php-file-iterator": "1.3.3", 845 | "satooshi/php-coveralls": "dev-master" 846 | }, 847 | "type": "library", 848 | "autoload": { 849 | "classmap": [ 850 | "hamcrest" 851 | ], 852 | "files": [ 853 | "hamcrest/Hamcrest.php" 854 | ] 855 | }, 856 | "notification-url": "https://packagist.org/downloads/", 857 | "license": [ 858 | "BSD" 859 | ], 860 | "description": "This is the PHP port of Hamcrest Matchers", 861 | "keywords": [ 862 | "test" 863 | ], 864 | "time": "2015-05-11 14:41:42" 865 | }, 866 | { 867 | "name": "mockery/mockery", 868 | "version": "0.9.4", 869 | "source": { 870 | "type": "git", 871 | "url": "https://github.com/padraic/mockery.git", 872 | "reference": "70bba85e4aabc9449626651f48b9018ede04f86b" 873 | }, 874 | "dist": { 875 | "type": "zip", 876 | "url": "https://api.github.com/repos/padraic/mockery/zipball/70bba85e4aabc9449626651f48b9018ede04f86b", 877 | "reference": "70bba85e4aabc9449626651f48b9018ede04f86b", 878 | "shasum": "" 879 | }, 880 | "require": { 881 | "hamcrest/hamcrest-php": "~1.1", 882 | "lib-pcre": ">=7.0", 883 | "php": ">=5.3.2" 884 | }, 885 | "require-dev": { 886 | "phpunit/phpunit": "~4.0" 887 | }, 888 | "type": "library", 889 | "extra": { 890 | "branch-alias": { 891 | "dev-master": "0.9.x-dev" 892 | } 893 | }, 894 | "autoload": { 895 | "psr-0": { 896 | "Mockery": "library/" 897 | } 898 | }, 899 | "notification-url": "https://packagist.org/downloads/", 900 | "license": [ 901 | "BSD-3-Clause" 902 | ], 903 | "authors": [ 904 | { 905 | "name": "Pádraic Brady", 906 | "email": "padraic.brady@gmail.com", 907 | "homepage": "http://blog.astrumfutura.com" 908 | }, 909 | { 910 | "name": "Dave Marshall", 911 | "email": "dave.marshall@atstsolutions.co.uk", 912 | "homepage": "http://davedevelopment.co.uk" 913 | } 914 | ], 915 | "description": "Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its core goal is to offer a test double framework with a succinct API capable of clearly defining all possible object operations and interactions using a human readable Domain Specific Language (DSL). Designed as a drop in alternative to PHPUnit's phpunit-mock-objects library, Mockery is easy to integrate with PHPUnit and can operate alongside phpunit-mock-objects without the World ending.", 916 | "homepage": "http://github.com/padraic/mockery", 917 | "keywords": [ 918 | "BDD", 919 | "TDD", 920 | "library", 921 | "mock", 922 | "mock objects", 923 | "mockery", 924 | "stub", 925 | "test", 926 | "test double", 927 | "testing" 928 | ], 929 | "time": "2015-04-02 19:54:00" 930 | }, 931 | { 932 | "name": "phpdocumentor/reflection-docblock", 933 | "version": "2.0.4", 934 | "source": { 935 | "type": "git", 936 | "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", 937 | "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8" 938 | }, 939 | "dist": { 940 | "type": "zip", 941 | "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8", 942 | "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8", 943 | "shasum": "" 944 | }, 945 | "require": { 946 | "php": ">=5.3.3" 947 | }, 948 | "require-dev": { 949 | "phpunit/phpunit": "~4.0" 950 | }, 951 | "suggest": { 952 | "dflydev/markdown": "~1.0", 953 | "erusev/parsedown": "~1.0" 954 | }, 955 | "type": "library", 956 | "extra": { 957 | "branch-alias": { 958 | "dev-master": "2.0.x-dev" 959 | } 960 | }, 961 | "autoload": { 962 | "psr-0": { 963 | "phpDocumentor": [ 964 | "src/" 965 | ] 966 | } 967 | }, 968 | "notification-url": "https://packagist.org/downloads/", 969 | "license": [ 970 | "MIT" 971 | ], 972 | "authors": [ 973 | { 974 | "name": "Mike van Riel", 975 | "email": "mike.vanriel@naenius.com" 976 | } 977 | ], 978 | "time": "2015-02-03 12:10:50" 979 | }, 980 | { 981 | "name": "phpspec/prophecy", 982 | "version": "v1.5.0", 983 | "source": { 984 | "type": "git", 985 | "url": "https://github.com/phpspec/prophecy.git", 986 | "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7" 987 | }, 988 | "dist": { 989 | "type": "zip", 990 | "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4745ded9307786b730d7a60df5cb5a6c43cf95f7", 991 | "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7", 992 | "shasum": "" 993 | }, 994 | "require": { 995 | "doctrine/instantiator": "^1.0.2", 996 | "phpdocumentor/reflection-docblock": "~2.0", 997 | "sebastian/comparator": "~1.1" 998 | }, 999 | "require-dev": { 1000 | "phpspec/phpspec": "~2.0" 1001 | }, 1002 | "type": "library", 1003 | "extra": { 1004 | "branch-alias": { 1005 | "dev-master": "1.4.x-dev" 1006 | } 1007 | }, 1008 | "autoload": { 1009 | "psr-0": { 1010 | "Prophecy\\": "src/" 1011 | } 1012 | }, 1013 | "notification-url": "https://packagist.org/downloads/", 1014 | "license": [ 1015 | "MIT" 1016 | ], 1017 | "authors": [ 1018 | { 1019 | "name": "Konstantin Kudryashov", 1020 | "email": "ever.zet@gmail.com", 1021 | "homepage": "http://everzet.com" 1022 | }, 1023 | { 1024 | "name": "Marcello Duarte", 1025 | "email": "marcello.duarte@gmail.com" 1026 | } 1027 | ], 1028 | "description": "Highly opinionated mocking framework for PHP 5.3+", 1029 | "homepage": "https://github.com/phpspec/prophecy", 1030 | "keywords": [ 1031 | "Double", 1032 | "Dummy", 1033 | "fake", 1034 | "mock", 1035 | "spy", 1036 | "stub" 1037 | ], 1038 | "time": "2015-08-13 10:07:40" 1039 | }, 1040 | { 1041 | "name": "phpunit/php-code-coverage", 1042 | "version": "2.2.4", 1043 | "source": { 1044 | "type": "git", 1045 | "url": "https://github.com/sebastianbergmann/php-code-coverage.git", 1046 | "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" 1047 | }, 1048 | "dist": { 1049 | "type": "zip", 1050 | "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", 1051 | "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", 1052 | "shasum": "" 1053 | }, 1054 | "require": { 1055 | "php": ">=5.3.3", 1056 | "phpunit/php-file-iterator": "~1.3", 1057 | "phpunit/php-text-template": "~1.2", 1058 | "phpunit/php-token-stream": "~1.3", 1059 | "sebastian/environment": "^1.3.2", 1060 | "sebastian/version": "~1.0" 1061 | }, 1062 | "require-dev": { 1063 | "ext-xdebug": ">=2.1.4", 1064 | "phpunit/phpunit": "~4" 1065 | }, 1066 | "suggest": { 1067 | "ext-dom": "*", 1068 | "ext-xdebug": ">=2.2.1", 1069 | "ext-xmlwriter": "*" 1070 | }, 1071 | "type": "library", 1072 | "extra": { 1073 | "branch-alias": { 1074 | "dev-master": "2.2.x-dev" 1075 | } 1076 | }, 1077 | "autoload": { 1078 | "classmap": [ 1079 | "src/" 1080 | ] 1081 | }, 1082 | "notification-url": "https://packagist.org/downloads/", 1083 | "license": [ 1084 | "BSD-3-Clause" 1085 | ], 1086 | "authors": [ 1087 | { 1088 | "name": "Sebastian Bergmann", 1089 | "email": "sb@sebastian-bergmann.de", 1090 | "role": "lead" 1091 | } 1092 | ], 1093 | "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", 1094 | "homepage": "https://github.com/sebastianbergmann/php-code-coverage", 1095 | "keywords": [ 1096 | "coverage", 1097 | "testing", 1098 | "xunit" 1099 | ], 1100 | "time": "2015-10-06 15:47:00" 1101 | }, 1102 | { 1103 | "name": "phpunit/php-file-iterator", 1104 | "version": "1.4.1", 1105 | "source": { 1106 | "type": "git", 1107 | "url": "https://github.com/sebastianbergmann/php-file-iterator.git", 1108 | "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0" 1109 | }, 1110 | "dist": { 1111 | "type": "zip", 1112 | "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0", 1113 | "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0", 1114 | "shasum": "" 1115 | }, 1116 | "require": { 1117 | "php": ">=5.3.3" 1118 | }, 1119 | "type": "library", 1120 | "extra": { 1121 | "branch-alias": { 1122 | "dev-master": "1.4.x-dev" 1123 | } 1124 | }, 1125 | "autoload": { 1126 | "classmap": [ 1127 | "src/" 1128 | ] 1129 | }, 1130 | "notification-url": "https://packagist.org/downloads/", 1131 | "license": [ 1132 | "BSD-3-Clause" 1133 | ], 1134 | "authors": [ 1135 | { 1136 | "name": "Sebastian Bergmann", 1137 | "email": "sb@sebastian-bergmann.de", 1138 | "role": "lead" 1139 | } 1140 | ], 1141 | "description": "FilterIterator implementation that filters files based on a list of suffixes.", 1142 | "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", 1143 | "keywords": [ 1144 | "filesystem", 1145 | "iterator" 1146 | ], 1147 | "time": "2015-06-21 13:08:43" 1148 | }, 1149 | { 1150 | "name": "phpunit/php-text-template", 1151 | "version": "1.2.1", 1152 | "source": { 1153 | "type": "git", 1154 | "url": "https://github.com/sebastianbergmann/php-text-template.git", 1155 | "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" 1156 | }, 1157 | "dist": { 1158 | "type": "zip", 1159 | "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", 1160 | "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", 1161 | "shasum": "" 1162 | }, 1163 | "require": { 1164 | "php": ">=5.3.3" 1165 | }, 1166 | "type": "library", 1167 | "autoload": { 1168 | "classmap": [ 1169 | "src/" 1170 | ] 1171 | }, 1172 | "notification-url": "https://packagist.org/downloads/", 1173 | "license": [ 1174 | "BSD-3-Clause" 1175 | ], 1176 | "authors": [ 1177 | { 1178 | "name": "Sebastian Bergmann", 1179 | "email": "sebastian@phpunit.de", 1180 | "role": "lead" 1181 | } 1182 | ], 1183 | "description": "Simple template engine.", 1184 | "homepage": "https://github.com/sebastianbergmann/php-text-template/", 1185 | "keywords": [ 1186 | "template" 1187 | ], 1188 | "time": "2015-06-21 13:50:34" 1189 | }, 1190 | { 1191 | "name": "phpunit/php-timer", 1192 | "version": "1.0.7", 1193 | "source": { 1194 | "type": "git", 1195 | "url": "https://github.com/sebastianbergmann/php-timer.git", 1196 | "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b" 1197 | }, 1198 | "dist": { 1199 | "type": "zip", 1200 | "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b", 1201 | "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b", 1202 | "shasum": "" 1203 | }, 1204 | "require": { 1205 | "php": ">=5.3.3" 1206 | }, 1207 | "type": "library", 1208 | "autoload": { 1209 | "classmap": [ 1210 | "src/" 1211 | ] 1212 | }, 1213 | "notification-url": "https://packagist.org/downloads/", 1214 | "license": [ 1215 | "BSD-3-Clause" 1216 | ], 1217 | "authors": [ 1218 | { 1219 | "name": "Sebastian Bergmann", 1220 | "email": "sb@sebastian-bergmann.de", 1221 | "role": "lead" 1222 | } 1223 | ], 1224 | "description": "Utility class for timing", 1225 | "homepage": "https://github.com/sebastianbergmann/php-timer/", 1226 | "keywords": [ 1227 | "timer" 1228 | ], 1229 | "time": "2015-06-21 08:01:12" 1230 | }, 1231 | { 1232 | "name": "phpunit/php-token-stream", 1233 | "version": "1.4.8", 1234 | "source": { 1235 | "type": "git", 1236 | "url": "https://github.com/sebastianbergmann/php-token-stream.git", 1237 | "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da" 1238 | }, 1239 | "dist": { 1240 | "type": "zip", 1241 | "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", 1242 | "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", 1243 | "shasum": "" 1244 | }, 1245 | "require": { 1246 | "ext-tokenizer": "*", 1247 | "php": ">=5.3.3" 1248 | }, 1249 | "require-dev": { 1250 | "phpunit/phpunit": "~4.2" 1251 | }, 1252 | "type": "library", 1253 | "extra": { 1254 | "branch-alias": { 1255 | "dev-master": "1.4-dev" 1256 | } 1257 | }, 1258 | "autoload": { 1259 | "classmap": [ 1260 | "src/" 1261 | ] 1262 | }, 1263 | "notification-url": "https://packagist.org/downloads/", 1264 | "license": [ 1265 | "BSD-3-Clause" 1266 | ], 1267 | "authors": [ 1268 | { 1269 | "name": "Sebastian Bergmann", 1270 | "email": "sebastian@phpunit.de" 1271 | } 1272 | ], 1273 | "description": "Wrapper around PHP's tokenizer extension.", 1274 | "homepage": "https://github.com/sebastianbergmann/php-token-stream/", 1275 | "keywords": [ 1276 | "tokenizer" 1277 | ], 1278 | "time": "2015-09-15 10:49:45" 1279 | }, 1280 | { 1281 | "name": "phpunit/phpunit", 1282 | "version": "4.8.18", 1283 | "source": { 1284 | "type": "git", 1285 | "url": "https://github.com/sebastianbergmann/phpunit.git", 1286 | "reference": "fa33d4ad96481b91df343d83e8c8aabed6b1dfd3" 1287 | }, 1288 | "dist": { 1289 | "type": "zip", 1290 | "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fa33d4ad96481b91df343d83e8c8aabed6b1dfd3", 1291 | "reference": "fa33d4ad96481b91df343d83e8c8aabed6b1dfd3", 1292 | "shasum": "" 1293 | }, 1294 | "require": { 1295 | "ext-dom": "*", 1296 | "ext-json": "*", 1297 | "ext-pcre": "*", 1298 | "ext-reflection": "*", 1299 | "ext-spl": "*", 1300 | "php": ">=5.3.3", 1301 | "phpspec/prophecy": "^1.3.1", 1302 | "phpunit/php-code-coverage": "~2.1", 1303 | "phpunit/php-file-iterator": "~1.4", 1304 | "phpunit/php-text-template": "~1.2", 1305 | "phpunit/php-timer": ">=1.0.6", 1306 | "phpunit/phpunit-mock-objects": "~2.3", 1307 | "sebastian/comparator": "~1.1", 1308 | "sebastian/diff": "~1.2", 1309 | "sebastian/environment": "~1.3", 1310 | "sebastian/exporter": "~1.2", 1311 | "sebastian/global-state": "~1.0", 1312 | "sebastian/version": "~1.0", 1313 | "symfony/yaml": "~2.1|~3.0" 1314 | }, 1315 | "suggest": { 1316 | "phpunit/php-invoker": "~1.1" 1317 | }, 1318 | "bin": [ 1319 | "phpunit" 1320 | ], 1321 | "type": "library", 1322 | "extra": { 1323 | "branch-alias": { 1324 | "dev-master": "4.8.x-dev" 1325 | } 1326 | }, 1327 | "autoload": { 1328 | "classmap": [ 1329 | "src/" 1330 | ] 1331 | }, 1332 | "notification-url": "https://packagist.org/downloads/", 1333 | "license": [ 1334 | "BSD-3-Clause" 1335 | ], 1336 | "authors": [ 1337 | { 1338 | "name": "Sebastian Bergmann", 1339 | "email": "sebastian@phpunit.de", 1340 | "role": "lead" 1341 | } 1342 | ], 1343 | "description": "The PHP Unit Testing framework.", 1344 | "homepage": "https://phpunit.de/", 1345 | "keywords": [ 1346 | "phpunit", 1347 | "testing", 1348 | "xunit" 1349 | ], 1350 | "time": "2015-11-11 11:32:49" 1351 | }, 1352 | { 1353 | "name": "phpunit/phpunit-mock-objects", 1354 | "version": "2.3.8", 1355 | "source": { 1356 | "type": "git", 1357 | "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", 1358 | "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" 1359 | }, 1360 | "dist": { 1361 | "type": "zip", 1362 | "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", 1363 | "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", 1364 | "shasum": "" 1365 | }, 1366 | "require": { 1367 | "doctrine/instantiator": "^1.0.2", 1368 | "php": ">=5.3.3", 1369 | "phpunit/php-text-template": "~1.2", 1370 | "sebastian/exporter": "~1.2" 1371 | }, 1372 | "require-dev": { 1373 | "phpunit/phpunit": "~4.4" 1374 | }, 1375 | "suggest": { 1376 | "ext-soap": "*" 1377 | }, 1378 | "type": "library", 1379 | "extra": { 1380 | "branch-alias": { 1381 | "dev-master": "2.3.x-dev" 1382 | } 1383 | }, 1384 | "autoload": { 1385 | "classmap": [ 1386 | "src/" 1387 | ] 1388 | }, 1389 | "notification-url": "https://packagist.org/downloads/", 1390 | "license": [ 1391 | "BSD-3-Clause" 1392 | ], 1393 | "authors": [ 1394 | { 1395 | "name": "Sebastian Bergmann", 1396 | "email": "sb@sebastian-bergmann.de", 1397 | "role": "lead" 1398 | } 1399 | ], 1400 | "description": "Mock Object library for PHPUnit", 1401 | "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", 1402 | "keywords": [ 1403 | "mock", 1404 | "xunit" 1405 | ], 1406 | "time": "2015-10-02 06:51:40" 1407 | }, 1408 | { 1409 | "name": "psr/log", 1410 | "version": "1.0.0", 1411 | "source": { 1412 | "type": "git", 1413 | "url": "https://github.com/php-fig/log.git", 1414 | "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b" 1415 | }, 1416 | "dist": { 1417 | "type": "zip", 1418 | "url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b", 1419 | "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b", 1420 | "shasum": "" 1421 | }, 1422 | "type": "library", 1423 | "autoload": { 1424 | "psr-0": { 1425 | "Psr\\Log\\": "" 1426 | } 1427 | }, 1428 | "notification-url": "https://packagist.org/downloads/", 1429 | "license": [ 1430 | "MIT" 1431 | ], 1432 | "authors": [ 1433 | { 1434 | "name": "PHP-FIG", 1435 | "homepage": "http://www.php-fig.org/" 1436 | } 1437 | ], 1438 | "description": "Common interface for logging libraries", 1439 | "keywords": [ 1440 | "log", 1441 | "psr", 1442 | "psr-3" 1443 | ], 1444 | "time": "2012-12-21 11:40:51" 1445 | }, 1446 | { 1447 | "name": "satooshi/php-coveralls", 1448 | "version": "v0.6.1", 1449 | "source": { 1450 | "type": "git", 1451 | "url": "https://github.com/satooshi/php-coveralls.git", 1452 | "reference": "dd0df95bd37a7cf5c5c50304dfe260ffe4b50760" 1453 | }, 1454 | "dist": { 1455 | "type": "zip", 1456 | "url": "https://api.github.com/repos/satooshi/php-coveralls/zipball/dd0df95bd37a7cf5c5c50304dfe260ffe4b50760", 1457 | "reference": "dd0df95bd37a7cf5c5c50304dfe260ffe4b50760", 1458 | "shasum": "" 1459 | }, 1460 | "require": { 1461 | "ext-curl": "*", 1462 | "ext-json": "*", 1463 | "ext-simplexml": "*", 1464 | "guzzle/guzzle": ">=3.0", 1465 | "php": ">=5.3", 1466 | "psr/log": "1.0.0", 1467 | "symfony/config": ">=2.0", 1468 | "symfony/console": ">=2.0", 1469 | "symfony/stopwatch": ">=2.2", 1470 | "symfony/yaml": ">=2.0" 1471 | }, 1472 | "require-dev": { 1473 | "apigen/apigen": "2.8.*@stable", 1474 | "pdepend/pdepend": "dev-master", 1475 | "phpmd/phpmd": "dev-master", 1476 | "phpunit/php-invoker": ">=1.1.0,<1.2.0", 1477 | "phpunit/phpunit": "3.7.*@stable", 1478 | "sebastian/finder-facade": "dev-master", 1479 | "sebastian/phpcpd": "1.4.*@stable", 1480 | "squizlabs/php_codesniffer": "1.4.*@stable", 1481 | "theseer/fdomdocument": "dev-master" 1482 | }, 1483 | "bin": [ 1484 | "composer/bin/coveralls" 1485 | ], 1486 | "type": "library", 1487 | "autoload": { 1488 | "psr-0": { 1489 | "Contrib\\Component": "src/", 1490 | "Contrib\\Bundle": "src/" 1491 | } 1492 | }, 1493 | "notification-url": "https://packagist.org/downloads/", 1494 | "license": [ 1495 | "MIT" 1496 | ], 1497 | "authors": [ 1498 | { 1499 | "name": "Kitamura Satoshi", 1500 | "email": "with.no.parachute@gmail.com", 1501 | "homepage": "https://www.facebook.com/satooshi.jp" 1502 | } 1503 | ], 1504 | "description": "PHP client library for Coveralls API", 1505 | "homepage": "https://github.com/satooshi/php-coveralls", 1506 | "keywords": [ 1507 | "ci", 1508 | "coverage", 1509 | "github", 1510 | "test" 1511 | ], 1512 | "time": "2013-05-04 08:07:33" 1513 | }, 1514 | { 1515 | "name": "sebastian/comparator", 1516 | "version": "1.2.0", 1517 | "source": { 1518 | "type": "git", 1519 | "url": "https://github.com/sebastianbergmann/comparator.git", 1520 | "reference": "937efb279bd37a375bcadf584dec0726f84dbf22" 1521 | }, 1522 | "dist": { 1523 | "type": "zip", 1524 | "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22", 1525 | "reference": "937efb279bd37a375bcadf584dec0726f84dbf22", 1526 | "shasum": "" 1527 | }, 1528 | "require": { 1529 | "php": ">=5.3.3", 1530 | "sebastian/diff": "~1.2", 1531 | "sebastian/exporter": "~1.2" 1532 | }, 1533 | "require-dev": { 1534 | "phpunit/phpunit": "~4.4" 1535 | }, 1536 | "type": "library", 1537 | "extra": { 1538 | "branch-alias": { 1539 | "dev-master": "1.2.x-dev" 1540 | } 1541 | }, 1542 | "autoload": { 1543 | "classmap": [ 1544 | "src/" 1545 | ] 1546 | }, 1547 | "notification-url": "https://packagist.org/downloads/", 1548 | "license": [ 1549 | "BSD-3-Clause" 1550 | ], 1551 | "authors": [ 1552 | { 1553 | "name": "Jeff Welch", 1554 | "email": "whatthejeff@gmail.com" 1555 | }, 1556 | { 1557 | "name": "Volker Dusch", 1558 | "email": "github@wallbash.com" 1559 | }, 1560 | { 1561 | "name": "Bernhard Schussek", 1562 | "email": "bschussek@2bepublished.at" 1563 | }, 1564 | { 1565 | "name": "Sebastian Bergmann", 1566 | "email": "sebastian@phpunit.de" 1567 | } 1568 | ], 1569 | "description": "Provides the functionality to compare PHP values for equality", 1570 | "homepage": "http://www.github.com/sebastianbergmann/comparator", 1571 | "keywords": [ 1572 | "comparator", 1573 | "compare", 1574 | "equality" 1575 | ], 1576 | "time": "2015-07-26 15:48:44" 1577 | }, 1578 | { 1579 | "name": "sebastian/diff", 1580 | "version": "1.3.0", 1581 | "source": { 1582 | "type": "git", 1583 | "url": "https://github.com/sebastianbergmann/diff.git", 1584 | "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3" 1585 | }, 1586 | "dist": { 1587 | "type": "zip", 1588 | "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/863df9687835c62aa423a22412d26fa2ebde3fd3", 1589 | "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3", 1590 | "shasum": "" 1591 | }, 1592 | "require": { 1593 | "php": ">=5.3.3" 1594 | }, 1595 | "require-dev": { 1596 | "phpunit/phpunit": "~4.2" 1597 | }, 1598 | "type": "library", 1599 | "extra": { 1600 | "branch-alias": { 1601 | "dev-master": "1.3-dev" 1602 | } 1603 | }, 1604 | "autoload": { 1605 | "classmap": [ 1606 | "src/" 1607 | ] 1608 | }, 1609 | "notification-url": "https://packagist.org/downloads/", 1610 | "license": [ 1611 | "BSD-3-Clause" 1612 | ], 1613 | "authors": [ 1614 | { 1615 | "name": "Kore Nordmann", 1616 | "email": "mail@kore-nordmann.de" 1617 | }, 1618 | { 1619 | "name": "Sebastian Bergmann", 1620 | "email": "sebastian@phpunit.de" 1621 | } 1622 | ], 1623 | "description": "Diff implementation", 1624 | "homepage": "http://www.github.com/sebastianbergmann/diff", 1625 | "keywords": [ 1626 | "diff" 1627 | ], 1628 | "time": "2015-02-22 15:13:53" 1629 | }, 1630 | { 1631 | "name": "sebastian/environment", 1632 | "version": "1.3.2", 1633 | "source": { 1634 | "type": "git", 1635 | "url": "https://github.com/sebastianbergmann/environment.git", 1636 | "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44" 1637 | }, 1638 | "dist": { 1639 | "type": "zip", 1640 | "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6324c907ce7a52478eeeaede764f48733ef5ae44", 1641 | "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44", 1642 | "shasum": "" 1643 | }, 1644 | "require": { 1645 | "php": ">=5.3.3" 1646 | }, 1647 | "require-dev": { 1648 | "phpunit/phpunit": "~4.4" 1649 | }, 1650 | "type": "library", 1651 | "extra": { 1652 | "branch-alias": { 1653 | "dev-master": "1.3.x-dev" 1654 | } 1655 | }, 1656 | "autoload": { 1657 | "classmap": [ 1658 | "src/" 1659 | ] 1660 | }, 1661 | "notification-url": "https://packagist.org/downloads/", 1662 | "license": [ 1663 | "BSD-3-Clause" 1664 | ], 1665 | "authors": [ 1666 | { 1667 | "name": "Sebastian Bergmann", 1668 | "email": "sebastian@phpunit.de" 1669 | } 1670 | ], 1671 | "description": "Provides functionality to handle HHVM/PHP environments", 1672 | "homepage": "http://www.github.com/sebastianbergmann/environment", 1673 | "keywords": [ 1674 | "Xdebug", 1675 | "environment", 1676 | "hhvm" 1677 | ], 1678 | "time": "2015-08-03 06:14:51" 1679 | }, 1680 | { 1681 | "name": "sebastian/exporter", 1682 | "version": "1.2.1", 1683 | "source": { 1684 | "type": "git", 1685 | "url": "https://github.com/sebastianbergmann/exporter.git", 1686 | "reference": "7ae5513327cb536431847bcc0c10edba2701064e" 1687 | }, 1688 | "dist": { 1689 | "type": "zip", 1690 | "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/7ae5513327cb536431847bcc0c10edba2701064e", 1691 | "reference": "7ae5513327cb536431847bcc0c10edba2701064e", 1692 | "shasum": "" 1693 | }, 1694 | "require": { 1695 | "php": ">=5.3.3", 1696 | "sebastian/recursion-context": "~1.0" 1697 | }, 1698 | "require-dev": { 1699 | "phpunit/phpunit": "~4.4" 1700 | }, 1701 | "type": "library", 1702 | "extra": { 1703 | "branch-alias": { 1704 | "dev-master": "1.2.x-dev" 1705 | } 1706 | }, 1707 | "autoload": { 1708 | "classmap": [ 1709 | "src/" 1710 | ] 1711 | }, 1712 | "notification-url": "https://packagist.org/downloads/", 1713 | "license": [ 1714 | "BSD-3-Clause" 1715 | ], 1716 | "authors": [ 1717 | { 1718 | "name": "Jeff Welch", 1719 | "email": "whatthejeff@gmail.com" 1720 | }, 1721 | { 1722 | "name": "Volker Dusch", 1723 | "email": "github@wallbash.com" 1724 | }, 1725 | { 1726 | "name": "Bernhard Schussek", 1727 | "email": "bschussek@2bepublished.at" 1728 | }, 1729 | { 1730 | "name": "Sebastian Bergmann", 1731 | "email": "sebastian@phpunit.de" 1732 | }, 1733 | { 1734 | "name": "Adam Harvey", 1735 | "email": "aharvey@php.net" 1736 | } 1737 | ], 1738 | "description": "Provides the functionality to export PHP variables for visualization", 1739 | "homepage": "http://www.github.com/sebastianbergmann/exporter", 1740 | "keywords": [ 1741 | "export", 1742 | "exporter" 1743 | ], 1744 | "time": "2015-06-21 07:55:53" 1745 | }, 1746 | { 1747 | "name": "sebastian/global-state", 1748 | "version": "1.1.1", 1749 | "source": { 1750 | "type": "git", 1751 | "url": "https://github.com/sebastianbergmann/global-state.git", 1752 | "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" 1753 | }, 1754 | "dist": { 1755 | "type": "zip", 1756 | "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", 1757 | "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", 1758 | "shasum": "" 1759 | }, 1760 | "require": { 1761 | "php": ">=5.3.3" 1762 | }, 1763 | "require-dev": { 1764 | "phpunit/phpunit": "~4.2" 1765 | }, 1766 | "suggest": { 1767 | "ext-uopz": "*" 1768 | }, 1769 | "type": "library", 1770 | "extra": { 1771 | "branch-alias": { 1772 | "dev-master": "1.0-dev" 1773 | } 1774 | }, 1775 | "autoload": { 1776 | "classmap": [ 1777 | "src/" 1778 | ] 1779 | }, 1780 | "notification-url": "https://packagist.org/downloads/", 1781 | "license": [ 1782 | "BSD-3-Clause" 1783 | ], 1784 | "authors": [ 1785 | { 1786 | "name": "Sebastian Bergmann", 1787 | "email": "sebastian@phpunit.de" 1788 | } 1789 | ], 1790 | "description": "Snapshotting of global state", 1791 | "homepage": "http://www.github.com/sebastianbergmann/global-state", 1792 | "keywords": [ 1793 | "global state" 1794 | ], 1795 | "time": "2015-10-12 03:26:01" 1796 | }, 1797 | { 1798 | "name": "sebastian/recursion-context", 1799 | "version": "1.0.1", 1800 | "source": { 1801 | "type": "git", 1802 | "url": "https://github.com/sebastianbergmann/recursion-context.git", 1803 | "reference": "994d4a811bafe801fb06dccbee797863ba2792ba" 1804 | }, 1805 | "dist": { 1806 | "type": "zip", 1807 | "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/994d4a811bafe801fb06dccbee797863ba2792ba", 1808 | "reference": "994d4a811bafe801fb06dccbee797863ba2792ba", 1809 | "shasum": "" 1810 | }, 1811 | "require": { 1812 | "php": ">=5.3.3" 1813 | }, 1814 | "require-dev": { 1815 | "phpunit/phpunit": "~4.4" 1816 | }, 1817 | "type": "library", 1818 | "extra": { 1819 | "branch-alias": { 1820 | "dev-master": "1.0.x-dev" 1821 | } 1822 | }, 1823 | "autoload": { 1824 | "classmap": [ 1825 | "src/" 1826 | ] 1827 | }, 1828 | "notification-url": "https://packagist.org/downloads/", 1829 | "license": [ 1830 | "BSD-3-Clause" 1831 | ], 1832 | "authors": [ 1833 | { 1834 | "name": "Jeff Welch", 1835 | "email": "whatthejeff@gmail.com" 1836 | }, 1837 | { 1838 | "name": "Sebastian Bergmann", 1839 | "email": "sebastian@phpunit.de" 1840 | }, 1841 | { 1842 | "name": "Adam Harvey", 1843 | "email": "aharvey@php.net" 1844 | } 1845 | ], 1846 | "description": "Provides functionality to recursively process PHP variables", 1847 | "homepage": "http://www.github.com/sebastianbergmann/recursion-context", 1848 | "time": "2015-06-21 08:04:50" 1849 | }, 1850 | { 1851 | "name": "sebastian/version", 1852 | "version": "1.0.6", 1853 | "source": { 1854 | "type": "git", 1855 | "url": "https://github.com/sebastianbergmann/version.git", 1856 | "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" 1857 | }, 1858 | "dist": { 1859 | "type": "zip", 1860 | "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", 1861 | "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", 1862 | "shasum": "" 1863 | }, 1864 | "type": "library", 1865 | "autoload": { 1866 | "classmap": [ 1867 | "src/" 1868 | ] 1869 | }, 1870 | "notification-url": "https://packagist.org/downloads/", 1871 | "license": [ 1872 | "BSD-3-Clause" 1873 | ], 1874 | "authors": [ 1875 | { 1876 | "name": "Sebastian Bergmann", 1877 | "email": "sebastian@phpunit.de", 1878 | "role": "lead" 1879 | } 1880 | ], 1881 | "description": "Library that helps with managing the version number of Git-hosted PHP projects", 1882 | "homepage": "https://github.com/sebastianbergmann/version", 1883 | "time": "2015-06-21 13:59:46" 1884 | }, 1885 | { 1886 | "name": "symfony/config", 1887 | "version": "v2.7.6", 1888 | "source": { 1889 | "type": "git", 1890 | "url": "https://github.com/symfony/config.git", 1891 | "reference": "831f88908b51b9ce945f5e6f402931d1ac544423" 1892 | }, 1893 | "dist": { 1894 | "type": "zip", 1895 | "url": "https://api.github.com/repos/symfony/config/zipball/831f88908b51b9ce945f5e6f402931d1ac544423", 1896 | "reference": "831f88908b51b9ce945f5e6f402931d1ac544423", 1897 | "shasum": "" 1898 | }, 1899 | "require": { 1900 | "php": ">=5.3.9", 1901 | "symfony/filesystem": "~2.3" 1902 | }, 1903 | "type": "library", 1904 | "extra": { 1905 | "branch-alias": { 1906 | "dev-master": "2.7-dev" 1907 | } 1908 | }, 1909 | "autoload": { 1910 | "psr-4": { 1911 | "Symfony\\Component\\Config\\": "" 1912 | } 1913 | }, 1914 | "notification-url": "https://packagist.org/downloads/", 1915 | "license": [ 1916 | "MIT" 1917 | ], 1918 | "authors": [ 1919 | { 1920 | "name": "Fabien Potencier", 1921 | "email": "fabien@symfony.com" 1922 | }, 1923 | { 1924 | "name": "Symfony Community", 1925 | "homepage": "https://symfony.com/contributors" 1926 | } 1927 | ], 1928 | "description": "Symfony Config Component", 1929 | "homepage": "https://symfony.com", 1930 | "time": "2015-10-11 09:39:48" 1931 | }, 1932 | { 1933 | "name": "symfony/event-dispatcher", 1934 | "version": "v2.7.6", 1935 | "source": { 1936 | "type": "git", 1937 | "url": "https://github.com/symfony/event-dispatcher.git", 1938 | "reference": "87a5db5ea887763fa3a31a5471b512ff1596d9b8" 1939 | }, 1940 | "dist": { 1941 | "type": "zip", 1942 | "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/87a5db5ea887763fa3a31a5471b512ff1596d9b8", 1943 | "reference": "87a5db5ea887763fa3a31a5471b512ff1596d9b8", 1944 | "shasum": "" 1945 | }, 1946 | "require": { 1947 | "php": ">=5.3.9" 1948 | }, 1949 | "require-dev": { 1950 | "psr/log": "~1.0", 1951 | "symfony/config": "~2.0,>=2.0.5", 1952 | "symfony/dependency-injection": "~2.6", 1953 | "symfony/expression-language": "~2.6", 1954 | "symfony/stopwatch": "~2.3" 1955 | }, 1956 | "suggest": { 1957 | "symfony/dependency-injection": "", 1958 | "symfony/http-kernel": "" 1959 | }, 1960 | "type": "library", 1961 | "extra": { 1962 | "branch-alias": { 1963 | "dev-master": "2.7-dev" 1964 | } 1965 | }, 1966 | "autoload": { 1967 | "psr-4": { 1968 | "Symfony\\Component\\EventDispatcher\\": "" 1969 | } 1970 | }, 1971 | "notification-url": "https://packagist.org/downloads/", 1972 | "license": [ 1973 | "MIT" 1974 | ], 1975 | "authors": [ 1976 | { 1977 | "name": "Fabien Potencier", 1978 | "email": "fabien@symfony.com" 1979 | }, 1980 | { 1981 | "name": "Symfony Community", 1982 | "homepage": "https://symfony.com/contributors" 1983 | } 1984 | ], 1985 | "description": "Symfony EventDispatcher Component", 1986 | "homepage": "https://symfony.com", 1987 | "time": "2015-10-11 09:39:48" 1988 | }, 1989 | { 1990 | "name": "symfony/filesystem", 1991 | "version": "v2.7.6", 1992 | "source": { 1993 | "type": "git", 1994 | "url": "https://github.com/symfony/filesystem.git", 1995 | "reference": "56fd6df73be859323ff97418d97edc1d756df6df" 1996 | }, 1997 | "dist": { 1998 | "type": "zip", 1999 | "url": "https://api.github.com/repos/symfony/filesystem/zipball/56fd6df73be859323ff97418d97edc1d756df6df", 2000 | "reference": "56fd6df73be859323ff97418d97edc1d756df6df", 2001 | "shasum": "" 2002 | }, 2003 | "require": { 2004 | "php": ">=5.3.9" 2005 | }, 2006 | "type": "library", 2007 | "extra": { 2008 | "branch-alias": { 2009 | "dev-master": "2.7-dev" 2010 | } 2011 | }, 2012 | "autoload": { 2013 | "psr-4": { 2014 | "Symfony\\Component\\Filesystem\\": "" 2015 | } 2016 | }, 2017 | "notification-url": "https://packagist.org/downloads/", 2018 | "license": [ 2019 | "MIT" 2020 | ], 2021 | "authors": [ 2022 | { 2023 | "name": "Fabien Potencier", 2024 | "email": "fabien@symfony.com" 2025 | }, 2026 | { 2027 | "name": "Symfony Community", 2028 | "homepage": "https://symfony.com/contributors" 2029 | } 2030 | ], 2031 | "description": "Symfony Filesystem Component", 2032 | "homepage": "https://symfony.com", 2033 | "time": "2015-10-18 20:23:18" 2034 | }, 2035 | { 2036 | "name": "symfony/stopwatch", 2037 | "version": "v2.7.6", 2038 | "source": { 2039 | "type": "git", 2040 | "url": "https://github.com/symfony/stopwatch.git", 2041 | "reference": "f8ab957c17e4b85a73c4df03bdf94ee597f2bd55" 2042 | }, 2043 | "dist": { 2044 | "type": "zip", 2045 | "url": "https://api.github.com/repos/symfony/stopwatch/zipball/f8ab957c17e4b85a73c4df03bdf94ee597f2bd55", 2046 | "reference": "f8ab957c17e4b85a73c4df03bdf94ee597f2bd55", 2047 | "shasum": "" 2048 | }, 2049 | "require": { 2050 | "php": ">=5.3.9" 2051 | }, 2052 | "type": "library", 2053 | "extra": { 2054 | "branch-alias": { 2055 | "dev-master": "2.7-dev" 2056 | } 2057 | }, 2058 | "autoload": { 2059 | "psr-4": { 2060 | "Symfony\\Component\\Stopwatch\\": "" 2061 | } 2062 | }, 2063 | "notification-url": "https://packagist.org/downloads/", 2064 | "license": [ 2065 | "MIT" 2066 | ], 2067 | "authors": [ 2068 | { 2069 | "name": "Fabien Potencier", 2070 | "email": "fabien@symfony.com" 2071 | }, 2072 | { 2073 | "name": "Symfony Community", 2074 | "homepage": "https://symfony.com/contributors" 2075 | } 2076 | ], 2077 | "description": "Symfony Stopwatch Component", 2078 | "homepage": "https://symfony.com", 2079 | "time": "2015-10-12 12:42:24" 2080 | }, 2081 | { 2082 | "name": "symfony/yaml", 2083 | "version": "v2.7.6", 2084 | "source": { 2085 | "type": "git", 2086 | "url": "https://github.com/symfony/yaml.git", 2087 | "reference": "eca9019c88fbe250164affd107bc8057771f3f4d" 2088 | }, 2089 | "dist": { 2090 | "type": "zip", 2091 | "url": "https://api.github.com/repos/symfony/yaml/zipball/eca9019c88fbe250164affd107bc8057771f3f4d", 2092 | "reference": "eca9019c88fbe250164affd107bc8057771f3f4d", 2093 | "shasum": "" 2094 | }, 2095 | "require": { 2096 | "php": ">=5.3.9" 2097 | }, 2098 | "type": "library", 2099 | "extra": { 2100 | "branch-alias": { 2101 | "dev-master": "2.7-dev" 2102 | } 2103 | }, 2104 | "autoload": { 2105 | "psr-4": { 2106 | "Symfony\\Component\\Yaml\\": "" 2107 | } 2108 | }, 2109 | "notification-url": "https://packagist.org/downloads/", 2110 | "license": [ 2111 | "MIT" 2112 | ], 2113 | "authors": [ 2114 | { 2115 | "name": "Fabien Potencier", 2116 | "email": "fabien@symfony.com" 2117 | }, 2118 | { 2119 | "name": "Symfony Community", 2120 | "homepage": "https://symfony.com/contributors" 2121 | } 2122 | ], 2123 | "description": "Symfony Yaml Component", 2124 | "homepage": "https://symfony.com", 2125 | "time": "2015-10-11 09:39:48" 2126 | } 2127 | ], 2128 | "aliases": [], 2129 | "minimum-stability": "stable", 2130 | "stability-flags": { 2131 | "codeclimate/php-test-reporter": 20 2132 | }, 2133 | "prefer-stable": false, 2134 | "prefer-lowest": false, 2135 | "platform": [], 2136 | "platform-dev": [] 2137 | } 2138 | -------------------------------------------------------------------------------- /phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | ./tests 10 | 11 | 12 | 13 | 14 | ./src 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/ArrayHydrator.php: -------------------------------------------------------------------------------- 1 | entityManager = $entityManager; 56 | } 57 | 58 | /** 59 | * @param $entity 60 | * @param array $data 61 | * @return mixed|object 62 | * @throws Exception 63 | */ 64 | public function hydrate($entity, array $data) 65 | { 66 | if (is_string($entity) && class_exists($entity)) { 67 | $entity = new $entity; 68 | } 69 | elseif (!is_object($entity)) { 70 | throw new Exception('Entity passed to ArrayHydrator::hydrate() must be a class name or entity object'); 71 | } 72 | 73 | $entity = $this->hydrateProperties($entity, $data); 74 | $entity = $this->hydrateAssociations($entity, $data); 75 | return $entity; 76 | } 77 | 78 | /** 79 | * @param boolean $hydrateAssociationReferences 80 | */ 81 | public function setHydrateAssociationReferences($hydrateAssociationReferences) 82 | { 83 | $this->hydrateAssociationReferences = $hydrateAssociationReferences; 84 | } 85 | 86 | /** 87 | * @param bool $hydrateId 88 | */ 89 | public function setHydrateId($hydrateId) 90 | { 91 | $this->hydrateId = $hydrateId; 92 | } 93 | 94 | /** 95 | * @param int $hydrateBy 96 | */ 97 | public function setHydrateBy($hydrateBy) 98 | { 99 | $this->hydrateBy = $hydrateBy; 100 | } 101 | 102 | /** 103 | * @param object $entity the doctrine entity 104 | * @param array $data 105 | * @return object 106 | */ 107 | protected function hydrateProperties($entity, $data) 108 | { 109 | $reflectionObject = new \ReflectionObject($entity); 110 | 111 | $metaData = $this->entityManager->getClassMetadata(get_class($entity)); 112 | 113 | $platform = $this->entityManager->getConnection() 114 | ->getDatabasePlatform(); 115 | 116 | $skipFields = $this->hydrateId ? [] : $metaData->identifier; 117 | 118 | foreach ($metaData->fieldNames as $fieldName) { 119 | $dataKey = $this->hydrateBy === self::HYDRATE_BY_FIELD ? $fieldName : $metaData->getColumnName($fieldName); 120 | 121 | if (array_key_exists($dataKey, $data) && !in_array($fieldName, $skipFields, true)) { 122 | $value = $data[$dataKey]; 123 | 124 | if (array_key_exists('type', $metaData->fieldMappings[$fieldName])) { 125 | $fieldType = $metaData->fieldMappings[$fieldName]['type']; 126 | 127 | $type = Type::getType($fieldType); 128 | 129 | $value = $type->convertToPHPValue($value, $platform); 130 | } 131 | 132 | $entity = $this->setProperty($entity, $fieldName, $value, $reflectionObject); 133 | } 134 | } 135 | 136 | return $entity; 137 | } 138 | 139 | /** 140 | * @param $entity 141 | * @param $data 142 | * @return mixed 143 | */ 144 | protected function hydrateAssociations($entity, $data) 145 | { 146 | $metaData = $this->entityManager->getClassMetadata(get_class($entity)); 147 | foreach ($metaData->associationMappings as $fieldName => $mapping) { 148 | $associationData = $this->getAssociatedId($fieldName, $mapping, $data); 149 | if (!empty($associationData)) { 150 | if (in_array($mapping['type'], [ClassMetadataInfo::ONE_TO_ONE, ClassMetadataInfo::MANY_TO_ONE])) { 151 | $entity = $this->hydrateToOneAssociation($entity, $fieldName, $mapping, $associationData); 152 | } 153 | 154 | if (in_array($mapping['type'], [ClassMetadataInfo::ONE_TO_MANY, ClassMetadataInfo::MANY_TO_MANY])) { 155 | $entity = $this->hydrateToManyAssociation($entity, $fieldName, $mapping, $associationData); 156 | } 157 | } 158 | } 159 | 160 | return $entity; 161 | } 162 | 163 | /** 164 | * Retrieves the associated entity's id from $data 165 | * 166 | * @param string $fieldName name of field that stores the associated entity 167 | * @param array $mapping doctrine's association mapping array for the field 168 | * @param array $data the hydration data 169 | * 170 | * @return mixed null, if the association is not found 171 | */ 172 | protected function getAssociatedId($fieldName, $mapping, $data) 173 | { 174 | if ($this->hydrateBy === self::HYDRATE_BY_FIELD) { 175 | 176 | return isset($data[$fieldName]) ? $data[$fieldName] : null; 177 | } 178 | 179 | // from this point it is self::HYDRATE_BY_COLUMN 180 | // we do not support compound foreign keys (yet) 181 | if (isset($mapping['joinColumns']) && count($mapping['joinColumns']) === 1) { 182 | $columnName = $mapping['joinColumns'][0]['name']; 183 | 184 | return isset($data[$columnName]) ? $data[$columnName] : null; 185 | } 186 | 187 | // If joinColumns does not exist, then this is not the owning side of an association 188 | // This should not happen with column based hydration 189 | return null; 190 | } 191 | 192 | /** 193 | * @param $entity 194 | * @param $propertyName 195 | * @param $mapping 196 | * @param $value 197 | * @return mixed 198 | */ 199 | protected function hydrateToOneAssociation($entity, $propertyName, $mapping, $value) 200 | { 201 | $reflectionObject = new \ReflectionObject($entity); 202 | 203 | $toOneAssociationObject = $this->fetchAssociationEntity($mapping['targetEntity'], $value); 204 | if (!is_null($toOneAssociationObject)) { 205 | $entity = $this->setProperty($entity, $propertyName, $toOneAssociationObject, $reflectionObject); 206 | } 207 | 208 | return $entity; 209 | } 210 | 211 | /** 212 | * @param $entity 213 | * @param $propertyName 214 | * @param $mapping 215 | * @param $value 216 | * @return mixed 217 | */ 218 | protected function hydrateToManyAssociation($entity, $propertyName, $mapping, $value) 219 | { 220 | $reflectionObject = new \ReflectionObject($entity); 221 | $values = is_array($value) ? $value : [$value]; 222 | 223 | $assocationObjects = []; 224 | foreach ($values as $value) { 225 | if (is_array($value)) { 226 | $assocationObjects[] = $this->hydrate($mapping['targetEntity'], $value); 227 | } 228 | elseif ($associationObject = $this->fetchAssociationEntity($mapping['targetEntity'], $value)) { 229 | $assocationObjects[] = $associationObject; 230 | } 231 | } 232 | 233 | $entity = $this->setProperty($entity, $propertyName, $assocationObjects, $reflectionObject); 234 | 235 | return $entity; 236 | } 237 | 238 | /** 239 | * @param $entity 240 | * @param $propertyName 241 | * @param $value 242 | * @param null $reflectionObject 243 | * @return mixed 244 | */ 245 | protected function setProperty($entity, $propertyName, $value, $reflectionObject = null) 246 | { 247 | $reflectionObject = is_null($reflectionObject) ? new \ReflectionObject($entity) : $reflectionObject; 248 | $property = $reflectionObject->getProperty($propertyName); 249 | $property->setAccessible(true); 250 | $property->setValue($entity, $value); 251 | return $entity; 252 | } 253 | 254 | /** 255 | * @param $className 256 | * @param $id 257 | * @return bool|\Doctrine\Common\Proxy\Proxy|null|object 258 | * @throws \Doctrine\ORM\ORMException 259 | * @throws \Doctrine\ORM\OptimisticLockException 260 | * @throws \Doctrine\ORM\TransactionRequiredException 261 | */ 262 | protected function fetchAssociationEntity($className, $id) 263 | { 264 | if ($this->hydrateAssociationReferences) { 265 | return $this->entityManager->getReference($className, $id); 266 | } 267 | 268 | return $this->entityManager->find($className, $id); 269 | } 270 | } 271 | -------------------------------------------------------------------------------- /src/JsonApiHydrator.php: -------------------------------------------------------------------------------- 1 | entityManager->getClassMetadata(get_class($entity)); 38 | 39 | foreach ($data['relationships'] as $name => $data) { 40 | if (!isset($metadata->associationMappings[$name])) { 41 | throw new \Exception(sprintf('Relation `%s` association not found', $name)); 42 | } 43 | 44 | $mapping = $metadata->associationMappings[$name]; 45 | 46 | if (is_array($data['data'])) { 47 | if ($resourceId = $this->getResourceId($data['data'])) { 48 | $this->hydrateToOneAssociation($entity, $name, $mapping, $resourceId); 49 | } else { 50 | $this->hydrateToManyAssociation($entity, $name, $mapping, 51 | $this->mapRelationshipsArray($data['data']) 52 | ); 53 | } 54 | } 55 | } 56 | } 57 | 58 | return $entity; 59 | } 60 | 61 | /** 62 | * @param array $data 63 | * 64 | * @return array 65 | */ 66 | protected function mapRelationshipsArray(array $data) 67 | { 68 | return array_map( 69 | function ($relation) { 70 | return $this->getResourceId($relation) ?: ['attributes' => $relation]; 71 | }, 72 | $data 73 | ); 74 | } 75 | 76 | /** 77 | * @param array $data 78 | * 79 | * @return int|null 80 | */ 81 | protected function getResourceId(array $data) 82 | { 83 | if (isset($data['id']) && isset($data['type'])) { 84 | return $data['id']; 85 | } 86 | 87 | return null; 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /tests/bootstrap.php: -------------------------------------------------------------------------------- 1 | id; 42 | } 43 | 44 | /** 45 | * @param int $id 46 | */ 47 | public function setId($id) 48 | { 49 | $this->id = $id; 50 | } 51 | 52 | /** 53 | * @return string 54 | */ 55 | public function getStreetAddress() 56 | { 57 | return $this->streetAddress; 58 | } 59 | 60 | /** 61 | * @param string $streetAddress 62 | */ 63 | public function setStreetAddress($streetAddress) 64 | { 65 | $this->streetAddress = $streetAddress; 66 | } 67 | 68 | /** 69 | * @return string 70 | */ 71 | public function getCity() 72 | { 73 | return $this->city; 74 | } 75 | 76 | /** 77 | * @param string $city 78 | */ 79 | public function setCity($city) 80 | { 81 | $this->city = $city; 82 | } 83 | 84 | /** 85 | * @return string 86 | */ 87 | public function getCountry() 88 | { 89 | return $this->country; 90 | } 91 | 92 | /** 93 | * @param string $country 94 | */ 95 | public function setCountry($country) 96 | { 97 | $this->country = $country; 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /tests/fixtures/Call.php: -------------------------------------------------------------------------------- 1 | id; 47 | } 48 | 49 | /** 50 | * @param int $id 51 | * 52 | * @return Call 53 | */ 54 | public function setId($id) 55 | { 56 | $this->id = $id; 57 | 58 | return $this; 59 | } 60 | 61 | /** 62 | * @return int 63 | */ 64 | public function getDuration() 65 | { 66 | return $this->duration; 67 | } 68 | 69 | /** 70 | * @param int $duration 71 | * 72 | * @return Call 73 | */ 74 | public function setDuration($duration) 75 | { 76 | $this->duration = $duration; 77 | 78 | return $this; 79 | } 80 | 81 | /** 82 | * @return \DateTime 83 | */ 84 | public function getStartTime() 85 | { 86 | return $this->startTime; 87 | } 88 | 89 | /** 90 | * @param \DateTime $startTime 91 | * 92 | * @return Call 93 | */ 94 | public function setStartTime(\DateTime $startTime) 95 | { 96 | $this->startTime = $startTime; 97 | 98 | return $this; 99 | } 100 | 101 | /** 102 | * @return bool 103 | */ 104 | public function isStatus() 105 | { 106 | return $this->status; 107 | } 108 | 109 | /** 110 | * @param bool $status 111 | * 112 | * @return Call 113 | */ 114 | public function setStatus($status) 115 | { 116 | $this->status = $status; 117 | 118 | return $this; 119 | } 120 | } -------------------------------------------------------------------------------- /tests/fixtures/Company.php: -------------------------------------------------------------------------------- 1 | id; 30 | } 31 | 32 | /** 33 | * @param int $id 34 | */ 35 | public function setId($id) 36 | { 37 | $this->id = $id; 38 | } 39 | 40 | /** 41 | * @return string 42 | */ 43 | public function getName() 44 | { 45 | return $this->name; 46 | } 47 | 48 | /** 49 | * @param string $name 50 | */ 51 | public function setName($name) 52 | { 53 | $this->name = $name; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /tests/fixtures/Permission.php: -------------------------------------------------------------------------------- 1 | id; 30 | } 31 | 32 | /** 33 | * @param int $id 34 | */ 35 | public function setId($id) 36 | { 37 | $this->id = $id; 38 | } 39 | 40 | /** 41 | * @return string 42 | */ 43 | public function getName() 44 | { 45 | return $this->name; 46 | } 47 | 48 | /** 49 | * @param string $name 50 | */ 51 | public function setName($name) 52 | { 53 | $this->name = $name; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /tests/fixtures/Preference.php: -------------------------------------------------------------------------------- 1 | id; 43 | } 44 | 45 | /** 46 | * @param int $id 47 | */ 48 | public function setId($id) 49 | { 50 | $this->id = $id; 51 | } 52 | 53 | /** 54 | * @return User 55 | */ 56 | public function getUser() 57 | { 58 | return $this->user; 59 | } 60 | 61 | /** 62 | * @param User $user 63 | */ 64 | public function setUser($user) 65 | { 66 | $this->user = $user; 67 | } 68 | 69 | /** 70 | * @return string 71 | */ 72 | public function getWallpaper() 73 | { 74 | return $this->wallpaper; 75 | } 76 | 77 | /** 78 | * @param string $wallpaper 79 | */ 80 | public function setWallpaper($wallpaper) 81 | { 82 | $this->wallpaper = $wallpaper; 83 | } 84 | 85 | /** 86 | * @return string 87 | */ 88 | public function getRingTone() 89 | { 90 | return $this->ringTone; 91 | } 92 | 93 | /** 94 | * @param string $ringTone 95 | */ 96 | public function setRingTone($ringTone) 97 | { 98 | $this->ringTone = $ringTone; 99 | } 100 | } -------------------------------------------------------------------------------- /tests/fixtures/User.php: -------------------------------------------------------------------------------- 1 | id; 61 | } 62 | 63 | /** 64 | * @param int $id 65 | */ 66 | public function setId($id) 67 | { 68 | $this->id = $id; 69 | } 70 | 71 | /** 72 | * @return string 73 | */ 74 | public function getName() 75 | { 76 | return $this->name; 77 | } 78 | 79 | /** 80 | * @param string $name 81 | */ 82 | public function setName($name) 83 | { 84 | $this->name = $name; 85 | } 86 | 87 | /** 88 | * @return string 89 | */ 90 | public function getEmail() 91 | { 92 | return $this->email; 93 | } 94 | 95 | /** 96 | * @param string $email 97 | */ 98 | public function setEmail($email) 99 | { 100 | $this->email = $email; 101 | } 102 | 103 | /** 104 | * @return Company 105 | */ 106 | public function getCompany() 107 | { 108 | return $this->company; 109 | } 110 | 111 | /** 112 | * @param Company $company 113 | */ 114 | public function setCompany($company) 115 | { 116 | $this->company = $company; 117 | } 118 | 119 | /** 120 | * @return Address 121 | */ 122 | public function getAddress() 123 | { 124 | return $this->address; 125 | } 126 | 127 | /** 128 | * @param Address $address 129 | */ 130 | public function setAddress($address) 131 | { 132 | $this->address = $address; 133 | } 134 | 135 | /** 136 | * @return Permission[] 137 | */ 138 | public function getPermissions() 139 | { 140 | return $this->permissions; 141 | } 142 | 143 | /** 144 | * @param Permission[] $permissions 145 | */ 146 | public function setPermissions($permissions) 147 | { 148 | $this->permissions = $permissions; 149 | } 150 | 151 | /** 152 | * @return Preference 153 | */ 154 | public function getPreference() 155 | { 156 | return $this->preference; 157 | } 158 | 159 | /** 160 | * @param Preference $preference 161 | */ 162 | public function setPreference($preference) 163 | { 164 | $this->preference = $preference; 165 | } 166 | } 167 | -------------------------------------------------------------------------------- /tests/unit/ArrayHydratorTest.php: -------------------------------------------------------------------------------- 1 | setupDoctrine(); 21 | $this->hydrator = new ArrayHydrator($this->entityManager); 22 | } 23 | 24 | public function testHydrateProperties() 25 | { 26 | $data = [ 27 | 'id'=>1, 28 | 'name'=>'Fred Jones', 29 | 'email'=>'fred@example.org', 30 | ]; 31 | 32 | $user = new Fixture\User; 33 | $user = $this->hydrator->hydrate($user, $data); 34 | 35 | $this->assertNull($user->getId()); 36 | $this->assertEquals($data['name'], $user->getName()); 37 | $this->assertEquals($data['email'], $user->getEmail()); 38 | } 39 | 40 | /** 41 | * Tests the hydration of a table where database column names and entity field names differ 42 | * 43 | * @throws \Exception 44 | */ 45 | public function testHydratePropertiesByColumn() 46 | { 47 | $data = [ 48 | 'address_id'=>103, 49 | 'street_address'=>'Super Street 12', 50 | 'town_or_similar'=>'Farmville at the Sea', 51 | 'country'=>'Republic', 52 | ]; 53 | 54 | $this->hydrator->setHydrateBy(ArrayHydrator::HYDRATE_BY_COLUMN); 55 | $address = new Fixture\Address; 56 | $address = $this->hydrator->hydrate($address, $data); 57 | 58 | $this->assertNull($address->getId()); 59 | $this->assertEquals($data['street_address'], $address->getStreetAddress()); 60 | $this->assertEquals($data['town_or_similar'], $address->getCity()); 61 | $this->assertEquals($data['country'], $address->getCountry()); 62 | } 63 | 64 | /** 65 | * Tests the hydration of a table where database column names and entity field names differ and we also want to 66 | * hydrate the primary key 67 | * 68 | * @throws \Exception 69 | */ 70 | public function testHydratePropertiesByColumnWithId() 71 | { 72 | $data = [ 73 | 'address_id'=>103, 74 | 'street_address'=>'Super Street 12', 75 | 'town_or_similar'=>'Farmville at the Sea', 76 | 'country'=>'Republic', 77 | ]; 78 | 79 | $this->hydrator->setHydrateId(true); 80 | $this->hydrator->setHydrateBy(ArrayHydrator::HYDRATE_BY_COLUMN); 81 | $address = new Fixture\Address; 82 | $address = $this->hydrator->hydrate($address, $data); 83 | 84 | $this->assertEquals($data['address_id'], $address->getId()); 85 | $this->assertEquals($data['street_address'], $address->getStreetAddress()); 86 | $this->assertEquals($data['town_or_similar'], $address->getCity()); 87 | $this->assertEquals($data['country'], $address->getCountry()); 88 | } 89 | 90 | public function testHydrateManyToOneAssociation() 91 | { 92 | $data = [ 93 | 'company'=>1, 94 | 'address'=>103, 95 | ]; 96 | 97 | $user = new Fixture\User; 98 | /** @var Fixture\User $user */ 99 | $user = $this->hydrator->hydrate($user, $data); 100 | 101 | $this->assertEquals(1, $user->getCompany()->getId()); 102 | $this->assertEquals(103, $user->getAddress()->getId()); 103 | } 104 | 105 | public function testHydrateManyToOneAssociationByColumn() 106 | { 107 | $data = [ 108 | 'company_id'=>1, 109 | 'foreign_address_id'=>103, 110 | ]; 111 | 112 | $this->hydrator->setHydrateBy(ArrayHydrator::HYDRATE_BY_COLUMN); 113 | $user = new Fixture\User; 114 | /** @var Fixture\User $user */ 115 | $user = $this->hydrator->hydrate($user, $data); 116 | 117 | $this->assertEquals(1, $user->getCompany()->getId()); 118 | $this->assertEquals(103, $user->getAddress()->getId()); 119 | } 120 | 121 | public function testHydrateOneToManyAssociations() 122 | { 123 | $data = [ 124 | 'permissions'=>[1,2,3,4,5], 125 | ]; 126 | 127 | $user = new Fixture\User; 128 | /** @var Fixture\User $user */ 129 | $user = $this->hydrator->hydrate($user, $data); 130 | 131 | $permissions = $user->getPermissions(); 132 | $this->assertEquals(1, $permissions[0]->getId()); 133 | $this->assertEquals(2, $permissions[1]->getId()); 134 | $this->assertEquals(3, $permissions[2]->getId()); 135 | $this->assertEquals(4, $permissions[3]->getId()); 136 | $this->assertEquals(5, $permissions[4]->getId()); 137 | } 138 | 139 | public function testHydrateOneToManyObjects() 140 | { 141 | $data = [ 142 | 'name' => 'George', 143 | 'permissions' => [ 144 | ['name' => 'New Permission 1'], 145 | ['name' => 'New Permission 2'], 146 | ], 147 | ]; 148 | 149 | $user = new Fixture\User; 150 | /** @var Fixture\User $user */ 151 | $user = $this->hydrator->hydrate($user, $data); 152 | 153 | $this->assertEquals($data['name'], $user->getName()); 154 | 155 | $permissions = $user->getPermissions(); 156 | foreach ($permissions as $permission) { 157 | $this->assertInstanceOf(Permission::class, $permission); 158 | } 159 | 160 | $this->assertEquals($data['permissions'][0]['name'], $permissions[0]->getName()); 161 | $this->assertEquals($data['permissions'][1]['name'], $permissions[1]->getName()); 162 | } 163 | 164 | public function testHydrateAll() 165 | { 166 | $data = [ 167 | 'id'=>1, 168 | 'name'=>'Fred Jones', 169 | 'email'=>'fred@example.org', 170 | 'company'=>1, 171 | 'permissions'=>[1,2,3,4,5], 172 | ]; 173 | 174 | $user = new Fixture\User; 175 | /** @var Fixture\User $user */ 176 | $user = $this->hydrator->hydrate($user, $data); 177 | 178 | $this->assertNull($user->getId()); 179 | $this->assertEquals($data['name'], $user->getName()); 180 | $this->assertEquals($data['email'], $user->getEmail()); 181 | 182 | $this->assertEquals(1, $user->getCompany()->getId()); 183 | 184 | $permissions = $user->getPermissions(); 185 | $this->assertEquals(1, $permissions[0]->getId()); 186 | $this->assertEquals(2, $permissions[1]->getId()); 187 | $this->assertEquals(3, $permissions[2]->getId()); 188 | $this->assertEquals(4, $permissions[3]->getId()); 189 | $this->assertEquals(5, $permissions[4]->getId()); 190 | } 191 | 192 | public function testHydrateNullValues() 193 | { 194 | $data = [ 195 | 'name' => null, 196 | 'email' => null, 197 | ]; 198 | 199 | $user = new Fixture\User; 200 | /** @var Fixture\User $user */ 201 | $user = $this->hydrator->hydrate($user, $data); 202 | $user->setName('name'); 203 | $user->setEmail('email'); 204 | 205 | $this->assertEquals('name', $user->getName()); 206 | $this->assertEquals('email', $user->getEmail()); 207 | $user = $this->hydrator->hydrate($user, $data); 208 | $this->assertNull($user->getName()); 209 | $this->assertNull($user->getEmail()); 210 | } 211 | 212 | /** 213 | * @expectedException \Exception 214 | */ 215 | public function testInvalidClass() 216 | { 217 | $this->hydrator->hydrate(1, []); 218 | } 219 | 220 | /** 221 | * @expectedException \Exception 222 | */ 223 | public function testUnkownClass() 224 | { 225 | $this->hydrator->hydrate('An\Unknown\Class', []); 226 | } 227 | 228 | public function testFetchAssociationEntity() 229 | { 230 | /** @var Fixture\User $user */ 231 | $user = new Fixture\User; 232 | $company = new Company(); 233 | $company->setId(1); 234 | $company->setName('testing'); 235 | 236 | /** @var EntityManager $entityManagerMock */ 237 | $entityManagerMock = m::mock($this->entityManager) 238 | ->shouldReceive('find')->with(Company::class, 1) 239 | ->andReturn($company) 240 | ->getMock(); 241 | 242 | $this->hydrator = new ArrayHydrator($entityManagerMock); 243 | $this->hydrator->setHydrateAssociationReferences(false); 244 | $user = $this->hydrator->hydrate($user, ['company' => $company->getId()]); 245 | 246 | $this->assertEquals($company->getId(), $user->getCompany()->getId()); 247 | $this->assertEquals($company->getName(), $user->getCompany()->getName()); 248 | } 249 | 250 | public function testConvertType() 251 | { 252 | $data = [ 253 | 'id' => '1', 254 | 'duration' => '50', 255 | 'startTime' => '2017-10-23 17:57:00', 256 | 'status' => 'true', 257 | ]; 258 | 259 | $call = new Fixture\Call(); 260 | $call = $this->hydrator->hydrate($call, $data); 261 | 262 | $this->assertInternalType('integer', $call->getDuration()); 263 | $this->assertInstanceOf(\DateTime::class, $call->getStartTime()); 264 | $this->assertInternalType('bool', $call->isStatus()); 265 | } 266 | } 267 | -------------------------------------------------------------------------------- /tests/unit/JsonApiHydratorTest.php: -------------------------------------------------------------------------------- 1 | setupDoctrine(); 17 | $this->hydrator = new JsonApiHydrator($this->entityManager); 18 | } 19 | 20 | public function testHydrateProperties() 21 | { 22 | $jsonapiData = [ 23 | 'attributes' => [ 24 | 'id'=>1, 25 | 'name'=>'Fred Jones', 26 | 'email'=>'fred@example.org', 27 | ] 28 | ]; 29 | 30 | $user = $this->hydrator->hydrate(User::class, $jsonapiData); 31 | $this->assertNull($user->getId()); 32 | $this->assertEquals($jsonapiData['attributes']['name'], $user->getName()); 33 | $this->assertEquals($jsonapiData['attributes']['email'], $user->getEmail()); 34 | } 35 | 36 | public function testHydrateOneToManyObjects() 37 | { 38 | $data = [ 39 | 'attributes' => [ 40 | 'name' => 'George', 41 | ], 42 | 'relationships' => [ 43 | 'permissions' => [ 44 | 'data' => [ 45 | ['name' => 'New Permission 1'], 46 | ['name' => 'New Permission 2'], 47 | ], 48 | ], 49 | ] 50 | ]; 51 | 52 | $user = new Fixture\User; 53 | /** @var Fixture\User $user */ 54 | $user = $this->hydrator->hydrate($user, $data); 55 | 56 | $this->assertEquals($data['attributes']['name'], $user->getName()); 57 | 58 | $permissions = $user->getPermissions(); 59 | // var_export($permissions); 60 | foreach ($permissions as $permission) { 61 | $this->assertInstanceOf(Permission::class, $permission); 62 | } 63 | 64 | $this->assertEquals($data['relationships']['permissions']['data'][0]['name'], $permissions[0]->getName()); 65 | $this->assertEquals($data['relationships']['permissions']['data'][1]['name'], $permissions[1]->getName()); 66 | } 67 | 68 | public function testHydrateAll() 69 | { 70 | $data = [ 71 | 'attributes' => [ 72 | 'id' => 1, 73 | 'name' => 'Fred Jones', 74 | 'email' => 'fred@example.org', 75 | ], 76 | 'relationships' => [ 77 | 'company' => [ 78 | 'data' => [ 79 | 'id' => 1, 'type' => 'company' 80 | ], 81 | ], 82 | 'permissions' => [ 83 | 'data' => [ 84 | ['id' => 1, 'type' => 'permission'], 85 | ['id' => 2, 'type' => 'permission'], 86 | ['id' => 3, 'type' => 'permission'], 87 | ['id' => 4, 'type' => 'permission'], 88 | ['id' => 5, 'type' => 'permission'], 89 | ] 90 | ], 91 | ] 92 | ]; 93 | 94 | /** @var Fixture\User $user */ 95 | $user = new User; 96 | $user = $this->hydrator->hydrate($user, $data); 97 | 98 | $this->assertNull($user->getId()); 99 | $this->assertEquals($data['attributes']['name'], $user->getName()); 100 | $this->assertEquals($data['attributes']['email'], $user->getEmail()); 101 | 102 | $this->assertEquals(1, $user->getCompany()->getId()); 103 | 104 | $permissions = $user->getPermissions(); 105 | $this->assertEquals(1, $permissions[0]->getId()); 106 | $this->assertEquals(2, $permissions[1]->getId()); 107 | $this->assertEquals(3, $permissions[2]->getId()); 108 | $this->assertEquals(4, $permissions[3]->getId()); 109 | $this->assertEquals(5, $permissions[4]->getId()); 110 | } 111 | 112 | public function testNotFoundRelationship() 113 | { 114 | $this->setExpectedException( 115 | \Exception::class, 116 | 'Relation `test` association not found' 117 | ); 118 | 119 | $user = new Fixture\User; 120 | $this->hydrator->hydrate($user, [ 121 | 'relationships' => [ 122 | 'test' => [ 123 | 'data' => ['id' => 1, 'type' => 'company'] 124 | ] 125 | ] 126 | ]); 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /tests/unit/TestCase.php: -------------------------------------------------------------------------------- 1 | getProperty($propertyName); 31 | $property->setAccessible(true); 32 | return $property->getValue($object); 33 | } 34 | 35 | /** 36 | * @param $object 37 | * @param $propertyName 38 | * @param $value 39 | */ 40 | protected function setProtectedValue(&$object, $propertyName, $value) 41 | { 42 | $reflectionObject = new \ReflectionObject($object); 43 | $property = $reflectionObject->getProperty($propertyName); 44 | $property->setAccessible(true); 45 | $property->setValue($object, $value); 46 | } 47 | 48 | /** 49 | * @throws \Doctrine\ORM\ORMException 50 | */ 51 | protected function setupDoctrine() 52 | { 53 | $databaseConfig = [ 54 | 'driver'=>'pdo_sqlite', 55 | 'dbname'=>':memory:', 56 | ]; 57 | $doctrineConfig = \Doctrine\ORM\Tools\Setup::createAnnotationMetadataConfiguration(['tests/fixtures/'], false, getcwd().'/build/tmp', new ArrayCache(), false); 58 | $doctrineConfig->setAutoGenerateProxyClasses(true); 59 | 60 | $this->entityManager = EntityManager::create($databaseConfig, $doctrineConfig); 61 | $this->annotationReader = $this->entityManager->getConfiguration()->getMetadataDriverImpl(); 62 | } 63 | 64 | /** 65 | * @param EntityManager $entityManager 66 | * @return array 67 | */ 68 | protected function getEntityClassNames(EntityManager $entityManager) 69 | { 70 | $classes = []; 71 | 72 | /** @var ClassMetadata[] $metas */ 73 | $metas = $entityManager->getMetadataFactory()->getAllMetadata(); 74 | foreach ($metas as $meta) { 75 | $classes[] = $meta->getName(); 76 | } 77 | 78 | return $classes; 79 | } 80 | 81 | } --------------------------------------------------------------------------------