src/mako/syringe/Container.php
protected function mergeParameters(array $reflectionParameters, array $providedParameters): array
	{
		// Make reflection parameter array associative

		$associativeReflectionParameters = [];

		foreach($reflectionParameters as $value)
		{
			$associativeReflectionParameters[$value->getName()] = $value;
		}

		// Make the provided parameter array associative

		$associativeProvidedParameters = [];

		foreach($providedParameters as $key => $value)
		{
			if(is_int($key))
			{
				$associativeProvidedParameters[$reflectionParameters[$key]->getName()] = $value;
			}
			else
			{
				$associativeProvidedParameters[$key] = $value;
			}
		}

		// Return merged parameters

		return array_replace($associativeReflectionParameters, $associativeProvidedParameters);
	}
protected function mergeParameters(array $reflectionParameters, array $providedParameters): array
	{
		// Make reflection parameter array associative

		$associativeReflectionParameters = [];

		foreach($reflectionParameters as $value)
		{
			$associativeReflectionParameters[$value->getName()] = $value;
		}

		// Make the provided parameter array associative

		$associativeProvidedParameters = [];

		foreach($providedParameters as $key => $value)
		{
			if(is_int($key))
			{
				$associativeProvidedParameters[$reflectionParameters[$key]->getName()] = $value;
			}
			else
			{
				$associativeProvidedParameters[$key] = $value;
			}
		}

		// Return merged parameters

		return array_replace($associativeReflectionParameters, $associativeProvidedParameters);
	}
protected function mergeParameters ( array $ reflectionParameters , array $ providedParameters ) : array { // Make reflection parameter array associative $ associativeReflectionParameters = [ ] ; foreach ( $ reflectionParameters as $ value ) { $ associativeReflectionParameters [ $ value -> getName ( ) ] = $ value ; } // Make the provided parameter array associative $ associativeProvidedParameters = [ ] ; foreach ( $ providedParameters as $ key => $ value ) { if ( is_int ( $ key ) ) { $ associativeProvidedParameters [ $ reflectionParameters [ $ key ] -> getName ( ) ] = $ value ; } else { $ associativeProvidedParameters [ $ key ] = $ value ; } } // Return merged parameters return array_replace ( $ associativeReflectionParameters , $ associativeProvidedParameters ) ; }
Merges the provided parameters with the reflection parameters.

@param  array $reflectionParameters Reflection parameters
@param  array $providedParameters   Provided parameters
@return array
Merges the provided parameters with the reflection parameters .