Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
chadicus committed Oct 5, 2015
0 parents commit ae6bf07
Show file tree
Hide file tree
Showing 14 changed files with 1,796 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
service_name: travis-ci
src_dir: .
coverage_clover: clover.xml
json_path: coveralls-upload.json
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/coverage/
/vendor/
24 changes: 24 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
filter:
excluded_paths:
- 'vendor/*'
- 'tests/*'
before_commands:
- 'composer install'
tools:
php_analyzer: true
php_mess_detector: true
php_code_sniffer:
config:
standard: PSR2
sensiolabs_security_checker: true
php_loc:
excluded_dirs:
- vendor
- tests
php_pdepend: true
php_sim: true
build_failure_conditions:
- 'elements.rating(<= B).new.exists'
- 'issues.label("coding-style").new.exists'
- 'issues.severity(>= MAJOR).new.exists'
- 'project.metric("scrutinizer.quality", < 9)'
11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
sudo: false
language: php
php:
- 5.4
- 5.5
- 5.6
- 7
- hhvm
install: composer install
script: ./vendor/bin/phpunit --coverage-clover clover.xml
after_success: sh -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then ./vendor/bin/coveralls -v; fi'
15 changes: 15 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Contribution Guidelines
We welcome you to report [issues](https://github.com/dominionenterprises/util-time-php/issues) or submit
[pull requests](https://github.com/dominionenterprises/util-time-php/pulls). While the below guidelines are necessary to get code merged, you can
submit pull requests that do not adhere to them and we will try to take care of them in our spare time. We are a smallish group of developers,
though, so if you can make sure the build is passing 100%, that would be very useful.

We recommend including details of your particular usecase(s) with any issues or pull requests. We love to hear how our libraries are being used
and we can get things merged in quicker when we understand its expected usage.

## Building
Our [build](build.php) runs the code through our [coding standard](http://www.php-fig.org/psr/psr-2/) and through our
test suite. Failures in either will keep us from merging the pull request. The test suite MUST have 100% code coverage in the report.

## Travis CI
Our [Travis build](https://travis-ci.org/dominionenterprises/util-time-php) executes the build above against pull requests.
49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# util-time-php
[![Build Status](https://travis-ci.org/dominionenterprises/util-time-php.svg?branch=master)](https://travis-ci.org/dominionenterprises/util-time-php)
[![Scrutinizer Code Quality](http://img.shields.io/scrutinizer/g/dominionenterprises/util-time-php.svg?style=flat)](https://scrutinizer-ci.com/g/dominionenterprises/util-time-php/)
[![Coverage Status](https://coveralls.io/repos/dominionenterprises/util-time-php/badge.svg?branch=master&service=github)](https://coveralls.io/github/dominionenterprises/util-time-php?branch=master)

[![Latest Stable Version](http://img.shields.io/packagist/v/dominionenterprises/util-time.svg?style=flat)](https://packagist.org/packages/dominionenterprises/util-time)
[![Total Downloads](http://img.shields.io/packagist/dt/dominionenterprises/util-time.svg?style=flat)](https://packagist.org/packages/dominionenterprises/util-time)
[![License](http://img.shields.io/packagist/l/dominionenterprises/util-time.svg?style=flat)](https://packagist.org/packages/dominionenterprises/util-time)

A collection of general util-timeities for making common programming tasks easier.

## Requirements

util-time-php requires PHP 5.4 (or later).

##Composer
To add the library as a local, per-project dependency use [Composer](http://getcomposer.org)! Simply add a dependency on
`dominionenterprises/util-time` to your project's `composer.json` file such as:

```json
{
"require": {
"dominionenterprises/util-time": "~1.0"
}
}
```
##Documentation
Found in the [source](src) itself, take a look!

##Contact
Developers may be contacted at:

* [Pull Requests](https://github.com/dominionenterprises/util-time-php/pulls)
* [Issues](https://github.com/dominionenterprises/util-time-php/issues)

##Project Build
With a checkout of the code get [Composer](http://getcomposer.org) in your PATH and run:

```sh
./build.php
```

There is also a [docker](http://www.docker.com/)-based
[fig](http://www.fig.sh/) configuration that will execute the build inside a docker container. This is an easy way to build the application:
```sh
fig run build
```

For more information on our build process, read through out our [Contribution Guidelines](CONTRIBUTING.md).
41 changes: 41 additions & 0 deletions build.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env php
<?php
chdir(__DIR__);

$returnStatus = null;
passthru('composer install', $returnStatus);
if ($returnStatus !== 0) {
exit(1);
}

require 'vendor/autoload.php';

$phpcsCLI = new PHP_CodeSniffer_CLI();
$phpcsArguments = [
'standard' => ['PSR2'],
'files' => ['src', 'tests', 'build.php'],
];
$phpcsViolations = $phpcsCLI->process($phpcsArguments);
if ($phpcsViolations > 0) {
exit(1);
}

$phpunitConfiguration = PHPUnit_Util_Configuration::getInstance(__DIR__ . '/phpunit.xml');
$phpunitArguments = ['coverageHtml' => __DIR__ . '/coverage', 'configuration' => $phpunitConfiguration];
$testRunner = new PHPUnit_TextUI_TestRunner();
$result = $testRunner->doRun($phpunitConfiguration->getTestSuiteConfiguration(), $phpunitArguments);
if (!$result->wasSuccessful()) {
exit(1);
}

$cloverCoverage = new PHP_CodeCoverage_Report_Clover();
file_put_contents('clover.xml', $cloverCoverage->process($result->getCodeCoverage()));

$coverageFactory = new PHP_CodeCoverage_Report_Factory();
$coverageReport = $coverageFactory->create($result->getCodeCoverage());
if ($coverageReport->getNumExecutedLines() !== $coverageReport->getNumExecutableLines()) {
file_put_contents('php://stderr', "Code coverage was NOT 100%\n");
exit(1);
}

echo "Code coverage was 100%\n";
34 changes: 34 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "dominionenterprises/util-time",
"description": "A collection of utility classes for working with times",
"keywords": ["utility", "time"],
"authors": [
{
"name": "Chad Gray",
"email": "chadwickgray@gmail.com",
"role": "Developer"
},
{
"name": "Spencer Rinehart",
"email": "anubis@overthemonkey.com",
"role": "Developer"
},
{
"name": "Jonathan Gaillard",
"email": "jonathan.gaillard@dominionenterprises.com",
"role": "Developer"
}
],
"license": "MIT",
"require": {
"php": "~5.4 || ~7.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
"satooshi/php-coveralls": "~0.6.1",
"squizlabs/php_codesniffer": "~2.0"
},
"autoload": {
"psr-4": { "DominionEnterprises\\Util\\": "src" }
}
}

0 comments on commit ae6bf07

Please sign in to comment.