├── .coveralls.yml ├── .github └── workflows │ ├── 74.yml │ ├── 80.yml │ ├── 81.yml │ └── 82.yml ├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── composer.json ├── composer.lock ├── phpunit.xml.dist ├── src └── Set.php └── tests └── SetTest.php /.coveralls.yml: -------------------------------------------------------------------------------- 1 | coverage_clover: build/logs/clover.xml 2 | json_path: build/logs/coveralls-upload.json 3 | service_name: travis-ci 4 | -------------------------------------------------------------------------------- /.github/workflows/74.yml: -------------------------------------------------------------------------------- 1 | name: php-74 2 | 3 | on: [push] 4 | 5 | jobs: 6 | build-test: 7 | runs-on: ubuntu-latest 8 | 9 | steps: 10 | - uses: actions/checkout@v3 11 | 12 | - uses: php-actions/composer@v6 13 | 14 | - name: PHPUnit Tests 15 | uses: php-actions/phpunit@v3 16 | env: 17 | TEST_NAME: Scarlett 18 | with: 19 | bootstrap: vendor/autoload.php 20 | configuration: phpunit.xml.dist 21 | args: --coverage-text 22 | php_version: "7.4" 23 | version: "9.6.8" 24 | -------------------------------------------------------------------------------- /.github/workflows/80.yml: -------------------------------------------------------------------------------- 1 | name: php-80 2 | 3 | on: [push] 4 | 5 | jobs: 6 | build-test: 7 | runs-on: ubuntu-latest 8 | 9 | steps: 10 | - uses: actions/checkout@v3 11 | 12 | - uses: php-actions/composer@v6 13 | 14 | - name: PHPUnit Tests 15 | uses: php-actions/phpunit@v3 16 | env: 17 | TEST_NAME: Scarlett 18 | with: 19 | bootstrap: vendor/autoload.php 20 | configuration: phpunit.xml.dist 21 | args: --coverage-text 22 | php_version: "8.0" 23 | version: "9.6.8" 24 | -------------------------------------------------------------------------------- /.github/workflows/81.yml: -------------------------------------------------------------------------------- 1 | name: php-81 2 | 3 | on: [push] 4 | 5 | jobs: 6 | build-test: 7 | runs-on: ubuntu-latest 8 | 9 | steps: 10 | - uses: actions/checkout@v3 11 | 12 | - uses: php-actions/composer@v6 13 | 14 | - name: PHPUnit Tests 15 | uses: php-actions/phpunit@v3 16 | env: 17 | TEST_NAME: Scarlett 18 | with: 19 | bootstrap: vendor/autoload.php 20 | configuration: phpunit.xml.dist 21 | args: --coverage-text 22 | php_version: "8.1" 23 | version: "9.6.8" 24 | -------------------------------------------------------------------------------- /.github/workflows/82.yml: -------------------------------------------------------------------------------- 1 | name: php-82 2 | 3 | on: [push] 4 | 5 | jobs: 6 | build-test: 7 | runs-on: ubuntu-latest 8 | 9 | steps: 10 | - uses: actions/checkout@v3 11 | 12 | - uses: php-actions/composer@v6 13 | 14 | - name: PHPUnit Tests 15 | uses: php-actions/phpunit@v3 16 | env: 17 | TEST_NAME: Scarlett 18 | with: 19 | bootstrap: vendor/autoload.php 20 | configuration: phpunit.xml.dist 21 | args: --coverage-text 22 | php_version: "8.2" 23 | version: "9.6.8" 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /vendor/* 2 | .idea/ 3 | 4 | Bench.php 5 | .phpunit.result.cache 6 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | 3 | php: 4 | - '7.4' 5 | - '8.0' 6 | - '8.1' 7 | - '8.2' 8 | 9 | install: 10 | - composer install 11 | - composer require satooshi/php-coveralls:~1.0@stable 12 | 13 | before_script: 14 | - mkdir -p build/logs 15 | 16 | script: 17 | - vendor/bin/phpunit --coverage-clover build/logs/clover.xml 18 | 19 | after_success: 20 | - sh -c 'if( [ "$TRAVIS_PHP_VERSION" != "hhvm" ] ); then php vendor/bin/coveralls -v; fi;' 21 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Travis (.com)](https://img.shields.io/travis/com/jakewhiteley/php-sets?style=flat-square)](https://travis-ci.com/jakewhiteley/php-sets) [![Coveralls github](https://img.shields.io/coveralls/github/jakewhiteley/php-sets?style=flat-square)](https://coveralls.io/github/jakewhiteley/php-sets) 2 | 3 | # php-set-data-structure 4 | A PHP implementation of a Java-like Set data structure. 5 | 6 | A set is simply a group of unique things that can be iterated by the order they were inserted. So, a significant characteristic of any set is that it does not contain duplicates. 7 | 8 | Implementation is based on the [MDN JS Reference](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Set) for Sets in EMCA 6 JavaScript. 9 | 10 | Sets require a min PHP version of 7.4. 11 | 12 | * [Installation](#installation) 13 | * [**Basic usage:**](#basic-usage) 14 | * [Creating a Set](#creating-a-set) 15 | * [Adding values](#adding-values) 16 | * [Removing values](#removing-values) 17 | * [Testing if a value is present](#testing-if-a-value-is-present) 18 | * [Counting items](#counting-items) 19 | * [**Set Iteration**](#iteration) 20 | * [As a traditional Array](#as-a-traditional-array) 21 | * [Using `entries()`](#using-entries) 22 | * [Using `each`](#using-eachcallback-args) 23 | * [**Set operations**](#set-operations) 24 | * [Union](#union) 25 | * [Difference](#difference) 26 | * [Symmetric difference](#symmetric-difference) 27 | * [Intersect](#intersect) 28 | * [Subsets](#subsets) 29 | * [**Set family operations**](#set-family-operations) 30 | * [Family Union](#union-of-a-family-of-sets) 31 | * [Family Intersection](#intersection-of-a-family-of-sets) 32 | 33 | ## Installation 34 | You can download the latest release via the releases link on this page. 35 | 36 | PHP-Sets is available via [Composer](https://packagist.org/packages/jakewhiteley/php-sets) by running the following command: 37 | 38 | ````bash 39 | composer require jakewhiteley/php-sets 40 | ```` 41 | 42 | then include the library in your project like so: 43 | ````php 44 | include('vendor/autoload.php'); 45 | 46 | use PhpSets\Set; 47 | ```` 48 | 49 | 50 | ## Basic Usage 51 | 52 | #### Creating a Set 53 | 54 | When you create a set, you can insert initial values or keep it empty. 55 | ````php 56 | $set = new Set(1, 2, 3); 57 | $emptySet = new Set(); 58 | ```` 59 | 60 | Sets cannot contain duplicate values, and values are stored in insertion order. 61 | ````php 62 | // $set contains [1, 2, 3] as duplicates are not stored 63 | $set = new Set(1, 2, 1, 3, 2); 64 | ```` 65 | 66 | If you have an array of elements, you can either pass in the array directly, or splat the array. 67 | ```php 68 | $set = new Set([1, 2, 1, 3, 2]); 69 | 70 | $array = [1, 2, 1, 3, 2]; 71 | $set = new Set(...$array); 72 | ``` 73 | 74 | #### Adding values 75 | Values of any type (Including Objects, arrays, and other `Sets`) are added to a set via the `add()` method. 76 | 77 | It is worth noting that uniqueness is on a **strict type** basis, so `(string) '1' !== (int) 1 !== (float) 1.0`. This also is true for Objects within the set and an object with a classA is not equal to an object with classB, even if the properties etc are the same. 78 | ````php 79 | // create empty Set 80 | $set = new Set(); 81 | 82 | $set->add('a'); 83 | // $set => ['a'] 84 | 85 | $set->add(1); 86 | // $set => ['a', 1] 87 | ```` 88 | 89 | As `Sets` implements the `ArrayAccess` interface, you can also add values as you would with a standard Array. 90 | ````php 91 | $set = new Set(); 92 | 93 | $set[] = 1; 94 | $set[] = 'foo'; 95 | // $set => [1, 'foo'] 96 | 97 | 98 | // You can also replace values by key, provided the new value is unique within the Set 99 | $set[0] = 2; 100 | // $set => [2, 'foo'] 101 | 102 | // If a key is not currently in the array, the value is appended to maintain insertion order 103 | $set[4] = 'foo'; 104 | // $newSet => [2, 'foo', 'foo'] 105 | ```` 106 | 107 | #### Removing values 108 | Values can be removed individually via `delete()`, or all at once via the `clear()` method. 109 | ````php 110 | $set = new Set(1, 2, 3); 111 | 112 | $set->delete(2); 113 | // $set => [1, 3] 114 | 115 | $set->clear(); 116 | // $set => [] 117 | ```` 118 | 119 | You can also delete methods via `ArrayAccess`: 120 | ````php 121 | $set = new Set(1, 2, 3); 122 | 123 | unset($set[0]); 124 | // $set => [2, 3] 125 | ```` 126 | 127 | #### Testing if a value is present 128 | You can easily test if a `Set` contains a value via the `has($value)` method. 129 | 130 | As with the other methods, this is a **strict type** test. 131 | 132 | ````php 133 | $set = new Set('a', [1, 2], 1.0); 134 | 135 | $set->has('a'); // true 136 | $set->has([1, 2]); // true 137 | $set->has(1); // false 138 | $set->has([1, '2']); // false 139 | $set->has('foo'); // false 140 | ```` 141 | 142 | 143 | #### Counting items 144 | This is done using the `count` method: 145 | ````php 146 | $set = new Set(1, 2, 3); 147 | 148 | echo $set->count(); // 3 149 | ```` 150 | 151 | 152 | 153 | 154 | ## Iteration 155 | There are many ways to iterate a `Set`: 156 | * Like a traditional PHP array 157 | * Using `entries()` to return an instance of PHP's `ArrayIterator` 158 | * Using `each()` and a provided callback function 159 | * Using `values()` which returns a traditional PHP Array version of the Set 160 | 161 | #### As a traditional Array 162 | The Set object extends an `ArrayObject`, and can be iterated like a normal array: 163 | ````php 164 | $set = new Set(1, 2); 165 | 166 | foreach ($set as $val) { 167 | print($val); 168 | } 169 | ```` 170 | 171 | Or if you want, you can iterate `$set->values()` instead. 172 | 173 | #### Using `entries()` 174 | The `entries()` method returns an [ArrayIterator](http://php.net/manual/en/class.arrayiterator.php) object. 175 | ````php 176 | $iterator = $set->entries(); 177 | 178 | while ($iterator->valid()) { 179 | echo $iterator->current(); 180 | $iterator->next(); 181 | } 182 | ```` 183 | 184 | #### Using `each($callback, ...$args)` 185 | You can also iterate a `Set` via a provided [callable](https://www.php.net/manual/en/language.types.callable.php) method. 186 | 187 | The callback is called with the current item as parameter 1, with any additional specified params passed after. 188 | 189 | ````php 190 | function cb($item, $parameter) { 191 | echo $item * $parameter; 192 | } 193 | 194 | $set = new Set(1, 2); 195 | 196 | $set->each('cb', 10); 197 | // prints 10 20 198 | ```` 199 | 200 | 201 | ## Set operations 202 | 203 | #### Union 204 | Appends a second `Set` onto a given `Set` without creating duplicates: 205 | ````php 206 | $a = new Set(1, 2, 3); 207 | $b = new Set(2, 3, 4); 208 | 209 | $merged = $a->union($b); 210 | 211 | print_r($merged->values()); // [1, 2, 3, 4] 212 | ```` 213 | 214 | #### Difference 215 | The `difference()` method will return a new `Set` containing values present in the original `Set` but not present in another. 216 | 217 | This is also known as the _relative complement_. 218 | ````php 219 | $a = new Set(1, 2, 3, 4); 220 | $b = new Set(3, 4, 5, 6); 221 | 222 | print_r($a->difference($b)->values()); // [1, 2] 223 | print_r($b->difference($a)->values()); // [5, 6] 224 | ```` 225 | 226 | #### Symmetric Difference 227 | The `symmetricDifference()` method also returns a new `Set` but differs to the `difference` method in that it will return **all** uncommon values between both `Sets`. 228 | 229 | ````php 230 | $a = new Set(1, 2, 3, 4); 231 | $b = new Set(3, 4, 5, 6); 232 | 233 | print_r($a->symmetricDifference($b)->values()); // [1, 2, 5, 6] 234 | ```` 235 | 236 | #### Intersect 237 | Returns a new `Set` containing the items common (present in both) between two sets: 238 | ````php 239 | $a = new Set(1, 2, 3); 240 | $b = new Set(2, 3, 4); 241 | 242 | $intersect = $a->intersect($b); 243 | 244 | print_r($intersect->values()); // [2, 3] 245 | ```` 246 | 247 | #### Subsets 248 | The `isSupersetOf` method returns a `bool` indicating if a given `Set` is a subset of the current `Set`. 249 | 250 | The order of values does not matter, but a subset must only contain items present in the original `Set`: 251 | 252 | ````php 253 | $a = new Set(1, 2, 3); 254 | $b = new Set(2, 3); 255 | 256 | var_Dump($b->isSupersetOf($a)); // true 257 | var_Dump($a->isSupersetOf($b)); // false 258 | ```` 259 | 260 | ## Set family operations 261 | 262 | If we have a collection of sets, for example `{ { 1,2,3 }, { 3,4,5 } , { 3, 5, 6, 7 } }`, often called a *family* of sets 263 | in Set Theory, we can take the union and intersection of the family. That is, `( { 1, 2, 3 } union { 3, 4, 5 } ) union { 3, 5, 6, 7 }` and likewise for intersection. In Set Theory a large union and intersection symbol is used for this purpose. 264 | 265 | Note that, at present, these operations are implemented 266 | naively by iteratively calling the `union` and `intersect` 267 | methods above. More efficient implementations are possible 268 | and welcome. 269 | 270 | #### Union of a Family of Sets 271 | 272 | At present the family of sets needs to be in an array of `Set` objects: 273 | ```php 274 | $set1 = Set(1, 2, 3); 275 | $set2 = Set(3, 4, 5); 276 | $set2 = Set(5, 1, 6); 277 | 278 | $set_union = Set::familyUnion([$set1, $set2]); // [1, 2, 3, 4, 5, 6] 279 | ``` 280 | 281 | #### Intersection of a Family of Sets 282 | 283 | As with `familyUnion`, the family of sets needs to be in an array of `Set` objects: 284 | ```php 285 | $set1 = Set(1,2,3); 286 | $set2 = Set(3,4,5); 287 | $set_family = [ $set1, $set2 ]; 288 | $set_intersection = Set::familyIntersection($set_family); 289 | ``` 290 | 291 | Note that, contrary to Set Theory, the result of 292 | taking the intersection of an empty array results 293 | in an empty array. (In Set Theory the intersection 294 | of an empty family is undefined as it would be the 295 | ['set of all sets'](https://en.wikipedia.org/wiki/Universal_set).) 296 | 297 | ### Contributing 298 | Contributions and changes welcome! Just open an issue or submit a PR :muscle: 299 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jakewhiteley/php-sets", 3 | "description": "An implementation of a Java-like Set data structure for PHP. A Set is an iterable data structure which allows strict-type storage of unique values.", 4 | "license": "GPL-3.0-or-later", 5 | "authors": [ 6 | { 7 | "name": "Jake Whiteley", 8 | "email": "jakebwhiteley@gmail.com" 9 | } 10 | ], 11 | "require": { 12 | "php": ">=7.4" 13 | }, 14 | "require-dev": { 15 | "phpunit/phpunit": "^9.6.8" 16 | }, 17 | "autoload": { 18 | "psr-4": { 19 | "PhpSets\\": "src/" 20 | } 21 | }, 22 | "autoload-dev": { 23 | "psr-4": { 24 | "PhpSets\\Test\\": "tests/" 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /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": "2d9d6eec7c08ddd0d47af33b9743079b", 8 | "packages": [], 9 | "packages-dev": [ 10 | { 11 | "name": "doctrine/instantiator", 12 | "version": "1.5.0", 13 | "source": { 14 | "type": "git", 15 | "url": "https://github.com/doctrine/instantiator.git", 16 | "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b" 17 | }, 18 | "dist": { 19 | "type": "zip", 20 | "url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b", 21 | "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b", 22 | "shasum": "" 23 | }, 24 | "require": { 25 | "php": "^7.1 || ^8.0" 26 | }, 27 | "require-dev": { 28 | "doctrine/coding-standard": "^9 || ^11", 29 | "ext-pdo": "*", 30 | "ext-phar": "*", 31 | "phpbench/phpbench": "^0.16 || ^1", 32 | "phpstan/phpstan": "^1.4", 33 | "phpstan/phpstan-phpunit": "^1", 34 | "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", 35 | "vimeo/psalm": "^4.30 || ^5.4" 36 | }, 37 | "type": "library", 38 | "autoload": { 39 | "psr-4": { 40 | "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" 41 | } 42 | }, 43 | "notification-url": "https://packagist.org/downloads/", 44 | "license": [ 45 | "MIT" 46 | ], 47 | "authors": [ 48 | { 49 | "name": "Marco Pivetta", 50 | "email": "ocramius@gmail.com", 51 | "homepage": "https://ocramius.github.io/" 52 | } 53 | ], 54 | "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", 55 | "homepage": "https://www.doctrine-project.org/projects/instantiator.html", 56 | "keywords": [ 57 | "constructor", 58 | "instantiate" 59 | ], 60 | "support": { 61 | "issues": "https://github.com/doctrine/instantiator/issues", 62 | "source": "https://github.com/doctrine/instantiator/tree/1.5.0" 63 | }, 64 | "funding": [ 65 | { 66 | "url": "https://www.doctrine-project.org/sponsorship.html", 67 | "type": "custom" 68 | }, 69 | { 70 | "url": "https://www.patreon.com/phpdoctrine", 71 | "type": "patreon" 72 | }, 73 | { 74 | "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", 75 | "type": "tidelift" 76 | } 77 | ], 78 | "time": "2022-12-30T00:15:36+00:00" 79 | }, 80 | { 81 | "name": "myclabs/deep-copy", 82 | "version": "1.11.1", 83 | "source": { 84 | "type": "git", 85 | "url": "https://github.com/myclabs/DeepCopy.git", 86 | "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" 87 | }, 88 | "dist": { 89 | "type": "zip", 90 | "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", 91 | "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", 92 | "shasum": "" 93 | }, 94 | "require": { 95 | "php": "^7.1 || ^8.0" 96 | }, 97 | "conflict": { 98 | "doctrine/collections": "<1.6.8", 99 | "doctrine/common": "<2.13.3 || >=3,<3.2.2" 100 | }, 101 | "require-dev": { 102 | "doctrine/collections": "^1.6.8", 103 | "doctrine/common": "^2.13.3 || ^3.2.2", 104 | "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" 105 | }, 106 | "type": "library", 107 | "autoload": { 108 | "files": [ 109 | "src/DeepCopy/deep_copy.php" 110 | ], 111 | "psr-4": { 112 | "DeepCopy\\": "src/DeepCopy/" 113 | } 114 | }, 115 | "notification-url": "https://packagist.org/downloads/", 116 | "license": [ 117 | "MIT" 118 | ], 119 | "description": "Create deep copies (clones) of your objects", 120 | "keywords": [ 121 | "clone", 122 | "copy", 123 | "duplicate", 124 | "object", 125 | "object graph" 126 | ], 127 | "support": { 128 | "issues": "https://github.com/myclabs/DeepCopy/issues", 129 | "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" 130 | }, 131 | "funding": [ 132 | { 133 | "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", 134 | "type": "tidelift" 135 | } 136 | ], 137 | "time": "2023-03-08T13:26:56+00:00" 138 | }, 139 | { 140 | "name": "nikic/php-parser", 141 | "version": "v4.15.5", 142 | "source": { 143 | "type": "git", 144 | "url": "https://github.com/nikic/PHP-Parser.git", 145 | "reference": "11e2663a5bc9db5d714eedb4277ee300403b4a9e" 146 | }, 147 | "dist": { 148 | "type": "zip", 149 | "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/11e2663a5bc9db5d714eedb4277ee300403b4a9e", 150 | "reference": "11e2663a5bc9db5d714eedb4277ee300403b4a9e", 151 | "shasum": "" 152 | }, 153 | "require": { 154 | "ext-tokenizer": "*", 155 | "php": ">=7.0" 156 | }, 157 | "require-dev": { 158 | "ircmaxell/php-yacc": "^0.0.7", 159 | "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" 160 | }, 161 | "bin": [ 162 | "bin/php-parse" 163 | ], 164 | "type": "library", 165 | "extra": { 166 | "branch-alias": { 167 | "dev-master": "4.9-dev" 168 | } 169 | }, 170 | "autoload": { 171 | "psr-4": { 172 | "PhpParser\\": "lib/PhpParser" 173 | } 174 | }, 175 | "notification-url": "https://packagist.org/downloads/", 176 | "license": [ 177 | "BSD-3-Clause" 178 | ], 179 | "authors": [ 180 | { 181 | "name": "Nikita Popov" 182 | } 183 | ], 184 | "description": "A PHP parser written in PHP", 185 | "keywords": [ 186 | "parser", 187 | "php" 188 | ], 189 | "support": { 190 | "issues": "https://github.com/nikic/PHP-Parser/issues", 191 | "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.5" 192 | }, 193 | "time": "2023-05-19T20:20:00+00:00" 194 | }, 195 | { 196 | "name": "phar-io/manifest", 197 | "version": "2.0.3", 198 | "source": { 199 | "type": "git", 200 | "url": "https://github.com/phar-io/manifest.git", 201 | "reference": "97803eca37d319dfa7826cc2437fc020857acb53" 202 | }, 203 | "dist": { 204 | "type": "zip", 205 | "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", 206 | "reference": "97803eca37d319dfa7826cc2437fc020857acb53", 207 | "shasum": "" 208 | }, 209 | "require": { 210 | "ext-dom": "*", 211 | "ext-phar": "*", 212 | "ext-xmlwriter": "*", 213 | "phar-io/version": "^3.0.1", 214 | "php": "^7.2 || ^8.0" 215 | }, 216 | "type": "library", 217 | "extra": { 218 | "branch-alias": { 219 | "dev-master": "2.0.x-dev" 220 | } 221 | }, 222 | "autoload": { 223 | "classmap": [ 224 | "src/" 225 | ] 226 | }, 227 | "notification-url": "https://packagist.org/downloads/", 228 | "license": [ 229 | "BSD-3-Clause" 230 | ], 231 | "authors": [ 232 | { 233 | "name": "Arne Blankerts", 234 | "email": "arne@blankerts.de", 235 | "role": "Developer" 236 | }, 237 | { 238 | "name": "Sebastian Heuer", 239 | "email": "sebastian@phpeople.de", 240 | "role": "Developer" 241 | }, 242 | { 243 | "name": "Sebastian Bergmann", 244 | "email": "sebastian@phpunit.de", 245 | "role": "Developer" 246 | } 247 | ], 248 | "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", 249 | "support": { 250 | "issues": "https://github.com/phar-io/manifest/issues", 251 | "source": "https://github.com/phar-io/manifest/tree/2.0.3" 252 | }, 253 | "time": "2021-07-20T11:28:43+00:00" 254 | }, 255 | { 256 | "name": "phar-io/version", 257 | "version": "3.2.1", 258 | "source": { 259 | "type": "git", 260 | "url": "https://github.com/phar-io/version.git", 261 | "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" 262 | }, 263 | "dist": { 264 | "type": "zip", 265 | "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", 266 | "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", 267 | "shasum": "" 268 | }, 269 | "require": { 270 | "php": "^7.2 || ^8.0" 271 | }, 272 | "type": "library", 273 | "autoload": { 274 | "classmap": [ 275 | "src/" 276 | ] 277 | }, 278 | "notification-url": "https://packagist.org/downloads/", 279 | "license": [ 280 | "BSD-3-Clause" 281 | ], 282 | "authors": [ 283 | { 284 | "name": "Arne Blankerts", 285 | "email": "arne@blankerts.de", 286 | "role": "Developer" 287 | }, 288 | { 289 | "name": "Sebastian Heuer", 290 | "email": "sebastian@phpeople.de", 291 | "role": "Developer" 292 | }, 293 | { 294 | "name": "Sebastian Bergmann", 295 | "email": "sebastian@phpunit.de", 296 | "role": "Developer" 297 | } 298 | ], 299 | "description": "Library for handling version information and constraints", 300 | "support": { 301 | "issues": "https://github.com/phar-io/version/issues", 302 | "source": "https://github.com/phar-io/version/tree/3.2.1" 303 | }, 304 | "time": "2022-02-21T01:04:05+00:00" 305 | }, 306 | { 307 | "name": "phpunit/php-code-coverage", 308 | "version": "9.2.26", 309 | "source": { 310 | "type": "git", 311 | "url": "https://github.com/sebastianbergmann/php-code-coverage.git", 312 | "reference": "443bc6912c9bd5b409254a40f4b0f4ced7c80ea1" 313 | }, 314 | "dist": { 315 | "type": "zip", 316 | "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/443bc6912c9bd5b409254a40f4b0f4ced7c80ea1", 317 | "reference": "443bc6912c9bd5b409254a40f4b0f4ced7c80ea1", 318 | "shasum": "" 319 | }, 320 | "require": { 321 | "ext-dom": "*", 322 | "ext-libxml": "*", 323 | "ext-xmlwriter": "*", 324 | "nikic/php-parser": "^4.15", 325 | "php": ">=7.3", 326 | "phpunit/php-file-iterator": "^3.0.3", 327 | "phpunit/php-text-template": "^2.0.2", 328 | "sebastian/code-unit-reverse-lookup": "^2.0.2", 329 | "sebastian/complexity": "^2.0", 330 | "sebastian/environment": "^5.1.2", 331 | "sebastian/lines-of-code": "^1.0.3", 332 | "sebastian/version": "^3.0.1", 333 | "theseer/tokenizer": "^1.2.0" 334 | }, 335 | "require-dev": { 336 | "phpunit/phpunit": "^9.3" 337 | }, 338 | "suggest": { 339 | "ext-pcov": "PHP extension that provides line coverage", 340 | "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" 341 | }, 342 | "type": "library", 343 | "extra": { 344 | "branch-alias": { 345 | "dev-master": "9.2-dev" 346 | } 347 | }, 348 | "autoload": { 349 | "classmap": [ 350 | "src/" 351 | ] 352 | }, 353 | "notification-url": "https://packagist.org/downloads/", 354 | "license": [ 355 | "BSD-3-Clause" 356 | ], 357 | "authors": [ 358 | { 359 | "name": "Sebastian Bergmann", 360 | "email": "sebastian@phpunit.de", 361 | "role": "lead" 362 | } 363 | ], 364 | "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", 365 | "homepage": "https://github.com/sebastianbergmann/php-code-coverage", 366 | "keywords": [ 367 | "coverage", 368 | "testing", 369 | "xunit" 370 | ], 371 | "support": { 372 | "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", 373 | "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.26" 374 | }, 375 | "funding": [ 376 | { 377 | "url": "https://github.com/sebastianbergmann", 378 | "type": "github" 379 | } 380 | ], 381 | "time": "2023-03-06T12:58:08+00:00" 382 | }, 383 | { 384 | "name": "phpunit/php-file-iterator", 385 | "version": "3.0.6", 386 | "source": { 387 | "type": "git", 388 | "url": "https://github.com/sebastianbergmann/php-file-iterator.git", 389 | "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" 390 | }, 391 | "dist": { 392 | "type": "zip", 393 | "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", 394 | "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", 395 | "shasum": "" 396 | }, 397 | "require": { 398 | "php": ">=7.3" 399 | }, 400 | "require-dev": { 401 | "phpunit/phpunit": "^9.3" 402 | }, 403 | "type": "library", 404 | "extra": { 405 | "branch-alias": { 406 | "dev-master": "3.0-dev" 407 | } 408 | }, 409 | "autoload": { 410 | "classmap": [ 411 | "src/" 412 | ] 413 | }, 414 | "notification-url": "https://packagist.org/downloads/", 415 | "license": [ 416 | "BSD-3-Clause" 417 | ], 418 | "authors": [ 419 | { 420 | "name": "Sebastian Bergmann", 421 | "email": "sebastian@phpunit.de", 422 | "role": "lead" 423 | } 424 | ], 425 | "description": "FilterIterator implementation that filters files based on a list of suffixes.", 426 | "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", 427 | "keywords": [ 428 | "filesystem", 429 | "iterator" 430 | ], 431 | "support": { 432 | "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", 433 | "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" 434 | }, 435 | "funding": [ 436 | { 437 | "url": "https://github.com/sebastianbergmann", 438 | "type": "github" 439 | } 440 | ], 441 | "time": "2021-12-02T12:48:52+00:00" 442 | }, 443 | { 444 | "name": "phpunit/php-invoker", 445 | "version": "3.1.1", 446 | "source": { 447 | "type": "git", 448 | "url": "https://github.com/sebastianbergmann/php-invoker.git", 449 | "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" 450 | }, 451 | "dist": { 452 | "type": "zip", 453 | "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", 454 | "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", 455 | "shasum": "" 456 | }, 457 | "require": { 458 | "php": ">=7.3" 459 | }, 460 | "require-dev": { 461 | "ext-pcntl": "*", 462 | "phpunit/phpunit": "^9.3" 463 | }, 464 | "suggest": { 465 | "ext-pcntl": "*" 466 | }, 467 | "type": "library", 468 | "extra": { 469 | "branch-alias": { 470 | "dev-master": "3.1-dev" 471 | } 472 | }, 473 | "autoload": { 474 | "classmap": [ 475 | "src/" 476 | ] 477 | }, 478 | "notification-url": "https://packagist.org/downloads/", 479 | "license": [ 480 | "BSD-3-Clause" 481 | ], 482 | "authors": [ 483 | { 484 | "name": "Sebastian Bergmann", 485 | "email": "sebastian@phpunit.de", 486 | "role": "lead" 487 | } 488 | ], 489 | "description": "Invoke callables with a timeout", 490 | "homepage": "https://github.com/sebastianbergmann/php-invoker/", 491 | "keywords": [ 492 | "process" 493 | ], 494 | "support": { 495 | "issues": "https://github.com/sebastianbergmann/php-invoker/issues", 496 | "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" 497 | }, 498 | "funding": [ 499 | { 500 | "url": "https://github.com/sebastianbergmann", 501 | "type": "github" 502 | } 503 | ], 504 | "time": "2020-09-28T05:58:55+00:00" 505 | }, 506 | { 507 | "name": "phpunit/php-text-template", 508 | "version": "2.0.4", 509 | "source": { 510 | "type": "git", 511 | "url": "https://github.com/sebastianbergmann/php-text-template.git", 512 | "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" 513 | }, 514 | "dist": { 515 | "type": "zip", 516 | "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", 517 | "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", 518 | "shasum": "" 519 | }, 520 | "require": { 521 | "php": ">=7.3" 522 | }, 523 | "require-dev": { 524 | "phpunit/phpunit": "^9.3" 525 | }, 526 | "type": "library", 527 | "extra": { 528 | "branch-alias": { 529 | "dev-master": "2.0-dev" 530 | } 531 | }, 532 | "autoload": { 533 | "classmap": [ 534 | "src/" 535 | ] 536 | }, 537 | "notification-url": "https://packagist.org/downloads/", 538 | "license": [ 539 | "BSD-3-Clause" 540 | ], 541 | "authors": [ 542 | { 543 | "name": "Sebastian Bergmann", 544 | "email": "sebastian@phpunit.de", 545 | "role": "lead" 546 | } 547 | ], 548 | "description": "Simple template engine.", 549 | "homepage": "https://github.com/sebastianbergmann/php-text-template/", 550 | "keywords": [ 551 | "template" 552 | ], 553 | "support": { 554 | "issues": "https://github.com/sebastianbergmann/php-text-template/issues", 555 | "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" 556 | }, 557 | "funding": [ 558 | { 559 | "url": "https://github.com/sebastianbergmann", 560 | "type": "github" 561 | } 562 | ], 563 | "time": "2020-10-26T05:33:50+00:00" 564 | }, 565 | { 566 | "name": "phpunit/php-timer", 567 | "version": "5.0.3", 568 | "source": { 569 | "type": "git", 570 | "url": "https://github.com/sebastianbergmann/php-timer.git", 571 | "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" 572 | }, 573 | "dist": { 574 | "type": "zip", 575 | "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", 576 | "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", 577 | "shasum": "" 578 | }, 579 | "require": { 580 | "php": ">=7.3" 581 | }, 582 | "require-dev": { 583 | "phpunit/phpunit": "^9.3" 584 | }, 585 | "type": "library", 586 | "extra": { 587 | "branch-alias": { 588 | "dev-master": "5.0-dev" 589 | } 590 | }, 591 | "autoload": { 592 | "classmap": [ 593 | "src/" 594 | ] 595 | }, 596 | "notification-url": "https://packagist.org/downloads/", 597 | "license": [ 598 | "BSD-3-Clause" 599 | ], 600 | "authors": [ 601 | { 602 | "name": "Sebastian Bergmann", 603 | "email": "sebastian@phpunit.de", 604 | "role": "lead" 605 | } 606 | ], 607 | "description": "Utility class for timing", 608 | "homepage": "https://github.com/sebastianbergmann/php-timer/", 609 | "keywords": [ 610 | "timer" 611 | ], 612 | "support": { 613 | "issues": "https://github.com/sebastianbergmann/php-timer/issues", 614 | "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" 615 | }, 616 | "funding": [ 617 | { 618 | "url": "https://github.com/sebastianbergmann", 619 | "type": "github" 620 | } 621 | ], 622 | "time": "2020-10-26T13:16:10+00:00" 623 | }, 624 | { 625 | "name": "phpunit/phpunit", 626 | "version": "9.6.8", 627 | "source": { 628 | "type": "git", 629 | "url": "https://github.com/sebastianbergmann/phpunit.git", 630 | "reference": "17d621b3aff84d0c8b62539e269e87d8d5baa76e" 631 | }, 632 | "dist": { 633 | "type": "zip", 634 | "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/17d621b3aff84d0c8b62539e269e87d8d5baa76e", 635 | "reference": "17d621b3aff84d0c8b62539e269e87d8d5baa76e", 636 | "shasum": "" 637 | }, 638 | "require": { 639 | "doctrine/instantiator": "^1.3.1 || ^2", 640 | "ext-dom": "*", 641 | "ext-json": "*", 642 | "ext-libxml": "*", 643 | "ext-mbstring": "*", 644 | "ext-xml": "*", 645 | "ext-xmlwriter": "*", 646 | "myclabs/deep-copy": "^1.10.1", 647 | "phar-io/manifest": "^2.0.3", 648 | "phar-io/version": "^3.0.2", 649 | "php": ">=7.3", 650 | "phpunit/php-code-coverage": "^9.2.13", 651 | "phpunit/php-file-iterator": "^3.0.5", 652 | "phpunit/php-invoker": "^3.1.1", 653 | "phpunit/php-text-template": "^2.0.3", 654 | "phpunit/php-timer": "^5.0.2", 655 | "sebastian/cli-parser": "^1.0.1", 656 | "sebastian/code-unit": "^1.0.6", 657 | "sebastian/comparator": "^4.0.8", 658 | "sebastian/diff": "^4.0.3", 659 | "sebastian/environment": "^5.1.3", 660 | "sebastian/exporter": "^4.0.5", 661 | "sebastian/global-state": "^5.0.1", 662 | "sebastian/object-enumerator": "^4.0.3", 663 | "sebastian/resource-operations": "^3.0.3", 664 | "sebastian/type": "^3.2", 665 | "sebastian/version": "^3.0.2" 666 | }, 667 | "suggest": { 668 | "ext-soap": "To be able to generate mocks based on WSDL files", 669 | "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" 670 | }, 671 | "bin": [ 672 | "phpunit" 673 | ], 674 | "type": "library", 675 | "extra": { 676 | "branch-alias": { 677 | "dev-master": "9.6-dev" 678 | } 679 | }, 680 | "autoload": { 681 | "files": [ 682 | "src/Framework/Assert/Functions.php" 683 | ], 684 | "classmap": [ 685 | "src/" 686 | ] 687 | }, 688 | "notification-url": "https://packagist.org/downloads/", 689 | "license": [ 690 | "BSD-3-Clause" 691 | ], 692 | "authors": [ 693 | { 694 | "name": "Sebastian Bergmann", 695 | "email": "sebastian@phpunit.de", 696 | "role": "lead" 697 | } 698 | ], 699 | "description": "The PHP Unit Testing framework.", 700 | "homepage": "https://phpunit.de/", 701 | "keywords": [ 702 | "phpunit", 703 | "testing", 704 | "xunit" 705 | ], 706 | "support": { 707 | "issues": "https://github.com/sebastianbergmann/phpunit/issues", 708 | "security": "https://github.com/sebastianbergmann/phpunit/security/policy", 709 | "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.8" 710 | }, 711 | "funding": [ 712 | { 713 | "url": "https://phpunit.de/sponsors.html", 714 | "type": "custom" 715 | }, 716 | { 717 | "url": "https://github.com/sebastianbergmann", 718 | "type": "github" 719 | }, 720 | { 721 | "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", 722 | "type": "tidelift" 723 | } 724 | ], 725 | "time": "2023-05-11T05:14:45+00:00" 726 | }, 727 | { 728 | "name": "sebastian/cli-parser", 729 | "version": "1.0.1", 730 | "source": { 731 | "type": "git", 732 | "url": "https://github.com/sebastianbergmann/cli-parser.git", 733 | "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" 734 | }, 735 | "dist": { 736 | "type": "zip", 737 | "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", 738 | "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", 739 | "shasum": "" 740 | }, 741 | "require": { 742 | "php": ">=7.3" 743 | }, 744 | "require-dev": { 745 | "phpunit/phpunit": "^9.3" 746 | }, 747 | "type": "library", 748 | "extra": { 749 | "branch-alias": { 750 | "dev-master": "1.0-dev" 751 | } 752 | }, 753 | "autoload": { 754 | "classmap": [ 755 | "src/" 756 | ] 757 | }, 758 | "notification-url": "https://packagist.org/downloads/", 759 | "license": [ 760 | "BSD-3-Clause" 761 | ], 762 | "authors": [ 763 | { 764 | "name": "Sebastian Bergmann", 765 | "email": "sebastian@phpunit.de", 766 | "role": "lead" 767 | } 768 | ], 769 | "description": "Library for parsing CLI options", 770 | "homepage": "https://github.com/sebastianbergmann/cli-parser", 771 | "support": { 772 | "issues": "https://github.com/sebastianbergmann/cli-parser/issues", 773 | "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" 774 | }, 775 | "funding": [ 776 | { 777 | "url": "https://github.com/sebastianbergmann", 778 | "type": "github" 779 | } 780 | ], 781 | "time": "2020-09-28T06:08:49+00:00" 782 | }, 783 | { 784 | "name": "sebastian/code-unit", 785 | "version": "1.0.8", 786 | "source": { 787 | "type": "git", 788 | "url": "https://github.com/sebastianbergmann/code-unit.git", 789 | "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" 790 | }, 791 | "dist": { 792 | "type": "zip", 793 | "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", 794 | "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", 795 | "shasum": "" 796 | }, 797 | "require": { 798 | "php": ">=7.3" 799 | }, 800 | "require-dev": { 801 | "phpunit/phpunit": "^9.3" 802 | }, 803 | "type": "library", 804 | "extra": { 805 | "branch-alias": { 806 | "dev-master": "1.0-dev" 807 | } 808 | }, 809 | "autoload": { 810 | "classmap": [ 811 | "src/" 812 | ] 813 | }, 814 | "notification-url": "https://packagist.org/downloads/", 815 | "license": [ 816 | "BSD-3-Clause" 817 | ], 818 | "authors": [ 819 | { 820 | "name": "Sebastian Bergmann", 821 | "email": "sebastian@phpunit.de", 822 | "role": "lead" 823 | } 824 | ], 825 | "description": "Collection of value objects that represent the PHP code units", 826 | "homepage": "https://github.com/sebastianbergmann/code-unit", 827 | "support": { 828 | "issues": "https://github.com/sebastianbergmann/code-unit/issues", 829 | "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" 830 | }, 831 | "funding": [ 832 | { 833 | "url": "https://github.com/sebastianbergmann", 834 | "type": "github" 835 | } 836 | ], 837 | "time": "2020-10-26T13:08:54+00:00" 838 | }, 839 | { 840 | "name": "sebastian/code-unit-reverse-lookup", 841 | "version": "2.0.3", 842 | "source": { 843 | "type": "git", 844 | "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", 845 | "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" 846 | }, 847 | "dist": { 848 | "type": "zip", 849 | "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", 850 | "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", 851 | "shasum": "" 852 | }, 853 | "require": { 854 | "php": ">=7.3" 855 | }, 856 | "require-dev": { 857 | "phpunit/phpunit": "^9.3" 858 | }, 859 | "type": "library", 860 | "extra": { 861 | "branch-alias": { 862 | "dev-master": "2.0-dev" 863 | } 864 | }, 865 | "autoload": { 866 | "classmap": [ 867 | "src/" 868 | ] 869 | }, 870 | "notification-url": "https://packagist.org/downloads/", 871 | "license": [ 872 | "BSD-3-Clause" 873 | ], 874 | "authors": [ 875 | { 876 | "name": "Sebastian Bergmann", 877 | "email": "sebastian@phpunit.de" 878 | } 879 | ], 880 | "description": "Looks up which function or method a line of code belongs to", 881 | "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", 882 | "support": { 883 | "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", 884 | "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" 885 | }, 886 | "funding": [ 887 | { 888 | "url": "https://github.com/sebastianbergmann", 889 | "type": "github" 890 | } 891 | ], 892 | "time": "2020-09-28T05:30:19+00:00" 893 | }, 894 | { 895 | "name": "sebastian/comparator", 896 | "version": "4.0.8", 897 | "source": { 898 | "type": "git", 899 | "url": "https://github.com/sebastianbergmann/comparator.git", 900 | "reference": "fa0f136dd2334583309d32b62544682ee972b51a" 901 | }, 902 | "dist": { 903 | "type": "zip", 904 | "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", 905 | "reference": "fa0f136dd2334583309d32b62544682ee972b51a", 906 | "shasum": "" 907 | }, 908 | "require": { 909 | "php": ">=7.3", 910 | "sebastian/diff": "^4.0", 911 | "sebastian/exporter": "^4.0" 912 | }, 913 | "require-dev": { 914 | "phpunit/phpunit": "^9.3" 915 | }, 916 | "type": "library", 917 | "extra": { 918 | "branch-alias": { 919 | "dev-master": "4.0-dev" 920 | } 921 | }, 922 | "autoload": { 923 | "classmap": [ 924 | "src/" 925 | ] 926 | }, 927 | "notification-url": "https://packagist.org/downloads/", 928 | "license": [ 929 | "BSD-3-Clause" 930 | ], 931 | "authors": [ 932 | { 933 | "name": "Sebastian Bergmann", 934 | "email": "sebastian@phpunit.de" 935 | }, 936 | { 937 | "name": "Jeff Welch", 938 | "email": "whatthejeff@gmail.com" 939 | }, 940 | { 941 | "name": "Volker Dusch", 942 | "email": "github@wallbash.com" 943 | }, 944 | { 945 | "name": "Bernhard Schussek", 946 | "email": "bschussek@2bepublished.at" 947 | } 948 | ], 949 | "description": "Provides the functionality to compare PHP values for equality", 950 | "homepage": "https://github.com/sebastianbergmann/comparator", 951 | "keywords": [ 952 | "comparator", 953 | "compare", 954 | "equality" 955 | ], 956 | "support": { 957 | "issues": "https://github.com/sebastianbergmann/comparator/issues", 958 | "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" 959 | }, 960 | "funding": [ 961 | { 962 | "url": "https://github.com/sebastianbergmann", 963 | "type": "github" 964 | } 965 | ], 966 | "time": "2022-09-14T12:41:17+00:00" 967 | }, 968 | { 969 | "name": "sebastian/complexity", 970 | "version": "2.0.2", 971 | "source": { 972 | "type": "git", 973 | "url": "https://github.com/sebastianbergmann/complexity.git", 974 | "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" 975 | }, 976 | "dist": { 977 | "type": "zip", 978 | "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", 979 | "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", 980 | "shasum": "" 981 | }, 982 | "require": { 983 | "nikic/php-parser": "^4.7", 984 | "php": ">=7.3" 985 | }, 986 | "require-dev": { 987 | "phpunit/phpunit": "^9.3" 988 | }, 989 | "type": "library", 990 | "extra": { 991 | "branch-alias": { 992 | "dev-master": "2.0-dev" 993 | } 994 | }, 995 | "autoload": { 996 | "classmap": [ 997 | "src/" 998 | ] 999 | }, 1000 | "notification-url": "https://packagist.org/downloads/", 1001 | "license": [ 1002 | "BSD-3-Clause" 1003 | ], 1004 | "authors": [ 1005 | { 1006 | "name": "Sebastian Bergmann", 1007 | "email": "sebastian@phpunit.de", 1008 | "role": "lead" 1009 | } 1010 | ], 1011 | "description": "Library for calculating the complexity of PHP code units", 1012 | "homepage": "https://github.com/sebastianbergmann/complexity", 1013 | "support": { 1014 | "issues": "https://github.com/sebastianbergmann/complexity/issues", 1015 | "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" 1016 | }, 1017 | "funding": [ 1018 | { 1019 | "url": "https://github.com/sebastianbergmann", 1020 | "type": "github" 1021 | } 1022 | ], 1023 | "time": "2020-10-26T15:52:27+00:00" 1024 | }, 1025 | { 1026 | "name": "sebastian/diff", 1027 | "version": "4.0.5", 1028 | "source": { 1029 | "type": "git", 1030 | "url": "https://github.com/sebastianbergmann/diff.git", 1031 | "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131" 1032 | }, 1033 | "dist": { 1034 | "type": "zip", 1035 | "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/74be17022044ebaaecfdf0c5cd504fc9cd5a7131", 1036 | "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131", 1037 | "shasum": "" 1038 | }, 1039 | "require": { 1040 | "php": ">=7.3" 1041 | }, 1042 | "require-dev": { 1043 | "phpunit/phpunit": "^9.3", 1044 | "symfony/process": "^4.2 || ^5" 1045 | }, 1046 | "type": "library", 1047 | "extra": { 1048 | "branch-alias": { 1049 | "dev-master": "4.0-dev" 1050 | } 1051 | }, 1052 | "autoload": { 1053 | "classmap": [ 1054 | "src/" 1055 | ] 1056 | }, 1057 | "notification-url": "https://packagist.org/downloads/", 1058 | "license": [ 1059 | "BSD-3-Clause" 1060 | ], 1061 | "authors": [ 1062 | { 1063 | "name": "Sebastian Bergmann", 1064 | "email": "sebastian@phpunit.de" 1065 | }, 1066 | { 1067 | "name": "Kore Nordmann", 1068 | "email": "mail@kore-nordmann.de" 1069 | } 1070 | ], 1071 | "description": "Diff implementation", 1072 | "homepage": "https://github.com/sebastianbergmann/diff", 1073 | "keywords": [ 1074 | "diff", 1075 | "udiff", 1076 | "unidiff", 1077 | "unified diff" 1078 | ], 1079 | "support": { 1080 | "issues": "https://github.com/sebastianbergmann/diff/issues", 1081 | "source": "https://github.com/sebastianbergmann/diff/tree/4.0.5" 1082 | }, 1083 | "funding": [ 1084 | { 1085 | "url": "https://github.com/sebastianbergmann", 1086 | "type": "github" 1087 | } 1088 | ], 1089 | "time": "2023-05-07T05:35:17+00:00" 1090 | }, 1091 | { 1092 | "name": "sebastian/environment", 1093 | "version": "5.1.5", 1094 | "source": { 1095 | "type": "git", 1096 | "url": "https://github.com/sebastianbergmann/environment.git", 1097 | "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" 1098 | }, 1099 | "dist": { 1100 | "type": "zip", 1101 | "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", 1102 | "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", 1103 | "shasum": "" 1104 | }, 1105 | "require": { 1106 | "php": ">=7.3" 1107 | }, 1108 | "require-dev": { 1109 | "phpunit/phpunit": "^9.3" 1110 | }, 1111 | "suggest": { 1112 | "ext-posix": "*" 1113 | }, 1114 | "type": "library", 1115 | "extra": { 1116 | "branch-alias": { 1117 | "dev-master": "5.1-dev" 1118 | } 1119 | }, 1120 | "autoload": { 1121 | "classmap": [ 1122 | "src/" 1123 | ] 1124 | }, 1125 | "notification-url": "https://packagist.org/downloads/", 1126 | "license": [ 1127 | "BSD-3-Clause" 1128 | ], 1129 | "authors": [ 1130 | { 1131 | "name": "Sebastian Bergmann", 1132 | "email": "sebastian@phpunit.de" 1133 | } 1134 | ], 1135 | "description": "Provides functionality to handle HHVM/PHP environments", 1136 | "homepage": "http://www.github.com/sebastianbergmann/environment", 1137 | "keywords": [ 1138 | "Xdebug", 1139 | "environment", 1140 | "hhvm" 1141 | ], 1142 | "support": { 1143 | "issues": "https://github.com/sebastianbergmann/environment/issues", 1144 | "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" 1145 | }, 1146 | "funding": [ 1147 | { 1148 | "url": "https://github.com/sebastianbergmann", 1149 | "type": "github" 1150 | } 1151 | ], 1152 | "time": "2023-02-03T06:03:51+00:00" 1153 | }, 1154 | { 1155 | "name": "sebastian/exporter", 1156 | "version": "4.0.5", 1157 | "source": { 1158 | "type": "git", 1159 | "url": "https://github.com/sebastianbergmann/exporter.git", 1160 | "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" 1161 | }, 1162 | "dist": { 1163 | "type": "zip", 1164 | "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", 1165 | "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", 1166 | "shasum": "" 1167 | }, 1168 | "require": { 1169 | "php": ">=7.3", 1170 | "sebastian/recursion-context": "^4.0" 1171 | }, 1172 | "require-dev": { 1173 | "ext-mbstring": "*", 1174 | "phpunit/phpunit": "^9.3" 1175 | }, 1176 | "type": "library", 1177 | "extra": { 1178 | "branch-alias": { 1179 | "dev-master": "4.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 | "name": "Jeff Welch", 1198 | "email": "whatthejeff@gmail.com" 1199 | }, 1200 | { 1201 | "name": "Volker Dusch", 1202 | "email": "github@wallbash.com" 1203 | }, 1204 | { 1205 | "name": "Adam Harvey", 1206 | "email": "aharvey@php.net" 1207 | }, 1208 | { 1209 | "name": "Bernhard Schussek", 1210 | "email": "bschussek@gmail.com" 1211 | } 1212 | ], 1213 | "description": "Provides the functionality to export PHP variables for visualization", 1214 | "homepage": "https://www.github.com/sebastianbergmann/exporter", 1215 | "keywords": [ 1216 | "export", 1217 | "exporter" 1218 | ], 1219 | "support": { 1220 | "issues": "https://github.com/sebastianbergmann/exporter/issues", 1221 | "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" 1222 | }, 1223 | "funding": [ 1224 | { 1225 | "url": "https://github.com/sebastianbergmann", 1226 | "type": "github" 1227 | } 1228 | ], 1229 | "time": "2022-09-14T06:03:37+00:00" 1230 | }, 1231 | { 1232 | "name": "sebastian/global-state", 1233 | "version": "5.0.5", 1234 | "source": { 1235 | "type": "git", 1236 | "url": "https://github.com/sebastianbergmann/global-state.git", 1237 | "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" 1238 | }, 1239 | "dist": { 1240 | "type": "zip", 1241 | "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", 1242 | "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", 1243 | "shasum": "" 1244 | }, 1245 | "require": { 1246 | "php": ">=7.3", 1247 | "sebastian/object-reflector": "^2.0", 1248 | "sebastian/recursion-context": "^4.0" 1249 | }, 1250 | "require-dev": { 1251 | "ext-dom": "*", 1252 | "phpunit/phpunit": "^9.3" 1253 | }, 1254 | "suggest": { 1255 | "ext-uopz": "*" 1256 | }, 1257 | "type": "library", 1258 | "extra": { 1259 | "branch-alias": { 1260 | "dev-master": "5.0-dev" 1261 | } 1262 | }, 1263 | "autoload": { 1264 | "classmap": [ 1265 | "src/" 1266 | ] 1267 | }, 1268 | "notification-url": "https://packagist.org/downloads/", 1269 | "license": [ 1270 | "BSD-3-Clause" 1271 | ], 1272 | "authors": [ 1273 | { 1274 | "name": "Sebastian Bergmann", 1275 | "email": "sebastian@phpunit.de" 1276 | } 1277 | ], 1278 | "description": "Snapshotting of global state", 1279 | "homepage": "http://www.github.com/sebastianbergmann/global-state", 1280 | "keywords": [ 1281 | "global state" 1282 | ], 1283 | "support": { 1284 | "issues": "https://github.com/sebastianbergmann/global-state/issues", 1285 | "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" 1286 | }, 1287 | "funding": [ 1288 | { 1289 | "url": "https://github.com/sebastianbergmann", 1290 | "type": "github" 1291 | } 1292 | ], 1293 | "time": "2022-02-14T08:28:10+00:00" 1294 | }, 1295 | { 1296 | "name": "sebastian/lines-of-code", 1297 | "version": "1.0.3", 1298 | "source": { 1299 | "type": "git", 1300 | "url": "https://github.com/sebastianbergmann/lines-of-code.git", 1301 | "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" 1302 | }, 1303 | "dist": { 1304 | "type": "zip", 1305 | "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", 1306 | "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", 1307 | "shasum": "" 1308 | }, 1309 | "require": { 1310 | "nikic/php-parser": "^4.6", 1311 | "php": ">=7.3" 1312 | }, 1313 | "require-dev": { 1314 | "phpunit/phpunit": "^9.3" 1315 | }, 1316 | "type": "library", 1317 | "extra": { 1318 | "branch-alias": { 1319 | "dev-master": "1.0-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": "Sebastian Bergmann", 1334 | "email": "sebastian@phpunit.de", 1335 | "role": "lead" 1336 | } 1337 | ], 1338 | "description": "Library for counting the lines of code in PHP source code", 1339 | "homepage": "https://github.com/sebastianbergmann/lines-of-code", 1340 | "support": { 1341 | "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", 1342 | "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" 1343 | }, 1344 | "funding": [ 1345 | { 1346 | "url": "https://github.com/sebastianbergmann", 1347 | "type": "github" 1348 | } 1349 | ], 1350 | "time": "2020-11-28T06:42:11+00:00" 1351 | }, 1352 | { 1353 | "name": "sebastian/object-enumerator", 1354 | "version": "4.0.4", 1355 | "source": { 1356 | "type": "git", 1357 | "url": "https://github.com/sebastianbergmann/object-enumerator.git", 1358 | "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" 1359 | }, 1360 | "dist": { 1361 | "type": "zip", 1362 | "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", 1363 | "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", 1364 | "shasum": "" 1365 | }, 1366 | "require": { 1367 | "php": ">=7.3", 1368 | "sebastian/object-reflector": "^2.0", 1369 | "sebastian/recursion-context": "^4.0" 1370 | }, 1371 | "require-dev": { 1372 | "phpunit/phpunit": "^9.3" 1373 | }, 1374 | "type": "library", 1375 | "extra": { 1376 | "branch-alias": { 1377 | "dev-master": "4.0-dev" 1378 | } 1379 | }, 1380 | "autoload": { 1381 | "classmap": [ 1382 | "src/" 1383 | ] 1384 | }, 1385 | "notification-url": "https://packagist.org/downloads/", 1386 | "license": [ 1387 | "BSD-3-Clause" 1388 | ], 1389 | "authors": [ 1390 | { 1391 | "name": "Sebastian Bergmann", 1392 | "email": "sebastian@phpunit.de" 1393 | } 1394 | ], 1395 | "description": "Traverses array structures and object graphs to enumerate all referenced objects", 1396 | "homepage": "https://github.com/sebastianbergmann/object-enumerator/", 1397 | "support": { 1398 | "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", 1399 | "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" 1400 | }, 1401 | "funding": [ 1402 | { 1403 | "url": "https://github.com/sebastianbergmann", 1404 | "type": "github" 1405 | } 1406 | ], 1407 | "time": "2020-10-26T13:12:34+00:00" 1408 | }, 1409 | { 1410 | "name": "sebastian/object-reflector", 1411 | "version": "2.0.4", 1412 | "source": { 1413 | "type": "git", 1414 | "url": "https://github.com/sebastianbergmann/object-reflector.git", 1415 | "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" 1416 | }, 1417 | "dist": { 1418 | "type": "zip", 1419 | "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", 1420 | "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", 1421 | "shasum": "" 1422 | }, 1423 | "require": { 1424 | "php": ">=7.3" 1425 | }, 1426 | "require-dev": { 1427 | "phpunit/phpunit": "^9.3" 1428 | }, 1429 | "type": "library", 1430 | "extra": { 1431 | "branch-alias": { 1432 | "dev-master": "2.0-dev" 1433 | } 1434 | }, 1435 | "autoload": { 1436 | "classmap": [ 1437 | "src/" 1438 | ] 1439 | }, 1440 | "notification-url": "https://packagist.org/downloads/", 1441 | "license": [ 1442 | "BSD-3-Clause" 1443 | ], 1444 | "authors": [ 1445 | { 1446 | "name": "Sebastian Bergmann", 1447 | "email": "sebastian@phpunit.de" 1448 | } 1449 | ], 1450 | "description": "Allows reflection of object attributes, including inherited and non-public ones", 1451 | "homepage": "https://github.com/sebastianbergmann/object-reflector/", 1452 | "support": { 1453 | "issues": "https://github.com/sebastianbergmann/object-reflector/issues", 1454 | "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" 1455 | }, 1456 | "funding": [ 1457 | { 1458 | "url": "https://github.com/sebastianbergmann", 1459 | "type": "github" 1460 | } 1461 | ], 1462 | "time": "2020-10-26T13:14:26+00:00" 1463 | }, 1464 | { 1465 | "name": "sebastian/recursion-context", 1466 | "version": "4.0.5", 1467 | "source": { 1468 | "type": "git", 1469 | "url": "https://github.com/sebastianbergmann/recursion-context.git", 1470 | "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" 1471 | }, 1472 | "dist": { 1473 | "type": "zip", 1474 | "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", 1475 | "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", 1476 | "shasum": "" 1477 | }, 1478 | "require": { 1479 | "php": ">=7.3" 1480 | }, 1481 | "require-dev": { 1482 | "phpunit/phpunit": "^9.3" 1483 | }, 1484 | "type": "library", 1485 | "extra": { 1486 | "branch-alias": { 1487 | "dev-master": "4.0-dev" 1488 | } 1489 | }, 1490 | "autoload": { 1491 | "classmap": [ 1492 | "src/" 1493 | ] 1494 | }, 1495 | "notification-url": "https://packagist.org/downloads/", 1496 | "license": [ 1497 | "BSD-3-Clause" 1498 | ], 1499 | "authors": [ 1500 | { 1501 | "name": "Sebastian Bergmann", 1502 | "email": "sebastian@phpunit.de" 1503 | }, 1504 | { 1505 | "name": "Jeff Welch", 1506 | "email": "whatthejeff@gmail.com" 1507 | }, 1508 | { 1509 | "name": "Adam Harvey", 1510 | "email": "aharvey@php.net" 1511 | } 1512 | ], 1513 | "description": "Provides functionality to recursively process PHP variables", 1514 | "homepage": "https://github.com/sebastianbergmann/recursion-context", 1515 | "support": { 1516 | "issues": "https://github.com/sebastianbergmann/recursion-context/issues", 1517 | "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" 1518 | }, 1519 | "funding": [ 1520 | { 1521 | "url": "https://github.com/sebastianbergmann", 1522 | "type": "github" 1523 | } 1524 | ], 1525 | "time": "2023-02-03T06:07:39+00:00" 1526 | }, 1527 | { 1528 | "name": "sebastian/resource-operations", 1529 | "version": "3.0.3", 1530 | "source": { 1531 | "type": "git", 1532 | "url": "https://github.com/sebastianbergmann/resource-operations.git", 1533 | "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" 1534 | }, 1535 | "dist": { 1536 | "type": "zip", 1537 | "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", 1538 | "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", 1539 | "shasum": "" 1540 | }, 1541 | "require": { 1542 | "php": ">=7.3" 1543 | }, 1544 | "require-dev": { 1545 | "phpunit/phpunit": "^9.0" 1546 | }, 1547 | "type": "library", 1548 | "extra": { 1549 | "branch-alias": { 1550 | "dev-master": "3.0-dev" 1551 | } 1552 | }, 1553 | "autoload": { 1554 | "classmap": [ 1555 | "src/" 1556 | ] 1557 | }, 1558 | "notification-url": "https://packagist.org/downloads/", 1559 | "license": [ 1560 | "BSD-3-Clause" 1561 | ], 1562 | "authors": [ 1563 | { 1564 | "name": "Sebastian Bergmann", 1565 | "email": "sebastian@phpunit.de" 1566 | } 1567 | ], 1568 | "description": "Provides a list of PHP built-in functions that operate on resources", 1569 | "homepage": "https://www.github.com/sebastianbergmann/resource-operations", 1570 | "support": { 1571 | "issues": "https://github.com/sebastianbergmann/resource-operations/issues", 1572 | "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" 1573 | }, 1574 | "funding": [ 1575 | { 1576 | "url": "https://github.com/sebastianbergmann", 1577 | "type": "github" 1578 | } 1579 | ], 1580 | "time": "2020-09-28T06:45:17+00:00" 1581 | }, 1582 | { 1583 | "name": "sebastian/type", 1584 | "version": "3.2.1", 1585 | "source": { 1586 | "type": "git", 1587 | "url": "https://github.com/sebastianbergmann/type.git", 1588 | "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" 1589 | }, 1590 | "dist": { 1591 | "type": "zip", 1592 | "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", 1593 | "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", 1594 | "shasum": "" 1595 | }, 1596 | "require": { 1597 | "php": ">=7.3" 1598 | }, 1599 | "require-dev": { 1600 | "phpunit/phpunit": "^9.5" 1601 | }, 1602 | "type": "library", 1603 | "extra": { 1604 | "branch-alias": { 1605 | "dev-master": "3.2-dev" 1606 | } 1607 | }, 1608 | "autoload": { 1609 | "classmap": [ 1610 | "src/" 1611 | ] 1612 | }, 1613 | "notification-url": "https://packagist.org/downloads/", 1614 | "license": [ 1615 | "BSD-3-Clause" 1616 | ], 1617 | "authors": [ 1618 | { 1619 | "name": "Sebastian Bergmann", 1620 | "email": "sebastian@phpunit.de", 1621 | "role": "lead" 1622 | } 1623 | ], 1624 | "description": "Collection of value objects that represent the types of the PHP type system", 1625 | "homepage": "https://github.com/sebastianbergmann/type", 1626 | "support": { 1627 | "issues": "https://github.com/sebastianbergmann/type/issues", 1628 | "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" 1629 | }, 1630 | "funding": [ 1631 | { 1632 | "url": "https://github.com/sebastianbergmann", 1633 | "type": "github" 1634 | } 1635 | ], 1636 | "time": "2023-02-03T06:13:03+00:00" 1637 | }, 1638 | { 1639 | "name": "sebastian/version", 1640 | "version": "3.0.2", 1641 | "source": { 1642 | "type": "git", 1643 | "url": "https://github.com/sebastianbergmann/version.git", 1644 | "reference": "c6c1022351a901512170118436c764e473f6de8c" 1645 | }, 1646 | "dist": { 1647 | "type": "zip", 1648 | "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", 1649 | "reference": "c6c1022351a901512170118436c764e473f6de8c", 1650 | "shasum": "" 1651 | }, 1652 | "require": { 1653 | "php": ">=7.3" 1654 | }, 1655 | "type": "library", 1656 | "extra": { 1657 | "branch-alias": { 1658 | "dev-master": "3.0-dev" 1659 | } 1660 | }, 1661 | "autoload": { 1662 | "classmap": [ 1663 | "src/" 1664 | ] 1665 | }, 1666 | "notification-url": "https://packagist.org/downloads/", 1667 | "license": [ 1668 | "BSD-3-Clause" 1669 | ], 1670 | "authors": [ 1671 | { 1672 | "name": "Sebastian Bergmann", 1673 | "email": "sebastian@phpunit.de", 1674 | "role": "lead" 1675 | } 1676 | ], 1677 | "description": "Library that helps with managing the version number of Git-hosted PHP projects", 1678 | "homepage": "https://github.com/sebastianbergmann/version", 1679 | "support": { 1680 | "issues": "https://github.com/sebastianbergmann/version/issues", 1681 | "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" 1682 | }, 1683 | "funding": [ 1684 | { 1685 | "url": "https://github.com/sebastianbergmann", 1686 | "type": "github" 1687 | } 1688 | ], 1689 | "time": "2020-09-28T06:39:44+00:00" 1690 | }, 1691 | { 1692 | "name": "theseer/tokenizer", 1693 | "version": "1.2.1", 1694 | "source": { 1695 | "type": "git", 1696 | "url": "https://github.com/theseer/tokenizer.git", 1697 | "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" 1698 | }, 1699 | "dist": { 1700 | "type": "zip", 1701 | "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", 1702 | "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", 1703 | "shasum": "" 1704 | }, 1705 | "require": { 1706 | "ext-dom": "*", 1707 | "ext-tokenizer": "*", 1708 | "ext-xmlwriter": "*", 1709 | "php": "^7.2 || ^8.0" 1710 | }, 1711 | "type": "library", 1712 | "autoload": { 1713 | "classmap": [ 1714 | "src/" 1715 | ] 1716 | }, 1717 | "notification-url": "https://packagist.org/downloads/", 1718 | "license": [ 1719 | "BSD-3-Clause" 1720 | ], 1721 | "authors": [ 1722 | { 1723 | "name": "Arne Blankerts", 1724 | "email": "arne@blankerts.de", 1725 | "role": "Developer" 1726 | } 1727 | ], 1728 | "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", 1729 | "support": { 1730 | "issues": "https://github.com/theseer/tokenizer/issues", 1731 | "source": "https://github.com/theseer/tokenizer/tree/1.2.1" 1732 | }, 1733 | "funding": [ 1734 | { 1735 | "url": "https://github.com/theseer", 1736 | "type": "github" 1737 | } 1738 | ], 1739 | "time": "2021-07-28T10:34:58+00:00" 1740 | } 1741 | ], 1742 | "aliases": [], 1743 | "minimum-stability": "stable", 1744 | "stability-flags": [], 1745 | "prefer-stable": false, 1746 | "prefer-lowest": false, 1747 | "platform": { 1748 | "php": ">=7.4" 1749 | }, 1750 | "platform-dev": [], 1751 | "plugin-api-version": "2.2.0" 1752 | } 1753 | -------------------------------------------------------------------------------- /phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 13 | 14 | 15 | ./tests/ 16 | 17 | 18 | 19 | 20 | ./src 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/Set.php: -------------------------------------------------------------------------------- 1 | 14 | * @version 1.3.0 15 | * @license http://www.gnu.org/licenses/gpl-3.0.en.html 16 | */ 17 | class Set extends ArrayObject 18 | { 19 | /** 20 | * The current amount of values in the set. 21 | */ 22 | public int $size = 0; 23 | 24 | /** 25 | * Create new Set 26 | * 27 | * @param mixed|array $args Any number of items to add to the Set object 28 | */ 29 | public function __construct(...$args) 30 | { 31 | parent::__construct([], ArrayObject::STD_PROP_LIST); 32 | 33 | if (count($args) === 1 && is_array($args[0])) { 34 | foreach ($args[0] as $insert) { 35 | $this->add($insert); 36 | } 37 | 38 | return; 39 | } 40 | 41 | foreach ($args as $insert) { 42 | $this->add($insert); 43 | } 44 | } 45 | 46 | /** 47 | * Appends a new element with the given value to the Set object. Returns the Set object. 48 | * 49 | * @param mixed $value Value to add 50 | * @return Set 51 | */ 52 | public function add($value): Set 53 | { 54 | $this->append($value); 55 | return $this; 56 | } 57 | 58 | /** 59 | * Removes the element associated to the value. 60 | * 61 | * @param mixed $value The value to remove from the Set object 62 | * @return boolean 63 | */ 64 | public function delete($value): bool 65 | { 66 | $key = array_search($value, $this->getArrayCopy(), true); 67 | 68 | if ($key !== false) { 69 | unset($this[$key]); 70 | return true; 71 | } 72 | 73 | return false; 74 | } 75 | 76 | /** 77 | * Removes all elements from the Set object. Returns the Set object. 78 | * 79 | * @return Set 80 | */ 81 | public function clear(): Set 82 | { 83 | $this->exchangeArray([]); 84 | $this->size = 0; 85 | return $this; 86 | } 87 | 88 | /** 89 | * Returns a boolean asserting whether an element is present with the given value in the Set object or not. 90 | * 91 | * @param mixed $value The value to check for. 92 | * @return boolean 93 | */ 94 | public function has($value): bool 95 | { 96 | return in_array($value, $this->getArrayCopy(), true); 97 | } 98 | 99 | /** 100 | * Calls $callback once for each value present in the Set object, in insertion order. 101 | * 102 | * Any number of additional arguments can be passed to the callback. 103 | * 104 | * @param callable $callback The callback function 105 | * The callback is called with argument 1 being the current iterated value 106 | * @param mixed $args Additional arguments to pass to the callback function 107 | * @return Set 108 | */ 109 | public function each(callable $callback, ...$args): Set 110 | { 111 | $iterator = $this->entries(); 112 | 113 | while ($iterator->valid()) { 114 | array_unshift($args, $iterator->current()); 115 | call_user_func_array($callback, $args); 116 | $iterator->next(); 117 | } 118 | 119 | return $this; 120 | } 121 | 122 | /** 123 | * Returns a new ArrayIterator object that contains an array of each element in the Set object, in insertion order. 124 | * 125 | * @see http://php.net/manual/en/class.arrayiterator.php 126 | * @return ArrayIterator 127 | */ 128 | public function entries(): ArrayIterator 129 | { 130 | return $this->getIterator(); 131 | } 132 | 133 | /** 134 | * Returns an array of the values within the Set. 135 | * 136 | * @return array 137 | */ 138 | public function values(): array 139 | { 140 | return $this->getArrayCopy(); 141 | } 142 | 143 | /** 144 | * Returns a new Set which contains the unique items of the current and a given Set. 145 | * 146 | * Elements from the merged set are appended to the current instance's values. 147 | * 148 | * @param Set $set The set to append 149 | * @return Set A new set containing the merged items 150 | */ 151 | public function union(Set $set): Set 152 | { 153 | $merged = new Set(); 154 | $merged->exchangeArray($this->values()); 155 | 156 | foreach ($set->values() as $value) { 157 | if (!$this->has($value)) { 158 | $merged->add($value); 159 | } 160 | } 161 | 162 | return $merged; 163 | } 164 | 165 | /** 166 | * Returns a new Set containing values preset in this set, but not in another given set. 167 | * 168 | * @param Set $set Set to compare against 169 | * @return Set 170 | * 171 | */ 172 | public function difference(Set $set): Set 173 | { 174 | if ($this->size === 0) { 175 | return new Set(); 176 | } 177 | 178 | if ($set->size === 0) { 179 | return (new Set())->union($this); 180 | } 181 | 182 | $intersect = new Set; 183 | 184 | foreach ($this->values() as $value) { 185 | if (!$set->has($value)) { 186 | $intersect->add($value); 187 | } 188 | } 189 | 190 | return $intersect; 191 | } 192 | 193 | public function symmetricDifference(Set $set): Set 194 | { 195 | $diff = clone $this; 196 | 197 | foreach ($set->values() as $value) { 198 | if ($diff->has($value)) { 199 | $diff->delete($value); 200 | } else { 201 | $diff->add($value); 202 | } 203 | } 204 | 205 | return $diff; 206 | } 207 | 208 | /** 209 | * Checks if a given $set is a subset of the current instance. 210 | * 211 | * All values should be present, but ordinality does not matter. 212 | * 213 | * @param Set $set The Set to check against 214 | * @return bool Whether $set was a subset of $set 215 | */ 216 | public function isSupersetOf(Set $set): bool 217 | { 218 | // iterate through $set and return false is an uncommon value is present 219 | foreach ($set->values() as $value) { 220 | if (!$this->has($value)) { 221 | return false; 222 | } 223 | } 224 | 225 | return true; 226 | } 227 | 228 | /** 229 | * Returns a new Set object containing the common elements between two given sets 230 | * 231 | * @param Set $set 232 | * @return Set 233 | */ 234 | public function intersect(Set $set): Set 235 | { 236 | $intersect = new Set(); 237 | 238 | foreach ($set->values() as $value) { 239 | if ($this->has($value)) { 240 | $intersect->add($value); 241 | } 242 | } 243 | 244 | return $intersect; 245 | } 246 | 247 | /** 248 | * The main setter for the Array functionality. 249 | * 250 | * Ensure duplicates cant exist and updates the size property on value insert 251 | * 252 | * @param int|null $key The key to insert a value at 253 | * @param mixed $value The value to insert 254 | * @return void 255 | */ 256 | public function offsetSet($key, $value): void 257 | { 258 | $temp = $this->values(); 259 | 260 | if ($this->has($value) === false) { 261 | if (is_null($key)) { 262 | $temp[] = $value; 263 | } else { 264 | $temp[$key] = $value; 265 | } 266 | } 267 | 268 | $this->exchangeArray($temp); 269 | 270 | $this->size = $this->count(); 271 | } 272 | 273 | /** 274 | * The main un-setter for the Array functionality. 275 | * 276 | * @param int $key The key to remove a value at 277 | * @return void 278 | */ 279 | public function offsetUnset($key): void 280 | { 281 | $temp = $this->values(); 282 | 283 | if (isset($temp[$key])) { 284 | unset($temp[$key]); 285 | } 286 | 287 | $this->exchangeArray(array_values($temp)); 288 | 289 | $this->size = $this->count(); 290 | } 291 | 292 | /** 293 | * Union of a family (array) of sets 294 | * ([a,b,c]) => a u b u c 295 | * 296 | * @param array $sets The family of sets to take the union of 297 | * @return Set 298 | */ 299 | public static function familyUnion(array $sets): Set 300 | { 301 | /* trivial cases */ 302 | if (count($sets) === 0) { 303 | return new Set(); 304 | } 305 | 306 | if (count($sets) === 1) { 307 | return $sets[0]; 308 | } 309 | 310 | $result = array_shift($sets); 311 | 312 | foreach ($sets as $set) { 313 | $result = $result->union($set); 314 | } 315 | 316 | return $result; 317 | } 318 | 319 | /** 320 | * Intersection of a family (array) of sets 321 | * ([a,b,c]) => a n b n c 322 | * 323 | * @param array $sets The family of sets to take the intersection of 324 | * @return Set 325 | */ 326 | public static function familyIntersection(array $sets): Set 327 | { 328 | /* trivial cases */ 329 | if (count($sets) === 0) { 330 | return new Set(); 331 | } 332 | 333 | # should be error, not {} 334 | if (count($sets) === 1) { 335 | return $sets[0]; 336 | } 337 | 338 | $result = array_shift($sets); 339 | 340 | foreach ($sets as $set) { 341 | $result = $result->intersect($set); 342 | } 343 | 344 | return $result; 345 | } 346 | } 347 | -------------------------------------------------------------------------------- /tests/SetTest.php: -------------------------------------------------------------------------------- 1 | values(); 16 | 17 | $this->assertSame($expected, $result); 18 | } 19 | 20 | public function testAdd(): void 21 | { 22 | $set = new Set(); 23 | $set->add('a'); 24 | $this->assertSame(['a'], $set->values()); 25 | 26 | $set->add('a'); 27 | $this->assertSame(['a'], $set->values()); 28 | } 29 | 30 | public function testAddViaArrayAccess(): void 31 | { 32 | $set = new Set(); 33 | $set[] = 'a'; 34 | $this->assertSame(['a'], $set->values()); 35 | 36 | $set[] = 'a'; 37 | $this->assertSame(['a'], $set->values()); 38 | } 39 | 40 | public function testDelete(): void 41 | { 42 | $set = new Set(); 43 | $set->add('a'); 44 | 45 | $result = $set->delete('a'); 46 | 47 | $this->assertTrue($result); 48 | } 49 | 50 | public function testDeleteOnNonExistedKey(): void 51 | { 52 | $set = new Set(); 53 | 54 | $result = $set->delete('a'); 55 | 56 | $this->assertFalse($result); 57 | } 58 | 59 | public function testClear(): void 60 | { 61 | $set = new Set(); 62 | $set->add(1); 63 | $set->add(2); 64 | $set->clear(); 65 | 66 | $expected = []; 67 | $result = $set->values(); 68 | 69 | $this->assertSame($expected, $result); 70 | } 71 | 72 | public function testDiffOnSameValues(): void 73 | { 74 | $set = new Set(); 75 | $set->add(1); 76 | $set->add(2); 77 | 78 | $set2 = new Set(); 79 | $set2->add(1); 80 | $set2->add(2); 81 | 82 | $expected = 0; 83 | $result = $set->difference($set2)->size; 84 | 85 | $this->assertSame($expected, $result); 86 | } 87 | 88 | public function testDiffOnDifferentValues(): void 89 | { 90 | $set = new Set(1, 2); 91 | $set2 = new Set(3, 4); 92 | 93 | $result = $set->difference($set2); 94 | 95 | $this->assertSame(2, $result->size); 96 | $this->assertSame([1, 2], $result->values()); 97 | } 98 | 99 | public function testDiffOnEmptySet(): void 100 | { 101 | $set = new Set(); 102 | $set2 = new Set(3, 4); 103 | 104 | $result = $set->difference($set2); 105 | $this->assertSame(0, $result->size); 106 | } 107 | 108 | public function testDiffOnEmptyTargetSet(): void 109 | { 110 | $set = new Set(1, 2); 111 | $set2 = new Set(); 112 | 113 | $result = $set->difference($set2); 114 | $this->assertSame(2, $result->size); 115 | } 116 | 117 | public function testHas(): void 118 | { 119 | $set = new Set(); 120 | $result = $set->has(2); 121 | $this->assertFalse($result); 122 | 123 | $set->add(2); 124 | $result = $set->has(2); 125 | $this->assertTrue($result); 126 | } 127 | 128 | public function testEach(): void 129 | { 130 | $set = new Set(); 131 | $set->add(1); 132 | $set->add(2); 133 | 134 | $expected = $set->values(); 135 | 136 | $resultSet = $set->each(function ($value, $param) { 137 | return $value * $param; 138 | }, 10); 139 | $result = $resultSet->values(); 140 | 141 | $this->assertSame($expected, $result); 142 | } 143 | 144 | public function testOffsetSetOnNull(): void 145 | { 146 | $set = new Set(); 147 | $set->offsetSet(0, null); 148 | 149 | $expected = [null]; 150 | $result = $set->values(); 151 | 152 | $this->assertSame($expected, $result); 153 | } 154 | 155 | public function testMerge(): void 156 | { 157 | $set = new Set(); 158 | $set->add(1); 159 | $set->add(2); 160 | 161 | $set2 = new Set(); 162 | $set2->add(1); 163 | $set2->add(null); 164 | 165 | $expected = [1, 2, null]; 166 | $result = $set->union($set2)->values(); 167 | 168 | $this->assertSame($expected, $result); 169 | } 170 | 171 | public function testIntersectOnContainedValue(): void 172 | { 173 | $set = new Set(); 174 | $set->add(1); 175 | $set->add(2); 176 | $set->add(3); 177 | 178 | $set2 = new Set(); 179 | $set2->add(1); 180 | 181 | $expected = 1; 182 | $result = $set->intersect($set2)->size; 183 | 184 | $this->assertSame($expected, $result); 185 | } 186 | 187 | public function testIntersectOnNoContainedValue(): void 188 | { 189 | $set = new Set(); 190 | $set->add(1); 191 | $set->add(2); 192 | $set->add(3); 193 | 194 | $set2 = new Set(); 195 | $set2->add(4); 196 | 197 | $expected = 0; 198 | $result = $set->intersect($set2)->size; 199 | 200 | $this->assertSame($expected, $result); 201 | } 202 | 203 | public function testSubsetShouldReturnTrue(): void 204 | { 205 | $set = new Set(1, 2); 206 | $subset = new Set(1); 207 | 208 | $this->assertTrue($set->isSupersetOf($subset)); 209 | $this->assertFalse($subset->isSupersetOf($set)); 210 | } 211 | 212 | public function testSubsetShouldReturnFalse(): void 213 | { 214 | $set = new Set(); 215 | $set->add(1); 216 | $set->add(2); 217 | 218 | $subset = new Set(); 219 | $subset->add(3); 220 | 221 | $this->assertFalse($set->isSupersetOf($subset)); 222 | } 223 | 224 | public function testSymmetricDifference(): void 225 | { 226 | $set1 = new Set(1, 2, 'three'); 227 | $set2 = new Set(2, 3, 4); 228 | 229 | $this->assertEquals([1, 'three', 3, 4], $set1->symmetricDifference($set2)->values()); 230 | $this->assertEqualsArray([1, 'three', 3, 4], $set2->symmetricDifference($set1)->values()); 231 | } 232 | 233 | public function testFromArray(): void 234 | { 235 | $set1 = new Set(1, 2, 'three'); 236 | $set2 = new Set([1, 2, 'three']); 237 | $set3 = new Set(...[1, 2, 'three']); 238 | 239 | $this->assertEquals($set1->values(), $set2->values()); 240 | $this->assertEquals($set1->values(), $set3->values()); 241 | } 242 | 243 | public function testFamilyUnion(): void 244 | { 245 | # test empty family 246 | $sets = []; 247 | $set_expected = new Set(); 248 | $set_union = Set::familyUnion($sets); 249 | 250 | $this->assertEquals($set_union->values(), $set_expected->values()); 251 | 252 | # Test only one set 253 | $set1 = new Set(1, 2); 254 | $sets = [$set1]; 255 | $set_expected = new Set(1, 2); 256 | $set_union = Set::familyUnion($sets); 257 | 258 | $this->assertEquals($set_union->values(), $set_expected->values()); 259 | 260 | # Test equal sets 261 | $set1 = new Set(1, 2); 262 | $set2 = new Set(1, 2); 263 | $set3 = new Set(1, 2); 264 | $sets = [$set1, $set2, $set3]; 265 | $set_expected = new Set(1, 2); 266 | $set_union = Set::familyUnion($sets); 267 | 268 | $this->assertEquals($set_union->values(), $set_expected->values()); 269 | 270 | # Test disjoint sets 271 | $set1 = new Set(1, 2); 272 | $set2 = new Set(3, 4); 273 | $set3 = new Set(5, 6, 1); 274 | $sets = [$set1, $set2, $set3]; 275 | $set_expected = new Set(1, 2, 3, 4, 5, 6); 276 | $set_union = Set::familyUnion($sets); 277 | 278 | $this->assertEquals($set_union->values(), $set_expected->values()); 279 | 280 | # Test sets with nonempty intersection 281 | $set1 = new Set(1, 2, 3); 282 | $set2 = new Set(3, 4, 5); 283 | $sets = [$set1, $set2]; 284 | $set_expected = new Set(1, 2, 3, 4, 5); 285 | $set_union = Set::familyUnion($sets); 286 | 287 | $this->assertEquals($set_union->values(), $set_expected->values()); 288 | 289 | # Test sets where one is subset of another 290 | $set1 = new Set(1, 3, 2); 291 | $set2 = new Set(1, 2, 3, 4, 5); 292 | $sets = [$set1, $set2]; 293 | $set_expected = new Set(1, 3, 2, 4, 5); 294 | $set_union = Set::familyUnion($sets); 295 | 296 | $this->assertEquals($set_union->values(), $set_expected->values()); 297 | } 298 | 299 | public function testIntersectionOfArray(): void 300 | { 301 | # test empty family 302 | $sets = []; 303 | $set_expected = new Set(); 304 | $set_union = Set::familyIntersection($sets); 305 | 306 | $this->assertEquals($set_union->values(), $set_expected->values()); 307 | 308 | # Test only one set 309 | $set1 = new Set(1, 2); 310 | $sets = [$set1]; 311 | $set_expected = new Set(1, 2); 312 | $set_union = Set::familyIntersection($sets); 313 | 314 | $this->assertEquals($set_union->values(), $set_expected->values()); 315 | 316 | # Test equal sets 317 | $set1 = new Set(1, 2); 318 | $set2 = new Set(1, 2); 319 | $sets = [$set1, $set2]; 320 | $set_expected = new Set(1, 2); 321 | $set_intersection = Set::familyIntersection($sets); 322 | 323 | $this->assertEquals($set_intersection->values(), $set_expected->values()); 324 | 325 | # Test disjoint sets 326 | $set1 = new Set(1, 2); 327 | $set2 = new Set(3, 4); 328 | $sets = [$set1, $set2]; 329 | $set_expected = new Set(); 330 | $set_intersection = Set::familyIntersection($sets); 331 | 332 | $this->assertEquals($set_intersection->values(), $set_expected->values()); 333 | 334 | # Test sets with nonempty intersection 335 | $set1 = new Set(1, 2, 3); 336 | $set2 = new Set(2, 3, 4, 5); 337 | $sets = [$set1, $set2]; 338 | $set_expected = new Set(2, 3); 339 | $set_intersection = Set::familyIntersection($sets); 340 | 341 | $this->assertEquals($set_intersection->values(), $set_expected->values()); 342 | 343 | # Test sets where one is subset of another 344 | $set1 = new Set(1, 2, 3); 345 | $set2 = new Set(1, 2, 3, 4, 5); 346 | $sets = [$set1, $set2]; 347 | $set_expected = new Set(1, 2, 3); 348 | $set_intersection = Set::familyIntersection($sets); 349 | 350 | $this->assertEquals($set_intersection->values(), $set_expected->values()); 351 | } 352 | 353 | protected function assertEqualsArray($expected, $actual, $message = ''): void 354 | { 355 | sort($expected); 356 | sort($actual); 357 | $this->assertEquals($expected, $actual, $message); 358 | } 359 | 360 | 361 | } 362 | --------------------------------------------------------------------------------