From 504882abf56b82f6bb0bd084709e6510958477a2 Mon Sep 17 00:00:00 2001 From: Ben Ramsey Date: Tue, 16 Jun 2015 10:46:13 -0500 Subject: [PATCH 1/4] Updates to the README --- README.md | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 7071c97..78aa511 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,13 @@ # Rhumsaa\Uuid for PHP -[![Build Status](https://travis-ci.org/ramsey/uuid.svg?branch=master)](https://travis-ci.org/ramsey/uuid) -[![Coverage Status](https://coveralls.io/repos/ramsey/uuid/badge.svg?branch=master)](https://coveralls.io/r/ramsey/uuid) -[![Latest Stable Version](https://poser.pugx.org/rhumsaa/uuid/v/stable)](https://packagist.org/packages/rhumsaa/uuid) -[![Total Downloads](https://poser.pugx.org/rhumsaa/uuid/downloads)](https://packagist.org/packages/rhumsaa/uuid) -[![Latest Unstable Version](https://poser.pugx.org/rhumsaa/uuid/v/unstable)](https://packagist.org/packages/rhumsaa/uuid) [![License](https://poser.pugx.org/rhumsaa/uuid/license)](https://packagist.org/packages/rhumsaa/uuid) +[![Join the chat at https://gitter.im/ramsey/uuid](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/ramsey/uuid?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) + +[![Build Status](https://travis-ci.org/ramsey/uuid.svg?branch=2.8)](https://travis-ci.org/ramsey/uuid) +[![Coverage Status](https://coveralls.io/repos/ramsey/uuid/badge.svg?branch=2.8)](https://coveralls.io/r/ramsey/uuid) +[![Latest Stable Version](https://poser.pugx.org/ramsey/uuid/v/stable)](https://packagist.org/packages/ramsey/uuid) +[![Total Downloads](https://poser.pugx.org/ramsey/uuid/downloads)](https://packagist.org/packages/ramsey/uuid) +[![Latest Unstable Version](https://poser.pugx.org/ramsey/uuid/v/unstable)](https://packagist.org/packages/ramsey/uuid) +[![License](https://poser.pugx.org/ramsey/uuid/license)](https://packagist.org/packages/ramsey/uuid) ## About @@ -97,7 +100,7 @@ composer.phar require "ramsey/uuid=~2.8" [rfc4122]: http://tools.ietf.org/html/rfc4122 [javauuid]: http://docs.oracle.com/javase/6/docs/api/java/util/UUID.html [pyuuid]: http://docs.python.org/3/library/uuid.html -[packagist]: https://packagist.org/packages/rhumsaa/uuid +[packagist]: https://packagist.org/packages/ramsey/uuid [composer]: http://getcomposer.org/ [moontoast\math]: https://github.com/moontoast/math -[apidocs]: http://ramsey.github.io/uuid/apidocs +[apidocs]: http://docs.benramsey.com/ramsey-uuid/2.8/ From fb8b580d8157eb627843814617718dbba5a591bf Mon Sep 17 00:00:00 2001 From: Ben Ramsey Date: Tue, 16 Jun 2015 11:58:43 -0500 Subject: [PATCH 2/4] Adding more testing tools to the 2.8 branch --- composer.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 4a82193..6128c03 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,9 @@ "symfony/console": "~2.3", "doctrine/dbal": ">=2.3", "phpunit/phpunit": "~4.1", - "satooshi/php-coveralls": "~0.6" + "satooshi/php-coveralls": "~0.6", + "squizlabs/php_codesniffer": "^2.3", + "jakub-onderka/php-parallel-lint": "^0.9.0" }, "bin": ["bin/uuid"], "suggest": { From 72f86851f845990d37840f186a9133bb77206f1d Mon Sep 17 00:00:00 2001 From: Ben Ramsey Date: Tue, 16 Jun 2015 11:58:58 -0500 Subject: [PATCH 3/4] Fixing coding standards violations --- src/Console/Command/DecodeCommand.php | 1 - src/Uuid.php | 16 ++++------------ 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/src/Console/Command/DecodeCommand.php b/src/Console/Command/DecodeCommand.php index 0c1758f..97c9728 100644 --- a/src/Console/Command/DecodeCommand.php +++ b/src/Console/Command/DecodeCommand.php @@ -64,7 +64,6 @@ class DecodeCommand extends Command )); if ($uuid->getVariant() != Uuid::RFC_4122) { - $table->addRows(array( array('decode:', 'variant:', 'Not an RFC 4122 UUID'), )); diff --git a/src/Uuid.php b/src/Uuid.php index 81dd646..312b5dc 100644 --- a/src/Uuid.php +++ b/src/Uuid.php @@ -327,7 +327,8 @@ final class Uuid * * @return \DateTime A PHP DateTime representation of the date * @throws Exception\UnsupportedOperationException If this UUID is not a version 1 UUID - * @throws Exception\UnsatisfiedDependencyException if called on a 32-bit system and Moontoast\Math\BigNumber is not present + * @throws Exception\UnsatisfiedDependencyException if called on a 32-bit system + * and Moontoast\Math\BigNumber is not present */ public function getDateTime() { @@ -335,30 +336,22 @@ final class Uuid throw new Exception\UnsupportedOperationException('Not a time-based UUID'); } - if (self::is64BitSystem()) { - $unixTime = ($this->getTimestamp() - 0x01b21dd213814000) / 1e7; $unixTime = number_format($unixTime, 0, '', ''); - } elseif (self::hasBigNumber()) { - $time = \Moontoast\Math\BigNumber::baseConvert($this->getTimestampHex(), 16, 10); - $ts = new \Moontoast\Math\BigNumber($time, 20); $ts->subtract('122192928000000000'); $ts->divide('10000000.0'); $ts->round(); $unixTime = $ts->getValue(); - } else { - throw new Exception\UnsatisfiedDependencyException( 'When calling ' . __METHOD__ . ' on a 32-bit system, ' . 'Moontoast\Math\BigNumber must be present in order ' . 'to extract DateTime from version 1 UUIDs' ); - } return new \DateTime("@{$unixTime}"); @@ -1078,12 +1071,12 @@ final class Uuid * @param int $sec Seconds since the Unix Epoch * @param int $usec Microseconds * @return array - * @throws Exception\UnsatisfiedDependencyException if called on a 32-bit system and Moontoast\Math\BigNumber is not present + * @throws Exception\UnsatisfiedDependencyException if called on a 32-bit system + * and Moontoast\Math\BigNumber is not present */ protected static function calculateUuidTime($sec, $usec) { if (self::is64BitSystem()) { - // 0x01b21dd213814000 is the number of 100-ns intervals between the // UUID epoch 1582-10-15 00:00:00 and the Unix epoch 1970-01-01 00:00:00. $uuidTime = ($sec * 10000000) + ($usec * 10) + 0x01b21dd213814000; @@ -1096,7 +1089,6 @@ final class Uuid } if (self::hasBigNumber()) { - $uuidTime = new \Moontoast\Math\BigNumber('0'); $sec = new \Moontoast\Math\BigNumber($sec); From 72930cd28380d641a29fb1a503c9fce5048649b6 Mon Sep 17 00:00:00 2001 From: Ben Ramsey Date: Tue, 16 Jun 2015 12:04:06 -0500 Subject: [PATCH 4/4] Adding contributing guide --- CONTRIBUTING.md | 62 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..3cd9dc1 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,62 @@ +# Contributing + +Contributions are welcome. We accept pull requests on [GitHub](https://github.com/ramsey/uuid). + +_**Please note:** Currently, all active development is working towards the major 3.0 release. This work is taking place in the `master` branch. If you have patches for the 2.x series, please send those to the `2.8` branch._ + +## Team members + +* [Ben Ramsey](https://github.com/ramsey) - original author and maintainer +* [Marijn Huizendveld](https://github.com/marijn) - contributor, author of UUID type definition for Doctrine DBAL +* [Thibaud Fabre](https://github.com/aztech-dev) - contributor, lead developer for version 3.0.0 re-architecture + +## Communication Channels + +You can find help and discussion in the following places: + +* Gitter chat: +* GitHub Issues: +* Wiki: + +## Reporting Bugs + +Bugs are tracked in our project's [issue tracker](https://github.com/ramsey/uuid/issues). + +When submitting a bug report, please include enough information for us to reproduce the bug. A good bug report includes the following sections: + +* Expected outcome +* Actual outcome +* Steps to reproduce, including sample code +* Any other information that will help us debug and reproduce the issue, including stack traces, system/environment information, and screenshots + +**Please do not include passwords or any personally identifiable information in your bug report and sample code.** + +## Fixing Bugs + +We welcome pull requests to fix bugs! + +If you see a bug report that you'd like to fix, please feel free to do so. Following the directions and guidelines described in the "Adding New Features" section below, you may create bugfix branches and send us pull requests. + +## Adding New Features + +If you have an idea for a new feature, it's a good idea to check out our [issues](https://github.com/ramsey/uuid/issues) or active [pull requests](https://github.com/ramsey/uuid/pulls) first to see if the feature is already being worked on. If not, feel free to submit an issue first, asking whether the feature is beneficial to the project. This will save you from doing a lot of development work only to have your feature rejected. We don't enjoy rejecting your hard work, but some features just don't fit with the goals of the project. + +When you do begin working on your feature, here are some guidelines to consider: + +* Your pull request description should clearly detail the changes you have made. We will use this description to add to our CHANGELOG. If there is no description or it does not adequately describe your feature, we will ask you to update the description. +* We following the **[PSR-2 coding standard](http://www.php-fig.org/psr/psr-2/)**. Please ensure your code does, too. +* Please **write tests** for any new features you add. +* Please **ensure that tests pass** before submitting your pull request. We have Travis CI automatically running tests for pull requests. However, running the tests locally will help save time. +* **Use topic/feature branches.** Please do not ask us to pull from your master branch. +* **Submit one feature per pull request.** If you have multiple features you wish to submit, please break them up into separate pull requests. +* **Send coherent history**. Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before submitting. + +## Running Tests + +The following tests must pass before we will accept a pull request. If any of these do not pass, it will result in a complete build failure. Before you can run these, be sure to `composer install`. + +``` +./vendor/bin/parallel-lint src tests +./vendor/bin/phpunit --coverage-text +./vendor/bin/phpcs src --standard=psr2 -sp +```