Permalink
Browse files

initial release, closes #1 (#2)

  • Loading branch information...
1 parent 64bae4f commit 04470a73c99f3c55a6fee204dc37eb4185260526 @alcohol alcohol committed on GitHub Jun 30, 2016
Showing with 2,411 additions and 0 deletions.
  1. +18 −0 .gitattributes
  2. +3 −0 .gitignore
  3. +37 −0 .php_cs
  4. +28 −0 .travis.yml
  5. +8 −0 CHANGELOG.md
  6. +19 −0 LICENSE
  7. +34 −0 README.md
  8. +32 −0 composer.json
  9. +27 −0 phpunit.xml.dist
  10. +34 −0 src/DataProvider.php
  11. +1,922 −0 src/ISO3166.php
  12. +249 −0 src/ISO3166Test.php
View
@@ -0,0 +1,18 @@
+# automatically mark text files
+* text=auto
+
+# enforce lf and desired whitespace settings for these files
+*.php text eol=lf whitespace=blank-at-eol,blank-at-eof,space-before-tab,tab-in-indent,tabwidth=4 diff=php
+*.xml text eol=lf whitespace=blank-at-eol,blank-at-eof,space-before-tab,tab-in-indent,tabwidth=4
+*.json text eol=lf whitespace=blank-at-eol,blank-at-eof,space-before-tab,tab-in-indent,tabwidth=4
+*.yml text eol=lf whitespace=blank-at-eol,blank-at-eof,space-before-tab,tab-in-indent,tabwidth=4
+
+# don't add these file to github release tarballs (composer dist install)
+/src/ISO3166Test.php export-ignore
+/.gitattributes export-ignore
+/.gitignore export-ignore
+/.php_cs export-ignore
+/.travis.yml export-ignore
+/CHANGELOG.md export-ignore
+/phpunit.xml.dist export-ignore
+/README.md export-ignore
View
@@ -0,0 +1,3 @@
+vendor/
+.php_cs.cache
+composer.lock
View
@@ -0,0 +1,37 @@
+<?php
+
+$header = <<<EOF
+(c) Rob Bast <rob.bast@gmail.com>
+
+For the full copyright and license information, please view
+the LICENSE file that was distributed with this source code.
+EOF;
+
+$finder = (new Symfony\Component\Finder\Finder)
+ ->files()
+ ->name('*.php')
+ ->in(__DIR__)
+ ->exclude('vendor')
+;
+
+/* Based on dev-master|^2.0 of php-cs-fixer */
+return (new PhpCsFixer\Config('ISO3166', 'ISO3166 style guide'))
+ ->setUsingCache(true)
+ ->setUsingLinter(true)
+ ->setRiskyAllowed(true)
+ ->setRules([
+ // default
+ '@PSR2' => true,
+ '@Symfony' => true,
+ // additionally
+ 'concat_with_spaces' => true,
+ 'concat_without_spaces' => false,
+ 'header_comment' => ['header' => $header],
+ 'no_unused_imports' => false,
+ 'phpdoc_align' => false,
+ 'phpdoc_order' => true,
+ 'phpdoc_summary' => false,
+ 'simplified_null_return' => false,
+ ])
+ ->finder($finder)
+;
View
@@ -0,0 +1,28 @@
+language: php
+
+cache:
+ directories:
+ - $HOME/.composer/cache/files
+
+git:
+ depth: 5
+
+sudo: false
+
+php:
+ - 5.5
+ - 5.6
+ - 7
+ - hhvm
+ - nightly
+
+matrix:
+ fast_finish: true
+ allow_failures:
+ - php: nightly
+
+install:
+ - composer install --no-interaction --no-progress --prefer-dist --optimize-autoloader
+
+script:
+ - vendor/bin/phpunit
View
@@ -0,0 +1,8 @@
+# Change Log
+
+All notable changes to this project will be documented in this file.
+This project adheres to [Semantic Versioning](http://semver.org/).
+
+## Unreleased
+
+* New: initial release
View
@@ -0,0 +1,19 @@
+Copyright (C) Rob Bast <rob.bast@gmail.com>
+
+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.
View
@@ -0,0 +1,34 @@
+# league/iso3166
+
+A PHP library providing ISO 3166-1 data.
+
+[![Build Status](https://img.shields.io/travis/thephpleague/iso3166/master.svg?style=flat-square)](https://travis-ci.org/thephpleague/iso3166)
+[![License](https://img.shields.io/packagist/l/thephpleague/iso3166.svg?style=flat-square)](https://packagist.org/packages/thephpleague/iso3166)
+
+## What is ISO 3166-1
+
+> ISO 3166-1 is part of the ISO 3166 standard published by the International Organization for Standardization (ISO), and defines codes for the names of countries, dependent territories, and special areas of geographical interest. The official name of the standard is Codes for the representation of names of countries and their subdivisions – Part 1: Country codes. It defines three sets of country codes:
+> * ISO 3166-1 alpha-2 – two-letter country codes which are the most widely used of the three, and used most prominently for the Internet's country code top-level domains (with a few exceptions).
+> * ISO 3166-1 alpha-3 – three-letter country codes which allow a better visual association between the codes and the country names than the alpha-2 codes.
+> * ISO 3166-1 numeric – three-digit country codes which are identical to those developed and maintained by the United Nations Statistics Division, with the advantage of script (writing system) independence, and hence useful for people or systems using non-Latin scripts.
+>
+> *-- [Wikipedia](http://en.wikipedia.org/wiki/ISO_3166-1)*
+
+## Installing
+
+``` sh
+$ composer require league/iso3166
+```
+
+## Contributing
+
+Feel free to submit a pull request or create an issue.
+
+## License
+
+league/iso3166 is licensed under the MIT license.
+
+## Source(s)
+
+* [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) by [Wikipedia](http://www.wikipedia.org) licensed under [CC BY-SA 3.0 Unported License](http://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License)
+* [www.iso.org](http://www.iso.org)
View
@@ -0,0 +1,32 @@
+{
+ "name": "league/iso3166",
+ "description": "ISO 3166-1 PHP Library",
+ "keywords": ["ISO 3166", "ISO", "3166", "3166-1", "countries", "library"],
+ "homepage": "https://github.com/thephpleague/iso3166",
+ "license": "MIT",
+ "authors": [{
+ "name": "Rob Bast",
+ "email": "rob.bast@gmail.com"
+ }],
+ "support": {
+ "issues": "https://github.com/thephpleague/iso3166/issues",
+ "source": "https://github.com/thephpleague/iso3166"
+ },
+ "require": {
+ "php": "^5.5 || ^7.0"
+ },
+ "autoload": {
+ "psr-4": {
+ "League\\ISO3166\\": "src"
+ }
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^4.6 || ^5.0",
+ "phpunit/php-invoker": "@stable"
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.x-dev"
+ }
+ }
+}
View
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<phpunit
+ backupGlobals="false"
+ bootstrap="vendor/autoload.php"
+ colors="true"
+ stderr="true"
+>
+
+ <testsuites>
+ <testsuite name="ISO3166 Test Suite">
+ <file>src/ISO3166Test.php</file>
+ </testsuite>
+ </testsuites>
+
+ <filter>
+ <whitelist>
+ <file>src/ISO3166.php</file>
+ </whitelist>
+ </filter>
+
+ <logging>
+ <log type="coverage-text" target="php://stderr" />
+ <log type="coverage-html" target="coverage" showUncoveredFiles="true"/>
+ <log type="coverage-clover" target="coverage.xml" showUncoveredFiles="true"/>
+ </logging>
+
+</phpunit>
View
@@ -0,0 +1,34 @@
+<?php
+
+/*
+ * (c) Rob Bast <rob.bast@gmail.com>
+ *
+ * For the full copyright and license information, please view
+ * the LICENSE file that was distributed with this source code.
+ */
+
+namespace League\ISO3166;
+
+interface DataProvider
+{
+ /**
+ * Return data for given alpha2 code.
+ *
+ * @param string $alpha2
+ */
+ public function getByAlpha2($alpha2);
+
+ /**
+ * Return data for given alpha3 code.
+ *
+ * @param string $alpha3
+ */
+ public function getByAlpha3($alpha3);
+
+ /**
+ * Return data for given numeric code.
+ *
+ * @param string $numeric
+ */
+ public function getByNumeric($numeric);
+}
Oops, something went wrong.

0 comments on commit 04470a7

Please sign in to comment.