Skip to content

Commit

Permalink
Add foundation for DataValues/Validators ~=[,,_,,]:3
Browse files Browse the repository at this point in the history
  • Loading branch information
JeroenDeDauw committed Nov 17, 2013
0 parents commit f622b9b
Show file tree
Hide file tree
Showing 9 changed files with 559 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
*~
*.kate-swp
*.swp

!.*

.idea/
build/
vendor/

composer.phar
composer.lock
12 changes: 12 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
inherit: true

tools:
php_code_coverage: true
php_code_sniffer: true
php_cpd: true
php_cs_fixer: true
php_loc: true
php_mess_detector: true
php_pdepend: true
php_analyzer: true
sensiolabs_security_checker: true
16 changes: 16 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
language: php

php:
- 5.3
- 5.4
- 5.5

before_script:
- composer install

script:
- phpunit --coverage-clover build/logs/clover.xml

after_script:
- composer require satooshi/php-coveralls:dev-master
- php vendor/bin/coveralls -v
347 changes: 347 additions & 0 deletions COPYING

Large diffs are not rendered by default.

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



[![Build Status](https://secure.travis-ci.org/DataValues/Validators.png?branch=master)](http://travis-ci.org/DataValues/Validators)

On [Packagist](https://packagist.org/packages/data-values/validators):
[![Latest Stable Version](https://poser.pugx.org/data-values/validators/version.png)](https://packagist.org/packages/data-values/validators)
[![Download count](https://poser.pugx.org/data-values/validators/d/total.png)](https://packagist.org/packages/data-values/validators)

## Installation

The recommended way to use this library is via [Composer](http://getcomposer.org/).

### Composer

To add this package as a local, per-project dependency to your project, simply add a
dependency on `data-values/validators` to your project's `composer.json` file.
Here is a minimal example of a `composer.json` file that just defines a dependency on
version 1.0 of this package:

{
"require": {
"data-values/validators": "1.0.*"
}
}

### Manual

Get the code of this package, either via git, or some other means. Also get all dependencies.
You can find a list of the dependencies in the "require" section of the composer.json file.
Then take care of autoloading the classes defined in the src directory.

## Tests

This library comes with a set up PHPUnit tests that cover all non-trivial code. You can run these
tests using the PHPUnit configuration file found in the root directory. The tests can also be run
via TravisCI, as a TravisCI configuration file is also provided in the root directory.

## Authors

DataValues Validators has been written by the Wikidata team, as [Wikimedia Germany]
(https://wikimedia.de) employees for the [Wikidata project](https://wikidata.org/).

It is based upon and contains a lot of code written by [Jeroen De Dauw]
(https://github.com/JeroenDeDauw) for the [Maps](https://github.com/JeroenDeDauw/Maps) and
[Semantic MediaWiki](https://semantic-mediawiki.org/) projects.

## Release notes

### 0.1 (dev)

Initial release with these features:

* DimensionValidator
* ListValidator
* NullValidator
* RangeValidator
* StringValidator
* TitleValidator

## Links

* [DataValues Validators on Packagist](https://packagist.org/packages/data-values/validators)
* [DataValues Validators on TravisCI](https://travis-ci.org/DataValues/Validators)
32 changes: 32 additions & 0 deletions Validators.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

/**
* Entry point of the DataValues Validators library.
*
* @since 0.1
* @codeCoverageIgnore
*
* @licence GNU GPL v2+
* @author Jeroen De Dauw < [email protected] >
*/

if ( defined( 'DATAVALUES_VALIDATORS_VERSION' ) ) {
// Do not initialize more then once.
return 1;
}

define( 'DATAVALUES_VALIDATORS_VERSION', '0.1 beta' );

if ( defined( 'MEDIAWIKI' ) ) {
$GLOBALS['wgExtensionCredits']['datavalues'][] = array(
'path' => __DIR__,
'name' => 'DataValues Number',
'version' => DATAVALUES_NUMBER_VERSION,
'author' => array(
'[https://www.mediawiki.org/wiki/User:Jeroen_De_Dauw Jeroen De Dauw]',
'The Wikidata team',
),
'url' => 'https://github.com/DataValues/Validators',
'description' => 'Numerical value objects, parsers and formatters',
);
}
45 changes: 45 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "data-values/validators",
"type": "library",
"description": "",
"keywords": [
"datavalues",
"valueparsers",
"valueformatters",
"wikidata",
"validators",
"validation"
],
"homepage": "https://github.com/DataValues/Validators",
"license": "GPL-2.0+",
"authors": [
{
"name": "Jeroen De Dauw",
"email": "[email protected]",
"homepage": "http://jeroendedauw.com",
"role": "Developer"
},
{
"name": "The Wikidata team",
"role": "Developer"
}
],
"support": {
"irc": "irc://irc.freenode.net/wikidata"
},
"require": {
"php": ">=5.3.0",
"data-values/data-values": "~0.1",
"data-values/interfaces": "~0.1",
"data-values/common": "*"
},
"minimum-stability" : "dev",
"autoload": {
"files" : [
"Validators.php"
],
"psr-0": {
"ValueValidators\\": "src"
}
}
}
25 changes: 25 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="tests/bootstrap.php"
cacheTokens="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
strict="true"
verbose="true">
<testsuites>
<testsuite name="DataValuesValidators">
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
</whitelist>
</filter>
</phpunit>
5 changes: 5 additions & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

echo exec( 'composer update' ) . "\n";

require_once( __DIR__ . '/../vendor/autoload.php' );

0 comments on commit f622b9b

Please sign in to comment.