Skip to content

Commit 381f4a3

Browse files
committed
Initial commit.
0 parents  commit 381f4a3

13 files changed

+356
-0
lines changed

.editorconfig

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
; top-most EditorConfig file
2+
root = true
3+
4+
; Unix-style newlines
5+
[*]
6+
end_of_line = LF
7+
8+
[*.php]
9+
indent_style = space
10+
indent_size = 4

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/build
2+
/composer.lock
3+
/vendor

.scrutinizer.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
checks:
2+
php:
3+
code_rating: true
4+
duplication: true
5+
6+
filter:
7+
paths:
8+
- src/*
9+
10+
tools:
11+
external_code_coverage:
12+
runs: 4
13+
timeout: 600
14+
php_analyzer: true
15+
php_cs_fixer:
16+
config: { level: psr2 }
17+
php_pdepend: true
18+
php_mess_detector:
19+
config:
20+
ruleset: ./phpmd.xml
21+
php_sim: true
22+
sensiolabs_security_checker: true
23+

.travis.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
language: php
2+
3+
php:
4+
- 5.6
5+
- 5.5
6+
- 5.4
7+
- 5.3
8+
- hhvm
9+
10+
matrix:
11+
allow_failures:
12+
- php: hhvm
13+
14+
before_script:
15+
- composer install --prefer-dist --dev
16+
17+
after_script:
18+
- vendor/bin/ocular code-coverage:upload --format=php-clover build/logs/clover.xml

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2018 Arul Kumaran
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Async
2+
3+
[![Build Status](https://travis-ci.org/logicalsteps/async.svg?branch=master)](https://travis-ci.org/logicalsteps/async)
4+
[![Code Coverage](https://scrutinizer-ci.com/g/logicalsteps/async/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/logicalsteps/async/?branch=master)
5+
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/logicalsteps/async/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/logicalsteps/async/?branch=master)
6+
[![Latest Stable Version](https://poser.pugx.org/logicalsteps/async/v/stable.svg)](https://packagist.org/packages/logicalsteps/async)
7+
[![Total Downloads](https://poser.pugx.org/logicalsteps/async/downloads.svg)](https://packagist.org/packages/logicalsteps/async)
8+
[![License](https://poser.pugx.org/logicalsteps/async/license.svg)](https://packagist.org/packages/logicalsteps/async)
9+
10+
@todo
11+
12+
## Installation
13+
14+
Async can be installed with [Composer](http://getcomposer.org)
15+
by adding it as a dependency to your project's composer.json file.
16+
17+
```json
18+
{
19+
"require": {
20+
"logicalsteps/async": "*"
21+
}
22+
}
23+
```
24+
25+
Please refer to [Composer's documentation](https://github.com/composer/composer/blob/master/doc/00-intro.md#introduction)
26+
for more detailed installation and usage instructions.
27+
28+
## Usage
29+
30+
@todo

build.xml

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project name="Async" default="build">
3+
4+
<property name="builddir" value="${basedir}/build"/>
5+
<property name="composer" value="${builddir}/composer.phar"/>
6+
7+
<target name="build" depends="lint,composer,phploc,pdepend,phpmd-ci,phpcpd,phpunit"/>
8+
9+
<target name="clean" description="Cleanup build artifacts">
10+
<delete dir="${builddir}"/>
11+
</target>
12+
13+
<target name="clean-src" description="Cleanup dependency source code">
14+
<delete file="${basedir}/composer.lock"/>
15+
<delete dir="${basedir}/vendor"/>
16+
</target>
17+
18+
<target name="clean-all" depends="clean,clean-src" description="Cleanup build artifacts and dependency source code"/>
19+
20+
<target name="php-check">
21+
<condition property="php" value="php">
22+
<not>
23+
<isset property="${php}"/>
24+
</not>
25+
</condition>
26+
</target>
27+
28+
<target name="prepare">
29+
<mkdir dir="${builddir}/coverage"/>
30+
<mkdir dir="${builddir}/logs"/>
31+
<mkdir dir="${builddir}/pdepend"/>
32+
<mkdir dir="${builddir}/test"/>
33+
</target>
34+
35+
<target name="lint" depends="php-check" description="Perform syntax check of source code files">
36+
<apply executable="${php}" failonerror="true">
37+
<arg value="-l" />
38+
<fileset dir="${basedir}/src">
39+
<include name="**/*.php" />
40+
</fileset>
41+
<fileset dir="${basedir}/test">
42+
<include name="**/*.php" />
43+
</fileset>
44+
</apply>
45+
</target>
46+
47+
<target name="composer-check" depends="prepare">
48+
<available file="${composer}" property="composer.present"/>
49+
</target>
50+
51+
<target name="composer-download" depends="composer-check" unless="composer.present">
52+
<property name="composer.noselfupdate" value="true"/>
53+
<get src="https://getcomposer.org/composer.phar" dest="${composer}"/>
54+
</target>
55+
56+
<target name="composer-selfupdate" depends="php-check,composer-download" unless="composer.noselfupdate">
57+
<exec executable="${php}">
58+
<arg value="${composer}"/>
59+
<arg value="self-update"/>
60+
<arg value="--quiet"/>
61+
</exec>
62+
</target>
63+
64+
<target name="composer" depends="composer-selfupdate" unless="composer.noupdate" description="Run composer update">
65+
<exec executable="${php}">
66+
<arg value="${composer}"/>
67+
<arg value="update"/>
68+
</exec>
69+
</target>
70+
71+
<target name="phploc" depends="composer" description="Measure project size using PHPLOC">
72+
<exec executable="${basedir}/vendor/bin/phploc">
73+
<arg value="--log-csv" />
74+
<arg value="${builddir}/logs/phploc.csv" />
75+
<arg path="${basedir}/src" />
76+
</exec>
77+
</target>
78+
79+
<target name="pdepend" depends="composer" description="Calculate software metrics using PHP_Depend">
80+
<exec executable="${basedir}/vendor/bin/pdepend">
81+
<arg value="--jdepend-xml=${builddir}/logs/jdepend.xml" />
82+
<arg value="--jdepend-chart=${builddir}/pdepend/dependencies.svg" />
83+
<arg value="--overview-pyramid=${builddir}/pdepend/overview-pyramid.svg" />
84+
<arg path="${basedir}/src" />
85+
</exec>
86+
</target>
87+
88+
<target name="phpmd" description="Perform mess detection using PHPMD, print human readable output.">
89+
<exec executable="${basedir}/vendor/bin/phpmd">
90+
<arg path="${basedir}/src" />
91+
<arg value="text" />
92+
<arg value="${basedir}/phpmd.xml" />
93+
</exec>
94+
</target>
95+
96+
<target name="phpmd-ci" description="Perform mess detection using PHPMD, creating a log file for the CI server">
97+
<exec executable="${basedir}/vendor/bin/phpmd">
98+
<arg path="${basedir}/src" />
99+
<arg value="xml" />
100+
<arg value="${basedir}/phpmd.xml" />
101+
<arg value="--reportfile" />
102+
<arg value="${basedir}/build/logs/pmd.xml" />
103+
</exec>
104+
</target>
105+
106+
<target name="phpcpd" description="Find duplicate code using PHPCPD">
107+
<exec executable="${basedir}/vendor/bin/phpcpd">
108+
<arg value="--log-pmd" />
109+
<arg value="${basedir}/build/logs/pmd-cpd.xml" />
110+
<arg path="${basedir}/src" />
111+
</exec>
112+
</target>
113+
114+
<target name="phpunit" depends="composer" description="Run unit tests with PHPUnit">
115+
<exec executable="${basedir}/vendor/bin/phpunit" failonerror="true"/>
116+
</target>
117+
118+
</project>

composer.json

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"name": "logicalsteps/async",
3+
"type": "library",
4+
"description": "async await implementation using generator function in php",
5+
"homepage": "https://github.com/logicalsteps/async",
6+
"license": "MIT",
7+
"authors": [
8+
{
9+
"name": "See contributors",
10+
"homepage": "https://github.com/logicalsteps/async/graphs/contributors"
11+
}
12+
],
13+
"support": {
14+
"issues": "https://github.com/logicalsteps/async/issues"
15+
},
16+
"require": {
17+
"php": ">=5.3.0"
18+
},
19+
"require-dev": {
20+
"pdepend/pdepend": "~1.0",
21+
"phploc/phploc": "~2.0",
22+
"phpmd/phpmd": "~1.0",
23+
"phpunit/phpunit": "~3.0",
24+
"scrutinizer/ocular": "~1.0",
25+
"sebastian/phpcpd": "~2.0"
26+
},
27+
"autoload": {
28+
"psr-4": {
29+
"LogicalSteps\\Async\\": "src/"
30+
}
31+
},
32+
"autoload-dev": {
33+
"psr-4": {
34+
"LogicalSteps\\Async\\Test\\": "test/"
35+
}
36+
}
37+
}

phpmd.xml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="PHP Project Starter Rulset" xmlns="http://pmd.sf.net/ruleset/1.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
5+
xsi:noNamespaceSchemaLocation=" http://pmd.sf.net/ruleset_xml_schema.xsd">
6+
7+
<description>PHP Project Starter Rulset: Adopted From Jenkins for Symfony 2</description>
8+
9+
<rule ref="rulesets/codesize.xml/CyclomaticComplexity" />
10+
<rule ref="rulesets/codesize.xml/ExcessiveClassComplexity" />
11+
<rule ref="rulesets/codesize.xml/ExcessiveClassLength" />
12+
<rule ref="rulesets/codesize.xml/ExcessiveMethodLength" />
13+
<rule ref="rulesets/codesize.xml/ExcessiveParameterList" />
14+
<rule ref="rulesets/design.xml/EvalExpression" />
15+
<rule ref="rulesets/design.xml/GotoStatement" />
16+
<rule ref="rulesets/naming.xml/ConstructorWithNameAsEnclosingClass" />
17+
<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter" />
18+
<rule ref="rulesets/unusedcode.xml/UnusedPrivateField" />
19+
<rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod" />
20+
21+
</ruleset>

phpunit.xml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit backupGlobals="false"
3+
backupStaticAttributes="false"
4+
convertErrorsToExceptions="true"
5+
convertNoticesToExceptions="true"
6+
convertWarningsToExceptions="true"
7+
processIsolation="false"
8+
stopOnFailure="false"
9+
syntaxCheck="false"
10+
bootstrap="test/bootstrap.php">
11+
12+
<testsuites>
13+
<testsuite name="Async">
14+
<directory suffix="Test.php">test</directory>
15+
</testsuite>
16+
</testsuites>
17+
18+
<filter>
19+
<whitelist>
20+
<directory suffix=".php">src</directory>
21+
</whitelist>
22+
</filter>
23+
24+
<logging>
25+
<log type="coverage-html" target="build/coverage" charset="UTF-8"/>
26+
<log type="coverage-clover" target="build/logs/clover.xml" charset="UTF-8"/>
27+
<log type="junit" target="build/logs/junit.xml" logIncompleteSkipped="false"/>
28+
</logging>
29+
30+
</phpunit>

src/Async.php

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace LogicalSteps\Async;
4+
5+
class Async
6+
{
7+
/**
8+
* A method used to test whether this class is autoloaded.
9+
*
10+
* @return bool
11+
*
12+
* @see \LogicalSteps\Async\Test\DummyTest
13+
*/
14+
public function autoloaded()
15+
{
16+
return true;
17+
}
18+
}

test/DummyTest.php

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace LogicalSteps\Async\Test;
4+
5+
use LogicalSteps\Async\Async;
6+
7+
class DummyTest extends \PHPUnit_Framework_TestCase
8+
{
9+
/**
10+
* A dummy test that calls a beacon method ensuring the class is autolaoded.
11+
*
12+
* @see https://github.com/cpliakas/php-project-starter/issues/19
13+
* @see https://github.com/cpliakas/php-project-starter/issues/21
14+
*/
15+
public function testAutoload()
16+
{
17+
$class = new Async();
18+
$this->assertTrue($class->autoloaded());
19+
}
20+
}

test/bootstrap.php

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
$autoloadFile = __DIR__ . '/../vendor/autoload.php';
4+
if (!file_exists($autoloadFile)) {
5+
throw new RuntimeException('Install dependencies to run phpunit.');
6+
}
7+
require_once $autoloadFile;

0 commit comments

Comments
 (0)