Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup for stable release #3

Merged
merged 6 commits into from
May 19, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 36 additions & 17 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,39 @@
<?php
$config = Symfony\CS\Config\Config::create();
$config->level(null);
$config->fixers(
array(
'indentation',
'linefeed',
'trailing_spaces',
'short_tag',
'visibility',
'php_closing_tag',
'braces',
'function_declaration',
'psr0',
'elseif',
'eof_ending',
'unused_use',
)
$finder = Symfony\CS\Finder\DefaultFinder::create()
->in(__DIR__);

$config = Symfony\CS\Config\Config::create()
->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
->finder($finder)
->fixers(
[
'blankline_after_open_tag',
'extra_empty_lines',
'no_blank_lines_after_class_opening',
'no_empty_lines_after_phpdocs',
'operators_spaces',
'duplicate_semicolon',
'namespace_no_leading_whitespace',
'phpdoc_indent',
'phpdoc_no_empty_return',
'phpdoc_no_package',
'phpdoc_params',
'phpdoc_separation',
'phpdoc_to_comment',
'phpdoc_trim',
'phpdoc_var_without_name',
'remove_leading_slash_use',
'remove_lines_between_uses',
'return',
'single_array_no_trailing_comma',
'single_quote',
'spaces_before_semicolon',
'spaces_cast',
'standardize_not_equal',
'ternary_spaces',
'whitespacy_lines',
'ordered_use',
'short_array_syntax'
]
);
return $config;
11 changes: 6 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ php:
- 5.5
- 5.6
- hhvm
- 7

before_script:
- wget https://scrutinizer-ci.com/ocular.phar
- composer install --prefer-source
install: travis_retry composer install --no-interaction --prefer-source

script:
- phpunit --coverage-text --coverage-clover=coverage.clover
- if [ "$TRAVIS_PHP_VERSION" == "hhvm" ]; then phpunit; fi
- if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then phpunit --coverage-text --coverage-clover=coverage.clover; fi

after_script:
- php ocular.phar code-coverage:upload --format=php-clover coverage.clover
- wget https://scrutinizer-ci.com/ocular.phar
- if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2015 Akihito Koriyama

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.
24 changes: 0 additions & 24 deletions Licence.txt

This file was deleted.

19 changes: 6 additions & 13 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
"name": "ray/web-param-module",
"description":"Binds the value(s) of a web context to method parameter.",
"keywords":[
"Ray.Di Module", "Web context", "Testability"
"Ray.Di Module", "Web context", "Testability"
],
"license": "BSD-3-Clause",
"license": "MIT",
"require": {
"ray/di": "~2.0",
"doctrine/cache": "~1.0"
},
"autoload":{
"psr-4":{
"Ray\\WebContextParam\\": "src/"
Expand All @@ -16,16 +20,5 @@
"Ray\\WebContextParam\\": "tests/",
"Ray\\WebContextParam\\": "tests/Fake"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"extra": {
"branch-alias": {
"dev-develop": "0.1.x-dev"
}
},
"require": {
"ray/di": "~2.0@dev",
"doctrine/cache": "~1.0"
}
}
4 changes: 3 additions & 1 deletion phpmd.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<ruleset xmlns="http://pmd.sf.net/ruleset/1.0.0"
<ruleset
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>PHP.Skeleton rule set</description>
<!--codesize-->
<rule ref="rulesets/codesize.xml/CyclomaticComplexity" />
<rule ref="rulesets/codesize.xml/NPathComplexity" />
Expand Down
4 changes: 2 additions & 2 deletions src/Annotation/AbstractWebContextParam.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
/**
* This file is part of the Ray.WebContextParam
* This file is part of the Ray.WebContextParam.
*
* @license http://opensource.org/licenses/bsd-license.php BSD
* @license http://opensource.org/licenses/bsd-license.php MIT
*/
namespace Ray\WebContextParam\Annotation;

Expand Down
4 changes: 2 additions & 2 deletions src/Annotation/CookieParam.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
/**
* This file is part of the Ray.WebContextParam
* This file is part of the Ray.WebContextParam.
*
* @license http://opensource.org/licenses/bsd-license.php BSD
* @license http://opensource.org/licenses/bsd-license.php MIT
*/
namespace Ray\WebContextParam\Annotation;

Expand Down
4 changes: 2 additions & 2 deletions src/Annotation/EnvParam.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
/**
* This file is part of the Ray.WebContextParam
* This file is part of the Ray.WebContextParam.
*
* @license http://opensource.org/licenses/bsd-license.php BSD
* @license http://opensource.org/licenses/bsd-license.php MIT
*/
namespace Ray\WebContextParam\Annotation;

Expand Down
4 changes: 2 additions & 2 deletions src/Annotation/FormParam.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
/**
* This file is part of the Ray.WebContextParam
* This file is part of the Ray.WebContextParam.
*
* @license http://opensource.org/licenses/bsd-license.php BSD
* @license http://opensource.org/licenses/bsd-license.php MIT
*/
namespace Ray\WebContextParam\Annotation;

Expand Down
4 changes: 2 additions & 2 deletions src/Annotation/QueryParam.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
/**
* This file is part of the Ray.WebContextParam
* This file is part of the Ray.WebContextParam.
*
* @license http://opensource.org/licenses/bsd-license.php BSD
* @license http://opensource.org/licenses/bsd-license.php MIT
*/
namespace Ray\WebContextParam\Annotation;

Expand Down
4 changes: 2 additions & 2 deletions src/Annotation/ServerParam.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
/**
* This file is part of the Ray.WebContextParam
* This file is part of the Ray.WebContextParam.
*
* @license http://opensource.org/licenses/bsd-license.php BSD
* @license http://opensource.org/licenses/bsd-license.php MIT
*/
namespace Ray\WebContextParam\Annotation;

Expand Down
4 changes: 2 additions & 2 deletions src/Exception/ExceptionInterface.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
/**
* This file is part of the Ray.WebContextParam
* This file is part of the Ray.WebContextParam.
*
* @license http://opensource.org/licenses/bsd-license.php BSD
* @license http://opensource.org/licenses/bsd-license.php MIT
*/
namespace Ray\WebContextParam\Exception;

Expand Down
4 changes: 2 additions & 2 deletions src/Exception/LogicException.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
/**
* This file is part of the Ray.WebContextParam
* This file is part of the Ray.WebContextParam.
*
* @license http://opensource.org/licenses/bsd-license.php BSD
* @license http://opensource.org/licenses/bsd-license.php MIT
*/
namespace Ray\WebContextParam\Exception;

Expand Down
4 changes: 2 additions & 2 deletions src/Exception/NotFoundArgumentException.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
/**
* This file is part of the Ray.WebContextParam
* This file is part of the Ray.WebContextParam.
*
* @license http://opensource.org/licenses/bsd-license.php BSD
* @license http://opensource.org/licenses/bsd-license.php MIT
*/
namespace Ray\WebContextParam\Exception;

Expand Down
4 changes: 2 additions & 2 deletions src/Exception/RuntimeException.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
/**
* This file is part of the Ray.WebContextParam
* This file is part of the Ray.WebContextParam.
*
* @license http://opensource.org/licenses/bsd-license.php BSD
* @license http://opensource.org/licenses/bsd-license.php MIT
*/
namespace Ray\WebContextParam\Exception;

Expand Down
4 changes: 2 additions & 2 deletions src/WebContext.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
/**
* This file is part of the Ray.WebContextParam
* This file is part of the Ray.WebContextParam.
*
* @license http://opensource.org/licenses/bsd-license.php BSD
* @license http://opensource.org/licenses/bsd-license.php MIT
*/
namespace Ray\WebContextParam;

Expand Down
4 changes: 2 additions & 2 deletions src/WebContextInterface.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
/**
* This file is part of the Ray.WebContextParam
* This file is part of the Ray.WebContextParam.
*
* @license http://opensource.org/licenses/bsd-license.php BSD
* @license http://opensource.org/licenses/bsd-license.php MIT
*/
namespace Ray\WebContextParam;

Expand Down
24 changes: 14 additions & 10 deletions src/WebContextParamInterceptor.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?php
/**
* This file is part of the Ray.WebContextParam
* This file is part of the Ray.WebContextParam.
*
* @license http://opensource.org/licenses/bsd-license.php BSD
* @license http://opensource.org/licenses/bsd-license.php MIT
*/
namespace Ray\WebContextParam;

use Doctrine\Common\Annotations\Reader;
use Doctrine\Common\Cache\Cache;
use Ray\Aop\Arguments;
use Ray\Aop\MethodInterceptor;
use Ray\Aop\MethodInvocation;
use Ray\Aop\Arguments;
use Ray\WebContextParam\Annotation\AbstractWebContextParam;
use Ray\WebContextParam\Exception\NotFoundArgumentException;

Expand Down Expand Up @@ -55,12 +55,11 @@ public function invoke(MethodInvocation $invocation)
$this->cache->save($id, $meta);
}
$parameters = $invocation->getMethod()->getParameters();
$cnt =count($parameters);
$cnt = count($parameters);
for ($i = 0; $i < $cnt; $i++) {
$this->setArg($args, $meta ,$i);
$this->setArg($args, $meta, $i);
}


return $invocation->proceed();
}

Expand All @@ -79,6 +78,12 @@ private function getMeta(\ReflectionMethod $method)
return $meta;
}

/**
* @param array $meta
* @param int $i
*
* @return array
*/
private function getParam(array $meta, $i)
{
list($globalKey, $key) = $meta[$i];
Expand All @@ -90,7 +95,6 @@ private function getParam(array $meta, $i)
return [false, null];
}


/**
* @param AbstractWebContextParam $annotation
* @param \ReflectionMethod $method
Expand All @@ -115,12 +119,12 @@ private function getPos(AbstractWebContextParam $annotation, \ReflectionMethod $
/**
* @param Arguments $args
* @param array $meta
* @param $i
* @param in $i
*/
private function setArg(Arguments $args ,array $meta ,$i)
private function setArg(Arguments $args, array $meta, $i)
{
if (isset($meta[$i]) && (! isset($args[$i]))) {
list($hasParam ,$param) = $this->getParam($meta ,$i);
list($hasParam, $param) = $this->getParam($meta, $i);
if ($hasParam) {
$args[$i] = $param;
}
Expand Down
2 changes: 1 addition & 1 deletion src/WebContextParamModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* This file is part of the Ray.AuraSqlModule package
*
* @license http://opensource.org/licenses/bsd-license.php BSD
* @license http://opensource.org/licenses/bsd-license.php MIT
*/
namespace Ray\WebContextParam;

Expand Down
5 changes: 2 additions & 3 deletions tests/Fake/FakeConsumer.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<?php
/**
* This file is part of the Ray.WebContextParam
* This file is part of the Ray.WebContextParam.
*
* @license http://opensource.org/licenses/bsd-license.php BSD
* @license http://opensource.org/licenses/bsd-license.php MIT
*/
namespace Ray\WebContextParam;


use Ray\WebContextParam\Annotation\QueryParam;

class FakeConsumer
Expand Down
Loading