Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
KanDisheng committed Feb 2, 2018
1 parent 681f980 commit 362f7ab
Show file tree
Hide file tree
Showing 16 changed files with 499 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .coveralls.yml
@@ -0,0 +1,2 @@
coverage_clover: workbench/code_coverage_report/clover/clover.xml
json_path: workbench/code_coverage_report/clover/coveralls.json
13 changes: 13 additions & 0 deletions .editorconfig
@@ -0,0 +1,13 @@
root=true

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

[*.php]
insert_final_newline=true
trim_trailing_whitespace=true
9 changes: 9 additions & 0 deletions .gitignore
@@ -0,0 +1,9 @@
# IDE
/.idea/

# Composer
/vendor/
/composer.lock

# Workbench
/workbench
18 changes: 18 additions & 0 deletions .travis.yml
@@ -0,0 +1,18 @@
language: php
matrix:
include:
- php: 5.3
dist: precise
php:
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
- 7.2
before_script:
- composer install
script:
- vendor/bin/phpunit -v
after_script:
- travis_retry vendor/bin/php-coveralls -v
27 changes: 27 additions & 0 deletions README.md
@@ -0,0 +1,27 @@
# KanDisheng DemoPHP

[![License](https://poser.pugx.org/KanDisheng/DemoPHP/license)](LICENSE)
[![Download](https://poser.pugx.org/KanDisheng/DemoPHP/downloads)](https://packagist.org/packages/KanDisheng/DemoPHP)
[![Stable](https://poser.pugx.org/KanDisheng/DemoPHP/version)](https://packagist.org/packages/KanDisheng/DemoPHP)
[![Unstable](https://poser.pugx.org/KanDisheng/DemoPHP/v/unstable)](https://packagist.org/packages/KanDisheng/DemoPHP)
[![composer.lock Available](https://poser.pugx.org/KanDisheng/DemoPHP/composerlock)](https://packagist.org/packages/KanDisheng/DemoPHP)
[![Build Status](https://travis-ci.org/KanDisheng/DemoPHP.svg?branch=master)](https://travis-ci.org/KanDisheng/DemoPHP)
[![Coverage Status](https://coveralls.io/repos/github/KanDisheng/DemoPHP/badge.svg?branch=master)](https://coveralls.io/github/KanDisheng/DemoPHP?branch=master)

> KanDisheng DemoPHP
## Manual

- [Version 1.0 简体中文](manual/1.0_SimplifiedChinese.md)

## Contributor

- [Candison November](http://www.kandisheng.com) - Founder

## Information

- [Homepage](http://www.kandisheng.com)
- [GitHub](https://github.com/KanDisheng/DemoPHP)
- [Packagist](https://packagist.org/packages/KanDisheng/DemoPHP)
- [Feedback](https://github.com/KanDisheng/DemoPHP/issues)
- [About KanDisheng](http://www.kandisheng.com)
34 changes: 34 additions & 0 deletions autoload.php
@@ -0,0 +1,34 @@
<?php

/**
* KanDisheng DemoPHP
* @author Candison November <www.kandisheng.com>
*/

$autoloaDirectory = array(
'class' => 'KanDisheng\\DemoPHP',
'interface' => 'KanDisheng\\DemoPHP'
);

foreach ($autoloaDirectory as $directory => $namespaceRoot) {
$directory = sprintf('%s%s%s', __DIR__, DIRECTORY_SEPARATOR, $directory);
spl_autoload_register(function ($className) use ($directory, $namespaceRoot) {
$directory = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $directory);
$directory = rtrim($directory, '/\\');
$namespaceRoot = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $namespaceRoot);
$namespaceRoot = trim($namespaceRoot, '/\\');
$className = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $className);
$className = trim($className, '/\\');
if (substr($className, 0, strlen($namespaceRoot)) == $namespaceRoot) {
$className = substr($className, strlen($namespaceRoot));
$className = ltrim($className, '/\\');
}
$extensionList = array('php', 'class.php');
foreach ($extensionList as $extension) {
$file = $directory . DIRECTORY_SEPARATOR . $className . '.' . $extension;
if (is_file($file) && is_readable($file)) {
require_once($file);
}
}
});
}
32 changes: 32 additions & 0 deletions class/Demo.php
@@ -0,0 +1,32 @@
<?php

/**
* KanDisheng DemoPHP
* @author Candison November <www.kandisheng.com>
*/

namespace KanDisheng\DemoPHP;

/**
* Class Demo
* @package KanDisheng\DemoPHP
*/
class Demo implements DemoInterface
{
/**
* Demo constructor.
*/
public function __construct()
{
}

/**
* Demo
* @param string $string
* @return string
*/
public function demo($string = '')
{
return $string;
}
}
71 changes: 71 additions & 0 deletions composer.json
@@ -0,0 +1,71 @@
{
"name": "kandisheng/demophp",
"type": "library",
"license": "Apache-2.0",
"homepage": "http://www.kandisheng.com",
"description": "KanDisheng DemoPHP",
"keywords": [
"KanDisheng",
"DemoPHP",
"PHP"
],
"support": {
"issues": "https://github.com/KanDisheng/DemoPHP/issues",
"source": "https://github.com/KanDisheng/DemoPHP"
},
"authors": [
{
"name": "Candison November",
"role": "Founder",
"email": "kandisheng@163.com",
"homepage": "http://www.kandisheng.com"
}
],
"autoload": {
"psr-4": {
"KanDisheng\\DemoPHP\\": [
"interface",
"class"
]
}
},
"autoload-dev": {
"psr-4": {
"KanDisheng\\DemoPHP\\Test\\": "test",
"KanDisheng\\DemoPHP\\Script\\": "script"
}
},
"require": {
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "*",
"phpmd/phpmd": "*",
"squizlabs/php_codesniffer": "*",
"satooshi/php-coveralls": "*",
"CodeMommy/TaskPHP": "*"
},
"scripts": {
"environment": [
"composer -V",
"php -v",
"php -m"
],
"update-project": [
"git pull",
"composer self-update",
"composer update"
],
"test": [
"composer phpunit",
"composer phpcbf",
"composer phpcs",
"composer phpmd"
],
"phpmd": "\"vendor/bin/phpmd\" autoload.php,interface,class,script,test,test_case text cleancode,codesize,controversial,design,naming,unusedcode",
"phpcs": "\"vendor/bin/phpcs\" autoload.php interface class script test test_case --standard=PSR2",
"phpcbf": "\"vendor/bin/phpcbf\" autoload.php interface class script test test_case --standard=PSR2",
"phpunit": "KanDisheng\\DemoPHP\\Script\\PHPUnit::start",
"clean": "KanDisheng\\DemoPHP\\Script\\Clean::start"
}
}
27 changes: 27 additions & 0 deletions interface/DemoInterface.php
@@ -0,0 +1,27 @@
<?php

/**
* KanDisheng DemoPHP
* @author Candison November <www.kandisheng.com>
*/

namespace KanDisheng\DemoPHP;

/**
* Interface DemoInterface
* @package KanDisheng\DemoPHP
*/
interface DemoInterface
{
/**
* DemoInterface constructor.
*/
public function __construct();

/**
* Demo
* @param string $string
* @return string
*/
public function demo($string = '');
}
1 change: 1 addition & 0 deletions manual/1.0_SimplifiedChinese.md
@@ -0,0 +1 @@
# KanDisheng DemoPHP 1.0 开发手册
19 changes: 19 additions & 0 deletions phpunit.xml
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="./vendor/autoload.php" colors="true">
<testsuites>
<testsuite name="KanDisheng DemoPHP">
<directory suffix="Test.php">./test</directory>
<exclude>./test_case</exclude>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./interface</directory>
<directory suffix=".php">./class</directory>
</whitelist>
</filter>
<logging>
<log type="coverage-clover" target="./workbench/code_coverage_report/clover/clover.xml"/>
<log type="coverage-html" target="./workbench/code_coverage_report/html"/>
</logging>
</phpunit>
42 changes: 42 additions & 0 deletions script/Clean.php
@@ -0,0 +1,42 @@
<?php

/**
* KanDisheng DemoPHP
* @author Candison November <www.kandisheng.com>
*/

namespace KanDisheng\DemoPHP\Script;

use CodeMommy\TaskPHP\Console;
use CodeMommy\TaskPHP\FileSystem;

/**
* Class Clean
* @package KanDisheng\DemoPHP\Script;
*/
class Clean
{
/**
* Clean constructor.
*/
public function __construct()
{
}

/**
* Start
*/
public static function start()
{
PHPUnit::clean();
$removeList = array(
'workbench'
);
$result = FileSystem::remove($removeList);
if ($result) {
Console::printLine('Clean Finished.', 'success');
} else {
Console::printLine('Clean Error.', 'error');
}
}
}

0 comments on commit 362f7ab

Please sign in to comment.