merged branch alexpods/patch-3 (PR #8003)

This PR was merged into the master branch.

Discussion
----------

[HttpFoundation][NamespacedAttributeBag] Refactoring of resolveKey() method

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Just code enhancement. Low priority.

1) We don't need to call strlen($name) as last argument of substr() function
2) We don't need to call strrpos (or strpos) two times.

Commits
-------

a644516 [HttpFoundation][NamespacedAttributeBag] Refactoring of resolveKey() method
This commit is contained in:
Fabien Potencier 2013-06-04 17:12:29 +02:00
commit 5f16e996d5

View File

@ -149,8 +149,8 @@ class NamespacedAttributeBag extends AttributeBag
*/
protected function resolveKey($name)
{
if (strpos($name, $this->namespaceCharacter) !== false) {
$name = substr($name, strrpos($name, $this->namespaceCharacter)+1, strlen($name));
if (false !== $pos = strrpos($name, $this->namespaceCharacter)) {
$name = substr($name, $pos+1);
}
return $name;