pax_global_header00006660000000000000000000000064136245464430014525gustar00rootroot0000000000000052 comment=4170cfcf10d42090efafe2683ec776e213370ffd php-composer-spdx-licenses-1.5.3/000077500000000000000000000000001362454644300167265ustar00rootroot00000000000000php-composer-spdx-licenses-1.5.3/.gitignore000066400000000000000000000000541362454644300207150ustar00rootroot00000000000000vendor/ .php_cs .php_cs.cache composer.lock php-composer-spdx-licenses-1.5.3/.php_cs.dist000066400000000000000000000035471362454644300211560ustar00rootroot00000000000000 For the full copyright and license information, please view the LICENSE file that was distributed with this source code. EOF; $finder = PhpCsFixer\Finder::create() ->files() ->name('*.php') ->in(__DIR__.'/src') ->in(__DIR__.'/tests') ; /* fabpot/php-cs-fixer:^2.0-dev */ return PhpCsFixer\Config::create() ->setUsingCache(true) //->setUsingLinter(false) ->setRiskyAllowed(true) ->setRules(array( '@PSR2' => true, 'binary_operator_spaces' => true, 'blank_line_before_return' => true, 'cast_spaces' => true, 'header_comment' => array('header' => $header), 'include' => true, 'long_array_syntax' => true, 'method_separation' => true, 'no_blank_lines_after_class_opening' => true, 'no_blank_lines_after_phpdoc' => true, 'no_blank_lines_between_uses' => true, 'no_duplicate_semicolons' => true, 'no_extra_consecutive_blank_lines' => true, 'no_leading_import_slash' => true, 'no_leading_namespace_whitespace' => true, 'no_trailing_comma_in_singleline_array' => true, 'no_unused_imports' => true, 'no_whitespace_in_blank_lines' => true, 'object_operator_without_whitespace' => true, 'phpdoc_align' => true, 'phpdoc_indent' => true, 'phpdoc_no_access' => true, 'phpdoc_no_package' => true, 'phpdoc_order' => true, 'phpdoc_scalar' => true, 'phpdoc_trim' => true, 'phpdoc_type_to_var' => true, 'psr0' => true, 'single_blank_line_before_namespace' => true, 'standardize_not_equals' => true, 'ternary_operator_spaces' => true, 'trailing_comma_in_multiline_array' => true, )) ->finder($finder) ; php-composer-spdx-licenses-1.5.3/.travis.yml000066400000000000000000000013111362454644300210330ustar00rootroot00000000000000language: php cache: directories: - $HOME/.composer/cache - vendor git: depth: 5 matrix: include: - dist: precise php: 5.3 - dist: trusty php: 5.4 - dist: trusty php: 5.5 - dist: xenial php: 5.6 - dist: xenial php: 7.0 - dist: bionic php: 7.1 - dist: bionic php: 7.2 - dist: bionic php: 7.3 - dist: bionic php: 7.4 - dist: bionic php: nightly fast_finish: true allow_failures: - php: nightly install: - composer install --no-interaction --no-progress --prefer-dist --ansi script: - vendor/bin/phpunit --coverage-clover=coverage.xml after_success: - bash <(curl -s https://codecov.io/bash) php-composer-spdx-licenses-1.5.3/CHANGELOG.md000066400000000000000000000061171362454644300205440ustar00rootroot00000000000000# Change Log All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). ## [master] ... ## [1.5.2] 2019-07-29 * Changed: updated licenses list to SPDX 3.6 ## [1.5.1] 2019-03-26 * Changed: updated licenses list to SPDX 3.4 ## [1.5.0] 2018-11-01 * Changed: updated licenses list to SPDX 3.3 ## [1.4.0] 2018-05-04 * Changed: updated licenses list to SPDX 3.1 ## [1.3.0] 2018-01-31 * Added: `SpdxLicenses::getLicenses` to get the whole list of methods. * Changed: license identifiers are now case insensitive. ## [1.2.0] 2018-01-03 * Added: deprecation status for all licenses and a `SpdxLicenses::isDeprecatedByIdentifier` method. * Changed: updated licenses list to SPDX 3.0. ## [1.1.6] 2017-04-03 * Changed: updated licenses list. ## [1.1.5] 2016-09-28 * Changed: updated licenses list. ## [1.1.4] 2016-05-04 * Changed: updated licenses list. ## [1.1.3] 2016-03-25 * Changed: updated licenses list. * Changed: dropped `test` namespace. * Changed: tedious small things. ## [1.1.2] 2015-10-05 * Changed: updated licenses list. ## [1.1.1] 2015-09-07 * Changed: improved performance when looking up just one license. * Changed: updated licenses list. ## [1.1.0] 2015-07-17 * Changed: updater now sorts licenses and exceptions by key. * Changed: filenames now class constants of SpdxLicenses (`LICENSES_FILE` and `EXCEPTIONS_FILE`). * Changed: resources directory now available via static method `SpdxLicenses::getResourcesDir()`. * Changed: updated licenses list. * Changed: removed json-schema requirement. ## [1.0.0] 2015-07-15 * Break: the following classes and namespaces were renamed: - Namespace: `Composer\Util` -> `Composer\Spdx` - Classname: `SpdxLicense` -> `SpdxLicenses` - Classname: `SpdxLicenseTest` -> `SpdxLicensesTest` - Classname: `Updater` -> `SpdxLicensesUpdater` * Changed: validation via regex implementation instead of lexer. [master]: https://github.com/composer/spdx-licenses/compare/1.5.2...master [1.5.2]: https://github.com/composer/spdx-licenses/compare/1.5.1...1.5.2 [1.5.1]: https://github.com/composer/spdx-licenses/compare/1.5.0...1.5.1 [1.5.0]: https://github.com/composer/spdx-licenses/compare/1.4.0...1.5.0 [1.4.0]: https://github.com/composer/spdx-licenses/compare/1.3.0...1.4.0 [1.3.0]: https://github.com/composer/spdx-licenses/compare/1.2.0...1.3.0 [1.2.0]: https://github.com/composer/spdx-licenses/compare/1.1.6...1.2.0 [1.1.6]: https://github.com/composer/spdx-licenses/compare/1.1.5...1.1.6 [1.1.5]: https://github.com/composer/spdx-licenses/compare/1.1.4...1.1.5 [1.1.4]: https://github.com/composer/spdx-licenses/compare/1.1.3...1.1.4 [1.1.3]: https://github.com/composer/spdx-licenses/compare/1.1.2...1.1.3 [1.1.2]: https://github.com/composer/spdx-licenses/compare/1.1.1...1.1.2 [1.1.1]: https://github.com/composer/spdx-licenses/compare/1.1.0...1.1.1 [1.1.0]: https://github.com/composer/spdx-licenses/compare/1.0.0...1.1.0 [1.0.0]: https://github.com/composer/spdx-licenses/compare/0281a7fe7820c990db3058844e7d448d7b70e3ac...1.0.0 php-composer-spdx-licenses-1.5.3/CONTRIBUTING.md000066400000000000000000000020251362454644300211560ustar00rootroot00000000000000Contributing to composer/spdx-licenses ====================================== Please note that this project is released with a [Contributor Code of Conduct](http://contributor-covenant.org/version/1/1/0/). By participating in this project and its community you agree to abide by those terms. Reporting Issues ---------------- When reporting issues, please try to be as descriptive as possible, and include as much relevant information as you can. A step by step guide on how to reproduce the issue will greatly increase the chances of your issue being resolved in a timely manner. Contributing Policy ------------------- Fork the project, create a feature branch, and send us a pull request. To ensure a consistent code base, you should make sure the code follows the [PSR-2 Coding Standards](http://www.php-fig.org/psr/psr-2/). Run [php-cs-fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer) to automatically "fix" files. If you would like to help, take a look at the [list of issues](https://github.com/composer/spdx-licenses/issues). php-composer-spdx-licenses-1.5.3/LICENSE000066400000000000000000000020341362454644300177320ustar00rootroot00000000000000Copyright (C) 2015 Composer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. php-composer-spdx-licenses-1.5.3/README.md000066400000000000000000000034111362454644300202040ustar00rootroot00000000000000composer/spdx-licenses ====================== SPDX (Software Package Data Exchange) licenses list and validation library. Originally written as part of [composer/composer](https://github.com/composer/composer), now extracted and made available as a stand-alone library. [![Build Status](https://travis-ci.org/composer/spdx-licenses.svg?branch=master)](https://travis-ci.org/composer/spdx-licenses) Installation ------------ Install the latest version with: ```bash $ composer require composer/spdx-licenses ``` Basic Usage ----------- ```php getLicenseByIdentifier('MIT'); // get a license exception by identifier $licenses->getExceptionByIdentifier('Autoconf-exception-3.0'); // get a license identifier by name $licenses->getIdentifierByName('MIT License'); // check if a license is OSI approved by identifier $licenses->isOsiApprovedByIdentifier('MIT'); // check if a license identifier is deprecated $licenses->isDeprecatedByIdentifier('MIT'); // check if input is a valid SPDX license expression $licenses->validate($input); ``` > Read the [specifications](https://spdx.org/specifications) > to find out more about valid license expressions. Requirements ------------ * PHP 5.3.2 is required but using the latest version of PHP is highly recommended. License ------- composer/spdx-licenses is licensed under the MIT License, see the LICENSE file for details. Source ------ License information is curated by [SPDX](https://spdx.org/). The data is pulled from the [License List Data](https://github.com/spdx/license-list-data) repository. * [Licenses](https://spdx.org/licenses/index.html) * [License Exceptions](https://spdx.org/licenses/exceptions-index.html) php-composer-spdx-licenses-1.5.3/bin/000077500000000000000000000000001362454644300174765ustar00rootroot00000000000000php-composer-spdx-licenses-1.5.3/bin/update-spdx-licenses000077500000000000000000000003121362454644300234610ustar00rootroot00000000000000#!/usr/bin/env php dumpLicenses(); $updater->dumpExceptions(); php-composer-spdx-licenses-1.5.3/composer.json000066400000000000000000000024421362454644300214520ustar00rootroot00000000000000{ "name": "composer/spdx-licenses", "description": "SPDX licenses list and validation library.", "type": "library", "license": "MIT", "keywords": [ "spdx", "license", "validator" ], "authors": [ { "name": "Nils Adermann", "email": "naderman@naderman.de", "homepage": "http://www.naderman.de" }, { "name": "Jordi Boggiano", "email": "j.boggiano@seld.be", "homepage": "http://seld.be" }, { "name": "Rob Bast", "email": "rob.bast@gmail.com", "homepage": "http://robbast.nl" } ], "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/spdx-licenses/issues" }, "require": { "php": "^5.3.2 || ^7.0 || ^8.0" }, "require-dev": { "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 7" }, "autoload": { "psr-4": { "Composer\\Spdx\\": "src" } }, "autoload-dev": { "psr-4": { "Composer\\Spdx\\": "tests" } }, "extra": { "branch-alias": { "dev-master": "1.x-dev" } }, "scripts": { "test": "phpunit" } } php-composer-spdx-licenses-1.5.3/phpunit.xml.dist000066400000000000000000000010201362454644300220720ustar00rootroot00000000000000 tests src php-composer-spdx-licenses-1.5.3/res/000077500000000000000000000000001362454644300175175ustar00rootroot00000000000000php-composer-spdx-licenses-1.5.3/res/spdx-exceptions.json000066400000000000000000000053441362454644300235550ustar00rootroot00000000000000{ "389-exception": [ "389 Directory Server Exception" ], "Autoconf-exception-2.0": [ "Autoconf exception 2.0" ], "Autoconf-exception-3.0": [ "Autoconf exception 3.0" ], "Bison-exception-2.2": [ "Bison exception 2.2" ], "Bootloader-exception": [ "Bootloader Distribution Exception" ], "Classpath-exception-2.0": [ "Classpath exception 2.0" ], "CLISP-exception-2.0": [ "CLISP exception 2.0" ], "DigiRule-FOSS-exception": [ "DigiRule FOSS License Exception" ], "eCos-exception-2.0": [ "eCos exception 2.0" ], "Fawkes-Runtime-exception": [ "Fawkes Runtime Exception" ], "FLTK-exception": [ "FLTK exception" ], "Font-exception-2.0": [ "Font exception 2.0" ], "freertos-exception-2.0": [ "FreeRTOS Exception 2.0" ], "GCC-exception-2.0": [ "GCC Runtime Library exception 2.0" ], "GCC-exception-3.1": [ "GCC Runtime Library exception 3.1" ], "gnu-javamail-exception": [ "GNU JavaMail exception" ], "GPL-3.0-linking-exception": [ "GPL-3.0 Linking Exception" ], "GPL-3.0-linking-source-exception": [ "GPL-3.0 Linking Exception (with Corresponding Source)" ], "GPL-CC-1.0": [ "GPL Cooperation Commitment 1.0" ], "i2p-gpl-java-exception": [ "i2p GPL+Java Exception" ], "Libtool-exception": [ "Libtool Exception" ], "Linux-syscall-note": [ "Linux Syscall Note" ], "LLVM-exception": [ "LLVM Exception" ], "LZMA-exception": [ "LZMA exception" ], "mif-exception": [ "Macros and Inline Functions Exception" ], "Nokia-Qt-exception-1.1": [ "Nokia Qt LGPL exception 1.1" ], "OCaml-LGPL-linking-exception": [ "OCaml LGPL Linking Exception" ], "OCCT-exception-1.0": [ "Open CASCADE Exception 1.0" ], "OpenJDK-assembly-exception-1.0": [ "OpenJDK Assembly exception 1.0" ], "openvpn-openssl-exception": [ "OpenVPN OpenSSL Exception" ], "PS-or-PDF-font-exception-20170817": [ "PS/PDF font exception (2017-08-17)" ], "Qt-GPL-exception-1.0": [ "Qt GPL exception 1.0" ], "Qt-LGPL-exception-1.1": [ "Qt LGPL exception 1.1" ], "Qwt-exception-1.0": [ "Qwt exception 1.0" ], "Swift-exception": [ "Swift Exception" ], "u-boot-exception-2.0": [ "U-Boot exception 2.0" ], "Universal-FOSS-exception-1.0": [ "Universal FOSS Exception, Version 1.0" ], "WxWindows-exception-3.1": [ "WxWindows Library Exception 3.1" ] }php-composer-spdx-licenses-1.5.3/res/spdx-licenses.json000066400000000000000000001170341362454644300232010ustar00rootroot00000000000000{ "0BSD": [ "BSD Zero Clause License", true, false ], "AAL": [ "Attribution Assurance License", true, false ], "Abstyles": [ "Abstyles License", false, false ], "Adobe-2006": [ "Adobe Systems Incorporated Source Code License Agreement", false, false ], "Adobe-Glyph": [ "Adobe Glyph List License", false, false ], "ADSL": [ "Amazon Digital Services License", false, false ], "AFL-1.1": [ "Academic Free License v1.1", true, false ], "AFL-1.2": [ "Academic Free License v1.2", true, false ], "AFL-2.0": [ "Academic Free License v2.0", true, false ], "AFL-2.1": [ "Academic Free License v2.1", true, false ], "AFL-3.0": [ "Academic Free License v3.0", true, false ], "Afmparse": [ "Afmparse License", false, false ], "AGPL-1.0": [ "Affero General Public License v1.0", false, true ], "AGPL-1.0-only": [ "Affero General Public License v1.0 only", false, false ], "AGPL-1.0-or-later": [ "Affero General Public License v1.0 or later", false, false ], "AGPL-3.0": [ "GNU Affero General Public License v3.0", true, true ], "AGPL-3.0-only": [ "GNU Affero General Public License v3.0 only", true, false ], "AGPL-3.0-or-later": [ "GNU Affero General Public License v3.0 or later", true, false ], "Aladdin": [ "Aladdin Free Public License", false, false ], "AMDPLPA": [ "AMD's plpa_map.c License", false, false ], "AML": [ "Apple MIT License", false, false ], "AMPAS": [ "Academy of Motion Picture Arts and Sciences BSD", false, false ], "ANTLR-PD": [ "ANTLR Software Rights Notice", false, false ], "Apache-1.0": [ "Apache License 1.0", false, false ], "Apache-1.1": [ "Apache License 1.1", true, false ], "Apache-2.0": [ "Apache License 2.0", true, false ], "APAFML": [ "Adobe Postscript AFM License", false, false ], "APL-1.0": [ "Adaptive Public License 1.0", true, false ], "APSL-1.0": [ "Apple Public Source License 1.0", true, false ], "APSL-1.1": [ "Apple Public Source License 1.1", true, false ], "APSL-1.2": [ "Apple Public Source License 1.2", true, false ], "APSL-2.0": [ "Apple Public Source License 2.0", true, false ], "Artistic-1.0": [ "Artistic License 1.0", true, false ], "Artistic-1.0-cl8": [ "Artistic License 1.0 w/clause 8", true, false ], "Artistic-1.0-Perl": [ "Artistic License 1.0 (Perl)", true, false ], "Artistic-2.0": [ "Artistic License 2.0", true, false ], "Bahyph": [ "Bahyph License", false, false ], "Barr": [ "Barr License", false, false ], "Beerware": [ "Beerware License", false, false ], "BitTorrent-1.0": [ "BitTorrent Open Source License v1.0", false, false ], "BitTorrent-1.1": [ "BitTorrent Open Source License v1.1", false, false ], "blessing": [ "SQLite Blessing", false, false ], "BlueOak-1.0.0": [ "Blue Oak Model License 1.0.0", false, false ], "Borceux": [ "Borceux license", false, false ], "BSD-1-Clause": [ "BSD 1-Clause License", false, false ], "BSD-2-Clause": [ "BSD 2-Clause \"Simplified\" License", true, false ], "BSD-2-Clause-FreeBSD": [ "BSD 2-Clause FreeBSD License", false, false ], "BSD-2-Clause-NetBSD": [ "BSD 2-Clause NetBSD License", false, false ], "BSD-2-Clause-Patent": [ "BSD-2-Clause Plus Patent License", true, false ], "BSD-3-Clause": [ "BSD 3-Clause \"New\" or \"Revised\" License", true, false ], "BSD-3-Clause-Attribution": [ "BSD with attribution", false, false ], "BSD-3-Clause-Clear": [ "BSD 3-Clause Clear License", false, false ], "BSD-3-Clause-LBNL": [ "Lawrence Berkeley National Labs BSD variant license", true, false ], "BSD-3-Clause-No-Nuclear-License": [ "BSD 3-Clause No Nuclear License", false, false ], "BSD-3-Clause-No-Nuclear-License-2014": [ "BSD 3-Clause No Nuclear License 2014", false, false ], "BSD-3-Clause-No-Nuclear-Warranty": [ "BSD 3-Clause No Nuclear Warranty", false, false ], "BSD-3-Clause-Open-MPI": [ "BSD 3-Clause Open MPI variant", false, false ], "BSD-4-Clause": [ "BSD 4-Clause \"Original\" or \"Old\" License", false, false ], "BSD-4-Clause-UC": [ "BSD-4-Clause (University of California-Specific)", false, false ], "BSD-Protection": [ "BSD Protection License", false, false ], "BSD-Source-Code": [ "BSD Source Code Attribution", false, false ], "BSL-1.0": [ "Boost Software License 1.0", true, false ], "bzip2-1.0.5": [ "bzip2 and libbzip2 License v1.0.5", false, false ], "bzip2-1.0.6": [ "bzip2 and libbzip2 License v1.0.6", false, false ], "Caldera": [ "Caldera License", false, false ], "CATOSL-1.1": [ "Computer Associates Trusted Open Source License 1.1", true, false ], "CC-BY-1.0": [ "Creative Commons Attribution 1.0 Generic", false, false ], "CC-BY-2.0": [ "Creative Commons Attribution 2.0 Generic", false, false ], "CC-BY-2.5": [ "Creative Commons Attribution 2.5 Generic", false, false ], "CC-BY-3.0": [ "Creative Commons Attribution 3.0 Unported", false, false ], "CC-BY-4.0": [ "Creative Commons Attribution 4.0 International", false, false ], "CC-BY-NC-1.0": [ "Creative Commons Attribution Non Commercial 1.0 Generic", false, false ], "CC-BY-NC-2.0": [ "Creative Commons Attribution Non Commercial 2.0 Generic", false, false ], "CC-BY-NC-2.5": [ "Creative Commons Attribution Non Commercial 2.5 Generic", false, false ], "CC-BY-NC-3.0": [ "Creative Commons Attribution Non Commercial 3.0 Unported", false, false ], "CC-BY-NC-4.0": [ "Creative Commons Attribution Non Commercial 4.0 International", false, false ], "CC-BY-NC-ND-1.0": [ "Creative Commons Attribution Non Commercial No Derivatives 1.0 Generic", false, false ], "CC-BY-NC-ND-2.0": [ "Creative Commons Attribution Non Commercial No Derivatives 2.0 Generic", false, false ], "CC-BY-NC-ND-2.5": [ "Creative Commons Attribution Non Commercial No Derivatives 2.5 Generic", false, false ], "CC-BY-NC-ND-3.0": [ "Creative Commons Attribution Non Commercial No Derivatives 3.0 Unported", false, false ], "CC-BY-NC-ND-4.0": [ "Creative Commons Attribution Non Commercial No Derivatives 4.0 International", false, false ], "CC-BY-NC-SA-1.0": [ "Creative Commons Attribution Non Commercial Share Alike 1.0 Generic", false, false ], "CC-BY-NC-SA-2.0": [ "Creative Commons Attribution Non Commercial Share Alike 2.0 Generic", false, false ], "CC-BY-NC-SA-2.5": [ "Creative Commons Attribution Non Commercial Share Alike 2.5 Generic", false, false ], "CC-BY-NC-SA-3.0": [ "Creative Commons Attribution Non Commercial Share Alike 3.0 Unported", false, false ], "CC-BY-NC-SA-4.0": [ "Creative Commons Attribution Non Commercial Share Alike 4.0 International", false, false ], "CC-BY-ND-1.0": [ "Creative Commons Attribution No Derivatives 1.0 Generic", false, false ], "CC-BY-ND-2.0": [ "Creative Commons Attribution No Derivatives 2.0 Generic", false, false ], "CC-BY-ND-2.5": [ "Creative Commons Attribution No Derivatives 2.5 Generic", false, false ], "CC-BY-ND-3.0": [ "Creative Commons Attribution No Derivatives 3.0 Unported", false, false ], "CC-BY-ND-4.0": [ "Creative Commons Attribution No Derivatives 4.0 International", false, false ], "CC-BY-SA-1.0": [ "Creative Commons Attribution Share Alike 1.0 Generic", false, false ], "CC-BY-SA-2.0": [ "Creative Commons Attribution Share Alike 2.0 Generic", false, false ], "CC-BY-SA-2.5": [ "Creative Commons Attribution Share Alike 2.5 Generic", false, false ], "CC-BY-SA-3.0": [ "Creative Commons Attribution Share Alike 3.0 Unported", false, false ], "CC-BY-SA-4.0": [ "Creative Commons Attribution Share Alike 4.0 International", false, false ], "CC-PDDC": [ "Creative Commons Public Domain Dedication and Certification", false, false ], "CC0-1.0": [ "Creative Commons Zero v1.0 Universal", false, false ], "CDDL-1.0": [ "Common Development and Distribution License 1.0", true, false ], "CDDL-1.1": [ "Common Development and Distribution License 1.1", false, false ], "CDLA-Permissive-1.0": [ "Community Data License Agreement Permissive 1.0", false, false ], "CDLA-Sharing-1.0": [ "Community Data License Agreement Sharing 1.0", false, false ], "CECILL-1.0": [ "CeCILL Free Software License Agreement v1.0", false, false ], "CECILL-1.1": [ "CeCILL Free Software License Agreement v1.1", false, false ], "CECILL-2.0": [ "CeCILL Free Software License Agreement v2.0", false, false ], "CECILL-2.1": [ "CeCILL Free Software License Agreement v2.1", true, false ], "CECILL-B": [ "CeCILL-B Free Software License Agreement", false, false ], "CECILL-C": [ "CeCILL-C Free Software License Agreement", false, false ], "CERN-OHL-1.1": [ "CERN Open Hardware Licence v1.1", false, false ], "CERN-OHL-1.2": [ "CERN Open Hardware Licence v1.2", false, false ], "ClArtistic": [ "Clarified Artistic License", false, false ], "CNRI-Jython": [ "CNRI Jython License", false, false ], "CNRI-Python": [ "CNRI Python License", true, false ], "CNRI-Python-GPL-Compatible": [ "CNRI Python Open Source GPL Compatible License Agreement", false, false ], "Condor-1.1": [ "Condor Public License v1.1", false, false ], "copyleft-next-0.3.0": [ "copyleft-next 0.3.0", false, false ], "copyleft-next-0.3.1": [ "copyleft-next 0.3.1", false, false ], "CPAL-1.0": [ "Common Public Attribution License 1.0", true, false ], "CPL-1.0": [ "Common Public License 1.0", true, false ], "CPOL-1.02": [ "Code Project Open License 1.02", false, false ], "Crossword": [ "Crossword License", false, false ], "CrystalStacker": [ "CrystalStacker License", false, false ], "CUA-OPL-1.0": [ "CUA Office Public License v1.0", true, false ], "Cube": [ "Cube License", false, false ], "curl": [ "curl License", false, false ], "D-FSL-1.0": [ "Deutsche Freie Software Lizenz", false, false ], "diffmark": [ "diffmark license", false, false ], "DOC": [ "DOC License", false, false ], "Dotseqn": [ "Dotseqn License", false, false ], "DSDP": [ "DSDP License", false, false ], "dvipdfm": [ "dvipdfm License", false, false ], "ECL-1.0": [ "Educational Community License v1.0", true, false ], "ECL-2.0": [ "Educational Community License v2.0", true, false ], "eCos-2.0": [ "eCos license version 2.0", false, true ], "EFL-1.0": [ "Eiffel Forum License v1.0", true, false ], "EFL-2.0": [ "Eiffel Forum License v2.0", true, false ], "eGenix": [ "eGenix.com Public License 1.1.0", false, false ], "Entessa": [ "Entessa Public License v1.0", true, false ], "EPL-1.0": [ "Eclipse Public License 1.0", true, false ], "EPL-2.0": [ "Eclipse Public License 2.0", true, false ], "ErlPL-1.1": [ "Erlang Public License v1.1", false, false ], "etalab-2.0": [ "Etalab Open License 2.0", false, false ], "EUDatagrid": [ "EU DataGrid Software License", true, false ], "EUPL-1.0": [ "European Union Public License 1.0", false, false ], "EUPL-1.1": [ "European Union Public License 1.1", true, false ], "EUPL-1.2": [ "European Union Public License 1.2", true, false ], "Eurosym": [ "Eurosym License", false, false ], "Fair": [ "Fair License", true, false ], "Frameworx-1.0": [ "Frameworx Open License 1.0", true, false ], "FreeImage": [ "FreeImage Public License v1.0", false, false ], "FSFAP": [ "FSF All Permissive License", false, false ], "FSFUL": [ "FSF Unlimited License", false, false ], "FSFULLR": [ "FSF Unlimited License (with License Retention)", false, false ], "FTL": [ "Freetype Project License", false, false ], "GFDL-1.1": [ "GNU Free Documentation License v1.1", false, true ], "GFDL-1.1-only": [ "GNU Free Documentation License v1.1 only", false, false ], "GFDL-1.1-or-later": [ "GNU Free Documentation License v1.1 or later", false, false ], "GFDL-1.2": [ "GNU Free Documentation License v1.2", false, true ], "GFDL-1.2-only": [ "GNU Free Documentation License v1.2 only", false, false ], "GFDL-1.2-or-later": [ "GNU Free Documentation License v1.2 or later", false, false ], "GFDL-1.3": [ "GNU Free Documentation License v1.3", false, true ], "GFDL-1.3-only": [ "GNU Free Documentation License v1.3 only", false, false ], "GFDL-1.3-or-later": [ "GNU Free Documentation License v1.3 or later", false, false ], "Giftware": [ "Giftware License", false, false ], "GL2PS": [ "GL2PS License", false, false ], "Glide": [ "3dfx Glide License", false, false ], "Glulxe": [ "Glulxe License", false, false ], "gnuplot": [ "gnuplot License", false, false ], "GPL-1.0": [ "GNU General Public License v1.0 only", false, true ], "GPL-1.0+": [ "GNU General Public License v1.0 or later", false, true ], "GPL-1.0-only": [ "GNU General Public License v1.0 only", false, false ], "GPL-1.0-or-later": [ "GNU General Public License v1.0 or later", false, false ], "GPL-2.0": [ "GNU General Public License v2.0 only", true, true ], "GPL-2.0+": [ "GNU General Public License v2.0 or later", true, true ], "GPL-2.0-only": [ "GNU General Public License v2.0 only", true, false ], "GPL-2.0-or-later": [ "GNU General Public License v2.0 or later", true, false ], "GPL-2.0-with-autoconf-exception": [ "GNU General Public License v2.0 w/Autoconf exception", false, true ], "GPL-2.0-with-bison-exception": [ "GNU General Public License v2.0 w/Bison exception", false, true ], "GPL-2.0-with-classpath-exception": [ "GNU General Public License v2.0 w/Classpath exception", false, true ], "GPL-2.0-with-font-exception": [ "GNU General Public License v2.0 w/Font exception", false, true ], "GPL-2.0-with-GCC-exception": [ "GNU General Public License v2.0 w/GCC Runtime Library exception", false, true ], "GPL-3.0": [ "GNU General Public License v3.0 only", true, true ], "GPL-3.0+": [ "GNU General Public License v3.0 or later", true, true ], "GPL-3.0-only": [ "GNU General Public License v3.0 only", true, false ], "GPL-3.0-or-later": [ "GNU General Public License v3.0 or later", true, false ], "GPL-3.0-with-autoconf-exception": [ "GNU General Public License v3.0 w/Autoconf exception", false, true ], "GPL-3.0-with-GCC-exception": [ "GNU General Public License v3.0 w/GCC Runtime Library exception", true, true ], "gSOAP-1.3b": [ "gSOAP Public License v1.3b", false, false ], "HaskellReport": [ "Haskell Language Report License", false, false ], "HPND": [ "Historical Permission Notice and Disclaimer", true, false ], "HPND-sell-variant": [ "Historical Permission Notice and Disclaimer - sell variant", false, false ], "IBM-pibs": [ "IBM PowerPC Initialization and Boot Software", false, false ], "ICU": [ "ICU License", false, false ], "IJG": [ "Independent JPEG Group License", false, false ], "ImageMagick": [ "ImageMagick License", false, false ], "iMatix": [ "iMatix Standard Function Library Agreement", false, false ], "Imlib2": [ "Imlib2 License", false, false ], "Info-ZIP": [ "Info-ZIP License", false, false ], "Intel": [ "Intel Open Source License", true, false ], "Intel-ACPI": [ "Intel ACPI Software License Agreement", false, false ], "Interbase-1.0": [ "Interbase Public License v1.0", false, false ], "IPA": [ "IPA Font License", true, false ], "IPL-1.0": [ "IBM Public License v1.0", true, false ], "ISC": [ "ISC License", true, false ], "JasPer-2.0": [ "JasPer License", false, false ], "JPNIC": [ "Japan Network Information Center License", false, false ], "JSON": [ "JSON License", false, false ], "LAL-1.2": [ "Licence Art Libre 1.2", false, false ], "LAL-1.3": [ "Licence Art Libre 1.3", false, false ], "Latex2e": [ "Latex2e License", false, false ], "Leptonica": [ "Leptonica License", false, false ], "LGPL-2.0": [ "GNU Library General Public License v2 only", true, true ], "LGPL-2.0+": [ "GNU Library General Public License v2 or later", true, true ], "LGPL-2.0-only": [ "GNU Library General Public License v2 only", true, false ], "LGPL-2.0-or-later": [ "GNU Library General Public License v2 or later", true, false ], "LGPL-2.1": [ "GNU Lesser General Public License v2.1 only", true, true ], "LGPL-2.1+": [ "GNU Library General Public License v2.1 or later", true, true ], "LGPL-2.1-only": [ "GNU Lesser General Public License v2.1 only", true, false ], "LGPL-2.1-or-later": [ "GNU Lesser General Public License v2.1 or later", true, false ], "LGPL-3.0": [ "GNU Lesser General Public License v3.0 only", true, true ], "LGPL-3.0+": [ "GNU Lesser General Public License v3.0 or later", true, true ], "LGPL-3.0-only": [ "GNU Lesser General Public License v3.0 only", true, false ], "LGPL-3.0-or-later": [ "GNU Lesser General Public License v3.0 or later", true, false ], "LGPLLR": [ "Lesser General Public License For Linguistic Resources", false, false ], "Libpng": [ "libpng License", false, false ], "libpng-2.0": [ "PNG Reference Library version 2", false, false ], "libselinux-1.0": [ "libselinux public domain notice", false, false ], "libtiff": [ "libtiff License", false, false ], "LiLiQ-P-1.1": [ "Licence Libre du Qu\u00e9bec \u2013 Permissive version 1.1", true, false ], "LiLiQ-R-1.1": [ "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 version 1.1", true, false ], "LiLiQ-Rplus-1.1": [ "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 forte version 1.1", true, false ], "Linux-OpenIB": [ "Linux Kernel Variant of OpenIB.org license", false, false ], "LPL-1.0": [ "Lucent Public License Version 1.0", true, false ], "LPL-1.02": [ "Lucent Public License v1.02", true, false ], "LPPL-1.0": [ "LaTeX Project Public License v1.0", false, false ], "LPPL-1.1": [ "LaTeX Project Public License v1.1", false, false ], "LPPL-1.2": [ "LaTeX Project Public License v1.2", false, false ], "LPPL-1.3a": [ "LaTeX Project Public License v1.3a", false, false ], "LPPL-1.3c": [ "LaTeX Project Public License v1.3c", true, false ], "MakeIndex": [ "MakeIndex License", false, false ], "MirOS": [ "The MirOS Licence", true, false ], "MIT": [ "MIT License", true, false ], "MIT-0": [ "MIT No Attribution", false, false ], "MIT-advertising": [ "Enlightenment License (e16)", false, false ], "MIT-CMU": [ "CMU License", false, false ], "MIT-enna": [ "enna License", false, false ], "MIT-feh": [ "feh License", false, false ], "MITNFA": [ "MIT +no-false-attribs license", false, false ], "Motosoto": [ "Motosoto License", true, false ], "mpich2": [ "mpich2 License", false, false ], "MPL-1.0": [ "Mozilla Public License 1.0", true, false ], "MPL-1.1": [ "Mozilla Public License 1.1", true, false ], "MPL-2.0": [ "Mozilla Public License 2.0", true, false ], "MPL-2.0-no-copyleft-exception": [ "Mozilla Public License 2.0 (no copyleft exception)", true, false ], "MS-PL": [ "Microsoft Public License", true, false ], "MS-RL": [ "Microsoft Reciprocal License", true, false ], "MTLL": [ "Matrix Template Library License", false, false ], "MulanPSL-1.0": [ "Mulan Permissive Software License, Version 1", false, false ], "Multics": [ "Multics License", true, false ], "Mup": [ "Mup License", false, false ], "NASA-1.3": [ "NASA Open Source Agreement 1.3", true, false ], "Naumen": [ "Naumen Public License", true, false ], "NBPL-1.0": [ "Net Boolean Public License v1", false, false ], "NCSA": [ "University of Illinois/NCSA Open Source License", true, false ], "Net-SNMP": [ "Net-SNMP License", false, false ], "NetCDF": [ "NetCDF license", false, false ], "Newsletr": [ "Newsletr License", false, false ], "NGPL": [ "Nethack General Public License", true, false ], "NLOD-1.0": [ "Norwegian Licence for Open Government Data", false, false ], "NLPL": [ "No Limit Public License", false, false ], "Nokia": [ "Nokia Open Source License", true, false ], "NOSL": [ "Netizen Open Source License", false, false ], "Noweb": [ "Noweb License", false, false ], "NPL-1.0": [ "Netscape Public License v1.0", false, false ], "NPL-1.1": [ "Netscape Public License v1.1", false, false ], "NPOSL-3.0": [ "Non-Profit Open Software License 3.0", true, false ], "NRL": [ "NRL License", false, false ], "NTP": [ "NTP License", true, false ], "NTP-0": [ "NTP No Attribution", false, false ], "Nunit": [ "Nunit License", false, true ], "OCCT-PL": [ "Open CASCADE Technology Public License", false, false ], "OCLC-2.0": [ "OCLC Research Public License 2.0", true, false ], "ODbL-1.0": [ "ODC Open Database License v1.0", false, false ], "ODC-By-1.0": [ "Open Data Commons Attribution License v1.0", false, false ], "OFL-1.0": [ "SIL Open Font License 1.0", false, false ], "OFL-1.0-no-RFN": [ "SIL Open Font License 1.0 with no Reserved Font Name", false, false ], "OFL-1.0-RFN": [ "SIL Open Font License 1.0 with Reserved Font Name", false, false ], "OFL-1.1": [ "SIL Open Font License 1.1", true, false ], "OFL-1.1-no-RFN": [ "SIL Open Font License 1.1 with no Reserved Font Name", true, false ], "OFL-1.1-RFN": [ "SIL Open Font License 1.1 with Reserved Font Name", true, false ], "OGL-Canada-2.0": [ "Open Government Licence - Canada", false, false ], "OGL-UK-1.0": [ "Open Government Licence v1.0", false, false ], "OGL-UK-2.0": [ "Open Government Licence v2.0", false, false ], "OGL-UK-3.0": [ "Open Government Licence v3.0", false, false ], "OGTSL": [ "Open Group Test Suite License", true, false ], "OLDAP-1.1": [ "Open LDAP Public License v1.1", false, false ], "OLDAP-1.2": [ "Open LDAP Public License v1.2", false, false ], "OLDAP-1.3": [ "Open LDAP Public License v1.3", false, false ], "OLDAP-1.4": [ "Open LDAP Public License v1.4", false, false ], "OLDAP-2.0": [ "Open LDAP Public License v2.0 (or possibly 2.0A and 2.0B)", false, false ], "OLDAP-2.0.1": [ "Open LDAP Public License v2.0.1", false, false ], "OLDAP-2.1": [ "Open LDAP Public License v2.1", false, false ], "OLDAP-2.2": [ "Open LDAP Public License v2.2", false, false ], "OLDAP-2.2.1": [ "Open LDAP Public License v2.2.1", false, false ], "OLDAP-2.2.2": [ "Open LDAP Public License 2.2.2", false, false ], "OLDAP-2.3": [ "Open LDAP Public License v2.3", false, false ], "OLDAP-2.4": [ "Open LDAP Public License v2.4", false, false ], "OLDAP-2.5": [ "Open LDAP Public License v2.5", false, false ], "OLDAP-2.6": [ "Open LDAP Public License v2.6", false, false ], "OLDAP-2.7": [ "Open LDAP Public License v2.7", false, false ], "OLDAP-2.8": [ "Open LDAP Public License v2.8", false, false ], "OML": [ "Open Market License", false, false ], "OpenSSL": [ "OpenSSL License", false, false ], "OPL-1.0": [ "Open Public License v1.0", false, false ], "OSET-PL-2.1": [ "OSET Public License version 2.1", true, false ], "OSL-1.0": [ "Open Software License 1.0", true, false ], "OSL-1.1": [ "Open Software License 1.1", false, false ], "OSL-2.0": [ "Open Software License 2.0", true, false ], "OSL-2.1": [ "Open Software License 2.1", true, false ], "OSL-3.0": [ "Open Software License 3.0", true, false ], "Parity-6.0.0": [ "The Parity Public License 6.0.0", false, false ], "PDDL-1.0": [ "ODC Public Domain Dedication & License 1.0", false, false ], "PHP-3.0": [ "PHP License v3.0", true, false ], "PHP-3.01": [ "PHP License v3.01", false, false ], "Plexus": [ "Plexus Classworlds License", false, false ], "PostgreSQL": [ "PostgreSQL License", true, false ], "PSF-2.0": [ "Python Software Foundation License 2.0", false, false ], "psfrag": [ "psfrag License", false, false ], "psutils": [ "psutils License", false, false ], "Python-2.0": [ "Python License 2.0", true, false ], "Qhull": [ "Qhull License", false, false ], "QPL-1.0": [ "Q Public License 1.0", true, false ], "Rdisc": [ "Rdisc License", false, false ], "RHeCos-1.1": [ "Red Hat eCos Public License v1.1", false, false ], "RPL-1.1": [ "Reciprocal Public License 1.1", true, false ], "RPL-1.5": [ "Reciprocal Public License 1.5", true, false ], "RPSL-1.0": [ "RealNetworks Public Source License v1.0", true, false ], "RSA-MD": [ "RSA Message-Digest License", false, false ], "RSCPL": [ "Ricoh Source Code Public License", true, false ], "Ruby": [ "Ruby License", false, false ], "SAX-PD": [ "Sax Public Domain Notice", false, false ], "Saxpath": [ "Saxpath License", false, false ], "SCEA": [ "SCEA Shared Source License", false, false ], "Sendmail": [ "Sendmail License", false, false ], "Sendmail-8.23": [ "Sendmail License 8.23", false, false ], "SGI-B-1.0": [ "SGI Free Software License B v1.0", false, false ], "SGI-B-1.1": [ "SGI Free Software License B v1.1", false, false ], "SGI-B-2.0": [ "SGI Free Software License B v2.0", false, false ], "SHL-0.5": [ "Solderpad Hardware License v0.5", false, false ], "SHL-0.51": [ "Solderpad Hardware License, Version 0.51", false, false ], "SimPL-2.0": [ "Simple Public License 2.0", true, false ], "SISSL": [ "Sun Industry Standards Source License v1.1", true, false ], "SISSL-1.2": [ "Sun Industry Standards Source License v1.2", false, false ], "Sleepycat": [ "Sleepycat License", true, false ], "SMLNJ": [ "Standard ML of New Jersey License", false, false ], "SMPPL": [ "Secure Messaging Protocol Public License", false, false ], "SNIA": [ "SNIA Public License 1.1", false, false ], "Spencer-86": [ "Spencer License 86", false, false ], "Spencer-94": [ "Spencer License 94", false, false ], "Spencer-99": [ "Spencer License 99", false, false ], "SPL-1.0": [ "Sun Public License v1.0", true, false ], "SSH-OpenSSH": [ "SSH OpenSSH license", false, false ], "SSH-short": [ "SSH short notice", false, false ], "SSPL-1.0": [ "Server Side Public License, v 1", false, false ], "StandardML-NJ": [ "Standard ML of New Jersey License", false, true ], "SugarCRM-1.1.3": [ "SugarCRM Public License v1.1.3", false, false ], "SWL": [ "Scheme Widget Library (SWL) Software License Agreement", false, false ], "TAPR-OHL-1.0": [ "TAPR Open Hardware License v1.0", false, false ], "TCL": [ "TCL/TK License", false, false ], "TCP-wrappers": [ "TCP Wrappers License", false, false ], "TMate": [ "TMate Open Source License", false, false ], "TORQUE-1.1": [ "TORQUE v2.5+ Software License v1.1", false, false ], "TOSL": [ "Trusster Open Source License", false, false ], "TU-Berlin-1.0": [ "Technische Universitaet Berlin License 1.0", false, false ], "TU-Berlin-2.0": [ "Technische Universitaet Berlin License 2.0", false, false ], "UCL-1.0": [ "Upstream Compatibility License v1.0", true, false ], "Unicode-DFS-2015": [ "Unicode License Agreement - Data Files and Software (2015)", false, false ], "Unicode-DFS-2016": [ "Unicode License Agreement - Data Files and Software (2016)", false, false ], "Unicode-TOU": [ "Unicode Terms of Use", false, false ], "Unlicense": [ "The Unlicense", false, false ], "UPL-1.0": [ "Universal Permissive License v1.0", true, false ], "Vim": [ "Vim License", false, false ], "VOSTROM": [ "VOSTROM Public License for Open Source", false, false ], "VSL-1.0": [ "Vovida Software License v1.0", true, false ], "W3C": [ "W3C Software Notice and License (2002-12-31)", true, false ], "W3C-19980720": [ "W3C Software Notice and License (1998-07-20)", false, false ], "W3C-20150513": [ "W3C Software Notice and Document License (2015-05-13)", false, false ], "Watcom-1.0": [ "Sybase Open Watcom Public License 1.0", true, false ], "Wsuipa": [ "Wsuipa License", false, false ], "WTFPL": [ "Do What The F*ck You Want To Public License", false, false ], "wxWindows": [ "wxWindows Library License", false, true ], "X11": [ "X11 License", false, false ], "Xerox": [ "Xerox License", false, false ], "XFree86-1.1": [ "XFree86 License 1.1", false, false ], "xinetd": [ "xinetd License", false, false ], "Xnet": [ "X.Net License", true, false ], "xpp": [ "XPP License", false, false ], "XSkat": [ "XSkat License", false, false ], "YPL-1.0": [ "Yahoo! Public License v1.0", false, false ], "YPL-1.1": [ "Yahoo! Public License v1.1", false, false ], "Zed": [ "Zed License", false, false ], "Zend-2.0": [ "Zend License v2.0", false, false ], "Zimbra-1.3": [ "Zimbra Public License v1.3", false, false ], "Zimbra-1.4": [ "Zimbra Public License v1.4", false, false ], "Zlib": [ "zlib License", true, false ], "zlib-acknowledgement": [ "zlib/libpng License with Acknowledgement", false, false ], "ZPL-1.1": [ "Zope Public License 1.1", false, false ], "ZPL-2.0": [ "Zope Public License 2.0", true, false ], "ZPL-2.1": [ "Zope Public License 2.1", false, false ] }php-composer-spdx-licenses-1.5.3/src/000077500000000000000000000000001362454644300175155ustar00rootroot00000000000000php-composer-spdx-licenses-1.5.3/src/SpdxLicenses.php000066400000000000000000000217751362454644300226460ustar00rootroot00000000000000 * * For the full copyright and license information, please view * the LICENSE file that was distributed with this source code. */ namespace Composer\Spdx; class SpdxLicenses { /** @var string */ const LICENSES_FILE = 'spdx-licenses.json'; /** @var string */ const EXCEPTIONS_FILE = 'spdx-exceptions.json'; /** * Contains all the licenses. * * The array is indexed by license identifiers, which contain * a numerically indexed array with license details. * * [ lowercased license identifier => * [ 0 => identifier (string), 1 => full name (string), 2 => osi certified (bool), 3 => deprecated (bool) ] * , ... * ] * * @var array */ private $licenses; /** * @var string */ private $licensesExpression; /** * Contains all the license exceptions. * * The array is indexed by license exception identifiers, which contain * a numerically indexed array with license exception details. * * [ lowercased exception identifier => * [ 0 => exception identifier (string), 1 => full name (string) ] * , ... * ] * * @var array */ private $exceptions; /** * @var string */ private $exceptionsExpression; public function __construct() { $this->loadLicenses(); $this->loadExceptions(); } /** * Returns license metadata by license identifier. * * This function adds a link to the full license text to the license metadata. * The array returned is in the form of: * * [ 0 => full name (string), 1 => osi certified, 2 => link to license text (string), 3 => deprecation status (bool) ] * * @param string $identifier * * @return array|null */ public function getLicenseByIdentifier($identifier) { $key = strtolower($identifier); if (!isset($this->licenses[$key])) { return; } list($identifier, $name, $isOsiApproved, $isDeprecatedLicenseId) = $this->licenses[$key]; return array( $name, $isOsiApproved, 'https://spdx.org/licenses/' . $identifier . '.html#licenseText', $isDeprecatedLicenseId, ); } /** * Returns all licenses information, keyed by the lowercased license identifier. * * @return array[] Each item is [ 0 => identifier (string), 1 => full name (string), 2 => osi certified (bool), 3 => deprecated (bool) ] */ public function getLicenses() { return $this->licenses; } /** * Returns license exception metadata by license exception identifier. * * This function adds a link to the full license exception text to the license exception metadata. * The array returned is in the form of: * * [ 0 => full name (string), 1 => link to license text (string) ] * * @param string $identifier * * @return array|null */ public function getExceptionByIdentifier($identifier) { $key = strtolower($identifier); if (!isset($this->exceptions[$key])) { return; } list($identifier, $name) = $this->exceptions[$key]; return array( $name, 'https://spdx.org/licenses/' . $identifier . '.html#licenseExceptionText', ); } /** * Returns the short identifier of a license (or license exception) by full name. * * @param string $name * * @return string|null */ public function getIdentifierByName($name) { foreach ($this->licenses as $licenseData) { if ($licenseData[1] === $name) { return $licenseData[0]; } } foreach ($this->exceptions as $licenseData) { if ($licenseData[1] === $name) { return $licenseData[0]; } } } /** * Returns the OSI Approved status for a license by identifier. * * @param string $identifier * * @return bool */ public function isOsiApprovedByIdentifier($identifier) { return $this->licenses[strtolower($identifier)][2]; } /** * Returns the deprecation status for a license by identifier. * * @param string $identifier * * @return bool */ public function isDeprecatedByIdentifier($identifier) { return $this->licenses[strtolower($identifier)][3]; } /** * @param array|string $license * * @throws \InvalidArgumentException * * @return bool */ public function validate($license) { if (is_array($license)) { $count = count($license); if ($count !== count(array_filter($license, 'is_string'))) { throw new \InvalidArgumentException('Array of strings expected.'); } $license = $count > 1 ? '(' . implode(' OR ', $license) . ')' : (string) reset($license); } if (!is_string($license)) { throw new \InvalidArgumentException(sprintf( 'Array or String expected, %s given.', gettype($license) )); } return $this->isValidLicenseString($license); } /** * @return string */ public static function getResourcesDir() { return dirname(__DIR__) . '/res'; } private function loadLicenses() { if (null !== $this->licenses) { return; } $json = file_get_contents(self::getResourcesDir() . '/' . self::LICENSES_FILE); $this->licenses = array(); foreach (json_decode($json, true) as $identifier => $license) { $this->licenses[strtolower($identifier)] = array($identifier, $license[0], $license[1], $license[2]); } } private function loadExceptions() { if (null !== $this->exceptions) { return; } $json = file_get_contents(self::getResourcesDir() . '/' . self::EXCEPTIONS_FILE); $this->exceptions = array(); foreach (json_decode($json, true) as $identifier => $exception) { $this->exceptions[strtolower($identifier)] = array($identifier, $exception[0]); } } /** * @return string */ private function getLicensesExpression() { if (null === $this->licensesExpression) { $licenses = array_map('preg_quote', array_keys($this->licenses)); rsort($licenses); $licenses = implode('|', $licenses); $this->licensesExpression = $licenses; } return $this->licensesExpression; } /** * @return string */ private function getExceptionsExpression() { if (null === $this->exceptionsExpression) { $exceptions = array_map('preg_quote', array_keys($this->exceptions)); rsort($exceptions); $exceptions = implode('|', $exceptions); $this->exceptionsExpression = $exceptions; } return $this->exceptionsExpression; } /** * @param string $license * * @throws \RuntimeException * * @return bool */ private function isValidLicenseString($license) { if (isset($this->licenses[strtolower($license)])) { return true; } $licenses = $this->getLicensesExpression(); $exceptions = $this->getExceptionsExpression(); $regex = <<[\pL\pN.-]{1,}) # license-id: taken from list (?${licenses}) # license-exception-id: taken from list (?${exceptions}) # license-ref: [DocumentRef-1*(idstring):]LicenseRef-1*(idstring) (?(?:DocumentRef-(?&idstring):)?LicenseRef-(?&idstring)) # simple-expresssion: license-id / license-id+ / license-ref (?(?&licenseid)\+? | (?&licenseid) | (?&licenseref)) # compound-expression: 1*( # simple-expression / # simple-expression WITH license-exception-id / # compound-expression AND compound-expression / # compound-expression OR compound-expression # ) / ( compound-expression ) ) (? (?&simple_expression) ( \s+ WITH \s+ (?&licenseexceptionid))? | \( \s* (?&compound_expression) \s* \) ) (? (?&compound_head) (?: \s+ (?:AND|OR) \s+ (?&compound_expression))? ) # license-expression: 1*1(simple-expression / compound-expression) (?(?&compound_expression) | (?&simple_expression)) ) # end of define ^(NONE | NOASSERTION | (?&license_expression))$ }xi REGEX; $match = preg_match($regex, $license); if (0 === $match) { return false; } if (false === $match) { throw new \RuntimeException('Regex failed to compile/run.'); } return true; } } php-composer-spdx-licenses-1.5.3/src/SpdxLicensesUpdater.php000066400000000000000000000054131362454644300241620ustar00rootroot00000000000000 * * For the full copyright and license information, please view * the LICENSE file that was distributed with this source code. */ namespace Composer\Spdx; /** * The SPDX Licenses Updater scrapes licenses from the spdx website * and updates the "res/*.json" file accordingly. * * The class is used by the update script "bin/update-spdx-licenses". */ class SpdxLicensesUpdater { /** * @param string $file * @param string $url */ public function dumpLicenses($file = null, $url = 'https://raw.githubusercontent.com/spdx/license-list-data/master/json/licenses.json') { if (null === $file) { $file = SpdxLicenses::getResourcesDir() . '/' . SpdxLicenses::LICENSES_FILE; } $options = 0; if (defined('JSON_PRETTY_PRINT')) { $options |= JSON_PRETTY_PRINT; } if (defined('JSON_UNESCAPED_SLASHES')) { $options |= JSON_UNESCAPED_SLASHES; } $licenses = json_encode($this->getLicenses($url), $options); file_put_contents($file, $licenses); } /** * @param string $file * @param string $url */ public function dumpExceptions($file = null, $url = 'https://raw.githubusercontent.com/spdx/license-list-data/master/json/exceptions.json') { if (null === $file) { $file = SpdxLicenses::getResourcesDir() . '/' . SpdxLicenses::EXCEPTIONS_FILE; } $options = 0; if (defined('JSON_PRETTY_PRINT')) { $options |= JSON_PRETTY_PRINT; } if (defined('JSON_UNESCAPED_SLASHES')) { $options |= JSON_UNESCAPED_SLASHES; } $exceptions = json_encode($this->getExceptions($url), $options); file_put_contents($file, $exceptions); } /** * @param string $url * * @return array */ private function getLicenses($url) { $licenses = array(); $data = json_decode(file_get_contents($url), true); foreach ($data['licenses'] as $info) { $licenses[$info['licenseId']] = array( trim($info['name']), $info['isOsiApproved'], $info['isDeprecatedLicenseId'] ); } uksort($licenses, 'strcasecmp'); return $licenses; } /** * @param string $url * * @return array */ private function getExceptions($url) { $exceptions = array(); $data = json_decode(file_get_contents($url), true); foreach ($data['exceptions'] as $info) { $exceptions[$info['licenseExceptionId']] = array(trim($info['name'])); } uksort($exceptions, 'strcasecmp'); return $exceptions; } } php-composer-spdx-licenses-1.5.3/tests/000077500000000000000000000000001362454644300200705ustar00rootroot00000000000000php-composer-spdx-licenses-1.5.3/tests/SpdxLicensesTest.php000066400000000000000000000214621362454644300240520ustar00rootroot00000000000000 * * For the full copyright and license information, please view * the LICENSE file that was distributed with this source code. */ namespace Composer\Spdx; use PHPUnit\Framework\TestCase; class SpdxLicensesTest extends TestCase { /** * @var SpdxLicenses */ private $licenses; public function setUp() { $this->licenses = new SpdxLicenses(); } /** * @dataProvider provideValidLicenses * * @param string|array $license */ public function testValidate($license) { $this->assertTrue($this->licenses->validate($license)); } /** * @dataProvider provideInvalidLicenses * * @param string|array $invalidLicense */ public function testInvalidLicenses($invalidLicense) { $this->assertFalse($this->licenses->validate($invalidLicense)); } /** * @dataProvider provideInvalidArgument * @expectedException \InvalidArgumentException * * @param mixed $invalidArgument */ public function testInvalidArgument($invalidArgument) { $this->licenses->validate($invalidArgument); } /** * @testdox Resources directory exists at expected locatation. */ public function testGetResourcesDir() { $dir = SpdxLicenses::getResourcesDir(); $this->assertTrue( is_dir($dir), 'Expected resources directory to exist.' ); $this->assertEquals( realpath($dir), realpath(__DIR__ . '/../res'), 'Expected resources directory to be "res" (relative to project root).' ); } /** * @testdox Resources files exist at expected locations. * @dataProvider provideResourceFiles * * @param string $file */ public function testResourceFilesExist($file) { $this->assertFileExists( SpdxLicenses::getResourcesDir() . '/' . $file, 'Expected file to exist in resources dir: ' . $file ); } /** * @testdox Resources files contain valid JSON. * @dataProvider provideResourceFiles * * @param string $file */ public function testResourceFilesContainJson($file) { $json = json_decode(file_get_contents(SpdxLicenses::getResourcesDir() . '/' . $file), true); if (null === $json && json_last_error()) { switch (json_last_error()) { case JSON_ERROR_NONE: $error = ' - no errors'; break; case JSON_ERROR_DEPTH: $error = ' - maximum stack depth exceeded'; break; case JSON_ERROR_STATE_MISMATCH: $error = ' - underflow or the modes mismatch'; break; case JSON_ERROR_CTRL_CHAR: $error = ' - unexpected control character found'; break; case JSON_ERROR_SYNTAX: $error = ' - syntax error, malformed JSON'; break; case JSON_ERROR_UTF8: $error = ' - malformed UTF-8 characters, possibly incorrectly encoded'; break; default: $error = ' - unknown error'; break; } $this->fail('Could not decode JSON within ' . $file . $error); } $this->assertNotEmpty($json); } public function testGetLicenseByIdentifier() { $license = $this->licenses->getLicenseByIdentifier('AGPL-1.0-only'); $this->assertEquals('Affero General Public License v1.0 only', $license[0]); $this->assertFalse($license[1]); $this->assertStringStartsWith('https://spdx.org/licenses/', $license[2]); $this->assertFalse($license[3]); $licenseNull = $this->licenses->getLicenseByIdentifier('AGPL-1.0-Illegal'); $this->assertNull($licenseNull); } public function testGetLicenses() { $results = $this->licenses->getLicenses(); $this->assertArrayHasKey('cc-by-sa-4.0', $results); $this->assertArrayHasKey(0, $results['cc-by-sa-4.0']); $this->assertEquals('CC-BY-SA-4.0', $results['cc-by-sa-4.0'][0]); $this->assertEquals('Creative Commons Attribution Share Alike 4.0 International', $results['cc-by-sa-4.0'][1]); $this->assertEquals(false, $results['cc-by-sa-4.0'][2]); $this->assertEquals(false, $results['cc-by-sa-4.0'][3]); } public function testGetExceptionByIdentifier() { $licenseNull = $this->licenses->getExceptionByIdentifier('Font-exception-2.0-Errorl'); $this->assertNull($licenseNull); $license = $this->licenses->getExceptionByIdentifier('Font-exception-2.0'); $this->assertInternalType('array', $license); $this->assertSame('Font exception 2.0', $license[0]); } public function testGetIdentifierByName() { $identifier = $this->licenses->getIdentifierByName('Affero General Public License v1.0'); $this->assertEquals($identifier, 'AGPL-1.0'); $identifier = $this->licenses->getIdentifierByName('BSD 2-Clause "Simplified" License'); $this->assertEquals($identifier, 'BSD-2-Clause'); $identifier = $this->licenses->getIdentifierByName('Font exception 2.0'); $this->assertEquals($identifier, 'Font-exception-2.0'); $identifier = $this->licenses->getIdentifierByName('null-identifier-name'); $this->assertNull($identifier); } public function testIsOsiApprovedByIdentifier() { $osiApproved = $this->licenses->isOsiApprovedByIdentifier('MIT'); $this->assertTrue($osiApproved); $osiApproved = $this->licenses->isOsiApprovedByIdentifier('AGPL-1.0'); $this->assertFalse($osiApproved); } public function testIsDeprecatedByIdentifier() { $deprecated = $this->licenses->isDeprecatedByIdentifier('GPL-3.0'); $this->assertTrue($deprecated); $deprecated = $this->licenses->isDeprecatedByIdentifier('GPL-3.0-only'); $this->assertFalse($deprecated); } /** * @return array */ public function provideResourceFiles() { return array( array(SpdxLicenses::LICENSES_FILE), array(SpdxLicenses::EXCEPTIONS_FILE), ); } /** * @return array */ public function provideValidLicenses() { $json = file_get_contents(SpdxLicenses::getResourcesDir() . '/' . SpdxLicenses::LICENSES_FILE); $licenses = json_decode($json, true); $identifiers = array_keys($licenses); $valid = array_merge( array( 'MIT', 'MIT+', array('(MIT)'), 'NONE', 'NOASSERTION', 'LicenseRef-3', array('LGPL-2.0-only', 'GPL-3.0-or-later'), '(LGPL-2.0-only or GPL-3.0-or-later)', '(LGPL-2.0-only OR GPL-3.0-or-later)', array('EUDatagrid and GPL-3.0-or-later'), '(EUDatagrid and GPL-3.0-or-later)', '(EUDatagrid AND GPL-3.0-or-later)', 'GPL-2.0-only with Autoconf-exception-2.0', 'GPL-2.0-only WITH Autoconf-exception-2.0', 'GPL-2.0-or-later WITH Autoconf-exception-2.0', array('(GPL-3.0-only and GPL-2.0-only or GPL-3.0-or-later)'), ), $identifiers ); foreach ($valid as &$r) { $r = array($r); } return $valid; } /** * @return array */ public function provideInvalidLicenses() { return array( array(''), array(array()), array('The system pwns you'), array('()'), array('(MIT'), array('MIT)'), array('MIT NONE'), array('MIT AND NONE'), array('MIT (MIT and MIT)'), array('(MIT and MIT) MIT'), array(array('LGPL-2.0-only', 'The system pwns you')), array('and GPL-3.0-or-later'), array('(EUDatagrid and GPL-3.0-or-later and )'), array('(EUDatagrid xor GPL-3.0-or-later)'), array('(NONE or MIT)'), array('(NOASSERTION or MIT)'), array('Autoconf-exception-2.0 WITH MIT'), array('MIT WITH'), array('MIT OR'), array('MIT AND'), ); } /** * @return array */ public function provideInvalidArgument() { return array( array(null), array(new \stdClass()), array(array(new \stdClass())), array(array('mixed', new \stdClass())), array(array(new \stdClass(), new \stdClass())), ); } } php-composer-spdx-licenses-1.5.3/tests/SpdxLicensesUpdaterTest.php000066400000000000000000000026371362454644300254020ustar00rootroot00000000000000 * * For the full copyright and license information, please view * the LICENSE file that was distributed with this source code. */ namespace Composer\Spdx; use PHPUnit\Framework\TestCase; class SpdxLicensesUpdaterTest extends TestCase { /** * @var SpdxLicenses */ private $updater; private $licenseFiles; private $exceptionFile; public function setUp() { $this->updater = new SpdxLicensesUpdater(); $this->licenseFile = __DIR__ . '/../res/licenses.json'; $this->exceptionFile = __DIR__ . '/../res/exceptions.json'; } public function tearDown() { @unlink($this->licenseFile); @unlink($this->exceptionFile); } public function testDumpLicenses() { $this->updater->dumpLicenses(); $this->assertFileExists(SpdxLicenses::getResourcesDir() . '/' . SpdxLicenses::LICENSES_FILE); $this->updater->dumpLicenses($this->licenseFile); $this->assertFileExists($this->licenseFile); } public function testDumpExceptions() { $this->updater->dumpExceptions(); $this->assertFileExists(SpdxLicenses::getResourcesDir() . '/' . SpdxLicenses::EXCEPTIONS_FILE); $this->updater->dumpExceptions($this->exceptionFile); $this->assertFileExists($this->exceptionFile); } }