Skip to content
This repository has been archived by the owner on Aug 13, 2023. It is now read-only.

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
rez1dent3 committed Jan 23, 2017
1 parent e152db5 commit e661cc5
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions src/DI/DI.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,10 @@ protected static function requireInstance()

/**
* @param string $name
* @param array $arguments
*
* @return mixed
* @param $row
* @param $last
*/
public function call($name, array $arguments = [])
protected function initSteps($name, &$row, &$last)
{
$path = $this->path($name);
$row = $this->getFirst($path);
Expand All @@ -64,7 +63,17 @@ public function call($name, array $arguments = [])
{
$this->steps($row, $path);
}
}

/**
* @param string $name
* @param array $arguments
*
* @return mixed
*/
public function call($name, array $arguments = [])
{
$this->initSteps($name, $row, $last);
$isCallable = is_callable($row);

if (!$isCallable && !$last)
Expand Down Expand Up @@ -122,15 +131,7 @@ protected function getFirst(&$path)

public function get($name)
{
$path = $this->path($name);
$row = $this->getFirst($path);
$last = array_pop($path);

if (!empty($path))
{
$this->steps($row, $path);
}

$this->initSteps($name, $row, $last);
if ($last && is_object($row))
{
if ($row instanceof self)
Expand Down

0 comments on commit e661cc5

Please sign in to comment.