Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Recca Tsai committed Jun 5, 2016
0 parents commit 9960841
Show file tree
Hide file tree
Showing 18 changed files with 722 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.yml]
indent_style = space
indent_size = 2
12 changes: 12 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
* text=auto

/build export-ignore
/tests export-ignore
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.nitpick.json export-ignore
.php_cs export-ignore
.travis.yml export-ignore
phpunit.php export-ignore
phpunit.xml export-ignore
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/vendor
/resources/assets/vendor
/node_modules
composer.phar
composer.lock
.php_cs.cache
.DS_Store
Thumbs.db
5 changes: 5 additions & 0 deletions .nitpick.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"ignore": [
"tests/*"
]
}
82 changes: 82 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?php

use Symfony\CS\Config\Config;
use Symfony\CS\Finder\DefaultFinder;
use Symfony\CS\FixerInterface;

$fixers = [
'blankline_after_open_tag',
'braces',
'concat_without_spaces',
'double_arrow_multiline_whitespaces',
'duplicate_semicolon',
'elseif',
'empty_return',
'encoding',
'eof_ending',
'extra_empty_lines',
'function_call_space',
'function_declaration',
'include',
'indentation',
'join_function',
'line_after_namespace',
'linefeed',
'list_commas',
// 'logical_not_operators_with_successor_space',
'lowercase_constants',
'lowercase_keywords',
'method_argument_space',
'multiline_array_trailing_comma',
'multiline_spaces_before_semicolon',
'multiple_use',
'namespace_no_leading_whitespace',
'no_blank_lines_after_class_opening',
'no_empty_lines_after_phpdocs',
'object_operator',
'operators_spaces',
'parenthesis',
'phpdoc_indent',
'phpdoc_inline_tag',
'phpdoc_no_access',
'phpdoc_no_package',
'phpdoc_scalar',
'phpdoc_short_description',
'phpdoc_to_comment',
'phpdoc_trim',
'phpdoc_type_to_var',
'phpdoc_var_without_name',
'remove_leading_slash_use',
'remove_lines_between_uses',
'return',
'self_accessor',
'short_array_syntax',
'short_echo_tag',
'short_tag',
'single_array_no_trailing_comma',
'single_blank_line_before_namespace',
'single_line_after_imports',
'single_quote',
'spaces_before_semicolon',
'spaces_cast',
'standardize_not_equal',
'ternary_spaces',
'trailing_spaces',
'trim_array_spaces',
'unalign_equals',
'unary_operators_spaces',
'unused_use',
'visibility',
'whitespacy_lines',
// custom
'align_double_arrow',
'new_with_braces',
'ordered_use',
'-psr0',
];

return Config::create()
->finder(DefaultFinder::create()->in(__DIR__))
->fixers($fixers)
->level(FixerInterface::NONE_LEVEL)
->setUsingCache(true);
14 changes: 14 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
language: php

php:
- 5.5.9
- 5.5
- 5.6
- 7.0
- hhvm

sudo: false

install: travis_retry composer install --no-interaction --prefer-source

script: vendor/bin/phpunit --verbose
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2015 Recca Tsai

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.

19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# TWZIPCODE

[![Latest Stable Version](https://poser.pugx.org/recca0120/twzipcode/v/stable)](https://packagist.org/packages/recca0120/twzipcode)
[![Total Downloads](https://poser.pugx.org/recca0120/twzipcode/downloads)](https://packagist.org/packages/recca0120/twzipcode)
[![Latest Unstable Version](https://poser.pugx.org/recca0120/twzipcode/v/unstable)](https://packagist.org/packages/recca0120/twzipcode)
[![License](https://poser.pugx.org/recca0120/twzipcode/license)](https://packagist.org/packages/recca0120/twzipcode)
[![Monthly Downloads](https://poser.pugx.org/recca0120/twzipcode/d/monthly)](https://packagist.org/packages/recca0120/twzipcode)
[![Daily Downloads](https://poser.pugx.org/recca0120/twzipcode/d/daily)](https://packagist.org/packages/recca0120/twzipcode)

用來獲取台灣的區碼

```php
$twzipcode = new Twzipcode('北 縣 萬里鄉中正路100號');
$twzipcode->getZipcode(); // 207
$twzipcode->getCounty(); // 新北市
$twzipcode->getDistrict(); // 萬里區
$twzipcode->getAddress(); // 新北市萬里區中正路100號
$twzipcode->getShortAddress(); // 中正路100號
```
23 changes: 23 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "recca0120/twzipcode",
"description": "twzipcode",
"keywords": ["twzipcode"],
"license": "MIT",
"type": "library",
"require": {
"php": ">=5.5.9"
},
"require-dev": {
"mockery/mockery": "0.9.*",
"nesbot/carbon": "~1.20",
"phpunit/phpunit": "~4.0"
},
"autoload": {
"psr-4": {
"Recca0120\\Twzipcode\\": "src"
}
},
"config": {
"preferred-install": "dist"
}
}
20 changes: 20 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
var elixir = require('laravel-elixir');
var path = require('path');

/*
|--------------------------------------------------------------------------
| Elixir Asset Management
|--------------------------------------------------------------------------
|
| Elixir provides a clean, fluent API for defining some basic Gulp tasks
| for your Laravel application. By default, we are compiling the Sass
| file for our application, as well as publishing vendor resources.
|
*/

elixir(function(mix) {
mix.phpUnit([
'src/**/*.php',
'tests/**/*'
], path.normalize('vendor/bin/phpunit') + ' --verbose');
});
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"private": true,
"devDependencies": {
"gulp": "^3.9.1"
},
"dependencies": {
"laravel-elixir": "^6.0.0-2"
}
}
20 changes: 20 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0"?>
<ruleset name="Custom Standard">
<rule ref="PSR2">
<exclude name="Generic.Files.LineLength"/>
<exclude name="PSR1.Classes.ClassDeclaration"/>
</rule>

<exclude-pattern>*.blade.php</exclude-pattern>
<exclude-pattern>*.twig.php</exclude-pattern>
<exclude-pattern>bootstrap/</exclude-pattern>
<exclude-pattern>node_modules/</exclude-pattern>
<exclude-pattern>public/build/</exclude-pattern>
<exclude-pattern>public/css/</exclude-pattern>
<exclude-pattern>public/js/</exclude-pattern>
<exclude-pattern>public/vendor/</exclude-pattern>
<exclude-pattern>resources/assets/</exclude-pattern>
<exclude-pattern>resources/views/</exclude-pattern>
<exclude-pattern>storage/</exclude-pattern>
<exclude-pattern>vendor/</exclude-pattern>
</ruleset>
25 changes: 25 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="tests/bootstrap.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
syntaxCheck="true"
verbose="true"
>
<testsuites>
<testsuite name="Package Test Suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
</phpunit>
29 changes: 29 additions & 0 deletions ruleset.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0"?>
<ruleset
name="Custom PHPMD rule set"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd"
>
<rule ref="rulesets/codesize.xml" />
<rule ref="rulesets/controversial.xml" />
<rule ref="rulesets/design.xml" />
<rule ref="rulesets/naming.xml">
<exclude name="ShortVariable" />
<exclude name="ShortMethodName" />
</rule>
<rule ref="rulesets/naming.xml/ShortVariable">
<priority>1</priority>
<properties>
<property name="minimum" value="2" />
</properties>
</rule>
<rule ref="rulesets/naming.xml/ShortMethodName">
<priority>1</priority>
<properties>
<property name="minimum" value="2" />
</properties>
</rule>
<rule ref="rulesets/unusedcode.xml" />
</ruleset>
Loading

0 comments on commit 9960841

Please sign in to comment.