public static function factory(Localization $localization, $name, PlaceHolder $source = null)
	{
		$placeHolder = null;
		
		switch ($localization::DISCRIMINATOR) {
			case self::TEMPLATE_DISCR:
				$placeHolder = new TemplatePlaceHolder($name);
				break;
			case self::PAGE_DISCR:
			case self::APPLICATION_DISCR:
				$placeHolder = new PagePlaceHolder($name);
				break;
			default:
				throw new \LogicException("Not recognized discriminator value for entity [{$localization}]");
		}
		
		if ($source !== null) {
			foreach ($source->getBlocks() as $block) {
				if (! $block->getLocked()) {
					$placeHolder->addBlock(Block::factory($localization, $block));
				}
			}
		}

		return $placeHolder;
	}
public static function factory(Localization $localization, $name, PlaceHolder $source = null)
	{
		$placeHolder = null;
		
		switch ($localization::DISCRIMINATOR) {
			case self::TEMPLATE_DISCR:
				$placeHolder = new TemplatePlaceHolder($name);
				break;
			case self::PAGE_DISCR:
			case self::APPLICATION_DISCR:
				$placeHolder = new PagePlaceHolder($name);
				break;
			default:
				throw new \LogicException("Not recognized discriminator value for entity [{$localization}]");
		}
		
		if ($source !== null) {
			foreach ($source->getBlocks() as $block) {
				if (! $block->getLocked()) {
					$placeHolder->addBlock(Block::factory($localization, $block));
				}
			}
		}

		return $placeHolder;
	}
public static function factory ( Localization $ localization , $ name , PlaceHolder $ source = null ) { $ placeHolder = null ; switch ( $ localization :: DISCRIMINATOR ) { case self :: TEMPLATE_DISCR : $ placeHolder = new TemplatePlaceHolder ( $ name ) ; break ; case self :: PAGE_DISCR : case self :: APPLICATION_DISCR : $ placeHolder = new PagePlaceHolder ( $ name ) ; break ; default : throw new \ LogicException ( "Not recognized discriminator value for entity [{$localization}]" ) ; } if ( $ source !== null ) { foreach ( $ source -> getBlocks ( ) as $ block ) { if ( ! $ block -> getLocked ( ) ) { $ placeHolder -> addBlock ( Block :: factory ( $ localization , $ block ) ) ; } } } return $ placeHolder ; }
Creates new instance based on the discriminator of source entity.

@param Localization $localization
@param string $name
@param PlaceHolder $source
@return PlaceHolder
Creates new instance based on the discriminator of source entity .