├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── composer.json ├── composer.lock ├── phpunit.xml ├── src └── AddressValidator.php └── tests └── AddressValidatorTest.php /.gitignore: -------------------------------------------------------------------------------- 1 | /.idea/ 2 | /coverage/ 3 | /vendor/ 4 | 5 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | php: 3 | - '7.2' 4 | 5 | env: 6 | global: 7 | - CC_TEST_REPORTER_ID=a0379f4a604771d7c38b62a3092b9af03af020eb6687b7ecc12005aa5d28548b 8 | 9 | before_script: 10 | - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter 11 | - chmod +x ./cc-test-reporter 12 | - ./cc-test-reporter before-build 13 | - composer install 14 | script: 15 | - phpunit --coverage-clover build/logs/clover.xml 16 | after_script: 17 | - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT 18 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Mozilla Public License Version 2.0 2 | ================================== 3 | 4 | 1. Definitions 5 | -------------- 6 | 7 | 1.1. "Contributor" 8 | means each individual or legal entity that creates, contributes to 9 | the creation of, or owns Covered Software. 10 | 11 | 1.2. "Contributor Version" 12 | means the combination of the Contributions of others (if any) used 13 | by a Contributor and that particular Contributor's Contribution. 14 | 15 | 1.3. "Contribution" 16 | means Covered Software of a particular Contributor. 17 | 18 | 1.4. "Covered Software" 19 | means Source Code Form to which the initial Contributor has attached 20 | the notice in Exhibit A, the Executable Form of such Source Code 21 | Form, and Modifications of such Source Code Form, in each case 22 | including portions thereof. 23 | 24 | 1.5. "Incompatible With Secondary Licenses" 25 | means 26 | 27 | (a) that the initial Contributor has attached the notice described 28 | in Exhibit B to the Covered Software; or 29 | 30 | (b) that the Covered Software was made available under the terms of 31 | version 1.1 or earlier of the License, but not also under the 32 | terms of a Secondary License. 33 | 34 | 1.6. "Executable Form" 35 | means any form of the work other than Source Code Form. 36 | 37 | 1.7. "Larger Work" 38 | means a work that combines Covered Software with other material, in 39 | a separate file or files, that is not Covered Software. 40 | 41 | 1.8. "License" 42 | means this document. 43 | 44 | 1.9. "Licensable" 45 | means having the right to grant, to the maximum extent possible, 46 | whether at the time of the initial grant or subsequently, any and 47 | all of the rights conveyed by this License. 48 | 49 | 1.10. "Modifications" 50 | means any of the following: 51 | 52 | (a) any file in Source Code Form that results from an addition to, 53 | deletion from, or modification of the contents of Covered 54 | Software; or 55 | 56 | (b) any new file in Source Code Form that contains any Covered 57 | Software. 58 | 59 | 1.11. "Patent Claims" of a Contributor 60 | means any patent claim(s), including without limitation, method, 61 | process, and apparatus claims, in any patent Licensable by such 62 | Contributor that would be infringed, but for the grant of the 63 | License, by the making, using, selling, offering for sale, having 64 | made, import, or transfer of either its Contributions or its 65 | Contributor Version. 66 | 67 | 1.12. "Secondary License" 68 | means either the GNU General Public License, Version 2.0, the GNU 69 | Lesser General Public License, Version 2.1, the GNU Affero General 70 | Public License, Version 3.0, or any later versions of those 71 | licenses. 72 | 73 | 1.13. "Source Code Form" 74 | means the form of the work preferred for making modifications. 75 | 76 | 1.14. "You" (or "Your") 77 | means an individual or a legal entity exercising rights under this 78 | License. For legal entities, "You" includes any entity that 79 | controls, is controlled by, or is under common control with You. For 80 | purposes of this definition, "control" means (a) the power, direct 81 | or indirect, to cause the direction or management of such entity, 82 | whether by contract or otherwise, or (b) ownership of more than 83 | fifty percent (50%) of the outstanding shares or beneficial 84 | ownership of such entity. 85 | 86 | 2. License Grants and Conditions 87 | -------------------------------- 88 | 89 | 2.1. Grants 90 | 91 | Each Contributor hereby grants You a world-wide, royalty-free, 92 | non-exclusive license: 93 | 94 | (a) under intellectual property rights (other than patent or trademark) 95 | Licensable by such Contributor to use, reproduce, make available, 96 | modify, display, perform, distribute, and otherwise exploit its 97 | Contributions, either on an unmodified basis, with Modifications, or 98 | as part of a Larger Work; and 99 | 100 | (b) under Patent Claims of such Contributor to make, use, sell, offer 101 | for sale, have made, import, and otherwise transfer either its 102 | Contributions or its Contributor Version. 103 | 104 | 2.2. Effective Date 105 | 106 | The licenses granted in Section 2.1 with respect to any Contribution 107 | become effective for each Contribution on the date the Contributor first 108 | distributes such Contribution. 109 | 110 | 2.3. Limitations on Grant Scope 111 | 112 | The licenses granted in this Section 2 are the only rights granted under 113 | this License. No additional rights or licenses will be implied from the 114 | distribution or licensing of Covered Software under this License. 115 | Notwithstanding Section 2.1(b) above, no patent license is granted by a 116 | Contributor: 117 | 118 | (a) for any code that a Contributor has removed from Covered Software; 119 | or 120 | 121 | (b) for infringements caused by: (i) Your and any other third party's 122 | modifications of Covered Software, or (ii) the combination of its 123 | Contributions with other software (except as part of its Contributor 124 | Version); or 125 | 126 | (c) under Patent Claims infringed by Covered Software in the absence of 127 | its Contributions. 128 | 129 | This License does not grant any rights in the trademarks, service marks, 130 | or logos of any Contributor (except as may be necessary to comply with 131 | the notice requirements in Section 3.4). 132 | 133 | 2.4. Subsequent Licenses 134 | 135 | No Contributor makes additional grants as a result of Your choice to 136 | distribute the Covered Software under a subsequent version of this 137 | License (see Section 10.2) or under the terms of a Secondary License (if 138 | permitted under the terms of Section 3.3). 139 | 140 | 2.5. Representation 141 | 142 | Each Contributor represents that the Contributor believes its 143 | Contributions are its original creation(s) or it has sufficient rights 144 | to grant the rights to its Contributions conveyed by this License. 145 | 146 | 2.6. Fair Use 147 | 148 | This License is not intended to limit any rights You have under 149 | applicable copyright doctrines of fair use, fair dealing, or other 150 | equivalents. 151 | 152 | 2.7. Conditions 153 | 154 | Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted 155 | in Section 2.1. 156 | 157 | 3. Responsibilities 158 | ------------------- 159 | 160 | 3.1. Distribution of Source Form 161 | 162 | All distribution of Covered Software in Source Code Form, including any 163 | Modifications that You create or to which You contribute, must be under 164 | the terms of this License. You must inform recipients that the Source 165 | Code Form of the Covered Software is governed by the terms of this 166 | License, and how they can obtain a copy of this License. You may not 167 | attempt to alter or restrict the recipients' rights in the Source Code 168 | Form. 169 | 170 | 3.2. Distribution of Executable Form 171 | 172 | If You distribute Covered Software in Executable Form then: 173 | 174 | (a) such Covered Software must also be made available in Source Code 175 | Form, as described in Section 3.1, and You must inform recipients of 176 | the Executable Form how they can obtain a copy of such Source Code 177 | Form by reasonable means in a timely manner, at a charge no more 178 | than the cost of distribution to the recipient; and 179 | 180 | (b) You may distribute such Executable Form under the terms of this 181 | License, or sublicense it under different terms, provided that the 182 | license for the Executable Form does not attempt to limit or alter 183 | the recipients' rights in the Source Code Form under this License. 184 | 185 | 3.3. Distribution of a Larger Work 186 | 187 | You may create and distribute a Larger Work under terms of Your choice, 188 | provided that You also comply with the requirements of this License for 189 | the Covered Software. If the Larger Work is a combination of Covered 190 | Software with a work governed by one or more Secondary Licenses, and the 191 | Covered Software is not Incompatible With Secondary Licenses, this 192 | License permits You to additionally distribute such Covered Software 193 | under the terms of such Secondary License(s), so that the recipient of 194 | the Larger Work may, at their option, further distribute the Covered 195 | Software under the terms of either this License or such Secondary 196 | License(s). 197 | 198 | 3.4. Notices 199 | 200 | You may not remove or alter the substance of any license notices 201 | (including copyright notices, patent notices, disclaimers of warranty, 202 | or limitations of liability) contained within the Source Code Form of 203 | the Covered Software, except that You may alter any license notices to 204 | the extent required to remedy known factual inaccuracies. 205 | 206 | 3.5. Application of Additional Terms 207 | 208 | You may choose to offer, and to charge a fee for, warranty, support, 209 | indemnity or liability obligations to one or more recipients of Covered 210 | Software. However, You may do so only on Your own behalf, and not on 211 | behalf of any Contributor. You must make it absolutely clear that any 212 | such warranty, support, indemnity, or liability obligation is offered by 213 | You alone, and You hereby agree to indemnify every Contributor for any 214 | liability incurred by such Contributor as a result of warranty, support, 215 | indemnity or liability terms You offer. You may include additional 216 | disclaimers of warranty and limitations of liability specific to any 217 | jurisdiction. 218 | 219 | 4. Inability to Comply Due to Statute or Regulation 220 | --------------------------------------------------- 221 | 222 | If it is impossible for You to comply with any of the terms of this 223 | License with respect to some or all of the Covered Software due to 224 | statute, judicial order, or regulation then You must: (a) comply with 225 | the terms of this License to the maximum extent possible; and (b) 226 | describe the limitations and the code they affect. Such description must 227 | be placed in a text file included with all distributions of the Covered 228 | Software under this License. Except to the extent prohibited by statute 229 | or regulation, such description must be sufficiently detailed for a 230 | recipient of ordinary skill to be able to understand it. 231 | 232 | 5. Termination 233 | -------------- 234 | 235 | 5.1. The rights granted under this License will terminate automatically 236 | if You fail to comply with any of its terms. However, if You become 237 | compliant, then the rights granted under this License from a particular 238 | Contributor are reinstated (a) provisionally, unless and until such 239 | Contributor explicitly and finally terminates Your grants, and (b) on an 240 | ongoing basis, if such Contributor fails to notify You of the 241 | non-compliance by some reasonable means prior to 60 days after You have 242 | come back into compliance. Moreover, Your grants from a particular 243 | Contributor are reinstated on an ongoing basis if such Contributor 244 | notifies You of the non-compliance by some reasonable means, this is the 245 | first time You have received notice of non-compliance with this License 246 | from such Contributor, and You become compliant prior to 30 days after 247 | Your receipt of the notice. 248 | 249 | 5.2. If You initiate litigation against any entity by asserting a patent 250 | infringement claim (excluding declaratory judgment actions, 251 | counter-claims, and cross-claims) alleging that a Contributor Version 252 | directly or indirectly infringes any patent, then the rights granted to 253 | You by any and all Contributors for the Covered Software under Section 254 | 2.1 of this License shall terminate. 255 | 256 | 5.3. In the event of termination under Sections 5.1 or 5.2 above, all 257 | end user license agreements (excluding distributors and resellers) which 258 | have been validly granted by You or Your distributors under this License 259 | prior to termination shall survive termination. 260 | 261 | ************************************************************************ 262 | * * 263 | * 6. Disclaimer of Warranty * 264 | * ------------------------- * 265 | * * 266 | * Covered Software is provided under this License on an "as is" * 267 | * basis, without warranty of any kind, either expressed, implied, or * 268 | * statutory, including, without limitation, warranties that the * 269 | * Covered Software is free of defects, merchantable, fit for a * 270 | * particular purpose or non-infringing. The entire risk as to the * 271 | * quality and performance of the Covered Software is with You. * 272 | * Should any Covered Software prove defective in any respect, You * 273 | * (not any Contributor) assume the cost of any necessary servicing, * 274 | * repair, or correction. This disclaimer of warranty constitutes an * 275 | * essential part of this License. No use of any Covered Software is * 276 | * authorized under this License except under this disclaimer. * 277 | * * 278 | ************************************************************************ 279 | 280 | ************************************************************************ 281 | * * 282 | * 7. Limitation of Liability * 283 | * -------------------------- * 284 | * * 285 | * Under no circumstances and under no legal theory, whether tort * 286 | * (including negligence), contract, or otherwise, shall any * 287 | * Contributor, or anyone who distributes Covered Software as * 288 | * permitted above, be liable to You for any direct, indirect, * 289 | * special, incidental, or consequential damages of any character * 290 | * including, without limitation, damages for lost profits, loss of * 291 | * goodwill, work stoppage, computer failure or malfunction, or any * 292 | * and all other commercial damages or losses, even if such party * 293 | * shall have been informed of the possibility of such damages. This * 294 | * limitation of liability shall not apply to liability for death or * 295 | * personal injury resulting from such party's negligence to the * 296 | * extent applicable law prohibits such limitation. Some * 297 | * jurisdictions do not allow the exclusion or limitation of * 298 | * incidental or consequential damages, so this exclusion and * 299 | * limitation may not apply to You. * 300 | * * 301 | ************************************************************************ 302 | 303 | 8. Litigation 304 | ------------- 305 | 306 | Any litigation relating to this License may be brought only in the 307 | courts of a jurisdiction where the defendant maintains its principal 308 | place of business and such litigation shall be governed by laws of that 309 | jurisdiction, without reference to its conflict-of-law provisions. 310 | Nothing in this Section shall prevent a party's ability to bring 311 | cross-claims or counter-claims. 312 | 313 | 9. Miscellaneous 314 | ---------------- 315 | 316 | This License represents the complete agreement concerning the subject 317 | matter hereof. If any provision of this License is held to be 318 | unenforceable, such provision shall be reformed only to the extent 319 | necessary to make it enforceable. Any law or regulation which provides 320 | that the language of a contract shall be construed against the drafter 321 | shall not be used to construe this License against a Contributor. 322 | 323 | 10. Versions of the License 324 | --------------------------- 325 | 326 | 10.1. New Versions 327 | 328 | Mozilla Foundation is the license steward. Except as provided in Section 329 | 10.3, no one other than the license steward has the right to modify or 330 | publish new versions of this License. Each version will be given a 331 | distinguishing version number. 332 | 333 | 10.2. Effect of New Versions 334 | 335 | You may distribute the Covered Software under the terms of the version 336 | of the License under which You originally received the Covered Software, 337 | or under the terms of any subsequent version published by the license 338 | steward. 339 | 340 | 10.3. Modified Versions 341 | 342 | If you create software not governed by this License, and you want to 343 | create a new license for such software, you may create and use a 344 | modified version of this License if you rename the license and remove 345 | any references to the name of the license steward (except to note that 346 | such modified license differs from this License). 347 | 348 | 10.4. Distributing Source Code Form that is Incompatible With Secondary 349 | Licenses 350 | 351 | If You choose to distribute Source Code Form that is Incompatible With 352 | Secondary Licenses under the terms of this version of the License, the 353 | notice described in Exhibit B of this License must be attached. 354 | 355 | Exhibit A - Source Code Form License Notice 356 | ------------------------------------------- 357 | 358 | This Source Code Form is subject to the terms of the Mozilla Public 359 | License, v. 2.0. If a copy of the MPL was not distributed with this 360 | file, You can obtain one at http://mozilla.org/MPL/2.0/. 361 | 362 | If it is not possible or desirable to put the notice in a particular 363 | file, then You may include the notice in a location (such as a LICENSE 364 | file in a relevant directory) where a recipient would be likely to look 365 | for such a notice. 366 | 367 | You may add additional accurate notices of copyright ownership. 368 | 369 | Exhibit B - "Incompatible With Secondary Licenses" Notice 370 | --------------------------------------------------------- 371 | 372 | This Source Code Form is "Incompatible With Secondary Licenses", as 373 | defined by the Mozilla Public License, v. 2.0. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Ethereum Address Validator 2 | -- 3 | (c) by Andrzej Budzanowski 4 | 5 | [![Maintainability](https://api.codeclimate.com/v1/badges/6ed9a66abca4f38be143/maintainability)](https://codeclimate.com/github/psychob/ethereum-address-validator/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/6ed9a66abca4f38be143/test_coverage)](https://codeclimate.com/github/psychob/ethereum-address-validator/test_coverage) [![Build Status](https://travis-ci.org/psychob/ethereum-address-validator.svg?branch=master)](https://travis-ci.org/psychob/ethereum-address-validator) 6 | 7 | ## License 8 | MPL-2.0 9 | 10 | ## Brief 11 | Class that verifies if [Ethereum](https://www.ethereum.org/) address is properly formatted and - optionaly - properly checksummed according to [EIP-55](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-55.md). 12 | 13 | ## Installation 14 | Use composer: 15 | 16 | ```bash 17 | composer require psychob/ethereum-address-validator 18 | ``` 19 | 20 | ## Usage 21 | ```php 22 | =7.1" 16 | }, 17 | "require-dev": { 18 | "phpunit/phpunit": "^7.5" 19 | }, 20 | "autoload": { 21 | "psr-4": { 22 | "PsychoB\\Ethereum\\": "./src" 23 | } 24 | }, 25 | "autoload-dev": { 26 | "psr-4": { 27 | "Tests\\PsychoB\\Ethereum\\": "./tests" 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#installing-dependencies", 5 | "This file is @generated automatically" 6 | ], 7 | "content-hash": "a0ab9dc2be40e18b0062161196369e9a", 8 | "packages": [ 9 | { 10 | "name": "kornrunner/keccak", 11 | "version": "1.0.3", 12 | "source": { 13 | "type": "git", 14 | "url": "https://github.com/kornrunner/php-keccak.git", 15 | "reference": "ad761f528f4d1e3ce378b8a0841e5f82c9973535" 16 | }, 17 | "dist": { 18 | "type": "zip", 19 | "url": "https://api.github.com/repos/kornrunner/php-keccak/zipball/ad761f528f4d1e3ce378b8a0841e5f82c9973535", 20 | "reference": "ad761f528f4d1e3ce378b8a0841e5f82c9973535", 21 | "shasum": "" 22 | }, 23 | "require": { 24 | "php": ">=7.1.0", 25 | "symfony/polyfill-mbstring": "^1.8" 26 | }, 27 | "require-dev": { 28 | "php-coveralls/php-coveralls": "^2.1", 29 | "phpunit/phpunit": "~7" 30 | }, 31 | "type": "library", 32 | "autoload": { 33 | "psr-4": { 34 | "kornrunner\\": "src" 35 | } 36 | }, 37 | "notification-url": "https://packagist.org/downloads/", 38 | "license": [ 39 | "MIT" 40 | ], 41 | "authors": [ 42 | { 43 | "name": "Boris Momcilovic", 44 | "homepage": "https://github.com/kornrunner/php-keccak" 45 | } 46 | ], 47 | "description": "Pure PHP implementation of Keccak", 48 | "keywords": [ 49 | "keccak", 50 | "sha-3", 51 | "sha3-256" 52 | ], 53 | "time": "2018-07-30T22:16:23+00:00" 54 | }, 55 | { 56 | "name": "symfony/polyfill-mbstring", 57 | "version": "v1.10.0", 58 | "source": { 59 | "type": "git", 60 | "url": "https://github.com/symfony/polyfill-mbstring.git", 61 | "reference": "c79c051f5b3a46be09205c73b80b346e4153e494" 62 | }, 63 | "dist": { 64 | "type": "zip", 65 | "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/c79c051f5b3a46be09205c73b80b346e4153e494", 66 | "reference": "c79c051f5b3a46be09205c73b80b346e4153e494", 67 | "shasum": "" 68 | }, 69 | "require": { 70 | "php": ">=5.3.3" 71 | }, 72 | "suggest": { 73 | "ext-mbstring": "For best performance" 74 | }, 75 | "type": "library", 76 | "extra": { 77 | "branch-alias": { 78 | "dev-master": "1.9-dev" 79 | } 80 | }, 81 | "autoload": { 82 | "psr-4": { 83 | "Symfony\\Polyfill\\Mbstring\\": "" 84 | }, 85 | "files": [ 86 | "bootstrap.php" 87 | ] 88 | }, 89 | "notification-url": "https://packagist.org/downloads/", 90 | "license": [ 91 | "MIT" 92 | ], 93 | "authors": [ 94 | { 95 | "name": "Nicolas Grekas", 96 | "email": "p@tchwork.com" 97 | }, 98 | { 99 | "name": "Symfony Community", 100 | "homepage": "https://symfony.com/contributors" 101 | } 102 | ], 103 | "description": "Symfony polyfill for the Mbstring extension", 104 | "homepage": "https://symfony.com", 105 | "keywords": [ 106 | "compatibility", 107 | "mbstring", 108 | "polyfill", 109 | "portable", 110 | "shim" 111 | ], 112 | "time": "2018-09-21T13:07:52+00:00" 113 | } 114 | ], 115 | "packages-dev": [ 116 | { 117 | "name": "doctrine/instantiator", 118 | "version": "1.1.0", 119 | "source": { 120 | "type": "git", 121 | "url": "https://github.com/doctrine/instantiator.git", 122 | "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" 123 | }, 124 | "dist": { 125 | "type": "zip", 126 | "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", 127 | "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", 128 | "shasum": "" 129 | }, 130 | "require": { 131 | "php": "^7.1" 132 | }, 133 | "require-dev": { 134 | "athletic/athletic": "~0.1.8", 135 | "ext-pdo": "*", 136 | "ext-phar": "*", 137 | "phpunit/phpunit": "^6.2.3", 138 | "squizlabs/php_codesniffer": "^3.0.2" 139 | }, 140 | "type": "library", 141 | "extra": { 142 | "branch-alias": { 143 | "dev-master": "1.2.x-dev" 144 | } 145 | }, 146 | "autoload": { 147 | "psr-4": { 148 | "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" 149 | } 150 | }, 151 | "notification-url": "https://packagist.org/downloads/", 152 | "license": [ 153 | "MIT" 154 | ], 155 | "authors": [ 156 | { 157 | "name": "Marco Pivetta", 158 | "email": "ocramius@gmail.com", 159 | "homepage": "http://ocramius.github.com/" 160 | } 161 | ], 162 | "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", 163 | "homepage": "https://github.com/doctrine/instantiator", 164 | "keywords": [ 165 | "constructor", 166 | "instantiate" 167 | ], 168 | "time": "2017-07-22T11:58:36+00:00" 169 | }, 170 | { 171 | "name": "myclabs/deep-copy", 172 | "version": "1.8.1", 173 | "source": { 174 | "type": "git", 175 | "url": "https://github.com/myclabs/DeepCopy.git", 176 | "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8" 177 | }, 178 | "dist": { 179 | "type": "zip", 180 | "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", 181 | "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", 182 | "shasum": "" 183 | }, 184 | "require": { 185 | "php": "^7.1" 186 | }, 187 | "replace": { 188 | "myclabs/deep-copy": "self.version" 189 | }, 190 | "require-dev": { 191 | "doctrine/collections": "^1.0", 192 | "doctrine/common": "^2.6", 193 | "phpunit/phpunit": "^7.1" 194 | }, 195 | "type": "library", 196 | "autoload": { 197 | "psr-4": { 198 | "DeepCopy\\": "src/DeepCopy/" 199 | }, 200 | "files": [ 201 | "src/DeepCopy/deep_copy.php" 202 | ] 203 | }, 204 | "notification-url": "https://packagist.org/downloads/", 205 | "license": [ 206 | "MIT" 207 | ], 208 | "description": "Create deep copies (clones) of your objects", 209 | "keywords": [ 210 | "clone", 211 | "copy", 212 | "duplicate", 213 | "object", 214 | "object graph" 215 | ], 216 | "time": "2018-06-11T23:09:50+00:00" 217 | }, 218 | { 219 | "name": "phar-io/manifest", 220 | "version": "1.0.3", 221 | "source": { 222 | "type": "git", 223 | "url": "https://github.com/phar-io/manifest.git", 224 | "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" 225 | }, 226 | "dist": { 227 | "type": "zip", 228 | "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", 229 | "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", 230 | "shasum": "" 231 | }, 232 | "require": { 233 | "ext-dom": "*", 234 | "ext-phar": "*", 235 | "phar-io/version": "^2.0", 236 | "php": "^5.6 || ^7.0" 237 | }, 238 | "type": "library", 239 | "extra": { 240 | "branch-alias": { 241 | "dev-master": "1.0.x-dev" 242 | } 243 | }, 244 | "autoload": { 245 | "classmap": [ 246 | "src/" 247 | ] 248 | }, 249 | "notification-url": "https://packagist.org/downloads/", 250 | "license": [ 251 | "BSD-3-Clause" 252 | ], 253 | "authors": [ 254 | { 255 | "name": "Arne Blankerts", 256 | "email": "arne@blankerts.de", 257 | "role": "Developer" 258 | }, 259 | { 260 | "name": "Sebastian Heuer", 261 | "email": "sebastian@phpeople.de", 262 | "role": "Developer" 263 | }, 264 | { 265 | "name": "Sebastian Bergmann", 266 | "email": "sebastian@phpunit.de", 267 | "role": "Developer" 268 | } 269 | ], 270 | "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", 271 | "time": "2018-07-08T19:23:20+00:00" 272 | }, 273 | { 274 | "name": "phar-io/version", 275 | "version": "2.0.1", 276 | "source": { 277 | "type": "git", 278 | "url": "https://github.com/phar-io/version.git", 279 | "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" 280 | }, 281 | "dist": { 282 | "type": "zip", 283 | "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", 284 | "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", 285 | "shasum": "" 286 | }, 287 | "require": { 288 | "php": "^5.6 || ^7.0" 289 | }, 290 | "type": "library", 291 | "autoload": { 292 | "classmap": [ 293 | "src/" 294 | ] 295 | }, 296 | "notification-url": "https://packagist.org/downloads/", 297 | "license": [ 298 | "BSD-3-Clause" 299 | ], 300 | "authors": [ 301 | { 302 | "name": "Arne Blankerts", 303 | "email": "arne@blankerts.de", 304 | "role": "Developer" 305 | }, 306 | { 307 | "name": "Sebastian Heuer", 308 | "email": "sebastian@phpeople.de", 309 | "role": "Developer" 310 | }, 311 | { 312 | "name": "Sebastian Bergmann", 313 | "email": "sebastian@phpunit.de", 314 | "role": "Developer" 315 | } 316 | ], 317 | "description": "Library for handling version information and constraints", 318 | "time": "2018-07-08T19:19:57+00:00" 319 | }, 320 | { 321 | "name": "phpdocumentor/reflection-common", 322 | "version": "1.0.1", 323 | "source": { 324 | "type": "git", 325 | "url": "https://github.com/phpDocumentor/ReflectionCommon.git", 326 | "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" 327 | }, 328 | "dist": { 329 | "type": "zip", 330 | "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", 331 | "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", 332 | "shasum": "" 333 | }, 334 | "require": { 335 | "php": ">=5.5" 336 | }, 337 | "require-dev": { 338 | "phpunit/phpunit": "^4.6" 339 | }, 340 | "type": "library", 341 | "extra": { 342 | "branch-alias": { 343 | "dev-master": "1.0.x-dev" 344 | } 345 | }, 346 | "autoload": { 347 | "psr-4": { 348 | "phpDocumentor\\Reflection\\": [ 349 | "src" 350 | ] 351 | } 352 | }, 353 | "notification-url": "https://packagist.org/downloads/", 354 | "license": [ 355 | "MIT" 356 | ], 357 | "authors": [ 358 | { 359 | "name": "Jaap van Otterdijk", 360 | "email": "opensource@ijaap.nl" 361 | } 362 | ], 363 | "description": "Common reflection classes used by phpdocumentor to reflect the code structure", 364 | "homepage": "http://www.phpdoc.org", 365 | "keywords": [ 366 | "FQSEN", 367 | "phpDocumentor", 368 | "phpdoc", 369 | "reflection", 370 | "static analysis" 371 | ], 372 | "time": "2017-09-11T18:02:19+00:00" 373 | }, 374 | { 375 | "name": "phpdocumentor/reflection-docblock", 376 | "version": "4.3.0", 377 | "source": { 378 | "type": "git", 379 | "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", 380 | "reference": "94fd0001232e47129dd3504189fa1c7225010d08" 381 | }, 382 | "dist": { 383 | "type": "zip", 384 | "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08", 385 | "reference": "94fd0001232e47129dd3504189fa1c7225010d08", 386 | "shasum": "" 387 | }, 388 | "require": { 389 | "php": "^7.0", 390 | "phpdocumentor/reflection-common": "^1.0.0", 391 | "phpdocumentor/type-resolver": "^0.4.0", 392 | "webmozart/assert": "^1.0" 393 | }, 394 | "require-dev": { 395 | "doctrine/instantiator": "~1.0.5", 396 | "mockery/mockery": "^1.0", 397 | "phpunit/phpunit": "^6.4" 398 | }, 399 | "type": "library", 400 | "extra": { 401 | "branch-alias": { 402 | "dev-master": "4.x-dev" 403 | } 404 | }, 405 | "autoload": { 406 | "psr-4": { 407 | "phpDocumentor\\Reflection\\": [ 408 | "src/" 409 | ] 410 | } 411 | }, 412 | "notification-url": "https://packagist.org/downloads/", 413 | "license": [ 414 | "MIT" 415 | ], 416 | "authors": [ 417 | { 418 | "name": "Mike van Riel", 419 | "email": "me@mikevanriel.com" 420 | } 421 | ], 422 | "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", 423 | "time": "2017-11-30T07:14:17+00:00" 424 | }, 425 | { 426 | "name": "phpdocumentor/type-resolver", 427 | "version": "0.4.0", 428 | "source": { 429 | "type": "git", 430 | "url": "https://github.com/phpDocumentor/TypeResolver.git", 431 | "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" 432 | }, 433 | "dist": { 434 | "type": "zip", 435 | "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", 436 | "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", 437 | "shasum": "" 438 | }, 439 | "require": { 440 | "php": "^5.5 || ^7.0", 441 | "phpdocumentor/reflection-common": "^1.0" 442 | }, 443 | "require-dev": { 444 | "mockery/mockery": "^0.9.4", 445 | "phpunit/phpunit": "^5.2||^4.8.24" 446 | }, 447 | "type": "library", 448 | "extra": { 449 | "branch-alias": { 450 | "dev-master": "1.0.x-dev" 451 | } 452 | }, 453 | "autoload": { 454 | "psr-4": { 455 | "phpDocumentor\\Reflection\\": [ 456 | "src/" 457 | ] 458 | } 459 | }, 460 | "notification-url": "https://packagist.org/downloads/", 461 | "license": [ 462 | "MIT" 463 | ], 464 | "authors": [ 465 | { 466 | "name": "Mike van Riel", 467 | "email": "me@mikevanriel.com" 468 | } 469 | ], 470 | "time": "2017-07-14T14:27:02+00:00" 471 | }, 472 | { 473 | "name": "phpspec/prophecy", 474 | "version": "1.8.0", 475 | "source": { 476 | "type": "git", 477 | "url": "https://github.com/phpspec/prophecy.git", 478 | "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06" 479 | }, 480 | "dist": { 481 | "type": "zip", 482 | "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4ba436b55987b4bf311cb7c6ba82aa528aac0a06", 483 | "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06", 484 | "shasum": "" 485 | }, 486 | "require": { 487 | "doctrine/instantiator": "^1.0.2", 488 | "php": "^5.3|^7.0", 489 | "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", 490 | "sebastian/comparator": "^1.1|^2.0|^3.0", 491 | "sebastian/recursion-context": "^1.0|^2.0|^3.0" 492 | }, 493 | "require-dev": { 494 | "phpspec/phpspec": "^2.5|^3.2", 495 | "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" 496 | }, 497 | "type": "library", 498 | "extra": { 499 | "branch-alias": { 500 | "dev-master": "1.8.x-dev" 501 | } 502 | }, 503 | "autoload": { 504 | "psr-0": { 505 | "Prophecy\\": "src/" 506 | } 507 | }, 508 | "notification-url": "https://packagist.org/downloads/", 509 | "license": [ 510 | "MIT" 511 | ], 512 | "authors": [ 513 | { 514 | "name": "Konstantin Kudryashov", 515 | "email": "ever.zet@gmail.com", 516 | "homepage": "http://everzet.com" 517 | }, 518 | { 519 | "name": "Marcello Duarte", 520 | "email": "marcello.duarte@gmail.com" 521 | } 522 | ], 523 | "description": "Highly opinionated mocking framework for PHP 5.3+", 524 | "homepage": "https://github.com/phpspec/prophecy", 525 | "keywords": [ 526 | "Double", 527 | "Dummy", 528 | "fake", 529 | "mock", 530 | "spy", 531 | "stub" 532 | ], 533 | "time": "2018-08-05T17:53:17+00:00" 534 | }, 535 | { 536 | "name": "phpunit/php-code-coverage", 537 | "version": "6.1.4", 538 | "source": { 539 | "type": "git", 540 | "url": "https://github.com/sebastianbergmann/php-code-coverage.git", 541 | "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" 542 | }, 543 | "dist": { 544 | "type": "zip", 545 | "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", 546 | "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", 547 | "shasum": "" 548 | }, 549 | "require": { 550 | "ext-dom": "*", 551 | "ext-xmlwriter": "*", 552 | "php": "^7.1", 553 | "phpunit/php-file-iterator": "^2.0", 554 | "phpunit/php-text-template": "^1.2.1", 555 | "phpunit/php-token-stream": "^3.0", 556 | "sebastian/code-unit-reverse-lookup": "^1.0.1", 557 | "sebastian/environment": "^3.1 || ^4.0", 558 | "sebastian/version": "^2.0.1", 559 | "theseer/tokenizer": "^1.1" 560 | }, 561 | "require-dev": { 562 | "phpunit/phpunit": "^7.0" 563 | }, 564 | "suggest": { 565 | "ext-xdebug": "^2.6.0" 566 | }, 567 | "type": "library", 568 | "extra": { 569 | "branch-alias": { 570 | "dev-master": "6.1-dev" 571 | } 572 | }, 573 | "autoload": { 574 | "classmap": [ 575 | "src/" 576 | ] 577 | }, 578 | "notification-url": "https://packagist.org/downloads/", 579 | "license": [ 580 | "BSD-3-Clause" 581 | ], 582 | "authors": [ 583 | { 584 | "name": "Sebastian Bergmann", 585 | "email": "sebastian@phpunit.de", 586 | "role": "lead" 587 | } 588 | ], 589 | "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", 590 | "homepage": "https://github.com/sebastianbergmann/php-code-coverage", 591 | "keywords": [ 592 | "coverage", 593 | "testing", 594 | "xunit" 595 | ], 596 | "time": "2018-10-31T16:06:48+00:00" 597 | }, 598 | { 599 | "name": "phpunit/php-file-iterator", 600 | "version": "2.0.2", 601 | "source": { 602 | "type": "git", 603 | "url": "https://github.com/sebastianbergmann/php-file-iterator.git", 604 | "reference": "050bedf145a257b1ff02746c31894800e5122946" 605 | }, 606 | "dist": { 607 | "type": "zip", 608 | "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", 609 | "reference": "050bedf145a257b1ff02746c31894800e5122946", 610 | "shasum": "" 611 | }, 612 | "require": { 613 | "php": "^7.1" 614 | }, 615 | "require-dev": { 616 | "phpunit/phpunit": "^7.1" 617 | }, 618 | "type": "library", 619 | "extra": { 620 | "branch-alias": { 621 | "dev-master": "2.0.x-dev" 622 | } 623 | }, 624 | "autoload": { 625 | "classmap": [ 626 | "src/" 627 | ] 628 | }, 629 | "notification-url": "https://packagist.org/downloads/", 630 | "license": [ 631 | "BSD-3-Clause" 632 | ], 633 | "authors": [ 634 | { 635 | "name": "Sebastian Bergmann", 636 | "email": "sebastian@phpunit.de", 637 | "role": "lead" 638 | } 639 | ], 640 | "description": "FilterIterator implementation that filters files based on a list of suffixes.", 641 | "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", 642 | "keywords": [ 643 | "filesystem", 644 | "iterator" 645 | ], 646 | "time": "2018-09-13T20:33:42+00:00" 647 | }, 648 | { 649 | "name": "phpunit/php-text-template", 650 | "version": "1.2.1", 651 | "source": { 652 | "type": "git", 653 | "url": "https://github.com/sebastianbergmann/php-text-template.git", 654 | "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" 655 | }, 656 | "dist": { 657 | "type": "zip", 658 | "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", 659 | "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", 660 | "shasum": "" 661 | }, 662 | "require": { 663 | "php": ">=5.3.3" 664 | }, 665 | "type": "library", 666 | "autoload": { 667 | "classmap": [ 668 | "src/" 669 | ] 670 | }, 671 | "notification-url": "https://packagist.org/downloads/", 672 | "license": [ 673 | "BSD-3-Clause" 674 | ], 675 | "authors": [ 676 | { 677 | "name": "Sebastian Bergmann", 678 | "email": "sebastian@phpunit.de", 679 | "role": "lead" 680 | } 681 | ], 682 | "description": "Simple template engine.", 683 | "homepage": "https://github.com/sebastianbergmann/php-text-template/", 684 | "keywords": [ 685 | "template" 686 | ], 687 | "time": "2015-06-21T13:50:34+00:00" 688 | }, 689 | { 690 | "name": "phpunit/php-timer", 691 | "version": "2.0.0", 692 | "source": { 693 | "type": "git", 694 | "url": "https://github.com/sebastianbergmann/php-timer.git", 695 | "reference": "8b8454ea6958c3dee38453d3bd571e023108c91f" 696 | }, 697 | "dist": { 698 | "type": "zip", 699 | "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/8b8454ea6958c3dee38453d3bd571e023108c91f", 700 | "reference": "8b8454ea6958c3dee38453d3bd571e023108c91f", 701 | "shasum": "" 702 | }, 703 | "require": { 704 | "php": "^7.1" 705 | }, 706 | "require-dev": { 707 | "phpunit/phpunit": "^7.0" 708 | }, 709 | "type": "library", 710 | "extra": { 711 | "branch-alias": { 712 | "dev-master": "2.0-dev" 713 | } 714 | }, 715 | "autoload": { 716 | "classmap": [ 717 | "src/" 718 | ] 719 | }, 720 | "notification-url": "https://packagist.org/downloads/", 721 | "license": [ 722 | "BSD-3-Clause" 723 | ], 724 | "authors": [ 725 | { 726 | "name": "Sebastian Bergmann", 727 | "email": "sebastian@phpunit.de", 728 | "role": "lead" 729 | } 730 | ], 731 | "description": "Utility class for timing", 732 | "homepage": "https://github.com/sebastianbergmann/php-timer/", 733 | "keywords": [ 734 | "timer" 735 | ], 736 | "time": "2018-02-01T13:07:23+00:00" 737 | }, 738 | { 739 | "name": "phpunit/php-token-stream", 740 | "version": "3.0.1", 741 | "source": { 742 | "type": "git", 743 | "url": "https://github.com/sebastianbergmann/php-token-stream.git", 744 | "reference": "c99e3be9d3e85f60646f152f9002d46ed7770d18" 745 | }, 746 | "dist": { 747 | "type": "zip", 748 | "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/c99e3be9d3e85f60646f152f9002d46ed7770d18", 749 | "reference": "c99e3be9d3e85f60646f152f9002d46ed7770d18", 750 | "shasum": "" 751 | }, 752 | "require": { 753 | "ext-tokenizer": "*", 754 | "php": "^7.1" 755 | }, 756 | "require-dev": { 757 | "phpunit/phpunit": "^7.0" 758 | }, 759 | "type": "library", 760 | "extra": { 761 | "branch-alias": { 762 | "dev-master": "3.0-dev" 763 | } 764 | }, 765 | "autoload": { 766 | "classmap": [ 767 | "src/" 768 | ] 769 | }, 770 | "notification-url": "https://packagist.org/downloads/", 771 | "license": [ 772 | "BSD-3-Clause" 773 | ], 774 | "authors": [ 775 | { 776 | "name": "Sebastian Bergmann", 777 | "email": "sebastian@phpunit.de" 778 | } 779 | ], 780 | "description": "Wrapper around PHP's tokenizer extension.", 781 | "homepage": "https://github.com/sebastianbergmann/php-token-stream/", 782 | "keywords": [ 783 | "tokenizer" 784 | ], 785 | "time": "2018-10-30T05:52:18+00:00" 786 | }, 787 | { 788 | "name": "phpunit/phpunit", 789 | "version": "7.5.2", 790 | "source": { 791 | "type": "git", 792 | "url": "https://github.com/sebastianbergmann/phpunit.git", 793 | "reference": "7c89093bd00f7d5ddf0ab81dee04f801416b4944" 794 | }, 795 | "dist": { 796 | "type": "zip", 797 | "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/7c89093bd00f7d5ddf0ab81dee04f801416b4944", 798 | "reference": "7c89093bd00f7d5ddf0ab81dee04f801416b4944", 799 | "shasum": "" 800 | }, 801 | "require": { 802 | "doctrine/instantiator": "^1.1", 803 | "ext-dom": "*", 804 | "ext-json": "*", 805 | "ext-libxml": "*", 806 | "ext-mbstring": "*", 807 | "ext-xml": "*", 808 | "myclabs/deep-copy": "^1.7", 809 | "phar-io/manifest": "^1.0.2", 810 | "phar-io/version": "^2.0", 811 | "php": "^7.1", 812 | "phpspec/prophecy": "^1.7", 813 | "phpunit/php-code-coverage": "^6.0.7", 814 | "phpunit/php-file-iterator": "^2.0.1", 815 | "phpunit/php-text-template": "^1.2.1", 816 | "phpunit/php-timer": "^2.0", 817 | "sebastian/comparator": "^3.0", 818 | "sebastian/diff": "^3.0", 819 | "sebastian/environment": "^4.0", 820 | "sebastian/exporter": "^3.1", 821 | "sebastian/global-state": "^2.0", 822 | "sebastian/object-enumerator": "^3.0.3", 823 | "sebastian/resource-operations": "^2.0", 824 | "sebastian/version": "^2.0.1" 825 | }, 826 | "conflict": { 827 | "phpunit/phpunit-mock-objects": "*" 828 | }, 829 | "require-dev": { 830 | "ext-pdo": "*" 831 | }, 832 | "suggest": { 833 | "ext-soap": "*", 834 | "ext-xdebug": "*", 835 | "phpunit/php-invoker": "^2.0" 836 | }, 837 | "bin": [ 838 | "phpunit" 839 | ], 840 | "type": "library", 841 | "extra": { 842 | "branch-alias": { 843 | "dev-master": "7.5-dev" 844 | } 845 | }, 846 | "autoload": { 847 | "classmap": [ 848 | "src/" 849 | ] 850 | }, 851 | "notification-url": "https://packagist.org/downloads/", 852 | "license": [ 853 | "BSD-3-Clause" 854 | ], 855 | "authors": [ 856 | { 857 | "name": "Sebastian Bergmann", 858 | "email": "sebastian@phpunit.de", 859 | "role": "lead" 860 | } 861 | ], 862 | "description": "The PHP Unit Testing framework.", 863 | "homepage": "https://phpunit.de/", 864 | "keywords": [ 865 | "phpunit", 866 | "testing", 867 | "xunit" 868 | ], 869 | "time": "2019-01-15T08:19:08+00:00" 870 | }, 871 | { 872 | "name": "sebastian/code-unit-reverse-lookup", 873 | "version": "1.0.1", 874 | "source": { 875 | "type": "git", 876 | "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", 877 | "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" 878 | }, 879 | "dist": { 880 | "type": "zip", 881 | "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", 882 | "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", 883 | "shasum": "" 884 | }, 885 | "require": { 886 | "php": "^5.6 || ^7.0" 887 | }, 888 | "require-dev": { 889 | "phpunit/phpunit": "^5.7 || ^6.0" 890 | }, 891 | "type": "library", 892 | "extra": { 893 | "branch-alias": { 894 | "dev-master": "1.0.x-dev" 895 | } 896 | }, 897 | "autoload": { 898 | "classmap": [ 899 | "src/" 900 | ] 901 | }, 902 | "notification-url": "https://packagist.org/downloads/", 903 | "license": [ 904 | "BSD-3-Clause" 905 | ], 906 | "authors": [ 907 | { 908 | "name": "Sebastian Bergmann", 909 | "email": "sebastian@phpunit.de" 910 | } 911 | ], 912 | "description": "Looks up which function or method a line of code belongs to", 913 | "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", 914 | "time": "2017-03-04T06:30:41+00:00" 915 | }, 916 | { 917 | "name": "sebastian/comparator", 918 | "version": "3.0.2", 919 | "source": { 920 | "type": "git", 921 | "url": "https://github.com/sebastianbergmann/comparator.git", 922 | "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da" 923 | }, 924 | "dist": { 925 | "type": "zip", 926 | "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", 927 | "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", 928 | "shasum": "" 929 | }, 930 | "require": { 931 | "php": "^7.1", 932 | "sebastian/diff": "^3.0", 933 | "sebastian/exporter": "^3.1" 934 | }, 935 | "require-dev": { 936 | "phpunit/phpunit": "^7.1" 937 | }, 938 | "type": "library", 939 | "extra": { 940 | "branch-alias": { 941 | "dev-master": "3.0-dev" 942 | } 943 | }, 944 | "autoload": { 945 | "classmap": [ 946 | "src/" 947 | ] 948 | }, 949 | "notification-url": "https://packagist.org/downloads/", 950 | "license": [ 951 | "BSD-3-Clause" 952 | ], 953 | "authors": [ 954 | { 955 | "name": "Jeff Welch", 956 | "email": "whatthejeff@gmail.com" 957 | }, 958 | { 959 | "name": "Volker Dusch", 960 | "email": "github@wallbash.com" 961 | }, 962 | { 963 | "name": "Bernhard Schussek", 964 | "email": "bschussek@2bepublished.at" 965 | }, 966 | { 967 | "name": "Sebastian Bergmann", 968 | "email": "sebastian@phpunit.de" 969 | } 970 | ], 971 | "description": "Provides the functionality to compare PHP values for equality", 972 | "homepage": "https://github.com/sebastianbergmann/comparator", 973 | "keywords": [ 974 | "comparator", 975 | "compare", 976 | "equality" 977 | ], 978 | "time": "2018-07-12T15:12:46+00:00" 979 | }, 980 | { 981 | "name": "sebastian/diff", 982 | "version": "3.0.1", 983 | "source": { 984 | "type": "git", 985 | "url": "https://github.com/sebastianbergmann/diff.git", 986 | "reference": "366541b989927187c4ca70490a35615d3fef2dce" 987 | }, 988 | "dist": { 989 | "type": "zip", 990 | "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/366541b989927187c4ca70490a35615d3fef2dce", 991 | "reference": "366541b989927187c4ca70490a35615d3fef2dce", 992 | "shasum": "" 993 | }, 994 | "require": { 995 | "php": "^7.1" 996 | }, 997 | "require-dev": { 998 | "phpunit/phpunit": "^7.0", 999 | "symfony/process": "^2 || ^3.3 || ^4" 1000 | }, 1001 | "type": "library", 1002 | "extra": { 1003 | "branch-alias": { 1004 | "dev-master": "3.0-dev" 1005 | } 1006 | }, 1007 | "autoload": { 1008 | "classmap": [ 1009 | "src/" 1010 | ] 1011 | }, 1012 | "notification-url": "https://packagist.org/downloads/", 1013 | "license": [ 1014 | "BSD-3-Clause" 1015 | ], 1016 | "authors": [ 1017 | { 1018 | "name": "Kore Nordmann", 1019 | "email": "mail@kore-nordmann.de" 1020 | }, 1021 | { 1022 | "name": "Sebastian Bergmann", 1023 | "email": "sebastian@phpunit.de" 1024 | } 1025 | ], 1026 | "description": "Diff implementation", 1027 | "homepage": "https://github.com/sebastianbergmann/diff", 1028 | "keywords": [ 1029 | "diff", 1030 | "udiff", 1031 | "unidiff", 1032 | "unified diff" 1033 | ], 1034 | "time": "2018-06-10T07:54:39+00:00" 1035 | }, 1036 | { 1037 | "name": "sebastian/environment", 1038 | "version": "4.0.2", 1039 | "source": { 1040 | "type": "git", 1041 | "url": "https://github.com/sebastianbergmann/environment.git", 1042 | "reference": "4a43e9af57b4afa663077b9bc85255dbc6e8a2bd" 1043 | }, 1044 | "dist": { 1045 | "type": "zip", 1046 | "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/4a43e9af57b4afa663077b9bc85255dbc6e8a2bd", 1047 | "reference": "4a43e9af57b4afa663077b9bc85255dbc6e8a2bd", 1048 | "shasum": "" 1049 | }, 1050 | "require": { 1051 | "php": "^7.1" 1052 | }, 1053 | "require-dev": { 1054 | "phpunit/phpunit": "^7.4" 1055 | }, 1056 | "type": "library", 1057 | "extra": { 1058 | "branch-alias": { 1059 | "dev-master": "4.0-dev" 1060 | } 1061 | }, 1062 | "autoload": { 1063 | "classmap": [ 1064 | "src/" 1065 | ] 1066 | }, 1067 | "notification-url": "https://packagist.org/downloads/", 1068 | "license": [ 1069 | "BSD-3-Clause" 1070 | ], 1071 | "authors": [ 1072 | { 1073 | "name": "Sebastian Bergmann", 1074 | "email": "sebastian@phpunit.de" 1075 | } 1076 | ], 1077 | "description": "Provides functionality to handle HHVM/PHP environments", 1078 | "homepage": "http://www.github.com/sebastianbergmann/environment", 1079 | "keywords": [ 1080 | "Xdebug", 1081 | "environment", 1082 | "hhvm" 1083 | ], 1084 | "time": "2019-01-28T15:26:03+00:00" 1085 | }, 1086 | { 1087 | "name": "sebastian/exporter", 1088 | "version": "3.1.0", 1089 | "source": { 1090 | "type": "git", 1091 | "url": "https://github.com/sebastianbergmann/exporter.git", 1092 | "reference": "234199f4528de6d12aaa58b612e98f7d36adb937" 1093 | }, 1094 | "dist": { 1095 | "type": "zip", 1096 | "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/234199f4528de6d12aaa58b612e98f7d36adb937", 1097 | "reference": "234199f4528de6d12aaa58b612e98f7d36adb937", 1098 | "shasum": "" 1099 | }, 1100 | "require": { 1101 | "php": "^7.0", 1102 | "sebastian/recursion-context": "^3.0" 1103 | }, 1104 | "require-dev": { 1105 | "ext-mbstring": "*", 1106 | "phpunit/phpunit": "^6.0" 1107 | }, 1108 | "type": "library", 1109 | "extra": { 1110 | "branch-alias": { 1111 | "dev-master": "3.1.x-dev" 1112 | } 1113 | }, 1114 | "autoload": { 1115 | "classmap": [ 1116 | "src/" 1117 | ] 1118 | }, 1119 | "notification-url": "https://packagist.org/downloads/", 1120 | "license": [ 1121 | "BSD-3-Clause" 1122 | ], 1123 | "authors": [ 1124 | { 1125 | "name": "Jeff Welch", 1126 | "email": "whatthejeff@gmail.com" 1127 | }, 1128 | { 1129 | "name": "Volker Dusch", 1130 | "email": "github@wallbash.com" 1131 | }, 1132 | { 1133 | "name": "Bernhard Schussek", 1134 | "email": "bschussek@2bepublished.at" 1135 | }, 1136 | { 1137 | "name": "Sebastian Bergmann", 1138 | "email": "sebastian@phpunit.de" 1139 | }, 1140 | { 1141 | "name": "Adam Harvey", 1142 | "email": "aharvey@php.net" 1143 | } 1144 | ], 1145 | "description": "Provides the functionality to export PHP variables for visualization", 1146 | "homepage": "http://www.github.com/sebastianbergmann/exporter", 1147 | "keywords": [ 1148 | "export", 1149 | "exporter" 1150 | ], 1151 | "time": "2017-04-03T13:19:02+00:00" 1152 | }, 1153 | { 1154 | "name": "sebastian/global-state", 1155 | "version": "2.0.0", 1156 | "source": { 1157 | "type": "git", 1158 | "url": "https://github.com/sebastianbergmann/global-state.git", 1159 | "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" 1160 | }, 1161 | "dist": { 1162 | "type": "zip", 1163 | "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", 1164 | "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", 1165 | "shasum": "" 1166 | }, 1167 | "require": { 1168 | "php": "^7.0" 1169 | }, 1170 | "require-dev": { 1171 | "phpunit/phpunit": "^6.0" 1172 | }, 1173 | "suggest": { 1174 | "ext-uopz": "*" 1175 | }, 1176 | "type": "library", 1177 | "extra": { 1178 | "branch-alias": { 1179 | "dev-master": "2.0-dev" 1180 | } 1181 | }, 1182 | "autoload": { 1183 | "classmap": [ 1184 | "src/" 1185 | ] 1186 | }, 1187 | "notification-url": "https://packagist.org/downloads/", 1188 | "license": [ 1189 | "BSD-3-Clause" 1190 | ], 1191 | "authors": [ 1192 | { 1193 | "name": "Sebastian Bergmann", 1194 | "email": "sebastian@phpunit.de" 1195 | } 1196 | ], 1197 | "description": "Snapshotting of global state", 1198 | "homepage": "http://www.github.com/sebastianbergmann/global-state", 1199 | "keywords": [ 1200 | "global state" 1201 | ], 1202 | "time": "2017-04-27T15:39:26+00:00" 1203 | }, 1204 | { 1205 | "name": "sebastian/object-enumerator", 1206 | "version": "3.0.3", 1207 | "source": { 1208 | "type": "git", 1209 | "url": "https://github.com/sebastianbergmann/object-enumerator.git", 1210 | "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" 1211 | }, 1212 | "dist": { 1213 | "type": "zip", 1214 | "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", 1215 | "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", 1216 | "shasum": "" 1217 | }, 1218 | "require": { 1219 | "php": "^7.0", 1220 | "sebastian/object-reflector": "^1.1.1", 1221 | "sebastian/recursion-context": "^3.0" 1222 | }, 1223 | "require-dev": { 1224 | "phpunit/phpunit": "^6.0" 1225 | }, 1226 | "type": "library", 1227 | "extra": { 1228 | "branch-alias": { 1229 | "dev-master": "3.0.x-dev" 1230 | } 1231 | }, 1232 | "autoload": { 1233 | "classmap": [ 1234 | "src/" 1235 | ] 1236 | }, 1237 | "notification-url": "https://packagist.org/downloads/", 1238 | "license": [ 1239 | "BSD-3-Clause" 1240 | ], 1241 | "authors": [ 1242 | { 1243 | "name": "Sebastian Bergmann", 1244 | "email": "sebastian@phpunit.de" 1245 | } 1246 | ], 1247 | "description": "Traverses array structures and object graphs to enumerate all referenced objects", 1248 | "homepage": "https://github.com/sebastianbergmann/object-enumerator/", 1249 | "time": "2017-08-03T12:35:26+00:00" 1250 | }, 1251 | { 1252 | "name": "sebastian/object-reflector", 1253 | "version": "1.1.1", 1254 | "source": { 1255 | "type": "git", 1256 | "url": "https://github.com/sebastianbergmann/object-reflector.git", 1257 | "reference": "773f97c67f28de00d397be301821b06708fca0be" 1258 | }, 1259 | "dist": { 1260 | "type": "zip", 1261 | "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", 1262 | "reference": "773f97c67f28de00d397be301821b06708fca0be", 1263 | "shasum": "" 1264 | }, 1265 | "require": { 1266 | "php": "^7.0" 1267 | }, 1268 | "require-dev": { 1269 | "phpunit/phpunit": "^6.0" 1270 | }, 1271 | "type": "library", 1272 | "extra": { 1273 | "branch-alias": { 1274 | "dev-master": "1.1-dev" 1275 | } 1276 | }, 1277 | "autoload": { 1278 | "classmap": [ 1279 | "src/" 1280 | ] 1281 | }, 1282 | "notification-url": "https://packagist.org/downloads/", 1283 | "license": [ 1284 | "BSD-3-Clause" 1285 | ], 1286 | "authors": [ 1287 | { 1288 | "name": "Sebastian Bergmann", 1289 | "email": "sebastian@phpunit.de" 1290 | } 1291 | ], 1292 | "description": "Allows reflection of object attributes, including inherited and non-public ones", 1293 | "homepage": "https://github.com/sebastianbergmann/object-reflector/", 1294 | "time": "2017-03-29T09:07:27+00:00" 1295 | }, 1296 | { 1297 | "name": "sebastian/recursion-context", 1298 | "version": "3.0.0", 1299 | "source": { 1300 | "type": "git", 1301 | "url": "https://github.com/sebastianbergmann/recursion-context.git", 1302 | "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" 1303 | }, 1304 | "dist": { 1305 | "type": "zip", 1306 | "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", 1307 | "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", 1308 | "shasum": "" 1309 | }, 1310 | "require": { 1311 | "php": "^7.0" 1312 | }, 1313 | "require-dev": { 1314 | "phpunit/phpunit": "^6.0" 1315 | }, 1316 | "type": "library", 1317 | "extra": { 1318 | "branch-alias": { 1319 | "dev-master": "3.0.x-dev" 1320 | } 1321 | }, 1322 | "autoload": { 1323 | "classmap": [ 1324 | "src/" 1325 | ] 1326 | }, 1327 | "notification-url": "https://packagist.org/downloads/", 1328 | "license": [ 1329 | "BSD-3-Clause" 1330 | ], 1331 | "authors": [ 1332 | { 1333 | "name": "Jeff Welch", 1334 | "email": "whatthejeff@gmail.com" 1335 | }, 1336 | { 1337 | "name": "Sebastian Bergmann", 1338 | "email": "sebastian@phpunit.de" 1339 | }, 1340 | { 1341 | "name": "Adam Harvey", 1342 | "email": "aharvey@php.net" 1343 | } 1344 | ], 1345 | "description": "Provides functionality to recursively process PHP variables", 1346 | "homepage": "http://www.github.com/sebastianbergmann/recursion-context", 1347 | "time": "2017-03-03T06:23:57+00:00" 1348 | }, 1349 | { 1350 | "name": "sebastian/resource-operations", 1351 | "version": "2.0.1", 1352 | "source": { 1353 | "type": "git", 1354 | "url": "https://github.com/sebastianbergmann/resource-operations.git", 1355 | "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" 1356 | }, 1357 | "dist": { 1358 | "type": "zip", 1359 | "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", 1360 | "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", 1361 | "shasum": "" 1362 | }, 1363 | "require": { 1364 | "php": "^7.1" 1365 | }, 1366 | "type": "library", 1367 | "extra": { 1368 | "branch-alias": { 1369 | "dev-master": "2.0-dev" 1370 | } 1371 | }, 1372 | "autoload": { 1373 | "classmap": [ 1374 | "src/" 1375 | ] 1376 | }, 1377 | "notification-url": "https://packagist.org/downloads/", 1378 | "license": [ 1379 | "BSD-3-Clause" 1380 | ], 1381 | "authors": [ 1382 | { 1383 | "name": "Sebastian Bergmann", 1384 | "email": "sebastian@phpunit.de" 1385 | } 1386 | ], 1387 | "description": "Provides a list of PHP built-in functions that operate on resources", 1388 | "homepage": "https://www.github.com/sebastianbergmann/resource-operations", 1389 | "time": "2018-10-04T04:07:39+00:00" 1390 | }, 1391 | { 1392 | "name": "sebastian/version", 1393 | "version": "2.0.1", 1394 | "source": { 1395 | "type": "git", 1396 | "url": "https://github.com/sebastianbergmann/version.git", 1397 | "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" 1398 | }, 1399 | "dist": { 1400 | "type": "zip", 1401 | "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", 1402 | "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", 1403 | "shasum": "" 1404 | }, 1405 | "require": { 1406 | "php": ">=5.6" 1407 | }, 1408 | "type": "library", 1409 | "extra": { 1410 | "branch-alias": { 1411 | "dev-master": "2.0.x-dev" 1412 | } 1413 | }, 1414 | "autoload": { 1415 | "classmap": [ 1416 | "src/" 1417 | ] 1418 | }, 1419 | "notification-url": "https://packagist.org/downloads/", 1420 | "license": [ 1421 | "BSD-3-Clause" 1422 | ], 1423 | "authors": [ 1424 | { 1425 | "name": "Sebastian Bergmann", 1426 | "email": "sebastian@phpunit.de", 1427 | "role": "lead" 1428 | } 1429 | ], 1430 | "description": "Library that helps with managing the version number of Git-hosted PHP projects", 1431 | "homepage": "https://github.com/sebastianbergmann/version", 1432 | "time": "2016-10-03T07:35:21+00:00" 1433 | }, 1434 | { 1435 | "name": "symfony/polyfill-ctype", 1436 | "version": "v1.10.0", 1437 | "source": { 1438 | "type": "git", 1439 | "url": "https://github.com/symfony/polyfill-ctype.git", 1440 | "reference": "e3d826245268269cd66f8326bd8bc066687b4a19" 1441 | }, 1442 | "dist": { 1443 | "type": "zip", 1444 | "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19", 1445 | "reference": "e3d826245268269cd66f8326bd8bc066687b4a19", 1446 | "shasum": "" 1447 | }, 1448 | "require": { 1449 | "php": ">=5.3.3" 1450 | }, 1451 | "suggest": { 1452 | "ext-ctype": "For best performance" 1453 | }, 1454 | "type": "library", 1455 | "extra": { 1456 | "branch-alias": { 1457 | "dev-master": "1.9-dev" 1458 | } 1459 | }, 1460 | "autoload": { 1461 | "psr-4": { 1462 | "Symfony\\Polyfill\\Ctype\\": "" 1463 | }, 1464 | "files": [ 1465 | "bootstrap.php" 1466 | ] 1467 | }, 1468 | "notification-url": "https://packagist.org/downloads/", 1469 | "license": [ 1470 | "MIT" 1471 | ], 1472 | "authors": [ 1473 | { 1474 | "name": "Symfony Community", 1475 | "homepage": "https://symfony.com/contributors" 1476 | }, 1477 | { 1478 | "name": "Gert de Pagter", 1479 | "email": "backendtea@gmail.com" 1480 | } 1481 | ], 1482 | "description": "Symfony polyfill for ctype functions", 1483 | "homepage": "https://symfony.com", 1484 | "keywords": [ 1485 | "compatibility", 1486 | "ctype", 1487 | "polyfill", 1488 | "portable" 1489 | ], 1490 | "time": "2018-08-06T14:22:27+00:00" 1491 | }, 1492 | { 1493 | "name": "theseer/tokenizer", 1494 | "version": "1.1.0", 1495 | "source": { 1496 | "type": "git", 1497 | "url": "https://github.com/theseer/tokenizer.git", 1498 | "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b" 1499 | }, 1500 | "dist": { 1501 | "type": "zip", 1502 | "url": "https://api.github.com/repos/theseer/tokenizer/zipball/cb2f008f3f05af2893a87208fe6a6c4985483f8b", 1503 | "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b", 1504 | "shasum": "" 1505 | }, 1506 | "require": { 1507 | "ext-dom": "*", 1508 | "ext-tokenizer": "*", 1509 | "ext-xmlwriter": "*", 1510 | "php": "^7.0" 1511 | }, 1512 | "type": "library", 1513 | "autoload": { 1514 | "classmap": [ 1515 | "src/" 1516 | ] 1517 | }, 1518 | "notification-url": "https://packagist.org/downloads/", 1519 | "license": [ 1520 | "BSD-3-Clause" 1521 | ], 1522 | "authors": [ 1523 | { 1524 | "name": "Arne Blankerts", 1525 | "email": "arne@blankerts.de", 1526 | "role": "Developer" 1527 | } 1528 | ], 1529 | "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", 1530 | "time": "2017-04-07T12:08:54+00:00" 1531 | }, 1532 | { 1533 | "name": "webmozart/assert", 1534 | "version": "1.4.0", 1535 | "source": { 1536 | "type": "git", 1537 | "url": "https://github.com/webmozart/assert.git", 1538 | "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9" 1539 | }, 1540 | "dist": { 1541 | "type": "zip", 1542 | "url": "https://api.github.com/repos/webmozart/assert/zipball/83e253c8e0be5b0257b881e1827274667c5c17a9", 1543 | "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9", 1544 | "shasum": "" 1545 | }, 1546 | "require": { 1547 | "php": "^5.3.3 || ^7.0", 1548 | "symfony/polyfill-ctype": "^1.8" 1549 | }, 1550 | "require-dev": { 1551 | "phpunit/phpunit": "^4.6", 1552 | "sebastian/version": "^1.0.1" 1553 | }, 1554 | "type": "library", 1555 | "extra": { 1556 | "branch-alias": { 1557 | "dev-master": "1.3-dev" 1558 | } 1559 | }, 1560 | "autoload": { 1561 | "psr-4": { 1562 | "Webmozart\\Assert\\": "src/" 1563 | } 1564 | }, 1565 | "notification-url": "https://packagist.org/downloads/", 1566 | "license": [ 1567 | "MIT" 1568 | ], 1569 | "authors": [ 1570 | { 1571 | "name": "Bernhard Schussek", 1572 | "email": "bschussek@gmail.com" 1573 | } 1574 | ], 1575 | "description": "Assertions to validate method input/output with nice error messages.", 1576 | "keywords": [ 1577 | "assert", 1578 | "check", 1579 | "validate" 1580 | ], 1581 | "time": "2018-12-25T11:19:39+00:00" 1582 | } 1583 | ], 1584 | "aliases": [], 1585 | "minimum-stability": "stable", 1586 | "stability-flags": [], 1587 | "prefer-stable": false, 1588 | "prefer-lowest": false, 1589 | "platform": { 1590 | "php": "^7.1" 1591 | }, 1592 | "platform-dev": [] 1593 | } 1594 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | ./tests 14 | 15 | 16 | 17 | 18 | ./src 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/AddressValidator.php: -------------------------------------------------------------------------------- 1 | 5 | // (c) 2018 - 2019 Andrzej Budzanowski 6 | // -- 7 | // See LICENSE for license information. 8 | // 9 | 10 | namespace PsychoB\Ethereum; 11 | 12 | use kornrunner\Keccak; 13 | 14 | class AddressValidator 15 | { 16 | /** 17 | * String is a valid Ethereum or Etherum Classic address 18 | */ 19 | public const ADDRESS_VALID = 0; 20 | 21 | /** 22 | * String have valid address, but capitalization is incorrect. 23 | */ 24 | public const ADDRESS_CHECKSUM_INVALID = 1; 25 | 26 | /** 27 | * String is not an Ethereum or Ethereum Classic address 28 | */ 29 | public const ADDRESS_INVALID = 2; 30 | 31 | /** 32 | * Check if string is Ethereum or Ethereum Classic address 33 | * 34 | * @param string $address 35 | * 36 | * @return int 37 | */ 38 | public static function isValid(string $address): int 39 | { 40 | if (!preg_match('/^0x[a-fA-F0-9]{40}$/', $address)) { 41 | return self::ADDRESS_INVALID; 42 | } 43 | 44 | if (preg_match('/^0x[a-f0-9]{40}$/', $address) || preg_match('/^0x[A-F0-9]{40}$/', $address)) { 45 | return self::ADDRESS_VALID; 46 | } 47 | 48 | return self::validateChecksumAddress(substr($address, 2)); 49 | } 50 | 51 | private static function validateChecksumAddress($address): int 52 | { 53 | $addressHash = Keccak::hash(strtolower($address), 256); 54 | $addressArray = str_split($address); 55 | $addressHashArray = str_split($addressHash); 56 | 57 | for ($i = 0; $i < 40; $i++) { 58 | // the nth letter should be uppercase if the nth digit of casemap is 1 59 | if ((intval($addressHashArray[$i], 16) > 7 && strtoupper($addressArray[$i]) !== $addressArray[$i]) || 60 | (intval($addressHashArray[$i], 16) <= 7 && strtolower($addressArray[$i]) !== $addressArray[$i])) { 61 | return self::ADDRESS_CHECKSUM_INVALID; 62 | } 63 | } 64 | 65 | return self::ADDRESS_VALID; 66 | } 67 | 68 | /** 69 | * Generate address with checksum from non-checksumed address. 70 | * 71 | * @param string $address 72 | * 73 | * @return string|null 74 | */ 75 | public static function getCanonicalAddress(string $address): ?string 76 | { 77 | if (!preg_match('/^0x[a-fA-F0-9]{40}$/', $address)) { 78 | return NULL; 79 | } 80 | 81 | $address = substr($address, 2); 82 | $addressHash = Keccak::hash(strtolower($address), 256); 83 | $addressArray = str_split($address); 84 | $addressHashArray = str_split($addressHash); 85 | 86 | $ret = ''; 87 | 88 | for ($i = 0; $i < 40; $i++) { 89 | // the nth letter should be uppercase if the nth digit of casemap is 1 90 | if (intval($addressHashArray[$i], 16) > 7) { 91 | $ret .= strtoupper($addressArray[$i]); 92 | } else /*if (intval($addressHashArray[$i], 16) <= 7)*/ { 93 | $ret .= strtolower($addressArray[$i]); 94 | } 95 | } 96 | 97 | return '0x' . $ret; 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /tests/AddressValidatorTest.php: -------------------------------------------------------------------------------- 1 | 5 | // (c) 2018 - 2019 Andrzej Budzanowski 6 | // -- 7 | // See LICENSE for license information. 8 | // 9 | 10 | namespace Tests\PsychoB\Ethereum; 11 | 12 | use PHPUnit\Framework\TestCase; 13 | use PsychoB\Ethereum\AddressValidator; 14 | 15 | class AddressValidatorTest extends TestCase 16 | { 17 | public function providerTestIsValid() 18 | { 19 | return [ 20 | ['0xA477941c7AAD6536f175ef123bf9eeD6F82A4c85'], // with checksum 21 | ['0xa477941c7aad6536f175ef123bf9eed6f82a4c85'], // without checksum, lower case 22 | ['0xA477941C7AAD6536F175EF123BF9EED6F82A4C85'], // without checksum, upper case 23 | ]; 24 | } 25 | 26 | /** @dataProvider providerTestIsValid */ 27 | public function testIsValid(string $address) 28 | { 29 | $this->assertEquals(AddressValidator::ADDRESS_VALID, AddressValidator::isValid($address)); 30 | } 31 | 32 | public function providerTestIsInValidChecksum() 33 | { 34 | return [ 35 | ['0xA477941c7aad6536f175ef123bf9eeD6F82A4c85'], // invalid checksum, capitalisation 36 | ['0xA477941c7aFd6536f175ef123bf9eeD6F82A4c85'], // invalid checksum, wrong address 37 | ]; 38 | } 39 | 40 | /** @dataProvider providerTestIsInValidChecksum */ 41 | public function testIsInValidChecksum(string $address) 42 | { 43 | $this->assertEquals(AddressValidator::ADDRESS_CHECKSUM_INVALID, AddressValidator::isValid($address)); 44 | } 45 | 46 | public function providerTestIsInvalid() 47 | { 48 | return [ 49 | ['0xA477941c7AAD6536f175ef123bf9eeD6F82A4c8'], // too short address 50 | ['0xA477941c7AAD6536f175ef123bf9eeD6F82A4c856'], // address too long 51 | [''], 52 | ]; 53 | } 54 | 55 | /** @dataProvider providerTestIsInvalid */ 56 | public function testIsInvalid(string $address) 57 | { 58 | $this->assertEquals(AddressValidator::ADDRESS_INVALID, AddressValidator::isValid($address)); 59 | } 60 | 61 | public function providerTestGetCanonical() 62 | { 63 | return [ 64 | ['0xA477941c7AAD6536f175ef123bf9eeD6F82A4c85', '0xA477941c7AAD6536f175ef123bf9eeD6F82A4c85'], 65 | ['0xa477941c7aad6536f175ef123bf9eed6f82a4c85', '0xA477941c7AAD6536f175ef123bf9eeD6F82A4c85'], 66 | ['0xA477941C7AAD6536F175EF123BF9EED6F82A4C85', '0xA477941c7AAD6536f175ef123bf9eeD6F82A4c85'], 67 | ['0xA477941c7aad6536f175ef123bf9eeD6F82A4c85', '0xA477941c7AAD6536f175ef123bf9eeD6F82A4c85'], 68 | ['0xA477941c7aFd6536f175ef123bf9eeD6F82A4c85', '0xa477941c7aFD6536f175ef123bf9eed6f82A4C85'], 69 | ['', NULL], 70 | ]; 71 | } 72 | 73 | /** @dataProvider providerTestGetCanonical */ 74 | public function testGetCanonical(string $address, $result) 75 | { 76 | $this->assertEquals($result, AddressValidator::getCanonicalAddress($address)); 77 | } 78 | } 79 | --------------------------------------------------------------------------------