Skip to content

Commit

Permalink
Dry up \Illuminate\View\Factory::share (#15954)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasmichot authored and taylorotwell committed Oct 17, 2016
1 parent 125bbe1 commit 1b09c67
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Illuminate/View/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,13 +344,13 @@ protected function getExtension($path)
*/
public function share($key, $value = null)
{
if (! is_array($key)) {
return $this->shared[$key] = $value;
}
$keys = is_array($key) ? $key : [$key => $value];

foreach ($key as $innerKey => $innerValue) {
$this->share($innerKey, $innerValue);
foreach ($keys as $key => $value) {
$this->shared[$key] = $value;
}

return $value;
}

/**
Expand Down

0 comments on commit 1b09c67

Please sign in to comment.