Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Micro-optimization

  • Loading branch information...
commit 30494b8a8ffde6c26397a0b252dc96cd3e42f2c7 1 parent 7b430b1
@dlsniper dlsniper authored fabpot committed
View
6 Dumper/PhpDumper.php
@@ -746,7 +746,7 @@ public function getParameter(\$name)
{
\$name = strtolower(\$name);
- if (!array_key_exists(\$name, \$this->parameters)) {
+ if (!(isset(\$this->parameters[\$name]) || array_key_exists(\$name, \$this->parameters))) {
throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', \$name));
}
@@ -758,7 +758,9 @@ public function getParameter(\$name)
*/
public function hasParameter(\$name)
{
- return array_key_exists(strtolower(\$name), \$this->parameters);
+ \$name = strtolower(\$name);
+
+ return isset(\$this->parameters[\$name]) || array_key_exists(\$name, \$this->parameters);
}
/**
View
6 Tests/Fixtures/php/services10.php
@@ -55,7 +55,7 @@ public function getParameter($name)
{
$name = strtolower($name);
- if (!array_key_exists($name, $this->parameters)) {
+ if (!(isset($this->parameters[$name]) || array_key_exists($name, $this->parameters))) {
throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));
}
@@ -67,7 +67,9 @@ public function getParameter($name)
*/
public function hasParameter($name)
{
- return array_key_exists(strtolower($name), $this->parameters);
+ $name = strtolower($name);
+
+ return isset($this->parameters[$name]) || array_key_exists($name, $this->parameters);
}
/**
View
6 Tests/Fixtures/php/services9_compiled.php
@@ -191,7 +191,7 @@ public function getParameter($name)
{
$name = strtolower($name);
- if (!array_key_exists($name, $this->parameters)) {
+ if (!(isset($this->parameters[$name]) || array_key_exists($name, $this->parameters))) {
throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));
}
@@ -203,7 +203,9 @@ public function getParameter($name)
*/
public function hasParameter($name)
{
- return array_key_exists(strtolower($name), $this->parameters);
+ $name = strtolower($name);
+
+ return isset($this->parameters[$name]) || array_key_exists($name, $this->parameters);
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.