Skip to content

Commit

Permalink
Set up library
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Wolf committed Jul 7, 2015
1 parent 9fa01c5 commit 580264d
Show file tree
Hide file tree
Showing 19 changed files with 308 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
src_dir: src
service_name: travis-ci
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text eol=lf
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
vendor
composer.lock
composer.phar
phpunit.xml
23 changes: 23 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
language: php

php:
- 5.4
- 5.5
- 5.6
- hhvm

matrix:
allow_failures:
- php: hhvm

before_script:
- composer self-update
- composer install --dev --prefer-source --no-interaction

script:
- php vendor/bin/phpunit -c travis.phpunit.xml
- php vendor/bin/phpmd src xml build/config/phpmd.xml --reportfile build/logs/pmd.xml
- php vendor/bin/phpcs --report=checkstyle --report-file=build/logs/checkstyle.xml --standard=build/config/phpcs.xml -v ./src/ ./tests/

after_script:
- php vendor/bin/coveralls
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2014 DETAIL NET

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
# dfw-filtering
DETAIL Framework library for input filtering
# DETAIL Framework library for index based filtering

[![Build Status](https://travis-ci.org/detailnet/dfw-filtering.svg?branch=master)](https://travis-ci.org/detailnet/dfw-filtering)
[![Coverage Status](https://img.shields.io/coveralls/detailnet/dfw-filtering.svg)](https://coveralls.io/r/detailnet/dfw-filtering)
[![Latest Stable Version](https://poser.pugx.org/detailnet/dfw-filtering/v/stable.svg)](https://packagist.org/packages/detailnet/dfw-filtering)
[![Latest Unstable Version](https://poser.pugx.org/detailnet/dfw-filtering/v/unstable.svg)](https://packagist.org/packages/detailnet/dfw-filtering)
5 changes: 5 additions & 0 deletions build/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*
!config
!config/*
!logs
!.gitignore
31 changes: 31 additions & 0 deletions build/config/phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0"?>
<ruleset name="DETAIL NET PHPCS rule set">
<description>The coding standard for a DETAIL NET PHP application</description>
<exclude-pattern>*/img/*</exclude-pattern>
<exclude-pattern>*/images/*</exclude-pattern>
<exclude-pattern>*/less/*</exclude-pattern>
<exclude-pattern>*/css/*</exclude-pattern>
<exclude-pattern>*/js/*</exclude-pattern>
<exclude-pattern>*.html</exclude-pattern>
<exclude-pattern>*.twig</exclude-pattern>
<exclude-pattern>*.yml</exclude-pattern>
<exclude-pattern>*.xml</exclude-pattern>
<exclude-pattern>*.txt</exclude-pattern>
<exclude-pattern>*.less</exclude-pattern>
<exclude-pattern>*.css</exclude-pattern>
<exclude-pattern>*.js</exclude-pattern>
<exclude-pattern>*.jpg</exclude-pattern>
<exclude-pattern>*.jpeg</exclude-pattern>
<exclude-pattern>*.png</exclude-pattern>
<exclude-pattern>*.gif</exclude-pattern>

<!-- Include the whole PSR-2 standard -->
<rule ref="PSR2"/>
<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="140"/>
<property name="absoluteLineLimit" value="0"/>
</properties>
</rule>

</ruleset>
56 changes: 56 additions & 0 deletions build/config/phpmd.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0"?>
<ruleset name="DETAIL NET PHPMD rule set"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">

<description>Ruleset for all DETAIL NET projects</description>

<rule ref="rulesets/unusedcode.xml" />

<rule ref="rulesets/design.xml">
<exclude name="CouplingBetweenObjects"/>
</rule>

<rule ref="rulesets/naming.xml">
<exclude name="ShortVariable"/>
<exclude name="LongVariable"/>
<exclude name="BooleanGetMethodName"/>
</rule>
<rule ref="rulesets/naming.xml/ShortVariable">
<properties>
<property name="minimum" value="2" />
</properties>
</rule>
<rule ref="rulesets/naming.xml/LongVariable">
<properties>
<property name="maximum" value="30" />
</properties>
</rule>

<rule ref="rulesets/codesize.xml">
<exclude name="TooManyMethods"/>
<exclude name="ExcessiveClassComplexity"/>
<exclude name="NPathComplexity"/>
</rule>
<rule ref="rulesets/codesize.xml/TooManyMethods">
<properties>
<property name="maxmethods" value="20" />
</properties>
</rule>
<rule ref="rulesets/codesize.xml/ExcessiveClassComplexity">
<properties>
<property name="maximum" value="70" />
</properties>
</rule>
<rule ref="rulesets/codesize.xml/NPathComplexity">
<properties>
<property name="minimum" value="300" />
</properties>
</rule>

<rule ref="rulesets/controversial.xml">
<exclude name="Superglobals"/>
</rule>
</ruleset>
2 changes: 2 additions & 0 deletions build/logs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
55 changes: 55 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"name": "detailnet/dfw-filtering",
"description": "DETAIL Framework library for input filtering",
"type": "library",
"keywords": [
"dfw",
"detailnet",
"input",
"filtering"
],
"homepage": "https://github.com/detailnet/dfw-filtering/",
"license": "MIT",
"authors": [
{
"name": "Ivan Wolf",
"email": "ivan.wolf@detailnet.ch"
}
],
"require": {
"php": ">=5.5.0"
},
"require-dev": {
"phpunit/phpunit": "~4.6",
"squizlabs/php_codesniffer" : "~2.3",
"phpmd/phpmd": "~2.2",
"satooshi/php-coveralls": "dev-master"
},
"autoload": {
"psr-0": {
"Detail\\Filtering\\": "src/"
}
},
"autoload-dev": {
"psr-0": {
"DetailTest\\Filtering\\": "tests/"
}
},
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
}
},
"archive": {
"exclude": [
"!vendor",
"tests",
"*phpunit.xml",
".coveralls.yml",
".travis.yml",
"build.xml",
"build.properties",
"composer.phar"
]
}
}
29 changes: 29 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<phpunit
bootstrap="./tests/bootstrap.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
verbose="true"
stopOnFailure="false"
processIsolation="false"
backupGlobals="false"
syntaxCheck="true"
>
<testsuite name="Detail\Filtering Test Suite">
<directory>./tests/DetailTest/Filtering</directory>
</testsuite>

<filter>
<whitelist>
<directory suffix=".php">./src</directory>
</whitelist>
</filter>

<logging>
<log type="coverage-text" target="php://stdout" showUncoveredFiles="true"/>
<log type="coverage-html" target="./build/coverage" title="Detail\Filtering" charset="UTF-8" yui="true" highlight="true" lowUpperBound="35" highLowerBound="70"/>
<log type="coverage-clover" target="./build/logs/clover.xml"/>
<log type="junit" target="./build/logs/junit.xml" logIncompleteSkipped="false"/>
</logging>
</phpunit>
7 changes: 7 additions & 0 deletions src/Detail/Search/Exception/ExceptionInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Detail\Filtering\Exception;

interface ExceptionInterface
{
}
8 changes: 8 additions & 0 deletions src/Detail/Search/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace Detail\Filtering\Exception;

class InvalidArgumentException extends \InvalidArgumentException implements
ExceptionInterface
{
}
8 changes: 8 additions & 0 deletions src/Detail/Search/Exception/RuntimeException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace Detail\Filtering\Exception;

class RuntimeException extends \RuntimeException implements
ExceptionInterface
{
}
1 change: 1 addition & 0 deletions tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
configuration.php
18 changes: 18 additions & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

$loader = null;
$basePath = realpath(__DIR__ . '/..') . '/';

if (file_exists($basePath . 'vendor/autoload.php')) {
$loader = include $basePath . 'vendor/autoload.php';
} else {
throw new RuntimeException(
$basePath . 'vendor/autoload.php could not be found. Did you run `php composer.phar install`?'
);
}

$loader->add('DetailTest\Filtering', __DIR__);

if (!$config = @include $basePath . 'tests/configuration.php') {
$config = require $basePath . 'tests/configuration.php.dist';
}
3 changes: 3 additions & 0 deletions tests/configuration.php.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

return array();
27 changes: 27 additions & 0 deletions travis.phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<phpunit
bootstrap="./tests/bootstrap.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
verbose="true"
stopOnFailure="false"
processIsolation="false"
backupGlobals="false"
syntaxCheck="true"
>
<testsuite name="Detail\Filtering Test Suite">
<directory>./tests/DetailTest/Filtering</directory>
</testsuite>

<filter>
<whitelist>
<directory suffix=".php">./src</directory>
</whitelist>
</filter>

<logging>
<log type="coverage-clover" target="./build/logs/clover.xml"/>
<log type="junit" target="./build/logs/junit.xml" logIncompleteSkipped="false"/>
</logging>
</phpunit>

0 comments on commit 580264d

Please sign in to comment.