for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace KGzocha\Bundle\SearcherBundle\DependencyInjection\CompilerPass;
use Symfony\Component\Config\Definition\Exception\InvalidDefinitionException;
/**
* @author Krzysztof Gzocha <[email protected]>
*/
class ParametersValidator
{
* @param string $contextId
* @param array $config
*
* @return bool
* @throws InvalidDefinitionException
public function validateParameters(
$contextId,
array &$config
) {
if (isset($config[AbstractCompilerPass::CLASS_PARAMETER])) {
return true;
}
if (isset($config[AbstractCompilerPass::SERVICE_PARAMETER])) {
throw new InvalidDefinitionException(sprintf(
'You have to specify "%s" or "%s" parameters for %s '.
'in searching context "%s".',
AbstractCompilerPass::CLASS_PARAMETER,
AbstractCompilerPass::SERVICE_PARAMETER,
AbstractCompilerPass::CRITERIA_COLLECTION_PARAMETER,
$contextId
));