From a64e2d3ed392ee00c0d51f9e801efbf13dcbe411 Mon Sep 17 00:00:00 2001 From: William DURAND Date: Fri, 18 Oct 2013 00:15:25 +0200 Subject: [PATCH] Rename lib & classes --- README.md | 22 +++++++++---------- composer.json | 4 ++-- ...lidator.php => JsonpCallbackValidator.php} | 4 +--- tests/CallbackValidator/Tests/TestCase.php | 7 ------ ...est.php => JsonpCallbackValidatorTest.php} | 8 ++----- tests/bootstrap.php | 2 -- 6 files changed, 16 insertions(+), 31 deletions(-) rename src/{CallbackValidator/CallbackValidator.php => JsonpCallbackValidator.php} (96%) delete mode 100644 tests/CallbackValidator/Tests/TestCase.php rename tests/{CallbackValidator/Tests/CallbackValidatorTest.php => JsonpCallbackValidatorTest.php} (95%) diff --git a/README.md b/README.md index f3512f4..e60f225 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,18 @@ -CallbackValidator -================= +JsonpCallbackValidator +====================== -**CallbackValidator** allows you to **validate a JSONP callback** in order to -prevent XSS attacks. +**JsonpCallbackValidator** allows you to **validate a JSONP callback** in order +to prevent XSS attacks. [![Build -Status](https://travis-ci.org/willdurand/CallbackValidator.png?branch=master)](https://travis-ci.org/willdurand/CallbackValidator) +Status](https://travis-ci.org/willdurand/JsonpCallbackValidator.png?branch=master)](https://travis-ci.org/willdurand/JsonpCallbackValidator) Usage ----- ```php -$validator = new \CallbackValidator\CallbackValidator(); +$validator = new \JsonpCallbackValidator(); $validator->validate('JSONP.callback'); // returns `true` @@ -25,19 +25,19 @@ $validator->validate('(function xss(x){evil()})'); Installation ------------ -The recommended way to install CallbackValidator is through +The recommended way to install JsonpCallbackValidator is through [Composer](http://getcomposer.org/): ``` json { "require": { - "willdurand/callback-validator": "@stable" + "willdurand/jsonp-callback-validator": "@stable" } } ``` **Protip:** you should browse the -[`willdurand/callback-validator`](https://packagist.org/packages/willdurand/callback-validator) +[`willdurand/jsonp-callback-validator`](https://packagist.org/packages/willdurand/jsonp-callback-validator) page to choose a stable version to use, avoid the `@stable` meta constraint. @@ -69,5 +69,5 @@ Credits License ------- -CallbackValidator is released under the MIT License. See the bundled LICENSE -file for details. +JsonpCallbackValidator is released under the MIT License. See the bundled +LICENSE file for details. diff --git a/composer.json b/composer.json index 4aad25f..6ed1463 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "willdurand/callback-validator", + "name": "willdurand/jsonp-callback-validator", "description": "JSONP callback validator.", "type": "library", "license": "MIT", @@ -16,7 +16,7 @@ "phpunit/phpunit": "~3.7" }, "autoload": { - "psr-0": { "CallbackValidator": "src/" } + "psr-0": { "JsonpCallbackValidator": "src/" } }, "config": { "bin-dir": "bin" diff --git a/src/CallbackValidator/CallbackValidator.php b/src/JsonpCallbackValidator.php similarity index 96% rename from src/CallbackValidator/CallbackValidator.php rename to src/JsonpCallbackValidator.php index 3eb6211..455d631 100644 --- a/src/CallbackValidator/CallbackValidator.php +++ b/src/JsonpCallbackValidator.php @@ -1,14 +1,12 @@ */ -class CallbackValidator +class JsonpCallbackValidator { private $reservedKeywords = array( 'break', diff --git a/tests/CallbackValidator/Tests/TestCase.php b/tests/CallbackValidator/Tests/TestCase.php deleted file mode 100644 index 3bbb1bb..0000000 --- a/tests/CallbackValidator/Tests/TestCase.php +++ /dev/null @@ -1,7 +0,0 @@ -assertEquals($expected, $validator->validate($callback)); } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 7fff5a0..d6d4805 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -11,5 +11,3 @@ EOT ); } - -$loader->add('CallbackValidator\Tests', __DIR__);