/**
* Resolve all of the dependencies from the ReflectionParameters.
*
* @param array $parameters
* @param array $primitives
* @return array
*/
// Resolve all of the dependencies from the ReflectionParameters.
protected function getDependencies(array $parameters, array $primitives = [])
{// if you want resolve the Dependencies ,first you need get it
$dependencies = [];// set a array dependencies

foreach ($parameters as $parameter) {// loop the parameters as parameter
$dependency = $parameter->getClass();// what ever get the Class name
// may set the name about the parameter

// If the class is null, it means the dependency is a string or some other
// primitive type which we can not resolve since it is not a class and
// we will just bomb out with an error since we have no-where to go.
if (array_key_exists($parameter->name, $primitives)) {// if the name in the primitives
$dependencies[] = $primitives[$parameter->name];// has the dependencies array
} elseif (is_null($dependency)) {// if is null
$dependencies[] = $this->resolveNonClass($parameter);// change the Non Class
} else {
$dependencies[] = $this->resolveClass($parameter);// resolveClass
}
}

return $dependencies;// ever thing done ,return the result
}