for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the AfDontTranslateBundle package
*
* (c) Antoine Froger <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code
*/
namespace Af\Bundle\DontTranslateBundle\ActivationMode;
/**
* Class ActivationModeFactory
* @package Af\Bundle\DontTranslateBundle\ActivationMode
* @author Antoine Froger <[email protected]>
class ActivationModeFactory
{
* @param string $modeName
* @return ActivationModeInterface
* @throws \InvalidArgumentException
public function build($modeName)
switch (strtolower($modeName)) {
case 'get':
return new Get();
case 'cookie':
return new Cookie();
}
throw new \InvalidArgumentException(sprintf('%s is not a valid mode', $modeName));