src/Alg/Parcel/Factory.php
public function produce( $packetName, $articles )
	{
		if( !in_array( $packetName, $this->packets ) )
			throw new InvalidArgumentException( 'Packet "'.$packetName.'" is not a valid Packet.' );
		try
		{
			$packet	= new Alg_Parcel_Packet( $packetName );
			foreach( $articles as $articleName => $articleQuantity )
			{
				if( !in_array( $articleName, $this->articles ) )
					throw new InvalidArgumentException( 'Article "'.$articleName.'" is not a valid Article.' );
				for( $i=0; $i<$articleQuantity; $i++ )
				{
					$volume	= $this->volumes[$packetName][$articleName];
					$packet->addArticle( $articleName, $volume );
				}
			}
			return $packet;
		}
		catch( OutOfRangeException $e )
		{
			throw new OutOfRangeException( 'To much Articles for Packet.' ); 
		}
	}
public function produce( $packetName, $articles )
	{
		if( !in_array( $packetName, $this->packets ) )
			throw new InvalidArgumentException( 'Packet "'.$packetName.'" is not a valid Packet.' );
		try
		{
			$packet	= new Alg_Parcel_Packet( $packetName );
			foreach( $articles as $articleName => $articleQuantity )
			{
				if( !in_array( $articleName, $this->articles ) )
					throw new InvalidArgumentException( 'Article "'.$articleName.'" is not a valid Article.' );
				for( $i=0; $i<$articleQuantity; $i++ )
				{
					$volume	= $this->volumes[$packetName][$articleName];
					$packet->addArticle( $articleName, $volume );
				}
			}
			return $packet;
		}
		catch( OutOfRangeException $e )
		{
			throw new OutOfRangeException( 'To much Articles for Packet.' ); 
		}
	}
public function produce ( $ packetName , $ articles ) { if ( ! in_array ( $ packetName , $ this -> packets ) ) throw new InvalidArgumentException ( 'Packet "' . $ packetName . '" is not a valid Packet.' ) ; try { $ packet = new Alg_Parcel_Packet ( $ packetName ) ; foreach ( $ articles as $ articleName => $ articleQuantity ) { if ( ! in_array ( $ articleName , $ this -> articles ) ) throw new InvalidArgumentException ( 'Article "' . $ articleName . '" is not a valid Article.' ) ; for ( $ i = 0 ; $ i < $ articleQuantity ; $ i ++ ) { $ volume = $ this -> volumes [ $ packetName ] [ $ articleName ] ; $ packet -> addArticle ( $ articleName , $ volume ) ; } } return $ packet ; } catch ( OutOfRangeException $ e ) { throw new OutOfRangeException ( 'To much Articles for Packet.' ) ; } }
Produces a new Packet, filled with given Articles and returns it.
@access		public
@param		string		$packetName		Name of Packet Size
@param		array		$articles		Articles to put into Packet
@return		Alg_Parcel_Packet
Produces a new Packet filled with given Articles and returns it .