├── .editorconfig ├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── composer.json ├── composer.lock ├── phpunit.xml ├── src └── CKAN │ ├── CkanClient.php │ ├── HttpException.php │ ├── NotFoundHttpException.php │ └── OrganizationList.php └── tests ├── Base.php ├── CkanClientTest.php ├── OrganizationListTest.php └── bootstrap.php /.editorconfig: -------------------------------------------------------------------------------- 1 | # This file is for unifying the coding style for different editors and IDEs 2 | # editorconfig.org 3 | 4 | root = true 5 | 6 | [*] 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | # Spaces in coffee 13 | [**.coffee] 14 | indent_style = space 15 | indent_size = 2 16 | 17 | [**.js] 18 | indent_style = space 19 | indent_size = 2 20 | 21 | # Tabs in less 22 | [**.less] 23 | indent_style = tab 24 | indent_size = 2 25 | 26 | [**.css] 27 | indent_style = tab 28 | indent_size = 2 29 | 30 | [**.php] 31 | indent_style = space 32 | indent_size = 4 33 | 34 | [**.html] 35 | indent_style = tab 36 | indent_size = 2 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | .DS_Store 3 | composer.phar 4 | vendor/ -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | #migrated to container-based infrastructure 2 | sudo: false 3 | 4 | language: php 5 | php: 6 | - '7.0' 7 | - '7.1' 8 | - nightly 9 | 10 | install: 11 | - composer install 12 | -------------------------------------------------------------------------------- /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 | ckan-php-client 2 | =============== 3 | 4 | [![Build Status](https://travis-ci.org/GSA/ckan-php-client.svg)](https://travis-ci.org/GSA/ckan-php-client) 5 | [![Codacy Badge](https://api.codacy.com/project/badge/d052803756de41bfa51ef9a4d080a5da)](https://www.codacy.com/app/alexandr-perfilov/ckan-php-client) 6 | [![Join the chat at https://gitter.im/GSA/ckan-php-client](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/GSA/ckan-php-client?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 7 | 8 | Tiny CKAN API client written in PHP 9 | 10 | ## Requirements 11 | 12 | * PHP 5.6+ : 13 | 14 | ## Installation 15 | 16 | The recommended way to install is [through composer](https://getcomposer.org/download/). 17 | 18 | And run these two commands to install it: 19 | 20 | $ curl -sS https://getcomposer.org/installer | php -- --install-dir=bin 21 | 22 | Create a composer.json file for your project: 23 | 24 | { 25 | "repositories": [ 26 | { 27 | "type": "git", 28 | "url": "https://github.com/GSA/ckan-php-client.git" 29 | } 30 | ], 31 | "require": { 32 | "gsa/ckan-php-client": "0.*" 33 | }, 34 | } 35 | 36 | Install dependencies: 37 | 38 | $ composer install 39 | 40 | Now you can add the autoloader, and you will have access to the library: 41 | 42 | package_search('organization:irs-gov'); 57 | $ckanResults = json_decode($ckanResults, true); 58 | 59 | ### Sample 60 | 61 | Check [GSA/ckan-php-manager](https://github.com/GSA/ckan-php-manager/) 62 | script as an example 63 | 64 | ## CKAN API DOCs 65 | 66 | http://docs.ckan.org/en/latest/api/index.html 67 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gsa/ckan-php-client", 3 | "description": "CKAN php client by GSA", 4 | "minimum-stability": "dev", 5 | "license": "GPL-3.0+", 6 | "type": "library", 7 | "authors": [ 8 | { 9 | "name": "Alex Perfilov", 10 | "email": "alexandr.perfilov@reisystems.com", 11 | "role": "Developer" 12 | } 13 | ], 14 | "autoload": { 15 | "psr-0": { 16 | "CKAN": "src/" 17 | } 18 | }, 19 | "prefer-stable": true, 20 | "require": { 21 | "php": ">=5.6", 22 | "ext-curl": "*", 23 | "ext-json": "*", 24 | "phpunit/phpunit": "*" 25 | }, 26 | "require-dev": { 27 | "doctrine/instantiator": "1.0.5", 28 | "phpunit/phpunit": "~4.8|~5.7" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", 5 | "This file is @generated automatically" 6 | ], 7 | "content-hash": "e9972f98967700fefea8146d2f58a7fe", 8 | "packages": [ 9 | { 10 | "name": "doctrine/instantiator", 11 | "version": "1.0.5", 12 | "source": { 13 | "type": "git", 14 | "url": "https://github.com/doctrine/instantiator.git", 15 | "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" 16 | }, 17 | "dist": { 18 | "type": "zip", 19 | "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", 20 | "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", 21 | "shasum": "" 22 | }, 23 | "require": { 24 | "php": ">=5.3,<8.0-DEV" 25 | }, 26 | "require-dev": { 27 | "athletic/athletic": "~0.1.8", 28 | "ext-pdo": "*", 29 | "ext-phar": "*", 30 | "phpunit/phpunit": "~4.0", 31 | "squizlabs/php_codesniffer": "~2.0" 32 | }, 33 | "type": "library", 34 | "extra": { 35 | "branch-alias": { 36 | "dev-master": "1.0.x-dev" 37 | } 38 | }, 39 | "autoload": { 40 | "psr-4": { 41 | "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" 42 | } 43 | }, 44 | "notification-url": "https://packagist.org/downloads/", 45 | "license": [ 46 | "MIT" 47 | ], 48 | "authors": [ 49 | { 50 | "name": "Marco Pivetta", 51 | "email": "ocramius@gmail.com", 52 | "homepage": "http://ocramius.github.com/" 53 | } 54 | ], 55 | "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", 56 | "homepage": "https://github.com/doctrine/instantiator", 57 | "keywords": [ 58 | "constructor", 59 | "instantiate" 60 | ], 61 | "time": "2015-06-14T21:17:01+00:00" 62 | }, 63 | { 64 | "name": "myclabs/deep-copy", 65 | "version": "1.7.0", 66 | "source": { 67 | "type": "git", 68 | "url": "https://github.com/myclabs/DeepCopy.git", 69 | "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e" 70 | }, 71 | "dist": { 72 | "type": "zip", 73 | "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", 74 | "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", 75 | "shasum": "" 76 | }, 77 | "require": { 78 | "php": "^5.6 || ^7.0" 79 | }, 80 | "require-dev": { 81 | "doctrine/collections": "^1.0", 82 | "doctrine/common": "^2.6", 83 | "phpunit/phpunit": "^4.1" 84 | }, 85 | "type": "library", 86 | "autoload": { 87 | "psr-4": { 88 | "DeepCopy\\": "src/DeepCopy/" 89 | }, 90 | "files": [ 91 | "src/DeepCopy/deep_copy.php" 92 | ] 93 | }, 94 | "notification-url": "https://packagist.org/downloads/", 95 | "license": [ 96 | "MIT" 97 | ], 98 | "description": "Create deep copies (clones) of your objects", 99 | "keywords": [ 100 | "clone", 101 | "copy", 102 | "duplicate", 103 | "object", 104 | "object graph" 105 | ], 106 | "time": "2017-10-19T19:58:43+00:00" 107 | }, 108 | { 109 | "name": "phpdocumentor/reflection-common", 110 | "version": "1.0.1", 111 | "source": { 112 | "type": "git", 113 | "url": "https://github.com/phpDocumentor/ReflectionCommon.git", 114 | "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" 115 | }, 116 | "dist": { 117 | "type": "zip", 118 | "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", 119 | "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", 120 | "shasum": "" 121 | }, 122 | "require": { 123 | "php": ">=5.5" 124 | }, 125 | "require-dev": { 126 | "phpunit/phpunit": "^4.6" 127 | }, 128 | "type": "library", 129 | "extra": { 130 | "branch-alias": { 131 | "dev-master": "1.0.x-dev" 132 | } 133 | }, 134 | "autoload": { 135 | "psr-4": { 136 | "phpDocumentor\\Reflection\\": [ 137 | "src" 138 | ] 139 | } 140 | }, 141 | "notification-url": "https://packagist.org/downloads/", 142 | "license": [ 143 | "MIT" 144 | ], 145 | "authors": [ 146 | { 147 | "name": "Jaap van Otterdijk", 148 | "email": "opensource@ijaap.nl" 149 | } 150 | ], 151 | "description": "Common reflection classes used by phpdocumentor to reflect the code structure", 152 | "homepage": "http://www.phpdoc.org", 153 | "keywords": [ 154 | "FQSEN", 155 | "phpDocumentor", 156 | "phpdoc", 157 | "reflection", 158 | "static analysis" 159 | ], 160 | "time": "2017-09-11T18:02:19+00:00" 161 | }, 162 | { 163 | "name": "phpdocumentor/reflection-docblock", 164 | "version": "4.2.0", 165 | "source": { 166 | "type": "git", 167 | "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", 168 | "reference": "66465776cfc249844bde6d117abff1d22e06c2da" 169 | }, 170 | "dist": { 171 | "type": "zip", 172 | "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/66465776cfc249844bde6d117abff1d22e06c2da", 173 | "reference": "66465776cfc249844bde6d117abff1d22e06c2da", 174 | "shasum": "" 175 | }, 176 | "require": { 177 | "php": "^7.0", 178 | "phpdocumentor/reflection-common": "^1.0.0", 179 | "phpdocumentor/type-resolver": "^0.4.0", 180 | "webmozart/assert": "^1.0" 181 | }, 182 | "require-dev": { 183 | "doctrine/instantiator": "~1.0.5", 184 | "mockery/mockery": "^1.0", 185 | "phpunit/phpunit": "^6.4" 186 | }, 187 | "type": "library", 188 | "extra": { 189 | "branch-alias": { 190 | "dev-master": "4.x-dev" 191 | } 192 | }, 193 | "autoload": { 194 | "psr-4": { 195 | "phpDocumentor\\Reflection\\": [ 196 | "src/" 197 | ] 198 | } 199 | }, 200 | "notification-url": "https://packagist.org/downloads/", 201 | "license": [ 202 | "MIT" 203 | ], 204 | "authors": [ 205 | { 206 | "name": "Mike van Riel", 207 | "email": "me@mikevanriel.com" 208 | } 209 | ], 210 | "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", 211 | "time": "2017-11-27T17:38:31+00:00" 212 | }, 213 | { 214 | "name": "phpdocumentor/type-resolver", 215 | "version": "0.4.0", 216 | "source": { 217 | "type": "git", 218 | "url": "https://github.com/phpDocumentor/TypeResolver.git", 219 | "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" 220 | }, 221 | "dist": { 222 | "type": "zip", 223 | "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", 224 | "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", 225 | "shasum": "" 226 | }, 227 | "require": { 228 | "php": "^5.5 || ^7.0", 229 | "phpdocumentor/reflection-common": "^1.0" 230 | }, 231 | "require-dev": { 232 | "mockery/mockery": "^0.9.4", 233 | "phpunit/phpunit": "^5.2||^4.8.24" 234 | }, 235 | "type": "library", 236 | "extra": { 237 | "branch-alias": { 238 | "dev-master": "1.0.x-dev" 239 | } 240 | }, 241 | "autoload": { 242 | "psr-4": { 243 | "phpDocumentor\\Reflection\\": [ 244 | "src/" 245 | ] 246 | } 247 | }, 248 | "notification-url": "https://packagist.org/downloads/", 249 | "license": [ 250 | "MIT" 251 | ], 252 | "authors": [ 253 | { 254 | "name": "Mike van Riel", 255 | "email": "me@mikevanriel.com" 256 | } 257 | ], 258 | "time": "2017-07-14T14:27:02+00:00" 259 | }, 260 | { 261 | "name": "phpspec/prophecy", 262 | "version": "1.7.3", 263 | "source": { 264 | "type": "git", 265 | "url": "https://github.com/phpspec/prophecy.git", 266 | "reference": "e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf" 267 | }, 268 | "dist": { 269 | "type": "zip", 270 | "url": "https://api.github.com/repos/phpspec/prophecy/zipball/e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf", 271 | "reference": "e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf", 272 | "shasum": "" 273 | }, 274 | "require": { 275 | "doctrine/instantiator": "^1.0.2", 276 | "php": "^5.3|^7.0", 277 | "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", 278 | "sebastian/comparator": "^1.1|^2.0", 279 | "sebastian/recursion-context": "^1.0|^2.0|^3.0" 280 | }, 281 | "require-dev": { 282 | "phpspec/phpspec": "^2.5|^3.2", 283 | "phpunit/phpunit": "^4.8.35 || ^5.7" 284 | }, 285 | "type": "library", 286 | "extra": { 287 | "branch-alias": { 288 | "dev-master": "1.7.x-dev" 289 | } 290 | }, 291 | "autoload": { 292 | "psr-0": { 293 | "Prophecy\\": "src/" 294 | } 295 | }, 296 | "notification-url": "https://packagist.org/downloads/", 297 | "license": [ 298 | "MIT" 299 | ], 300 | "authors": [ 301 | { 302 | "name": "Konstantin Kudryashov", 303 | "email": "ever.zet@gmail.com", 304 | "homepage": "http://everzet.com" 305 | }, 306 | { 307 | "name": "Marcello Duarte", 308 | "email": "marcello.duarte@gmail.com" 309 | } 310 | ], 311 | "description": "Highly opinionated mocking framework for PHP 5.3+", 312 | "homepage": "https://github.com/phpspec/prophecy", 313 | "keywords": [ 314 | "Double", 315 | "Dummy", 316 | "fake", 317 | "mock", 318 | "spy", 319 | "stub" 320 | ], 321 | "time": "2017-11-24T13:59:53+00:00" 322 | }, 323 | { 324 | "name": "phpunit/php-code-coverage", 325 | "version": "4.0.8", 326 | "source": { 327 | "type": "git", 328 | "url": "https://github.com/sebastianbergmann/php-code-coverage.git", 329 | "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d" 330 | }, 331 | "dist": { 332 | "type": "zip", 333 | "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ef7b2f56815df854e66ceaee8ebe9393ae36a40d", 334 | "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d", 335 | "shasum": "" 336 | }, 337 | "require": { 338 | "ext-dom": "*", 339 | "ext-xmlwriter": "*", 340 | "php": "^5.6 || ^7.0", 341 | "phpunit/php-file-iterator": "^1.3", 342 | "phpunit/php-text-template": "^1.2", 343 | "phpunit/php-token-stream": "^1.4.2 || ^2.0", 344 | "sebastian/code-unit-reverse-lookup": "^1.0", 345 | "sebastian/environment": "^1.3.2 || ^2.0", 346 | "sebastian/version": "^1.0 || ^2.0" 347 | }, 348 | "require-dev": { 349 | "ext-xdebug": "^2.1.4", 350 | "phpunit/phpunit": "^5.7" 351 | }, 352 | "suggest": { 353 | "ext-xdebug": "^2.5.1" 354 | }, 355 | "type": "library", 356 | "extra": { 357 | "branch-alias": { 358 | "dev-master": "4.0.x-dev" 359 | } 360 | }, 361 | "autoload": { 362 | "classmap": [ 363 | "src/" 364 | ] 365 | }, 366 | "notification-url": "https://packagist.org/downloads/", 367 | "license": [ 368 | "BSD-3-Clause" 369 | ], 370 | "authors": [ 371 | { 372 | "name": "Sebastian Bergmann", 373 | "email": "sb@sebastian-bergmann.de", 374 | "role": "lead" 375 | } 376 | ], 377 | "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", 378 | "homepage": "https://github.com/sebastianbergmann/php-code-coverage", 379 | "keywords": [ 380 | "coverage", 381 | "testing", 382 | "xunit" 383 | ], 384 | "time": "2017-04-02T07:44:40+00:00" 385 | }, 386 | { 387 | "name": "phpunit/php-file-iterator", 388 | "version": "1.4.5", 389 | "source": { 390 | "type": "git", 391 | "url": "https://github.com/sebastianbergmann/php-file-iterator.git", 392 | "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" 393 | }, 394 | "dist": { 395 | "type": "zip", 396 | "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", 397 | "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", 398 | "shasum": "" 399 | }, 400 | "require": { 401 | "php": ">=5.3.3" 402 | }, 403 | "type": "library", 404 | "extra": { 405 | "branch-alias": { 406 | "dev-master": "1.4.x-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": "sb@sebastian-bergmann.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 | "time": "2017-11-27T13:52:08+00:00" 432 | }, 433 | { 434 | "name": "phpunit/php-text-template", 435 | "version": "1.2.1", 436 | "source": { 437 | "type": "git", 438 | "url": "https://github.com/sebastianbergmann/php-text-template.git", 439 | "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" 440 | }, 441 | "dist": { 442 | "type": "zip", 443 | "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", 444 | "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", 445 | "shasum": "" 446 | }, 447 | "require": { 448 | "php": ">=5.3.3" 449 | }, 450 | "type": "library", 451 | "autoload": { 452 | "classmap": [ 453 | "src/" 454 | ] 455 | }, 456 | "notification-url": "https://packagist.org/downloads/", 457 | "license": [ 458 | "BSD-3-Clause" 459 | ], 460 | "authors": [ 461 | { 462 | "name": "Sebastian Bergmann", 463 | "email": "sebastian@phpunit.de", 464 | "role": "lead" 465 | } 466 | ], 467 | "description": "Simple template engine.", 468 | "homepage": "https://github.com/sebastianbergmann/php-text-template/", 469 | "keywords": [ 470 | "template" 471 | ], 472 | "time": "2015-06-21T13:50:34+00:00" 473 | }, 474 | { 475 | "name": "phpunit/php-timer", 476 | "version": "1.0.9", 477 | "source": { 478 | "type": "git", 479 | "url": "https://github.com/sebastianbergmann/php-timer.git", 480 | "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" 481 | }, 482 | "dist": { 483 | "type": "zip", 484 | "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", 485 | "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", 486 | "shasum": "" 487 | }, 488 | "require": { 489 | "php": "^5.3.3 || ^7.0" 490 | }, 491 | "require-dev": { 492 | "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" 493 | }, 494 | "type": "library", 495 | "extra": { 496 | "branch-alias": { 497 | "dev-master": "1.0-dev" 498 | } 499 | }, 500 | "autoload": { 501 | "classmap": [ 502 | "src/" 503 | ] 504 | }, 505 | "notification-url": "https://packagist.org/downloads/", 506 | "license": [ 507 | "BSD-3-Clause" 508 | ], 509 | "authors": [ 510 | { 511 | "name": "Sebastian Bergmann", 512 | "email": "sb@sebastian-bergmann.de", 513 | "role": "lead" 514 | } 515 | ], 516 | "description": "Utility class for timing", 517 | "homepage": "https://github.com/sebastianbergmann/php-timer/", 518 | "keywords": [ 519 | "timer" 520 | ], 521 | "time": "2017-02-26T11:10:40+00:00" 522 | }, 523 | { 524 | "name": "phpunit/php-token-stream", 525 | "version": "2.0.2", 526 | "source": { 527 | "type": "git", 528 | "url": "https://github.com/sebastianbergmann/php-token-stream.git", 529 | "reference": "791198a2c6254db10131eecfe8c06670700904db" 530 | }, 531 | "dist": { 532 | "type": "zip", 533 | "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db", 534 | "reference": "791198a2c6254db10131eecfe8c06670700904db", 535 | "shasum": "" 536 | }, 537 | "require": { 538 | "ext-tokenizer": "*", 539 | "php": "^7.0" 540 | }, 541 | "require-dev": { 542 | "phpunit/phpunit": "^6.2.4" 543 | }, 544 | "type": "library", 545 | "extra": { 546 | "branch-alias": { 547 | "dev-master": "2.0-dev" 548 | } 549 | }, 550 | "autoload": { 551 | "classmap": [ 552 | "src/" 553 | ] 554 | }, 555 | "notification-url": "https://packagist.org/downloads/", 556 | "license": [ 557 | "BSD-3-Clause" 558 | ], 559 | "authors": [ 560 | { 561 | "name": "Sebastian Bergmann", 562 | "email": "sebastian@phpunit.de" 563 | } 564 | ], 565 | "description": "Wrapper around PHP's tokenizer extension.", 566 | "homepage": "https://github.com/sebastianbergmann/php-token-stream/", 567 | "keywords": [ 568 | "tokenizer" 569 | ], 570 | "time": "2017-11-27T05:48:46+00:00" 571 | }, 572 | { 573 | "name": "phpunit/phpunit", 574 | "version": "5.7.25", 575 | "source": { 576 | "type": "git", 577 | "url": "https://github.com/sebastianbergmann/phpunit.git", 578 | "reference": "4b1c822a68ae6577df38a59eb49b046712ec0f6a" 579 | }, 580 | "dist": { 581 | "type": "zip", 582 | "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/4b1c822a68ae6577df38a59eb49b046712ec0f6a", 583 | "reference": "4b1c822a68ae6577df38a59eb49b046712ec0f6a", 584 | "shasum": "" 585 | }, 586 | "require": { 587 | "ext-dom": "*", 588 | "ext-json": "*", 589 | "ext-libxml": "*", 590 | "ext-mbstring": "*", 591 | "ext-xml": "*", 592 | "myclabs/deep-copy": "~1.3", 593 | "php": "^5.6 || ^7.0", 594 | "phpspec/prophecy": "^1.6.2", 595 | "phpunit/php-code-coverage": "^4.0.4", 596 | "phpunit/php-file-iterator": "~1.4", 597 | "phpunit/php-text-template": "~1.2", 598 | "phpunit/php-timer": "^1.0.6", 599 | "phpunit/phpunit-mock-objects": "^3.2", 600 | "sebastian/comparator": "^1.2.4", 601 | "sebastian/diff": "^1.4.3", 602 | "sebastian/environment": "^1.3.4 || ^2.0", 603 | "sebastian/exporter": "~2.0", 604 | "sebastian/global-state": "^1.1", 605 | "sebastian/object-enumerator": "~2.0", 606 | "sebastian/resource-operations": "~1.0", 607 | "sebastian/version": "~1.0.3|~2.0", 608 | "symfony/yaml": "~2.1|~3.0|~4.0" 609 | }, 610 | "conflict": { 611 | "phpdocumentor/reflection-docblock": "3.0.2" 612 | }, 613 | "require-dev": { 614 | "ext-pdo": "*" 615 | }, 616 | "suggest": { 617 | "ext-xdebug": "*", 618 | "phpunit/php-invoker": "~1.1" 619 | }, 620 | "bin": [ 621 | "phpunit" 622 | ], 623 | "type": "library", 624 | "extra": { 625 | "branch-alias": { 626 | "dev-master": "5.7.x-dev" 627 | } 628 | }, 629 | "autoload": { 630 | "classmap": [ 631 | "src/" 632 | ] 633 | }, 634 | "notification-url": "https://packagist.org/downloads/", 635 | "license": [ 636 | "BSD-3-Clause" 637 | ], 638 | "authors": [ 639 | { 640 | "name": "Sebastian Bergmann", 641 | "email": "sebastian@phpunit.de", 642 | "role": "lead" 643 | } 644 | ], 645 | "description": "The PHP Unit Testing framework.", 646 | "homepage": "https://phpunit.de/", 647 | "keywords": [ 648 | "phpunit", 649 | "testing", 650 | "xunit" 651 | ], 652 | "time": "2017-11-14T14:50:51+00:00" 653 | }, 654 | { 655 | "name": "phpunit/phpunit-mock-objects", 656 | "version": "3.4.4", 657 | "source": { 658 | "type": "git", 659 | "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", 660 | "reference": "a23b761686d50a560cc56233b9ecf49597cc9118" 661 | }, 662 | "dist": { 663 | "type": "zip", 664 | "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/a23b761686d50a560cc56233b9ecf49597cc9118", 665 | "reference": "a23b761686d50a560cc56233b9ecf49597cc9118", 666 | "shasum": "" 667 | }, 668 | "require": { 669 | "doctrine/instantiator": "^1.0.2", 670 | "php": "^5.6 || ^7.0", 671 | "phpunit/php-text-template": "^1.2", 672 | "sebastian/exporter": "^1.2 || ^2.0" 673 | }, 674 | "conflict": { 675 | "phpunit/phpunit": "<5.4.0" 676 | }, 677 | "require-dev": { 678 | "phpunit/phpunit": "^5.4" 679 | }, 680 | "suggest": { 681 | "ext-soap": "*" 682 | }, 683 | "type": "library", 684 | "extra": { 685 | "branch-alias": { 686 | "dev-master": "3.2.x-dev" 687 | } 688 | }, 689 | "autoload": { 690 | "classmap": [ 691 | "src/" 692 | ] 693 | }, 694 | "notification-url": "https://packagist.org/downloads/", 695 | "license": [ 696 | "BSD-3-Clause" 697 | ], 698 | "authors": [ 699 | { 700 | "name": "Sebastian Bergmann", 701 | "email": "sb@sebastian-bergmann.de", 702 | "role": "lead" 703 | } 704 | ], 705 | "description": "Mock Object library for PHPUnit", 706 | "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", 707 | "keywords": [ 708 | "mock", 709 | "xunit" 710 | ], 711 | "time": "2017-06-30T09:13:00+00:00" 712 | }, 713 | { 714 | "name": "sebastian/code-unit-reverse-lookup", 715 | "version": "1.0.1", 716 | "source": { 717 | "type": "git", 718 | "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", 719 | "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" 720 | }, 721 | "dist": { 722 | "type": "zip", 723 | "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", 724 | "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", 725 | "shasum": "" 726 | }, 727 | "require": { 728 | "php": "^5.6 || ^7.0" 729 | }, 730 | "require-dev": { 731 | "phpunit/phpunit": "^5.7 || ^6.0" 732 | }, 733 | "type": "library", 734 | "extra": { 735 | "branch-alias": { 736 | "dev-master": "1.0.x-dev" 737 | } 738 | }, 739 | "autoload": { 740 | "classmap": [ 741 | "src/" 742 | ] 743 | }, 744 | "notification-url": "https://packagist.org/downloads/", 745 | "license": [ 746 | "BSD-3-Clause" 747 | ], 748 | "authors": [ 749 | { 750 | "name": "Sebastian Bergmann", 751 | "email": "sebastian@phpunit.de" 752 | } 753 | ], 754 | "description": "Looks up which function or method a line of code belongs to", 755 | "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", 756 | "time": "2017-03-04T06:30:41+00:00" 757 | }, 758 | { 759 | "name": "sebastian/comparator", 760 | "version": "1.2.4", 761 | "source": { 762 | "type": "git", 763 | "url": "https://github.com/sebastianbergmann/comparator.git", 764 | "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" 765 | }, 766 | "dist": { 767 | "type": "zip", 768 | "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", 769 | "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", 770 | "shasum": "" 771 | }, 772 | "require": { 773 | "php": ">=5.3.3", 774 | "sebastian/diff": "~1.2", 775 | "sebastian/exporter": "~1.2 || ~2.0" 776 | }, 777 | "require-dev": { 778 | "phpunit/phpunit": "~4.4" 779 | }, 780 | "type": "library", 781 | "extra": { 782 | "branch-alias": { 783 | "dev-master": "1.2.x-dev" 784 | } 785 | }, 786 | "autoload": { 787 | "classmap": [ 788 | "src/" 789 | ] 790 | }, 791 | "notification-url": "https://packagist.org/downloads/", 792 | "license": [ 793 | "BSD-3-Clause" 794 | ], 795 | "authors": [ 796 | { 797 | "name": "Jeff Welch", 798 | "email": "whatthejeff@gmail.com" 799 | }, 800 | { 801 | "name": "Volker Dusch", 802 | "email": "github@wallbash.com" 803 | }, 804 | { 805 | "name": "Bernhard Schussek", 806 | "email": "bschussek@2bepublished.at" 807 | }, 808 | { 809 | "name": "Sebastian Bergmann", 810 | "email": "sebastian@phpunit.de" 811 | } 812 | ], 813 | "description": "Provides the functionality to compare PHP values for equality", 814 | "homepage": "http://www.github.com/sebastianbergmann/comparator", 815 | "keywords": [ 816 | "comparator", 817 | "compare", 818 | "equality" 819 | ], 820 | "time": "2017-01-29T09:50:25+00:00" 821 | }, 822 | { 823 | "name": "sebastian/diff", 824 | "version": "1.4.3", 825 | "source": { 826 | "type": "git", 827 | "url": "https://github.com/sebastianbergmann/diff.git", 828 | "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" 829 | }, 830 | "dist": { 831 | "type": "zip", 832 | "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", 833 | "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", 834 | "shasum": "" 835 | }, 836 | "require": { 837 | "php": "^5.3.3 || ^7.0" 838 | }, 839 | "require-dev": { 840 | "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" 841 | }, 842 | "type": "library", 843 | "extra": { 844 | "branch-alias": { 845 | "dev-master": "1.4-dev" 846 | } 847 | }, 848 | "autoload": { 849 | "classmap": [ 850 | "src/" 851 | ] 852 | }, 853 | "notification-url": "https://packagist.org/downloads/", 854 | "license": [ 855 | "BSD-3-Clause" 856 | ], 857 | "authors": [ 858 | { 859 | "name": "Kore Nordmann", 860 | "email": "mail@kore-nordmann.de" 861 | }, 862 | { 863 | "name": "Sebastian Bergmann", 864 | "email": "sebastian@phpunit.de" 865 | } 866 | ], 867 | "description": "Diff implementation", 868 | "homepage": "https://github.com/sebastianbergmann/diff", 869 | "keywords": [ 870 | "diff" 871 | ], 872 | "time": "2017-05-22T07:24:03+00:00" 873 | }, 874 | { 875 | "name": "sebastian/environment", 876 | "version": "2.0.0", 877 | "source": { 878 | "type": "git", 879 | "url": "https://github.com/sebastianbergmann/environment.git", 880 | "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac" 881 | }, 882 | "dist": { 883 | "type": "zip", 884 | "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac", 885 | "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac", 886 | "shasum": "" 887 | }, 888 | "require": { 889 | "php": "^5.6 || ^7.0" 890 | }, 891 | "require-dev": { 892 | "phpunit/phpunit": "^5.0" 893 | }, 894 | "type": "library", 895 | "extra": { 896 | "branch-alias": { 897 | "dev-master": "2.0.x-dev" 898 | } 899 | }, 900 | "autoload": { 901 | "classmap": [ 902 | "src/" 903 | ] 904 | }, 905 | "notification-url": "https://packagist.org/downloads/", 906 | "license": [ 907 | "BSD-3-Clause" 908 | ], 909 | "authors": [ 910 | { 911 | "name": "Sebastian Bergmann", 912 | "email": "sebastian@phpunit.de" 913 | } 914 | ], 915 | "description": "Provides functionality to handle HHVM/PHP environments", 916 | "homepage": "http://www.github.com/sebastianbergmann/environment", 917 | "keywords": [ 918 | "Xdebug", 919 | "environment", 920 | "hhvm" 921 | ], 922 | "time": "2016-11-26T07:53:53+00:00" 923 | }, 924 | { 925 | "name": "sebastian/exporter", 926 | "version": "2.0.0", 927 | "source": { 928 | "type": "git", 929 | "url": "https://github.com/sebastianbergmann/exporter.git", 930 | "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4" 931 | }, 932 | "dist": { 933 | "type": "zip", 934 | "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", 935 | "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", 936 | "shasum": "" 937 | }, 938 | "require": { 939 | "php": ">=5.3.3", 940 | "sebastian/recursion-context": "~2.0" 941 | }, 942 | "require-dev": { 943 | "ext-mbstring": "*", 944 | "phpunit/phpunit": "~4.4" 945 | }, 946 | "type": "library", 947 | "extra": { 948 | "branch-alias": { 949 | "dev-master": "2.0.x-dev" 950 | } 951 | }, 952 | "autoload": { 953 | "classmap": [ 954 | "src/" 955 | ] 956 | }, 957 | "notification-url": "https://packagist.org/downloads/", 958 | "license": [ 959 | "BSD-3-Clause" 960 | ], 961 | "authors": [ 962 | { 963 | "name": "Jeff Welch", 964 | "email": "whatthejeff@gmail.com" 965 | }, 966 | { 967 | "name": "Volker Dusch", 968 | "email": "github@wallbash.com" 969 | }, 970 | { 971 | "name": "Bernhard Schussek", 972 | "email": "bschussek@2bepublished.at" 973 | }, 974 | { 975 | "name": "Sebastian Bergmann", 976 | "email": "sebastian@phpunit.de" 977 | }, 978 | { 979 | "name": "Adam Harvey", 980 | "email": "aharvey@php.net" 981 | } 982 | ], 983 | "description": "Provides the functionality to export PHP variables for visualization", 984 | "homepage": "http://www.github.com/sebastianbergmann/exporter", 985 | "keywords": [ 986 | "export", 987 | "exporter" 988 | ], 989 | "time": "2016-11-19T08:54:04+00:00" 990 | }, 991 | { 992 | "name": "sebastian/global-state", 993 | "version": "1.1.1", 994 | "source": { 995 | "type": "git", 996 | "url": "https://github.com/sebastianbergmann/global-state.git", 997 | "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" 998 | }, 999 | "dist": { 1000 | "type": "zip", 1001 | "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", 1002 | "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", 1003 | "shasum": "" 1004 | }, 1005 | "require": { 1006 | "php": ">=5.3.3" 1007 | }, 1008 | "require-dev": { 1009 | "phpunit/phpunit": "~4.2" 1010 | }, 1011 | "suggest": { 1012 | "ext-uopz": "*" 1013 | }, 1014 | "type": "library", 1015 | "extra": { 1016 | "branch-alias": { 1017 | "dev-master": "1.0-dev" 1018 | } 1019 | }, 1020 | "autoload": { 1021 | "classmap": [ 1022 | "src/" 1023 | ] 1024 | }, 1025 | "notification-url": "https://packagist.org/downloads/", 1026 | "license": [ 1027 | "BSD-3-Clause" 1028 | ], 1029 | "authors": [ 1030 | { 1031 | "name": "Sebastian Bergmann", 1032 | "email": "sebastian@phpunit.de" 1033 | } 1034 | ], 1035 | "description": "Snapshotting of global state", 1036 | "homepage": "http://www.github.com/sebastianbergmann/global-state", 1037 | "keywords": [ 1038 | "global state" 1039 | ], 1040 | "time": "2015-10-12T03:26:01+00:00" 1041 | }, 1042 | { 1043 | "name": "sebastian/object-enumerator", 1044 | "version": "2.0.1", 1045 | "source": { 1046 | "type": "git", 1047 | "url": "https://github.com/sebastianbergmann/object-enumerator.git", 1048 | "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7" 1049 | }, 1050 | "dist": { 1051 | "type": "zip", 1052 | "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/1311872ac850040a79c3c058bea3e22d0f09cbb7", 1053 | "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7", 1054 | "shasum": "" 1055 | }, 1056 | "require": { 1057 | "php": ">=5.6", 1058 | "sebastian/recursion-context": "~2.0" 1059 | }, 1060 | "require-dev": { 1061 | "phpunit/phpunit": "~5" 1062 | }, 1063 | "type": "library", 1064 | "extra": { 1065 | "branch-alias": { 1066 | "dev-master": "2.0.x-dev" 1067 | } 1068 | }, 1069 | "autoload": { 1070 | "classmap": [ 1071 | "src/" 1072 | ] 1073 | }, 1074 | "notification-url": "https://packagist.org/downloads/", 1075 | "license": [ 1076 | "BSD-3-Clause" 1077 | ], 1078 | "authors": [ 1079 | { 1080 | "name": "Sebastian Bergmann", 1081 | "email": "sebastian@phpunit.de" 1082 | } 1083 | ], 1084 | "description": "Traverses array structures and object graphs to enumerate all referenced objects", 1085 | "homepage": "https://github.com/sebastianbergmann/object-enumerator/", 1086 | "time": "2017-02-18T15:18:39+00:00" 1087 | }, 1088 | { 1089 | "name": "sebastian/recursion-context", 1090 | "version": "2.0.0", 1091 | "source": { 1092 | "type": "git", 1093 | "url": "https://github.com/sebastianbergmann/recursion-context.git", 1094 | "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a" 1095 | }, 1096 | "dist": { 1097 | "type": "zip", 1098 | "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2c3ba150cbec723aa057506e73a8d33bdb286c9a", 1099 | "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a", 1100 | "shasum": "" 1101 | }, 1102 | "require": { 1103 | "php": ">=5.3.3" 1104 | }, 1105 | "require-dev": { 1106 | "phpunit/phpunit": "~4.4" 1107 | }, 1108 | "type": "library", 1109 | "extra": { 1110 | "branch-alias": { 1111 | "dev-master": "2.0.x-dev" 1112 | } 1113 | }, 1114 | "autoload": { 1115 | "classmap": [ 1116 | "src/" 1117 | ] 1118 | }, 1119 | "notification-url": "https://packagist.org/downloads/", 1120 | "license": [ 1121 | "BSD-3-Clause" 1122 | ], 1123 | "authors": [ 1124 | { 1125 | "name": "Jeff Welch", 1126 | "email": "whatthejeff@gmail.com" 1127 | }, 1128 | { 1129 | "name": "Sebastian Bergmann", 1130 | "email": "sebastian@phpunit.de" 1131 | }, 1132 | { 1133 | "name": "Adam Harvey", 1134 | "email": "aharvey@php.net" 1135 | } 1136 | ], 1137 | "description": "Provides functionality to recursively process PHP variables", 1138 | "homepage": "http://www.github.com/sebastianbergmann/recursion-context", 1139 | "time": "2016-11-19T07:33:16+00:00" 1140 | }, 1141 | { 1142 | "name": "sebastian/resource-operations", 1143 | "version": "1.0.0", 1144 | "source": { 1145 | "type": "git", 1146 | "url": "https://github.com/sebastianbergmann/resource-operations.git", 1147 | "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" 1148 | }, 1149 | "dist": { 1150 | "type": "zip", 1151 | "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", 1152 | "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", 1153 | "shasum": "" 1154 | }, 1155 | "require": { 1156 | "php": ">=5.6.0" 1157 | }, 1158 | "type": "library", 1159 | "extra": { 1160 | "branch-alias": { 1161 | "dev-master": "1.0.x-dev" 1162 | } 1163 | }, 1164 | "autoload": { 1165 | "classmap": [ 1166 | "src/" 1167 | ] 1168 | }, 1169 | "notification-url": "https://packagist.org/downloads/", 1170 | "license": [ 1171 | "BSD-3-Clause" 1172 | ], 1173 | "authors": [ 1174 | { 1175 | "name": "Sebastian Bergmann", 1176 | "email": "sebastian@phpunit.de" 1177 | } 1178 | ], 1179 | "description": "Provides a list of PHP built-in functions that operate on resources", 1180 | "homepage": "https://www.github.com/sebastianbergmann/resource-operations", 1181 | "time": "2015-07-28T20:34:47+00:00" 1182 | }, 1183 | { 1184 | "name": "sebastian/version", 1185 | "version": "2.0.1", 1186 | "source": { 1187 | "type": "git", 1188 | "url": "https://github.com/sebastianbergmann/version.git", 1189 | "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" 1190 | }, 1191 | "dist": { 1192 | "type": "zip", 1193 | "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", 1194 | "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", 1195 | "shasum": "" 1196 | }, 1197 | "require": { 1198 | "php": ">=5.6" 1199 | }, 1200 | "type": "library", 1201 | "extra": { 1202 | "branch-alias": { 1203 | "dev-master": "2.0.x-dev" 1204 | } 1205 | }, 1206 | "autoload": { 1207 | "classmap": [ 1208 | "src/" 1209 | ] 1210 | }, 1211 | "notification-url": "https://packagist.org/downloads/", 1212 | "license": [ 1213 | "BSD-3-Clause" 1214 | ], 1215 | "authors": [ 1216 | { 1217 | "name": "Sebastian Bergmann", 1218 | "email": "sebastian@phpunit.de", 1219 | "role": "lead" 1220 | } 1221 | ], 1222 | "description": "Library that helps with managing the version number of Git-hosted PHP projects", 1223 | "homepage": "https://github.com/sebastianbergmann/version", 1224 | "time": "2016-10-03T07:35:21+00:00" 1225 | }, 1226 | { 1227 | "name": "symfony/yaml", 1228 | "version": "v3.4.0", 1229 | "source": { 1230 | "type": "git", 1231 | "url": "https://github.com/symfony/yaml.git", 1232 | "reference": "b3d0c9c11be3831b84825967dc6b52b5a7b84e04" 1233 | }, 1234 | "dist": { 1235 | "type": "zip", 1236 | "url": "https://api.github.com/repos/symfony/yaml/zipball/b3d0c9c11be3831b84825967dc6b52b5a7b84e04", 1237 | "reference": "b3d0c9c11be3831b84825967dc6b52b5a7b84e04", 1238 | "shasum": "" 1239 | }, 1240 | "require": { 1241 | "php": "^5.5.9|>=7.0.8" 1242 | }, 1243 | "conflict": { 1244 | "symfony/console": "<3.4" 1245 | }, 1246 | "require-dev": { 1247 | "symfony/console": "~3.4|~4.0" 1248 | }, 1249 | "suggest": { 1250 | "symfony/console": "For validating YAML files using the lint command" 1251 | }, 1252 | "type": "library", 1253 | "extra": { 1254 | "branch-alias": { 1255 | "dev-master": "3.4-dev" 1256 | } 1257 | }, 1258 | "autoload": { 1259 | "psr-4": { 1260 | "Symfony\\Component\\Yaml\\": "" 1261 | }, 1262 | "exclude-from-classmap": [ 1263 | "/Tests/" 1264 | ] 1265 | }, 1266 | "notification-url": "https://packagist.org/downloads/", 1267 | "license": [ 1268 | "MIT" 1269 | ], 1270 | "authors": [ 1271 | { 1272 | "name": "Fabien Potencier", 1273 | "email": "fabien@symfony.com" 1274 | }, 1275 | { 1276 | "name": "Symfony Community", 1277 | "homepage": "https://symfony.com/contributors" 1278 | } 1279 | ], 1280 | "description": "Symfony Yaml Component", 1281 | "homepage": "https://symfony.com", 1282 | "time": "2017-11-29T13:28:14+00:00" 1283 | }, 1284 | { 1285 | "name": "webmozart/assert", 1286 | "version": "1.2.0", 1287 | "source": { 1288 | "type": "git", 1289 | "url": "https://github.com/webmozart/assert.git", 1290 | "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f" 1291 | }, 1292 | "dist": { 1293 | "type": "zip", 1294 | "url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f", 1295 | "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f", 1296 | "shasum": "" 1297 | }, 1298 | "require": { 1299 | "php": "^5.3.3 || ^7.0" 1300 | }, 1301 | "require-dev": { 1302 | "phpunit/phpunit": "^4.6", 1303 | "sebastian/version": "^1.0.1" 1304 | }, 1305 | "type": "library", 1306 | "extra": { 1307 | "branch-alias": { 1308 | "dev-master": "1.3-dev" 1309 | } 1310 | }, 1311 | "autoload": { 1312 | "psr-4": { 1313 | "Webmozart\\Assert\\": "src/" 1314 | } 1315 | }, 1316 | "notification-url": "https://packagist.org/downloads/", 1317 | "license": [ 1318 | "MIT" 1319 | ], 1320 | "authors": [ 1321 | { 1322 | "name": "Bernhard Schussek", 1323 | "email": "bschussek@gmail.com" 1324 | } 1325 | ], 1326 | "description": "Assertions to validate method input/output with nice error messages.", 1327 | "keywords": [ 1328 | "assert", 1329 | "check", 1330 | "validate" 1331 | ], 1332 | "time": "2016-11-23T20:04:58+00:00" 1333 | } 1334 | ], 1335 | "packages-dev": [], 1336 | "aliases": [], 1337 | "minimum-stability": "dev", 1338 | "stability-flags": [], 1339 | "prefer-stable": true, 1340 | "prefer-lowest": false, 1341 | "platform": { 1342 | "php": ">=5.6", 1343 | "ext-curl": "*", 1344 | "ext-json": "*" 1345 | }, 1346 | "platform-dev": [] 1347 | } 1348 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | ./tests/ 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/CKAN/CkanClient.php: -------------------------------------------------------------------------------- 1 | 'Continue', 47 | '200' => 'OK', 48 | '301' => 'Moved Permanently', 49 | '400' => 'Bad Request', 50 | '401' => 'Unauthorized', 51 | '403' => 'Not Authorized', 52 | '404' => 'Not Found', 53 | '409' => 'Conflict (e.g. name already exists)', 54 | '411' => 'Length required', 55 | '500' => 'Service Error', 56 | '503' => 'Service unavailable (e.g. CKAN build in progress, or you are banned)' 57 | ]; 58 | 59 | /** 60 | * @param $api_url 61 | * @param null $api_key 62 | */ 63 | public function __construct($api_url, $api_key = null) 64 | { 65 | $this->api_url = $api_url; 66 | $this->api_key = $api_key; 67 | 68 | // Create cURL object. 69 | $this->curl_handler = curl_init(); 70 | // Follow any Location: headers that the server sends. 71 | curl_setopt($this->curl_handler, CURLOPT_FOLLOWLOCATION, true); 72 | // However, don't follow more than five Location: headers. 73 | curl_setopt($this->curl_handler, CURLOPT_MAXREDIRS, 5); 74 | // Automatically set the Referrer: field in requests 75 | // following a Location: redirect. 76 | curl_setopt($this->curl_handler, CURLOPT_AUTOREFERER, true); 77 | // Return the transfer as a string instead of dumping to screen. 78 | curl_setopt($this->curl_handler, CURLOPT_RETURNTRANSFER, true); 79 | // If it takes more than 5 minutes => fail 80 | curl_setopt($this->curl_handler, CURLOPT_TIMEOUT, 60 * 5); 81 | // We don't want the header (use curl_getinfo()) 82 | curl_setopt($this->curl_handler, CURLOPT_HEADER, false); 83 | // Track the handle's request string 84 | curl_setopt($this->curl_handler, CURLINFO_HEADER_OUT, true); 85 | // Attempt to retrieve the modification date of the remote document. 86 | curl_setopt($this->curl_handler, CURLOPT_FILETIME, true); 87 | curl_setopt($this->curl_handler, CURLOPT_SSL_VERIFYPEER, false); 88 | // Initialize cURL headers 89 | $this->set_headers(); 90 | } 91 | 92 | /** 93 | * Sets the custom cURL headers. 94 | * @access private 95 | * @return void 96 | * @since Version 0.1.0 97 | */ 98 | private function set_headers() 99 | { 100 | $date = new DateTime(null, new DateTimeZone('UTC')); 101 | $this->curl_headers = [ 102 | 'Date: ' . $date->format('D, d M Y H:i:s') . ' GMT', // RFC 1123 103 | 'Accept: application/json', 104 | 'Accept-Charset: utf-8', 105 | 'Accept-Encoding: gzip', 106 | 'Cookie: auth_tkt=foo' 107 | ]; 108 | 109 | if ($this->api_key) { 110 | $this->curl_headers[] = 'Authorization: ' . $this->api_key; 111 | } 112 | } 113 | 114 | /** 115 | * @param $resource 116 | * 117 | * @return mixed 118 | * @throws \CKAN\NotFoundHttpException 119 | * @throws \Exception 120 | * @link http://docs.ckan.org/en/latest/api/#ckan.logic.action.create.resource_create 121 | */ 122 | public function resource_create($resource) 123 | { 124 | $data = json_encode($resource, JSON_PRETTY_PRINT); 125 | 126 | return $this->make_request( 127 | 'POST', 128 | 'action/resource_create', 129 | $data 130 | ); 131 | } 132 | 133 | /** 134 | * @param string $method // HTTP method (GET, POST) 135 | * @param string $uri // URI fragment to CKAN resource 136 | * @param string $data // Optional. String in JSON-format that will be in request body 137 | * 138 | * @return mixed // If success, either an array or object. Otherwise FALSE. 139 | * @throws Exception 140 | */ 141 | private function make_request($method, $uri, $data = null) 142 | { 143 | timer(); 144 | echo $uri.PHP_EOL; 145 | $method = strtoupper($method); 146 | if (!in_array($method, ['GET', 'POST'])) { 147 | throw new Exception('Method ' . $method . ' is not supported'); 148 | } 149 | // Set cURL URI. 150 | $url = strpos($uri, '//') ? $uri : $this->api_url . $uri; 151 | curl_setopt($this->curl_handler, CURLOPT_URL, $url); 152 | if ($method === 'POST' && $data) { 153 | curl_setopt($this->curl_handler, CURLOPT_POSTFIELDS, urlencode($data)); 154 | } else { 155 | $method = 'GET'; 156 | } 157 | 158 | // Set cURL method. 159 | curl_setopt($this->curl_handler, CURLOPT_CUSTOMREQUEST, $method); 160 | 161 | // Set headers. 162 | curl_setopt($this->curl_handler, CURLOPT_HTTPHEADER, $this->curl_headers); 163 | // Execute request and get response headers. 164 | $response = curl_exec($this->curl_handler); 165 | $info = curl_getinfo($this->curl_handler); 166 | // Check HTTP response code 167 | if ($info['http_code'] !== 200) { 168 | switch ($info['http_code']) { 169 | case 0: 170 | var_dump($info); 171 | break; 172 | case 404: 173 | throw new NotFoundHttpException($data); 174 | break; 175 | default: 176 | if (isset($info['http_code'])) { 177 | throw new Exception( 178 | $info['http_code'] . ': ' . 179 | $this->http_status_codes[$info['http_code']] . PHP_EOL . $data . PHP_EOL . $url . PHP_EOL 180 | ); 181 | } else { 182 | throw new Exception(serialize($info)); 183 | } 184 | } 185 | } 186 | 187 | return $response; 188 | } 189 | 190 | /** 191 | * Return a list of the site’s tags. 192 | * 193 | * @param $data 194 | * 195 | * @return mixed 196 | * @link http://docs.ckan.org/en/latest/api/#ckan.logic.action.get.tag_list 197 | * Params: 198 | * query (string) – a tag name query to search for, if given only tags whose names contain this string will be 199 | * returned (optional) vocabulary_id (string) – the id or name of a vocabulary, if give only tags that belong 200 | * to this vocabulary will be returned (optional) all_fields (boolean) – return full tag dictionaries instead 201 | * of just names (optional, default: False) 202 | */ 203 | public function tag_list($data = null) 204 | { 205 | return $this->make_request( 206 | 'POST', 207 | 'action/tag_list', 208 | $data 209 | ); 210 | } 211 | 212 | /** 213 | * @param $search 214 | * 215 | * @return mixed 216 | */ 217 | public function api_resource_search($search) 218 | { 219 | http: //catalog.data.gov/api/search/resource?url=explore.data.gov&all_fields=1&limit=100 220 | 221 | $query = http_build_query($search); 222 | 223 | return $this->make_request( 224 | 'GET', 225 | 'http://catalog.data.gov/api/search/resource?all_fields=1&limit=100&' . $query 226 | ); 227 | } 228 | 229 | /** 230 | * Create a new vocabulary tag. 231 | * 232 | * @param $name 233 | * @param null $vocabulary_id 234 | * 235 | * @return mixed 236 | * @link http://docs.ckan.org/en/latest/api/#ckan.logic.action.get.tag_list 237 | * Params: 238 | * name (string) – the name for the new tag, a string between 2 and 100 characters long containing only 239 | * alphanumeric characters and -, _ and ., e.g. 'Jazz' 240 | * vocabulary_id (string) – the name or id of the vocabulary that the new tag should be added to, e.g. 'Genre' 241 | */ 242 | public function tag_create($name, $vocabulary_id) 243 | { 244 | $data = [ 245 | 'name' => $name, 246 | 'vocabulary_id' => $vocabulary_id, 247 | ]; 248 | $data = json_encode($data, JSON_PRETTY_PRINT); 249 | 250 | return $this->make_request( 251 | 'POST', 252 | 'action/tag_create', 253 | $data 254 | ); 255 | } 256 | 257 | /** 258 | * Return a list of all the site’s tag vocabularies. 259 | */ 260 | public function vocabulary_list() 261 | { 262 | return $this->make_request('GET', 'action/vocabulary_list'); 263 | } 264 | 265 | /** 266 | * Create a new tag vocabulary. 267 | * 268 | * @param $name 269 | * Params: 270 | * name (string) – the name for the new vocabulary, a string between 2 and 100 characters long containing only 271 | * alphanumeric characters and -, _ and ., e.g. 'Jazz' tags (list of tag dictionaries) – the new tags to add to 272 | * the new vocabulary, for the format of tag dictionaries see tag_create() 273 | * 274 | * @return mixed 275 | */ 276 | public function vocabulary_create($name) 277 | { 278 | $data = [ 279 | 'name' => $name, 280 | ]; 281 | $data = json_encode($data, JSON_PRETTY_PRINT); 282 | 283 | return $this->make_request( 284 | 'POST', 285 | 'action/vocabulary_create', 286 | $data 287 | ); 288 | } 289 | 290 | /** 291 | * Return a list of the names of the site’s groups. 292 | * 293 | * @param bool $all_fields 294 | * 295 | * @return mixed 296 | * @link http://docs.ckan.org/en/latest/api/index.html#ckan.logic.action.get.group_list 297 | */ 298 | public function group_list($all_fields = false) 299 | { 300 | $solr_request = [ 301 | 'all_fields' => $all_fields 302 | ]; 303 | $data = json_encode($solr_request, JSON_PRETTY_PRINT); 304 | 305 | return $this->make_request( 306 | 'POST', 307 | 'action/group_list', 308 | $data 309 | ); 310 | } 311 | 312 | /** 313 | * Searches for packages satisfying a given search criteria 314 | * 315 | * @param string $package_id (id/name) 316 | * 317 | * @return mixed 318 | * @link http://docs.ckan.org/en/latest/api/index.html#ckan.logic.action.get.package_show 319 | */ 320 | public function package_show($package_id) 321 | { 322 | $solr_request = [ 323 | 'id' => $package_id 324 | ]; 325 | $data = json_encode($solr_request, JSON_PRETTY_PRINT); 326 | 327 | return $this->make_request( 328 | 'POST', 329 | 'action/package_show', 330 | $data 331 | ); 332 | } 333 | 334 | /** 335 | * Returns organization list 336 | * 337 | * @param $all_fields bool 338 | * 339 | * @return mixed 340 | * @link http://docs.ckan.org/en/latest/api/index.html#ckan.logic.action.get.organization_list 341 | */ 342 | public function organization_list($all_fields = false) 343 | { 344 | if ($all_fields) { 345 | return $this->make_request( 346 | 'POST', 347 | 'action/organization_list', 348 | json_encode(['all_fields' => true]) 349 | ); 350 | } 351 | return $this->make_request( 352 | 'POST', 353 | 'action/organization_list' 354 | ); 355 | } 356 | 357 | /** 358 | * Returns organization with matching id or name 359 | * 360 | * @param string $organization_id (id/name) 361 | * 362 | * @return mixed 363 | * @link http://docs.ckan.org/en/latest/api/index.html#ckan.logic.action.get.organization_show 364 | */ 365 | public function organization_show($organization_id, $include_datasets = False) 366 | { 367 | $solr_request = [ 368 | 'id' => $organization_id, 369 | 'include_datasets' => $include_datasets 370 | ]; 371 | $data = json_encode($solr_request, JSON_PRETTY_PRINT); 372 | 373 | return $this->make_request( 374 | 'POST', 375 | 'action/organization_show', 376 | $data 377 | ); 378 | } 379 | 380 | /** 381 | * Return a user’s public activity stream. 382 | * You must be authorized to view the user’s profile. 383 | * 384 | * @param $user_id 385 | * @return mixed 386 | * @throws Exception 387 | * @throws NotFoundHttpException 388 | * @link http://docs.ckan.org/en/latest/api/index.html#ckan.logic.action.get.user_activity_list 389 | */ 390 | public function user_activity_list($user_id) 391 | { 392 | $solr_request = [ 393 | 'id' => $user_id 394 | ]; 395 | $data = json_encode($solr_request, JSON_PRETTY_PRINT); 396 | 397 | return $this->make_request( 398 | 'POST', 399 | 'action/user_activity_list', 400 | $data 401 | ); 402 | } 403 | 404 | /** 405 | * Returns user with matching id or name 406 | * 407 | * @param string $user_id (id/name) 408 | * 409 | * @return mixed 410 | * @link http://docs.ckan.org/en/latest/api/index.html#ckan.logic.action.get.user_show 411 | */ 412 | public function user_show($user_id) 413 | { 414 | $solr_request = [ 415 | 'id' => $user_id 416 | ]; 417 | $data = json_encode($solr_request, JSON_PRETTY_PRINT); 418 | 419 | return $this->make_request( 420 | 'POST', 421 | 'action/user_show', 422 | $data 423 | ); 424 | } 425 | 426 | /** 427 | * @param $package_id 428 | * 429 | * @return mixed 430 | * 431 | * @link http://docs.ckan.org/en/latest/api/index.html#ckan.logic.action.delete.package_delete 432 | * 433 | * @throws \CKAN\NotFoundHttpException 434 | * @throws \Exception 435 | */ 436 | public function package_delete($package_id) 437 | { 438 | $solr_request = [ 439 | 'id' => $package_id, 440 | ]; 441 | $data = json_encode($solr_request, JSON_PRETTY_PRINT); 442 | 443 | return $this->make_request( 444 | 'POST', 445 | 'action/package_delete', 446 | $data 447 | ); 448 | } 449 | 450 | /** 451 | * @param $organization_id 452 | * 453 | * @return mixed 454 | * 455 | * @link http://docs.ckan.org/en/latest/api/#ckan.logic.action.delete.organization_delete 456 | * 457 | * @throws \CKAN\NotFoundHttpException 458 | * @throws \Exception 459 | */ 460 | public function organization_delete($organization_id) 461 | { 462 | $solr_request = [ 463 | 'id' => $organization_id, 464 | ]; 465 | $data = json_encode($solr_request, JSON_PRETTY_PRINT); 466 | 467 | return $this->make_request( 468 | 'POST', 469 | 'action/organization_delete', 470 | $data 471 | ); 472 | } 473 | 474 | /** 475 | * @param $organization_id 476 | * 477 | * @return mixed 478 | * 479 | * @link http://docs.ckan.org/en/latest/api/#ckan.logic.action.purge.organization_purge 480 | * 481 | * @throws \CKAN\NotFoundHttpException 482 | * @throws \Exception 483 | */ 484 | public function organization_purge($organization_id) 485 | { 486 | $solr_request = [ 487 | 'id' => $organization_id, 488 | ]; 489 | $data = json_encode($solr_request, JSON_PRETTY_PRINT); 490 | 491 | return $this->make_request( 492 | 'POST', 493 | 'action/organization_purge', 494 | $data 495 | ); 496 | } 497 | 498 | /** 499 | * Searches for packages satisfying a given search criteria 500 | * 501 | * @param $q 502 | * @param $fq 503 | * @param int $rows 504 | * @param int $start 505 | * @param string $sort 506 | * 507 | * @return mixed 508 | * @link http://docs.ckan.org/en/latest/api/index.html#ckan.logic.action.get.package_search 509 | */ 510 | public function package_search($q = '', $fq = '', $rows = 100, $start = 0, $sort = 'score desc, name asc') 511 | { 512 | $solr_request = [ 513 | 'q' => $q, 514 | 'fq' => $fq, 515 | 'rows' => $rows, 516 | 'start' => $start, 517 | 'sort' => $sort 518 | ]; 519 | $data = json_encode($solr_request, JSON_PRETTY_PRINT); 520 | 521 | return $this->make_request( 522 | 'POST', 523 | 'action/package_search', 524 | $data 525 | ); 526 | } 527 | 528 | /** 529 | * @param $member_id 530 | * @param string $object_type ('user', 'package') 531 | * @param string|bool $capacity ('member', 'editor', 'admin', 'public', 'private') 532 | * 533 | * @return mixed 534 | * 535 | * @link http://docs.ckan.org/en/latest/api/#ckan.logic.action.get.member_list 536 | */ 537 | public function member_list($member_id, $object_type = 'package', $capacity = false) 538 | { 539 | $solr_request = [ 540 | 'id' => $member_id 541 | ]; 542 | if ($object_type && ('none' != $object_type)) { 543 | $solr_request['object_type'] = $object_type; 544 | } 545 | if ($capacity) { 546 | $solr_request['capacity'] = $capacity; 547 | } 548 | $data = json_encode($solr_request, JSON_PRETTY_PRINT); 549 | 550 | return $this->make_request( 551 | 'POST', 552 | 'action/member_list', 553 | $data 554 | ); 555 | } 556 | 557 | /** 558 | * Create a dataset (package) 559 | * 560 | * @param $data 561 | * 562 | * @return mixed 563 | * @link http://docs.ckan.org/en/latest/api/index.html#ckan.logic.action.update.package_create 564 | */ 565 | public function package_create($data) 566 | { 567 | return $this->make_request( 568 | 'POST', 569 | 'action/package_create', 570 | $data 571 | ); 572 | } 573 | 574 | /** 575 | * Update a dataset (package) 576 | * 577 | * @param $data 578 | * 579 | * @return mixed 580 | * @link http://docs.ckan.org/en/latest/api/index.html#ckan.logic.action.update.package_update 581 | */ 582 | public function package_update(array $data) 583 | { 584 | $data = json_encode($data, JSON_PRETTY_PRINT); 585 | 586 | return $this->make_request( 587 | 'POST', 588 | 'action/package_update', 589 | $data 590 | ); 591 | } 592 | 593 | /** 594 | * patch a organization 595 | * 596 | * @param $data 597 | * 598 | * @return mixed 599 | * @link http://docs.ckan.org/en/latest/api/index.html#ckan.logic.action.patch.organization_patch 600 | */ 601 | public function organization_patch(array $data) 602 | { 603 | $data = json_encode($data, JSON_PRETTY_PRINT); 604 | 605 | return $this->make_request( 606 | 'POST', 607 | 'action/organization_patch', 608 | $data 609 | ); 610 | } 611 | 612 | /** 613 | * Since it's possible to leave cURL open, this is the last chance to close it 614 | */ 615 | public function __destruct() 616 | { 617 | if ($this->curl_handler) { 618 | curl_close($this->curl_handler); 619 | unset($this->curl_handler); 620 | } 621 | } 622 | } 623 | -------------------------------------------------------------------------------- /src/CKAN/HttpException.php: -------------------------------------------------------------------------------- 1 | jsonUrl = $jsonUrl; 31 | } 32 | 33 | try { 34 | $json = $this->get($this->jsonUrl); 35 | } catch (Exception $ex) { 36 | throw Exception('Fatal: could not get organization list from json ' . $this->jsonUrl . PHP_EOL); 37 | } 38 | 39 | if (null === $this->json = json_decode($json, true)) { //decode as array 40 | throw Exception('Fatal: could not decode json'); 41 | } 42 | } 43 | 44 | /** 45 | * for easier testing __constructor 46 | * @param $url 47 | * @return string 48 | */ 49 | private function get($url) 50 | { 51 | return file_get_contents($url); 52 | } 53 | 54 | /** 55 | * @param $organization 56 | * 57 | * @return array 58 | */ 59 | public function getTreeArrayFor($organization) 60 | { 61 | $return = []; 62 | $parent = []; 63 | 64 | $organization = trim($organization); 65 | foreach ($this->json['taxonomies'] as $tx) { 66 | 67 | $taxonomy = $tx['taxonomy']; 68 | 69 | if ($organization == trim($taxonomy['Federal Agency'])) { 70 | if (!$taxonomy['Sub Agency']) { 71 | // let's put parent agency first 72 | if (!defined('PARENT_TERM')) { 73 | define('PARENT_TERM', $taxonomy['unique id']); 74 | } 75 | $parent[$taxonomy['unique id']] = $organization; 76 | } else { 77 | $return[$taxonomy['unique id']] = $taxonomy['Sub Agency']; 78 | } 79 | } elseif ($organization == trim($taxonomy['term'])) { 80 | $return[$taxonomy['unique id']] = $organization; 81 | } 82 | } 83 | 84 | $result = array_merge($parent, $return); 85 | if (!$result) { 86 | echo "ERROR: Could not find organization: ".$organization.PHP_EOL; 87 | } 88 | 89 | return $result; 90 | } 91 | 92 | /** 93 | * @param $organization_term 94 | * @return bool 95 | */ 96 | public function getNameFor($organization_term) 97 | { 98 | $organization_name = false; 99 | $organization_term = trim($organization_term); 100 | foreach ($this->json['taxonomies'] as $taxonomy) { 101 | if ($taxonomy['taxonomy']['unique id'] !== $taxonomy['taxonomy']['term']) { 102 | // skip 3rd level children 103 | continue; 104 | } 105 | // if ($organization_term == trim($taxonomy['taxonomy']['Federal Agency'])) { 106 | if ($organization_term == trim($taxonomy['taxonomy']['unique id'])) { 107 | if ('' == trim($taxonomy['taxonomy']['Sub Agency'])) { 108 | $organization_name = $taxonomy['taxonomy']['Federal Agency']; 109 | break; 110 | } 111 | } 112 | // if ($organization_term == trim($taxonomy['taxonomy']['Sub Agency'])) { 113 | // $organization_name = $taxonomy['taxonomy']['unique id']; 114 | // break; 115 | // } 116 | } 117 | 118 | return $organization_name; 119 | } 120 | 121 | /** 122 | * @param $organization 123 | * 124 | * @return bool|array 125 | */ 126 | public function getTermFor($organization) 127 | { 128 | $term = false; 129 | $organization = trim($organization); 130 | foreach ($this->json['taxonomies'] as $taxonomy) { 131 | if ($taxonomy['taxonomy']['unique id'] !== $taxonomy['taxonomy']['term']) { 132 | // skip 3rd level children 133 | continue; 134 | } 135 | if ($organization == trim($taxonomy['taxonomy']['Federal Agency'])) { 136 | if ('' == trim($taxonomy['taxonomy']['Sub Agency'])) { 137 | $term = $taxonomy['taxonomy']['unique id']; 138 | break; 139 | } 140 | } 141 | if ($organization == trim($taxonomy['taxonomy']['Sub Agency'])) { 142 | $term = $taxonomy['taxonomy']['unique id']; 143 | break; 144 | } 145 | } 146 | 147 | return $term; 148 | } 149 | 150 | /** 151 | * @param string $rootAgency 152 | * 153 | * @return array 154 | */ 155 | public function getTreeArray($rootAgency = null) 156 | { 157 | $return = []; 158 | $taxonomies = []; 159 | 160 | /** 161 | * Sort & extract 162 | */ 163 | foreach ($this->json['taxonomies'] as $taxonomy) { 164 | unset($taxonomy['taxonomy']['vocabulary']); 165 | unset($taxonomy['taxonomy']['term']); 166 | 167 | $taxonomy['taxonomy']['Federal Agency'] = trim($taxonomy['taxonomy']['Federal Agency']); 168 | $taxonomy['taxonomy']['Sub Agency'] = trim($taxonomy['taxonomy']['Sub Agency']); 169 | $taxonomy['taxonomy']['id'] = trim($taxonomy['taxonomy']['unique id']); 170 | 171 | if (!$taxonomy['taxonomy']['Federal Agency'] || !$taxonomy['taxonomy']['id']) { 172 | continue; 173 | } 174 | 175 | if ($taxonomy['taxonomy']['Sub Agency']) { 176 | // sub-agency 177 | $taxonomy['taxonomy']['root'] = false; 178 | 179 | // putting in the tail of array 180 | $taxonomies[] = $taxonomy['taxonomy']; 181 | } else { 182 | // root agency 183 | $taxonomy['taxonomy']['root'] = true; 184 | // putting in the head of array 185 | array_unshift($taxonomies, $taxonomy['taxonomy']); 186 | } 187 | } 188 | 189 | /** 190 | * Temporary fix for missing root agency 191 | * Executive Office of the President [eop-gov] 192 | */ 193 | $return['Executive Office of the President'] = 194 | [ 195 | 'id' => 'eop-gov', 196 | 'is_cfo' => 'N', 197 | 'children' => [] 198 | ]; 199 | 200 | /** 201 | * Full scan 202 | */ 203 | foreach ($taxonomies as $taxonomy) { 204 | if ($taxonomy['root']) { 205 | if (isset($return[$taxonomy['Federal Agency']])) { 206 | continue; 207 | } 208 | $return[$taxonomy['Federal Agency']] = 209 | [ 210 | 'id' => $taxonomy['id'], 211 | 'is_cfo' => $taxonomy['is_cfo'], 212 | 'children' => [] 213 | ]; 214 | } else { 215 | if (isset($return[$taxonomy['Federal Agency']])) { 216 | if (isset($return[$taxonomy['Federal Agency']]['children'][$taxonomy['Sub Agency']])) { 217 | continue; 218 | } 219 | $return[$taxonomy['Federal Agency']]['children'][$taxonomy['Sub Agency']] = 220 | [ 221 | 'id' => $taxonomy['id'], 222 | 'is_cfo' => $taxonomy['is_cfo'], 223 | ]; 224 | 225 | } else { 226 | // echo "Parent not found: " . $taxonomy['Federal Agency'] . 227 | echo ' [' . $taxonomy['Sub Agency'] . '] ' . $taxonomy['id'] . PHP_EOL; 228 | } 229 | } 230 | } 231 | 232 | sort($return); 233 | 234 | if ($rootAgency) { 235 | if (isset($return[$rootAgency])) { 236 | $return = $return[$rootAgency]; 237 | } else { 238 | $return = []; 239 | } 240 | } 241 | 242 | return $return; 243 | } 244 | } 245 | -------------------------------------------------------------------------------- /tests/Base.php: -------------------------------------------------------------------------------- 1 | reflection = new \ReflectionClass($this->testClass); 13 | } 14 | 15 | public function getMethod($method) 16 | { 17 | $method = $this->reflection->getMethod($method); 18 | $method->setAccessible(true); 19 | 20 | return $method; 21 | } 22 | 23 | public function getProperty($property) 24 | { 25 | $property = $this->reflection->getProperty($property); 26 | $property->setAccessible(true); 27 | 28 | return $property->getValue($this->testClass); 29 | } 30 | 31 | public function setProperty($property, $value) 32 | { 33 | $property = $this->reflection->getProperty($property); 34 | $property->setAccessible(true); 35 | 36 | return $property->setValue($this->testClass, $value); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /tests/CkanClientTest.php: -------------------------------------------------------------------------------- 1 | CkanClient = $this->getMockBuilder('CkanClient') 22 | ->disableOriginalConstructor() 23 | ->getMock(); 24 | // $this->testClass = 'CkanClient'; 25 | // parent::setup(); 26 | } 27 | 28 | /** 29 | * 30 | */ 31 | public function testSetHeaders() 32 | { 33 | $this->assertTrue(true); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /tests/OrganizationListTest.php: -------------------------------------------------------------------------------- 1 | testClass = 'CKAN\OrganizationList'; 11 | parent::setUp(); 12 | $this->mock = $this->getMockBuilder($this->testClass) 13 | ->disableOriginalConstructor() 14 | ->getMock(); 15 | } 16 | 17 | // public function testConstructor() 18 | // { 19 | // set expectations for constructor calls 20 | // $this->mock->expects($this->once()) 21 | // ->method('get') 22 | // ->with( 23 | // $this->equalTo('someUrl') 24 | // ); 25 | 26 | // $this->mock->method('get') 27 | // ->willReturn('testor'); 28 | // 29 | // $this->assertEquals('testor', $this->mock->get('777')); 30 | 31 | // $get = $this->reflection->getMethod('get'); 32 | 33 | // $this->setExpectedException('Exception', 'could not get organization list from json someUrl'); 34 | 35 | // $constructor = $this->reflection->getConstructor(); 36 | // $this->setExpectedException('Exception'); 37 | // $constructor->invoke($this->mock, 'someUrl'); 38 | // } 39 | 40 | public function testGetTreeArrayFor() 41 | { 42 | $this->assertTrue($this->reflection->hasMethod('getTreeArrayFor')); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /tests/bootstrap.php: -------------------------------------------------------------------------------- 1 |