src/Support/Container/BoundCallable.php
/**
	 * Returns the resolved dependencies for the given parameters in their exact order. Parameters which could not be
	 * resolved will be provided as their default values or null.
	 *
	 * @param ReflectionParameter[] $parameters
	 * @return array
	 * @throws ReflectionException
	 */
Returns the resolved dependencies for the given parameters in their exact order. Parameters which could not be
resolved will be provided as their default values or null.

@param ReflectionParameter[] $parameters
@return array
@throws ReflectionException
Returns the resolved dependencies for the given parameters in their exact order . Parameters which could not be resolved will be provided as their default values or null . @param ReflectionParameter [] $parameters @return array @throws ReflectionException
private function resolve($parameters) {
		$resolved = array();
		foreach ($parameters as $parameter) {
			$name = $parameter->getName();
			if (version_compare(PHP_VERSION, '8.0.0') >= 0) {
				$class = $parameter->getType() ? $parameter->getType()->getName() : null;
			}
			else {
				$class = $parameter->getClass() ? $parameter->getClass()->name : null;
			}
			if (!is_null($class)) {
				if (isset($this->objects[$class])) {
					$resolved[] = $this->objects[$class];
					continue;
				}
				$collection = $this->container->all($class);
				$provided = $collection->first();
				if (!is_null($provided)) {
					$resolved[] = $provided;
					continue;
				}
			}
			else {
				if (isset($this->variables[$name])) {
					$resolved[] = $this->variables[$name];
					continue;
				}
			}
			$resolved[] = ($parameter->isOptional()) ? $parameter->getDefaultValue() : null;
		}
		return $resolved;
	}
private function resolve ( $ parameters ) { $ resolved = array ( ) ; foreach ( $ parameters as $ parameter ) { $ name = $ parameter -> getName ( ) ; if ( version_compare ( PHP_VERSION , '8.0.0' ) >= 0 ) { $ class = $ parameter -> getType ( ) ? $ parameter -> getType ( ) -> getName ( ) : null ; } else { $ class = $ parameter -> getClass ( ) ? $ parameter -> getClass ( ) -> name : null ; } if ( ! is_null ( $ class ) ) { if ( isset ( $ this -> objects [ $ class ] ) ) { $ resolved [ ] = $ this -> objects [ $ class ] ; continue ; } $ collection = $ this -> container -> all ( $ class ) ; $ provided = $ collection -> first ( ) ; if ( ! is_null ( $ provided ) ) { $ resolved [ ] = $ provided ; continue ; } } else { if ( isset ( $ this -> variables [ $ name ] ) ) { $ resolved [ ] = $ this -> variables [ $ name ] ; continue ; } } $ resolved [ ] = ( $ parameter -> isOptional ( ) ) ? $ parameter -> getDefaultValue ( ) : null ; } return $ resolved ; }
Returns the resolved dependencies for the given parameters in their exact order.
Returns the resolved dependencies for the given parameters in their exact order .
// Resolve parameter as an added class dependency // Resolve parameter as a provided class dependency // Resolve parameter as a variable by name // Resolve with default value or null