protected function compileSetterInjector(Binding $binding, $wrapClosure = true)
	{
		$setters = $binding->getMarkers(SetterInjection::class);
		
		if(empty($setters))
		{
			return 'NULL';
		}
		
		$setterTypeName = $binding->isImplementationBinding() ? $binding->getTarget() : $binding->getTypeName();
		
		$code = $wrapClosure ? 'function($obj) { ' : '';
		$ref = new \ReflectionClass($setterTypeName);
		
		foreach($setters as $setter)
		{
			foreach($this->collectSetterMethods($ref, $setter) as $method)
			{
				$params = $method->getParameters();
					
				if(empty($params))
				{
					continue;
				}
				
				$injector = '$obj->' . $method->getName() . '(';
					
				foreach($params as $i => $param)
				{
					if(NULL === ($paramTypeName = $param->getClass()))
					{
						continue 2;
					}
						
					if($i != 0)
					{
						$injector .= ', ';
					}
					
					$nullable = $param->isOptional() ? 'Nullable' : '';
				
					$injector .= '$this->get' . $nullable . '(' . var_export($paramTypeName->name, true) . ', new InjectionPoint(';
					$injector .= 'get_class($obj), ' . var_export($method->getName(), true) . '))';
				}
					
				$code .= $injector . '); ';
			}
		}
		
		return $wrapClosure ? ($code . '}') : $code;
	}
protected function compileSetterInjector(Binding $binding, $wrapClosure = true)
	{
		$setters = $binding->getMarkers(SetterInjection::class);
		
		if(empty($setters))
		{
			return 'NULL';
		}
		
		$setterTypeName = $binding->isImplementationBinding() ? $binding->getTarget() : $binding->getTypeName();
		
		$code = $wrapClosure ? 'function($obj) { ' : '';
		$ref = new \ReflectionClass($setterTypeName);
		
		foreach($setters as $setter)
		{
			foreach($this->collectSetterMethods($ref, $setter) as $method)
			{
				$params = $method->getParameters();
					
				if(empty($params))
				{
					continue;
				}
				
				$injector = '$obj->' . $method->getName() . '(';
					
				foreach($params as $i => $param)
				{
					if(NULL === ($paramTypeName = $param->getClass()))
					{
						continue 2;
					}
						
					if($i != 0)
					{
						$injector .= ', ';
					}
					
					$nullable = $param->isOptional() ? 'Nullable' : '';
				
					$injector .= '$this->get' . $nullable . '(' . var_export($paramTypeName->name, true) . ', new InjectionPoint(';
					$injector .= 'get_class($obj), ' . var_export($method->getName(), true) . '))';
				}
					
				$code .= $injector . '); ';
			}
		}
		
		return $wrapClosure ? ($code . '}') : $code;
	}
protected function compileSetterInjector ( Binding $ binding , $ wrapClosure = true ) { $ setters = $ binding -> getMarkers ( SetterInjection :: class ) ; if ( empty ( $ setters ) ) { return 'NULL' ; } $ setterTypeName = $ binding -> isImplementationBinding ( ) ? $ binding -> getTarget ( ) : $ binding -> getTypeName ( ) ; $ code = $ wrapClosure ? 'function($obj) { ' : '' ; $ ref = new \ ReflectionClass ( $ setterTypeName ) ; foreach ( $ setters as $ setter ) { foreach ( $ this -> collectSetterMethods ( $ ref , $ setter ) as $ method ) { $ params = $ method -> getParameters ( ) ; if ( empty ( $ params ) ) { continue ; } $ injector = '$obj->' . $ method -> getName ( ) . '(' ; foreach ( $ params as $ i => $ param ) { if ( NULL === ( $ paramTypeName = $ param -> getClass ( ) ) ) { continue 2 ; } if ( $ i != 0 ) { $ injector .= ', ' ; } $ nullable = $ param -> isOptional ( ) ? 'Nullable' : '' ; $ injector .= '$this->get' . $ nullable . '(' . var_export ( $ paramTypeName -> name , true ) . ', new InjectionPoint(' ; $ injector .= 'get_class($obj), ' . var_export ( $ method -> getName ( ) , true ) . '))' ; } $ code .= $ injector . '); ' ; } } return $ wrapClosure ? ( $ code . '}' ) : $ code ; }
Compile a setter injector for a binding.

@param Binding $binding
@param boolean $wrapClosure
@return string
Compile a setter injector for a binding .