for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Gearman Bundle for Symfony2 / Symfony3
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
* Feel free to edit as you please, and have fun.
* @author Marc Morera <[email protected]>
*/
namespace Mkk\GearmanBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
* This is the class that validates and merges configuration from your
* app/config files
class Configuration implements ConfigurationInterface
{
* Generates the configuration tree builder.
* @return TreeBuilder The tree builder
public function getConfigTreeBuilder()
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('gearman');
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
$a = "a"; $ab = "ab"; $abc = "abc";
will produce issues in the first and second line, while this second example
will produce no issues.
$rootNode
->children()
->arrayNode('bundles')
->prototype('array')
->scalarNode('name')
->isRequired()
->cannotBeEmpty()
->end()
->booleanNode('active')
->defaultFalse()
->arrayNode('include')
->prototype('scalar')->end()
->arrayNode('ignore')
->arrayNode('servers')
->performNoDeepMerging()
->defaultValue(array(
'localhost' => array(
'host' => '127.0.0.1',
'port' => '4730',
),
))
->scalarNode('host')
->integerNode('port')
->defaultValue('4730')
->arrayNode('defaults')
->addDefaultsIfNotSet()
->integerNode('iterations')
->min(0)
->defaultValue(0)
->scalarNode('method')
->defaultValue('doNormal')
->booleanNode('callbacks')
->defaultTrue()
->scalarNode('job_prefix')
->defaultNull()
->booleanNode('generate_unique_key')
->booleanNode('workers_name_prepend_namespace')
->integerNode('minimum_execution_time')
->integerNode('timeout')
->end();
return $treeBuilder;
}
This check marks files that end in a newline character, i.e. an empy line.
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
will produce issues in the first and second line, while this second example
will produce no issues.