매일laravel-20160816|Container -19
/**
* If extra parameters are passed by numeric ID, rekey them by argument name.
*
* @param array $dependencies
* @param array $parameters
* @return array
*/
protected function keyParametersByArgument(array $dependencies, array $parameters)
{// this function is work for change the numeric ID key to string name key
foreach ($parameters as $key => $value) {// loop the parameters
if (is_numeric($key)) {// if a numeric
unset($parameters[$key]);// first unset it
$parameters[$dependencies[$key]->name] = $value;// then parameters return
// get the string key
}
}
return $parameters;
}
/**
* Register a new resolving callback.
*
* @param string $abstract
* @param \Closure|null $callback
* @return void
*/
public function resolving($abstract, Closure $callback = null)
{
if ($callback === null && $abstract instanceof Closure) {// if no callback and abstract is a Closure
$this->resolvingCallback($abstract);// get the call back,use another way to save it
} else {
$this->resolvingCallbacks[$this->normalize($abstract)][] = $callback;// save the function to the abstract
}
}// register a new function for callback
/**
* Register a new after resolving callback for all types.
*
* @param string $abstract
* @param \Closure|null $callback
* @return void
*/
public function afterResolving($abstract, Closure $callback = null)
{// set the callback function used after resolve function done
if ($abstract instanceof Closure && $callback === null) {
$this->afterResolvingCallback($abstract);// if null, use other function
} else {
$this->afterResolvingCallbacks[$this->normalize($abstract)][] = $callback;
}// register the callback to the array store
}//
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
return / break / continue반복문을 종료 시키기도 하지만 값을 반환하고 함수 자체를 종료 함수에서 사용하지 않으면 에러가 발생 ⇒ 함수는 return을 사용하지 않아도 항상 값을 반환함 (기본값은 undefined) 반복문을 더 이상 진행하지...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.