Skip to content

Commit

Permalink
[5.4] Refactor - Save a count and a test (#16188)
Browse files Browse the repository at this point in the history
Save a count and a test with. array_shift has a O(1) complexity.
  • Loading branch information
sylwit authored and taylorotwell committed Oct 31, 2016
1 parent 05d8390 commit b7f38f8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Illuminate/Database/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,13 +290,13 @@ public function raw($value)
*
* @param string $query
* @param array $bindings
* @return mixed
* @return mixed|null
*/
public function selectOne($query, $bindings = [])
{
$records = $this->select($query, $bindings);

return count($records) > 0 ? reset($records) : null;
return array_shift($records);
}

/**
Expand Down

0 comments on commit b7f38f8

Please sign in to comment.