Skip to content

Commit

Permalink
Merging some unset calls for better control flow
Browse files Browse the repository at this point in the history
  • Loading branch information
Theaxiom committed Apr 17, 2017
1 parent 534fb76 commit 5dc7024
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
3 changes: 1 addition & 2 deletions src/Datasource/EntityTrait.php
Expand Up @@ -391,8 +391,7 @@ public function unsetProperty($property)
{
$property = (array)$property;
foreach ($property as $p) {
unset($this->_properties[$p]);
unset($this->_dirty[$p]);
unset($this->_properties[$p], $this->_dirty[$p]);
}

return $this;
Expand Down
3 changes: 1 addition & 2 deletions src/Http/ServerRequest.php
Expand Up @@ -387,8 +387,7 @@ protected function _processPost($data)
protected function _processGet($query, $queryString = '')
{
$unsetUrl = '/' . str_replace(['.', ' '], '_', urldecode($this->url));
unset($query[$unsetUrl]);
unset($query[$this->base . $unsetUrl]);
unset($query[$unsetUrl], $query[$this->base . $unsetUrl]);
if (strlen($queryString)) {
parse_str($queryString, $queryArgs);
$query += $queryArgs;
Expand Down
3 changes: 1 addition & 2 deletions src/ORM/Rule/ExistsIn.php
Expand Up @@ -118,8 +118,7 @@ public function __invoke(EntityInterface $entity, array $options)
$schema = $source->getSchema();
foreach ($this->_fields as $i => $field) {
if ($schema->column($field) && $schema->isNullable($field) && $entity->get($field) === null) {
unset($bindingKey[$i]);
unset($this->_fields[$i]);
unset($bindingKey[$i], $this->_fields[$i]);
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/Utility/Hash.php
Expand Up @@ -1077,8 +1077,7 @@ public static function diff(array $data, array $compare)
$intersection = array_intersect_key($data, $compare);
while (($key = key($intersection)) !== null) {
if ($data[$key] == $compare[$key]) {
unset($data[$key]);
unset($compare[$key]);
unset($data[$key], $compare[$key]);
}
next($intersection);
}
Expand Down

0 comments on commit 5dc7024

Please sign in to comment.