pax_global_header00006660000000000000000000000064126044572560014525gustar00rootroot0000000000000052 comment=9e1c3926bb0842812967213d7c92827bc5883671 spdx-licenses-1.1.2/000077500000000000000000000000001260445725600143075ustar00rootroot00000000000000spdx-licenses-1.1.2/CHANGELOG.md000066400000000000000000000017771260445725600161340ustar00rootroot00000000000000# Change Log All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). ## 1.1.1 - 2015-09-07 ### Fixed - improved performance when looking up just one license. - updated licenses/exceptions. ## 1.1.0 - 2015-07-17 ### Changed - updater now sorts licenses and exceptions by key. - filenames now class constants of SpdxLicenses (`LICENSES_FILE` and `EXCEPTIONS_FILE`). - resources directory now available via static method `SpdxLicenses::getResourcesDir()`. ### Fixed - updated licenses/exceptions. - removed json-schema from composer requirements. ## 1.0.0 - 2015-07-15 ### Changed - BC: the following classes and namespaces were renamed: - Namespace: `Composer\Util` -> `Composer\Spdx` - Classname: `SpdxLicense` -> `SpdxLicenses` - Classname: `SpdxLicenseTest` -> `SpdxLicensesTest` - Classname: `Updater` -> `SpdxLicensesUpdater` - validation via regex implementation instead of lexer. - code style using php-cs-fixer. spdx-licenses-1.1.2/LICENSE000066400000000000000000000020341260445725600153130ustar00rootroot00000000000000Copyright (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. spdx-licenses-1.1.2/README.md000066400000000000000000000030741260445725600155720ustar00rootroot00000000000000composer/spdx-licenses ====================== SPDX 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 input is a valid SPDX license expression $licenses->validate($input); ``` > Read the [specifications](https://spdx.org/SPDX-specifications/spdx-version-2.0) > 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 taken from [spdx.org](https://spdx.org/). * [Licenses](https://spdx.org/licenses/index.html) * [License Exceptions](https://spdx.org/licenses/exceptions-index.html) spdx-licenses-1.1.2/composer.json000066400000000000000000000024631260445725600170360ustar00rootroot00000000000000{ "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" }, "require-dev": { "phpunit/phpunit": "~4.5", "phpunit/phpunit-mock-objects": "~2.3" }, "autoload": { "psr-4": { "Composer\\Spdx\\": "src" } }, "autoload-dev": { "psr-4": { "Composer\\Spdx\\Test\\": "tests" } }, "extra": { "branch-alias": { "dev-master": "1.x-dev" } }, "scripts": { "test": "phpunit" } } spdx-licenses-1.1.2/res/000077500000000000000000000000001260445725600151005ustar00rootroot00000000000000spdx-licenses-1.1.2/res/spdx-exceptions.json000066400000000000000000000032451260445725600211340ustar00rootroot00000000000000{ "389-exception": [ "389 Directory Server\nException" ], "Autoconf-exception-2.0": [ "Autoconf exception 2.0" ], "Autoconf-exception-3.0": [ "Autoconf exception 3.0" ], "Bison-exception-2.2": [ "Bison exception 2.2" ], "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" ], "i2p-gpl-java-exception": [ "i2p GPL+Java Exception" ], "Libtool-exception": [ "Libtool Exception" ], "LZMA-exception": [ "LZMA exception" ], "mif-exception": [ "Macros and Inline Functions Exception" ], "Nokia-Qt-exception-1.1": [ "Nokia Qt LGPL exception 1.1" ], "openvpn-openssl-exception": [ "OpenVPN OpenSSL Exception" ], "Qwt-exception-1.0": [ "Qwt exception 1.0" ], "u-boot-exception-2.0": [ "U-Boot exception 2.0" ], "WxWindows-exception-3.1": [ "WxWindows Library Exception 3.1" ] }spdx-licenses-1.1.2/res/spdx-licenses.json000066400000000000000000000575131260445725600205670ustar00rootroot00000000000000{ "0BSD": [ "BSD Zero Clause License", false ], "AAL": [ "Attribution Assurance License", true ], "Abstyles": [ "Abstyles License", false ], "Adobe-2006": [ "Adobe Systems Incorporated Source Code License Agreement", false ], "Adobe-Glyph": [ "Adobe Glyph List License", false ], "ADSL": [ "Amazon Digital Services License", false ], "AFL-1.1": [ "Academic Free License v1.1", true ], "AFL-1.2": [ "Academic Free License v1.2", true ], "AFL-2.0": [ "Academic Free License v2.0", true ], "AFL-2.1": [ "Academic Free License v2.1", true ], "AFL-3.0": [ "Academic Free License v3.0", true ], "Afmparse": [ "Afmparse License", false ], "AGPL-1.0": [ "Affero General Public License v1.0", false ], "AGPL-3.0": [ "GNU Affero General Public License v3.0", true ], "Aladdin": [ "Aladdin Free Public License", false ], "AMDPLPA": [ "AMD's plpa_map.c License", false ], "AML": [ "Apple MIT License", false ], "AMPAS": [ "Academy of Motion Picture Arts and Sciences BSD", false ], "ANTLR-PD": [ "ANTLR Software Rights Notice", false ], "Apache-1.0": [ "Apache License 1.0", false ], "Apache-1.1": [ "Apache License 1.1", true ], "Apache-2.0": [ "Apache License 2.0", true ], "APAFML": [ "Adobe Postscript AFM License", false ], "APL-1.0": [ "Adaptive Public License 1.0", true ], "APSL-1.0": [ "Apple Public Source License 1.0", true ], "APSL-1.1": [ "Apple Public Source License 1.1", true ], "APSL-1.2": [ "Apple Public Source License 1.2", true ], "APSL-2.0": [ "Apple Public Source License 2.0", true ], "Artistic-1.0": [ "Artistic License 1.0", true ], "Artistic-1.0-cl8": [ "Artistic License 1.0 w/clause 8", true ], "Artistic-1.0-Perl": [ "Artistic License 1.0 (Perl)", true ], "Artistic-2.0": [ "Artistic License 2.0", true ], "Bahyph": [ "Bahyph License", false ], "Barr": [ "Barr License", false ], "Beerware": [ "Beerware License", false ], "BitTorrent-1.0": [ "BitTorrent Open Source License v1.0", false ], "BitTorrent-1.1": [ "BitTorrent Open Source License v1.1", false ], "Borceux": [ "Borceux license", false ], "BSD-2-Clause": [ "BSD 2-clause \"Simplified\" License", true ], "BSD-2-Clause-FreeBSD": [ "BSD 2-clause FreeBSD License", false ], "BSD-2-Clause-NetBSD": [ "BSD 2-clause NetBSD License", false ], "BSD-3-Clause": [ "BSD 3-clause \"New\" or \"Revised\" License", true ], "BSD-3-Clause-Attribution": [ "BSD with attribution", false ], "BSD-3-Clause-Clear": [ "BSD 3-clause Clear License", false ], "BSD-3-Clause-LBNL": [ "Lawrence Berkeley National Labs BSD variant license", false ], "BSD-4-Clause": [ "BSD 4-clause \"Original\" or \"Old\" License", false ], "BSD-4-Clause-UC": [ "BSD-4-Clause (University of California-Specific)", false ], "BSD-Protection": [ "BSD Protection License", false ], "BSL-1.0": [ "Boost Software License 1.0", true ], "bzip2-1.0.5": [ "bzip2 and libbzip2 License v1.0.5", false ], "bzip2-1.0.6": [ "bzip2 and libbzip2 License v1.0.6", false ], "Caldera": [ "Caldera License", false ], "CATOSL-1.1": [ "Computer Associates Trusted Open Source License 1.1", true ], "CC-BY-1.0": [ "Creative Commons Attribution 1.0", false ], "CC-BY-2.0": [ "Creative Commons Attribution 2.0", false ], "CC-BY-2.5": [ "Creative Commons Attribution 2.5", false ], "CC-BY-3.0": [ "Creative Commons Attribution 3.0", false ], "CC-BY-4.0": [ "Creative Commons Attribution 4.0", false ], "CC-BY-NC-1.0": [ "Creative Commons Attribution Non Commercial 1.0", false ], "CC-BY-NC-2.0": [ "Creative Commons Attribution Non Commercial 2.0", false ], "CC-BY-NC-2.5": [ "Creative Commons Attribution Non Commercial 2.5", false ], "CC-BY-NC-3.0": [ "Creative Commons Attribution Non Commercial 3.0", false ], "CC-BY-NC-4.0": [ "Creative Commons Attribution Non Commercial 4.0", false ], "CC-BY-NC-ND-1.0": [ "Creative Commons Attribution Non Commercial No Derivatives 1.0", false ], "CC-BY-NC-ND-2.0": [ "Creative Commons Attribution Non Commercial No Derivatives 2.0", false ], "CC-BY-NC-ND-2.5": [ "Creative Commons Attribution Non Commercial No Derivatives 2.5", false ], "CC-BY-NC-ND-3.0": [ "Creative Commons Attribution Non Commercial No Derivatives 3.0", false ], "CC-BY-NC-ND-4.0": [ "Creative Commons Attribution Non Commercial No Derivatives 4.0", false ], "CC-BY-NC-SA-1.0": [ "Creative Commons Attribution Non Commercial Share Alike 1.0", false ], "CC-BY-NC-SA-2.0": [ "Creative Commons Attribution Non Commercial Share Alike 2.0", false ], "CC-BY-NC-SA-2.5": [ "Creative Commons Attribution Non Commercial Share Alike 2.5", false ], "CC-BY-NC-SA-3.0": [ "Creative Commons Attribution Non Commercial Share Alike 3.0", false ], "CC-BY-NC-SA-4.0": [ "Creative Commons Attribution Non Commercial Share Alike 4.0", false ], "CC-BY-ND-1.0": [ "Creative Commons Attribution No Derivatives 1.0", false ], "CC-BY-ND-2.0": [ "Creative Commons Attribution No Derivatives 2.0", false ], "CC-BY-ND-2.5": [ "Creative Commons Attribution No Derivatives 2.5", false ], "CC-BY-ND-3.0": [ "Creative Commons Attribution No Derivatives 3.0", false ], "CC-BY-ND-4.0": [ "Creative Commons Attribution No Derivatives 4.0", false ], "CC-BY-SA-1.0": [ "Creative Commons Attribution Share Alike 1.0", false ], "CC-BY-SA-2.0": [ "Creative Commons Attribution Share Alike 2.0", false ], "CC-BY-SA-2.5": [ "Creative Commons Attribution Share Alike 2.5", false ], "CC-BY-SA-3.0": [ "Creative Commons Attribution Share Alike 3.0", false ], "CC-BY-SA-4.0": [ "Creative Commons Attribution Share Alike 4.0", false ], "CC0-1.0": [ "Creative Commons Zero v1.0 Universal", false ], "CDDL-1.0": [ "Common Development and Distribution License 1.0", true ], "CDDL-1.1": [ "Common Development and Distribution License 1.1", false ], "CECILL-1.0": [ "CeCILL Free Software License Agreement v1.0", false ], "CECILL-1.1": [ "CeCILL Free Software License Agreement v1.1", false ], "CECILL-2.0": [ "CeCILL Free Software License Agreement v2.0", false ], "CECILL-2.1": [ "CeCILL Free Software License Agreement v2.1", true ], "CECILL-B": [ "CeCILL-B Free Software License Agreement", false ], "CECILL-C": [ "CeCILL-C Free Software License Agreement", false ], "ClArtistic": [ "Clarified Artistic License", false ], "CNRI-Jython": [ "CNRI Jython License", false ], "CNRI-Python": [ "CNRI Python License", true ], "CNRI-Python-GPL-Compatible": [ "CNRI Python Open Source GPL Compatible License Agreement", false ], "Condor-1.1": [ "Condor Public License v1.1", false ], "CPAL-1.0": [ "Common Public Attribution License 1.0", true ], "CPL-1.0": [ "Common Public License 1.0", true ], "CPOL-1.02": [ "Code Project Open License 1.02", false ], "Crossword": [ "Crossword License", false ], "CrystalStacker": [ "CrystalStacker License", false ], "CUA-OPL-1.0": [ "CUA Office Public License v1.0", true ], "Cube": [ "Cube License", false ], "D-FSL-1.0": [ "Deutsche Freie Software Lizenz", false ], "diffmark": [ "diffmark license", false ], "DOC": [ "DOC License", false ], "Dotseqn": [ "Dotseqn License", false ], "DSDP": [ "DSDP License", false ], "dvipdfm": [ "dvipdfm License", false ], "ECL-1.0": [ "Educational Community License v1.0", true ], "ECL-2.0": [ "Educational Community License v2.0", true ], "EFL-1.0": [ "Eiffel Forum License v1.0", true ], "EFL-2.0": [ "Eiffel Forum License v2.0", true ], "eGenix": [ "eGenix.com Public License 1.1.0", false ], "Entessa": [ "Entessa Public License v1.0", true ], "EPL-1.0": [ "Eclipse Public License 1.0", true ], "ErlPL-1.1": [ "Erlang Public License v1.1", false ], "EUDatagrid": [ "EU DataGrid Software License", true ], "EUPL-1.0": [ "European Union Public License 1.0", false ], "EUPL-1.1": [ "European Union Public License 1.1", true ], "Eurosym": [ "Eurosym License", false ], "Fair": [ "Fair License", true ], "Frameworx-1.0": [ "Frameworx Open License 1.0", true ], "FreeImage": [ "FreeImage Public License v1.0", false ], "FSFUL": [ "FSF Unlimited License", false ], "FSFULLR": [ "FSF Unlimited License (with License Retention)", false ], "FTL": [ "Freetype Project License", false ], "GFDL-1.1": [ "GNU Free Documentation License v1.1", false ], "GFDL-1.2": [ "GNU Free Documentation License v1.2", false ], "GFDL-1.3": [ "GNU Free Documentation License v1.3", false ], "Giftware": [ "Giftware License", false ], "GL2PS": [ "GL2PS License", false ], "Glide": [ "3dfx Glide License", false ], "Glulxe": [ "Glulxe License", false ], "gnuplot": [ "gnuplot License", false ], "GPL-1.0": [ "GNU General Public License v1.0 only", false ], "GPL-2.0": [ "GNU General Public License v2.0 only", true ], "GPL-3.0": [ "GNU General Public License v3.0 only", true ], "gSOAP-1.3b": [ "gSOAP Public License v1.3b", false ], "HaskellReport": [ "Haskell Language Report License", false ], "HPND": [ "Historic Permission Notice and Disclaimer", true ], "IBM-pibs": [ "IBM PowerPC Initialization and Boot Software", false ], "ICU": [ "ICU License", false ], "IJG": [ "Independent JPEG Group License", false ], "ImageMagick": [ "ImageMagick License", false ], "iMatix": [ "iMatix Standard Function Library Agreement", false ], "Imlib2": [ "Imlib2 License", false ], "Intel": [ "Intel Open Source License", true ], "Intel-ACPI": [ "Intel ACPI Software License Agreement", false ], "Interbase-1.0": [ "Interbase Public License v1.0", false ], "IPA": [ "IPA Font License", true ], "IPL-1.0": [ "IBM Public License v1.0", true ], "ISC": [ "ISC License", true ], "JasPer-2.0": [ "JasPer License", false ], "JSON": [ "JSON License", false ], "Latex2e": [ "Latex2e License", false ], "Leptonica": [ "Leptonica License", false ], "LGPL-2.0": [ "GNU Library General Public License v2 only", true ], "LGPL-2.1": [ "GNU Lesser General Public License v2.1 only", true ], "LGPL-3.0": [ "GNU Lesser General Public License v3.0 only", true ], "LGPLLR": [ "Lesser General Public License For Linguistic Resources", false ], "Libpng": [ "libpng License", false ], "libtiff": [ "libtiff License", false ], "LPL-1.0": [ "Lucent Public License Version 1.0", true ], "LPL-1.02": [ "Lucent Public License v1.02", true ], "LPPL-1.0": [ "LaTeX Project Public License v1.0", false ], "LPPL-1.1": [ "LaTeX Project Public License v1.1", false ], "LPPL-1.2": [ "LaTeX Project Public License v1.2", false ], "LPPL-1.3a": [ "LaTeX Project Public License 1.3a", false ], "LPPL-1.3c": [ "LaTeX Project Public License v1.3c", true ], "MakeIndex": [ "MakeIndex License", false ], "MirOS": [ "MirOS Licence", true ], "MIT": [ "MIT License", true ], "MIT-advertising": [ "Enlightenment License (e16)", false ], "MIT-CMU": [ "CMU License", false ], "MIT-enna": [ "enna License", false ], "MIT-feh": [ "feh License", false ], "MITNFA": [ "MIT +no-false-attribs license", false ], "Motosoto": [ "Motosoto License", true ], "mpich2": [ "mpich2 License", false ], "MPL-1.0": [ "Mozilla Public License 1.0", true ], "MPL-1.1": [ "Mozilla Public License 1.1", true ], "MPL-2.0": [ "Mozilla Public License 2.0", true ], "MPL-2.0-no-copyleft-exception": [ "Mozilla Public License 2.0 (no copyleft exception)", true ], "MS-PL": [ "Microsoft Public License", true ], "MS-RL": [ "Microsoft Reciprocal License", true ], "MTLL": [ "Matrix Template Library License", false ], "Multics": [ "Multics License", true ], "Mup": [ "Mup License", false ], "NASA-1.3": [ "NASA Open Source Agreement 1.3", true ], "Naumen": [ "Naumen Public License", true ], "NBPL-1.0": [ "Net Boolean Public License v1", false ], "NCSA": [ "University of Illinois/NCSA Open Source License", true ], "NetCDF": [ "NetCDF license", false ], "Newsletr": [ "Newsletr License", false ], "NGPL": [ "Nethack General Public License", true ], "NLPL": [ "No Limit Public License", false ], "Nokia": [ "Nokia Open Source License", true ], "NOSL": [ "Netizen Open Source License", false ], "Noweb": [ "Noweb License", false ], "NPL-1.0": [ "Netscape Public License v1.0", false ], "NPL-1.1": [ "Netscape Public License v1.1", false ], "NPOSL-3.0": [ "Non-Profit Open Software License 3.0", true ], "NRL": [ "NRL License", false ], "NTP": [ "NTP License", true ], "Nunit": [ "Nunit License", false ], "OCLC-2.0": [ "OCLC Research Public License 2.0", true ], "ODbL-1.0": [ "ODC Open Database License v1.0", false ], "OFL-1.0": [ "SIL Open Font License 1.0", false ], "OFL-1.1": [ "SIL Open Font License 1.1", true ], "OGTSL": [ "Open Group Test Suite License", true ], "OLDAP-1.1": [ "Open LDAP Public License v1.1", false ], "OLDAP-1.2": [ "Open LDAP Public License v1.2", false ], "OLDAP-1.3": [ "Open LDAP Public License v1.3", false ], "OLDAP-1.4": [ "Open LDAP Public License v1.4", false ], "OLDAP-2.0": [ "Open LDAP Public License v2.0 (or possibly 2.0A and 2.0B)", false ], "OLDAP-2.0.1": [ "Open LDAP Public License v2.0.1", false ], "OLDAP-2.1": [ "Open LDAP Public License v2.1", false ], "OLDAP-2.2": [ "Open LDAP Public License v2.2", false ], "OLDAP-2.2.1": [ "Open LDAP Public License v2.2.1", false ], "OLDAP-2.2.2": [ "Open LDAP Public License 2.2.2", false ], "OLDAP-2.3": [ "Open LDAP Public License v2.3", false ], "OLDAP-2.4": [ "Open LDAP Public License v2.4", false ], "OLDAP-2.5": [ "Open LDAP Public License v2.5", false ], "OLDAP-2.6": [ "Open LDAP Public License v2.6", false ], "OLDAP-2.7": [ "Open LDAP Public License v2.7", false ], "OLDAP-2.8": [ "Open LDAP Public License v2.8", false ], "OML": [ "Open Market License", false ], "OpenSSL": [ "OpenSSL License", false ], "OPL-1.0": [ "Open Public License v1.0", false ], "OSL-1.0": [ "Open Software License 1.0", true ], "OSL-1.1": [ "Open Software License 1.1", false ], "OSL-2.0": [ "Open Software License 2.0", true ], "OSL-2.1": [ "Open Software License 2.1", true ], "OSL-3.0": [ "Open Software License 3.0", true ], "PDDL-1.0": [ "ODC Public Domain Dedication & License 1.0", false ], "PHP-3.0": [ "PHP License v3.0", true ], "PHP-3.01": [ "PHP License v3.01", false ], "Plexus": [ "Plexus Classworlds License", false ], "PostgreSQL": [ "PostgreSQL License", true ], "psfrag": [ "psfrag License", false ], "psutils": [ "psutils License", false ], "Python-2.0": [ "Python License 2.0", true ], "Qhull": [ "Qhull License", false ], "QPL-1.0": [ "Q Public License 1.0", true ], "Rdisc": [ "Rdisc License", false ], "RHeCos-1.1": [ "Red Hat eCos Public License v1.1", false ], "RPL-1.1": [ "Reciprocal Public License 1.1", true ], "RPL-1.5": [ "Reciprocal Public License 1.5", true ], "RPSL-1.0": [ "RealNetworks Public Source License v1.0", true ], "RSA-MD": [ "RSA Message-Digest License", false ], "RSCPL": [ "Ricoh Source Code Public License", true ], "Ruby": [ "Ruby License", false ], "SAX-PD": [ "Sax Public Domain Notice", false ], "Saxpath": [ "Saxpath License", false ], "SCEA": [ "SCEA Shared Source License", false ], "Sendmail": [ "Sendmail License", false ], "SGI-B-1.0": [ "SGI Free Software License B v1.0", false ], "SGI-B-1.1": [ "SGI Free Software License B v1.1", false ], "SGI-B-2.0": [ "SGI Free Software License B v2.0", false ], "SimPL-2.0": [ "Simple Public License 2.0", true ], "SISSL": [ "Sun Industry Standards Source License v1.1", true ], "SISSL-1.2": [ "Sun Industry Standards Source License v1.2", false ], "Sleepycat": [ "Sleepycat License", true ], "SMLNJ": [ "Standard ML of New Jersey License", false ], "SNIA": [ "SNIA Public License 1.1", false ], "Spencer-86": [ "Spencer License 86", false ], "Spencer-94": [ "Spencer License 94", false ], "Spencer-99": [ "Spencer License 99", false ], "SPL-1.0": [ "Sun Public License v1.0", true ], "SugarCRM-1.1.3": [ "SugarCRM Public License v1.1.3", false ], "SWL": [ "Scheme Widget Library (SWL) Software License Agreement", false ], "TCL": [ "TCL/TK License", false ], "TMate": [ "TMate Open Source License", false ], "TORQUE-1.1": [ "TORQUE v2.5+ Software License v1.1", false ], "TOSL": [ "Trusster Open Source License", false ], "Unicode-TOU": [ "Unicode Terms of Use", false ], "Unlicense": [ "The Unlicense", false ], "UPL-1.0": [ "Universal Permissive License v1.0", true ], "Vim": [ "Vim License", false ], "VOSTROM": [ "VOSTROM Public License for Open Source", false ], "VSL-1.0": [ "Vovida Software License v1.0", true ], "W3C": [ "W3C Software Notice and License (2002-12-31)", true ], "W3C-19980720": [ "W3C Software Notice and License (1998-07-20)", false ], "Watcom-1.0": [ "Sybase Open Watcom Public License 1.0", true ], "Wsuipa": [ "Wsuipa License", false ], "WTFPL": [ "Do What The F*ck You Want To Public License", false ], "X11": [ "X11 License", false ], "Xerox": [ "Xerox License", false ], "XFree86-1.1": [ "XFree86 License 1.1", false ], "xinetd": [ "xinetd License", false ], "Xnet": [ "X.Net License", true ], "xpp": [ "XPP License", false ], "XSkat": [ "XSkat License", false ], "YPL-1.0": [ "Yahoo! Public License v1.0", false ], "YPL-1.1": [ "Yahoo! Public License v1.1", false ], "Zed": [ "Zed License", false ], "Zend-2.0": [ "Zend License v2.0", false ], "Zimbra-1.3": [ "Zimbra Public License v1.3", false ], "Zimbra-1.4": [ "Zimbra Public License v1.4", false ], "Zlib": [ "zlib License", true ], "zlib-acknowledgement": [ "zlib/libpng License with Acknowledgement", false ], "ZPL-1.1": [ "Zope Public License 1.1", false ], "ZPL-2.0": [ "Zope Public License 2.0", true ], "ZPL-2.1": [ "Zope Public License 2.1", false ] }spdx-licenses-1.1.2/src/000077500000000000000000000000001260445725600150765ustar00rootroot00000000000000spdx-licenses-1.1.2/src/SpdxLicenses.php000066400000000000000000000172771260445725600202310ustar00rootroot00000000000000 * * 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. * * [ license identifier => * [ 0 => full name (string), 1 => osi certified (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. * * [ exception identifier => * [ 0 => 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) ] * * @param string $identifier * * @return array|null */ public function getLicenseByIdentifier($identifier) { if (!isset($this->licenses[$identifier])) { return; } $license = $this->licenses[$identifier]; $license[] = 'https://spdx.org/licenses/' . $identifier . '.html#licenseText'; return $license; } /** * 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) { if (!isset($this->exceptions[$identifier])) { return; } $license = $this->exceptions[$identifier]; $license[] = 'https://spdx.org/licenses/' . $identifier . '.html#licenseExceptionText'; return $license; } /** * 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 $identifier => $licenseData) { if ($licenseData[0] === $name) { return $identifier; } } foreach ($this->exceptions as $identifier => $licenseData) { if ($licenseData[0] === $name) { return $identifier; } } } /** * Returns the OSI Approved status for a license by identifier. * * @param string $identifier * * @return bool */ public function isOsiApprovedByIdentifier($identifier) { return $this->licenses[$identifier][1]; } /** * @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) { $json = file_get_contents(self::getResourcesDir() . '/' . self::LICENSES_FILE); $this->licenses = json_decode($json, true); } } private function loadExceptions() { if (null === $this->exceptions) { $json = file_get_contents(self::getResourcesDir() . '/' . self::EXCEPTIONS_FILE); $this->exceptions = json_decode($json, true); } } /** * @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[$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|WITH) \s+ (?&licenseexceptionid))? | \( \s* (?&compound_expression) \s* \) ) (? (?&compound_head) (?: \s+ (?:and|AND|or|OR) \s+ (?&compound_expression))? ) # license-expression: 1*1(simple-expression / compound-expression) (?(?&compound_expression) | (?&simple_expression)) ) # end of define ^(NONE | NOASSERTION | (?&license_expression))$ }x REGEX; $match = preg_match($regex, $license); if (0 === $match) { return false; } if (false === $match) { throw new \RuntimeException('Regex failed to compile/run.'); } return true; } }