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:
commit
5f16e996d5
@ -149,8 +149,8 @@ class NamespacedAttributeBag extends AttributeBag
|
|||||||
*/
|
*/
|
||||||
protected function resolveKey($name)
|
protected function resolveKey($name)
|
||||||
{
|
{
|
||||||
if (strpos($name, $this->namespaceCharacter) !== false) {
|
if (false !== $pos = strrpos($name, $this->namespaceCharacter)) {
|
||||||
$name = substr($name, strrpos($name, $this->namespaceCharacter)+1, strlen($name));
|
$name = substr($name, $pos+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $name;
|
return $name;
|
||||||
|
Reference in New Issue
Block a user