Example #1
0
    public function testHandlePartialNamespaces()
    {
        $fixer = $this->getFixer();
        $config = new Config();
        $config->setDir(__DIR__ . '/../../../');
        $fixer->setConfig($config);
        $file = $this->getTestFile(__DIR__ . '/../../../Fixer/PSR0/Psr0Fixer.php');
        $expected = <<<'EOF'
namespace Foo\Bar\Baz\Fixer\PSR0;
class Psr0Fixer {}
EOF;
        $input = <<<'EOF'
namespace Foo\Bar\Baz\FIXER\PSR0;
class Psr0Fixer {}
EOF;
        $this->assertSame($expected, $fixer->fix($file, $input));
        $config->setDir(__DIR__ . '/../../../Fixer/PSR0');
        $expected = <<<'EOF'
namespace Foo\Bar\Baz;
class Psr0Fixer {}
EOF;
        $input = <<<'EOF'
namespace Foo\Bar\Baz;
class Psr0Fixer {}
EOF;
        $this->assertSame($expected, $fixer->fix($file, $input));
    }
 public function testThatCacheFileCanBeMutated()
 {
     $cacheFile = 'some-directory/some.file';
     $config = new Config();
     $config->setCacheFile($cacheFile);
     $this->assertSame($cacheFile, $config->getCacheFile());
 }
Example #3
0
 /**
  * Construct an instance of a StyleConfig.
  *
  * @param string $name
  * @param string $description
  * @param null $finder
  */
 public function __construct($name = 'chroma', $description = 'Chroma default configuration', $finder = null)
 {
     parent::__construct($name, $description);
     $this->finder = coalesce($finder, $this->makeFinder());
     $this->level(FixerInterface::NONE_LEVEL);
     $this->fixers(['encoding', 'short_tag', 'braces', 'elseif', 'eof_ending', 'function_call_space', 'function_declaration', 'indentation', 'line_after_namespace', 'linefeed', 'lowercase_constants', 'lowercase_keywords', 'method_argument_space', 'multiple_use', 'parenthesis', 'php_closing_tag', 'trailing_spaces', 'visibility', 'duplicate_semicolon', 'extra_empty_lines', 'multiline_array_trailing_comma', 'new_with_braces', 'object_operator', 'operators_spaces', 'remove_lines_between_uses', 'return', 'single_array_no_trailing_comma', 'spaces_before_semicolon', 'spaces_cast', 'standardize_not_equal', 'ternary_spaces', 'whitespacy_lines', 'concat_with_spaces', 'multiline_spaces_before_semicolon', 'short_array_syntax', 'remove_leading_slash_use', 'phpdoc_order', 'unused_use', 'single_quote', 'single_blank_line_before_namespace', 'spaces_before_semicolon', 'trim_array_spaces', 'phpdoc_var_without_name', 'phpdoc_to_comment', 'phpdoc_short_description', 'phpdoc_scalar', 'phpdoc_no_empty_return', 'phpdoc_no_access', 'no_empty_lines_after_phpdocs', 'no_blank_lines_after_class_opening', 'join_function_fixer', 'blankline_after_open_tag', 'unalign_double_arrow', 'unalign_equals', 'short_echo_tag', 'php4_constructor']);
 }
Example #4
0
File: Jane.php Project: stof/jane
 public function generate($schemaFilePath, $name, $namespace, $directory)
 {
     $context = $this->createContext($schemaFilePath, $name, $namespace, $directory);
     if (!file_exists($directory . DIRECTORY_SEPARATOR . 'Model')) {
         mkdir($directory . DIRECTORY_SEPARATOR . 'Model', 0755, true);
     }
     if (!file_exists($directory . DIRECTORY_SEPARATOR . 'Normalizer')) {
         mkdir($directory . DIRECTORY_SEPARATOR . 'Normalizer', 0755, true);
     }
     $prettyPrinter = new Standard();
     $modelFiles = $this->modelGenerator->generate($context->getRootReference(), $name, $context);
     $normalizerFiles = $this->normalizerGenerator->generate($context->getRootReference(), $name, $context);
     $generated = [];
     foreach ($modelFiles as $file) {
         $generated[] = $file->getFilename();
         file_put_contents($file->getFilename(), $prettyPrinter->prettyPrintFile([$file->getNode()]));
     }
     foreach ($normalizerFiles as $file) {
         $generated[] = $file->getFilename();
         file_put_contents($file->getFilename(), $prettyPrinter->prettyPrintFile([$file->getNode()]));
     }
     if ($this->fixer !== null) {
         $config = Config::create()->setRiskyAllowed(true)->setRules(array('@Symfony' => true, 'empty_return' => false, 'concat_without_spaces' => false, 'double_arrow_multiline_whitespaces' => false, 'unalign_equals' => false, 'unalign_double_arrow' => false, 'align_double_arrow' => true, 'align_equals' => true, 'concat_with_spaces' => true, 'newline_after_open_tag' => true, 'ordered_use' => true, 'phpdoc_order' => true, 'short_array_syntax' => true))->finder(DefaultFinder::create()->in($directory));
         $resolver = new ConfigurationResolver();
         $resolver->setDefaultConfig($config);
         $resolver->resolve();
         $this->fixer->fix($config);
     }
     return $generated;
 }
Example #5
0
 /**
  * @param string $name
  * @param string $description
  */
 public function __construct($name = self::class, $description = '')
 {
     parent::__construct($name, $description);
     $this->level = FixerInterface::PSR2_LEVEL;
     $this->fixers = $this->getDefaultFixers();
     $this->setUsingCache(true);
 }
Example #6
0
 public function testThatCustomFinderWorks()
 {
     $finder = Finder::create();
     $finder->in(__DIR__ . '/../Fixtures/FinderDirectory');
     $config = Config::create();
     $config->finder($finder);
     $iterator = $config->getFinder()->getIterator();
     $this->assertSame(1, count($iterator));
     $iterator->rewind();
     $this->assertSame('somefile.php', $iterator->current()->getFilename());
 }
 /**
  * @return Config
  */
 public function build()
 {
     $config = new Config('cs278', 'Chris Smith\'s personal coding standard.');
     $config->setUsingCache(true);
     $config->level(FixerInterface::SYMFONY_LEVEL);
     $config->fixers(['newline_after_open_tag', 'ordered_use', 'phpdoc_order', 'short_array_syntax']);
     $config->finder($this->finder);
     return $config;
 }
Example #8
0
 /**
  * @covers Symfony\CS\Fixer::fix
  * @covers Symfony\CS\Fixer::fixFile
  */
 public function testThatFixInvalidFileReportsToErrorManager()
 {
     $fixer = new Fixer();
     $fixer->setLinter(new Linter());
     $config = Config::create()->finder(new \DirectoryIterator(__DIR__ . DIRECTORY_SEPARATOR . 'Fixtures' . DIRECTORY_SEPARATOR . 'FixerTest' . DIRECTORY_SEPARATOR . 'invalid'))->fixers(array(new \Symfony\CS\Fixer\PSR2\VisibilityFixer(), new \Symfony\CS\Fixer\Symfony\UnusedUseFixer()))->setUsingCache(false);
     $changed = $fixer->fix($config, true, true);
     $pathToInvalidFile = __DIR__ . DIRECTORY_SEPARATOR . 'Fixtures' . DIRECTORY_SEPARATOR . 'FixerTest' . DIRECTORY_SEPARATOR . 'invalid' . DIRECTORY_SEPARATOR . 'somefile.php';
     $this->assertCount(0, $changed);
     $errors = $fixer->getErrorsManager()->getInvalidErrors();
     $this->assertCount(1, $errors);
     $error = $errors[0];
     $this->assertInstanceOf('Symfony\\CS\\Error\\Error', $error);
     $this->assertSame(Error::TYPE_INVALID, $error->getType());
     $this->assertSame($pathToInvalidFile, $error->getFilePath());
 }
Example #9
0
 public function __construct()
 {
     @trigger_error(sprintf('The "%s" class is deprecated. You should stop using it, as it will soon be removed in 2.0 version.', __CLASS__), E_USER_DEPRECATED);
     parent::__construct();
     $this->finder = new Symfony23Finder();
 }
Example #10
0
    public function testHandlePartialNamespaces()
    {
        $fixer = $this->getFixer();
        $config = new Config();
        $config->setDir(__DIR__ . '/../../../');
        $fixer->setConfig($config);
        $file = $this->getTestFile(__DIR__ . '/../../../Fixer/PSR1/Psr4Fixer.php');
        $expected = <<<'EOF'
<?php
namespace Foo\Bar\Baz\Fixer\PSR1;
class Psr4Fixer {}
EOF;
        $this->makeTest($expected, null, $file, $fixer);
        $config->setDir(__DIR__ . '/../../../Fixer/PSR1');
        $expected = <<<'EOF'
<?php
namespace Foo\Bar\Baz;
class Psr4Fixer {}
EOF;
        $this->makeTest($expected, null, $file, $fixer);
    }
 public function __construct()
 {
     parent::__construct();
     $this->finder = new MagentoFinder();
 }
<?php

$finder = \Symfony\CS\Finder\DefaultFinder::create()->files();
$fixers = (require __DIR__ . '/.php_cs-fixers.php');
$finder->name('*.php')->in(__DIR__ . '/features')->in(__DIR__ . '/src');
return \Symfony\CS\Config\Config::create()->level(Symfony\CS\FixerInterface::PSR2_LEVEL)->fixers($fixers)->finder($finder);
Example #13
0
<?php

$branch = getenv('TRAVIS_BRANCH');
$phpVersion = getenv('TRAVIS_PHP_VERSION');
printf('Current branch inspected : %s' . PHP_EOL, $branch);
$finder = \Symfony\CS\Finder\DefaultFinder::create()->files();
$fixers = (require __DIR__ . '/.php_cs-fixers.php');
if (is_numeric(getenv('TRAVIS_PULL_REQUEST'))) {
    $commitRange = str_replace('...', '..', getenv('TRAVIS_COMMIT_RANGE'));
    printf('Commit range = %s' . PHP_EOL, $commitRange);
    exec('git diff ' . $commitRange . ' --name-only --diff-filter=AMR | grep -v ^spec/ | grep php$', $diff);
} else {
    exec('git show --name-only --oneline --pretty="format:" --diff-filter=AMR | grep -v ^spec/ | grep php$', $diff);
    $diff = array_filter($diff);
}
foreach ($diff as $filename) {
    printf('Parsed file : %s' . PHP_EOL, $filename);
}
$finder->append($diff);
return \Symfony\CS\Config\Config::create()->fixers($fixers)->finder($finder);
Example #14
0
 /**
  * @dataProvider provideAddCustomFixersCases
  */
 public function testAddCustomFixers($expected, $suite)
 {
     $config = Config::create();
     $config->addCustomFixers($suite);
     $this->assertSame($expected, $config->getCustomFixers());
 }
 /**
  * @param string       $styleCIConfigDir
  * @param string|array $finderDirs       A directory path or an array of directories for Finder
  *
  * @return Config
  */
 public static function create($styleCIConfigDir = null, $finderDirs = null)
 {
     $bridge = new static($styleCIConfigDir, $finderDirs);
     return Config::create()->finder($bridge->getFinder())->level($bridge->getLevel())->fixers($bridge->getFixers());
 }
 public function __construct()
 {
     parent::__construct();
     $this->finder = new Symfony23Finder();
 }
Example #17
0
    public function testHandlePartialNamespaces()
    {
        $fixer = $this->getFixer();
        $config = new Config();
        $config->setDir(__DIR__ . '/../../../');
        $fixer->setConfig($config);
        $file = $this->getTestFile(__DIR__ . '/../../../Fixer/Contrib/Psr0Fixer.php');
        $expected = <<<'EOF'
<?php
namespace Foo\Bar\Baz\Fixer\Contrib;
class Psr0Fixer {}
EOF;
        $input = <<<'EOF'
<?php
namespace Foo\Bar\Baz\FIXER\Contrib;
class Psr0Fixer {}
EOF;
        $this->doTest($expected, $input, $file, $fixer);
        $expected = <<<'EOF'
<?php
namespace /* hi there */ Foo\Bar\Baz\Fixer\Contrib;
class /* hi there */ Psr0Fixer {}
EOF;
        $input = <<<'EOF'
<?php
namespace /* hi there */ Foo\Bar\Baz\FIXER\Contrib;
class /* hi there */ Psr0Fixer {}
EOF;
        $this->doTest($expected, $input, $file, $fixer);
        $config->setDir(__DIR__ . '/../../../Fixer/Contrib');
        $expected = <<<'EOF'
<?php
namespace Foo\Bar\Baz;
class Psr0Fixer {}
EOF;
        $this->doTest($expected, null, $file, $fixer);
    }
Example #18
0
    public function testHandlePartialNamespaces()
    {
        $fixer = new Psr0Fixer();
        $config = new Config();
        $config->setDir(__DIR__ . '/../../');
        $fixer->setConfig($config);
        $file = new \SplFileInfo(__DIR__ . '/../../Fixer/Psr0Fixer.php');
        $expected = <<<'EOF'
namespace Foo\Bar\Baz\Fixer;
class Psr0Fixer {}
EOF;
        $input = <<<'EOF'
namespace Foo\Bar\Baz\FIXER;
class Psr0Fixer {}
EOF;
        ob_start();
        $this->assertEquals($expected, $fixer->fix($file, $input));
        $this->assertEquals('', ob_get_clean());
        $config->setDir(__DIR__ . '/../../Fixer');
        $expected = <<<'EOF'
namespace Foo\Bar\Baz;
class Psr0Fixer {}
EOF;
        $input = <<<'EOF'
namespace Foo\Bar\Baz;
class Psr0Fixer {}
EOF;
        ob_start();
        $this->assertEquals($expected, $fixer->fix($file, $input));
        $this->assertEquals('', ob_get_clean());
    }
Example #19
0
 /**
  * @param Fixer $fixer
  */
 public function __construct(Fixer $fixer = null)
 {
     $finder = DefaultFinder::create();
     $finder->append($this->commitedFiles());
     parent::__construct($fixer, Config::create()->finder($finder));
 }
Example #20
0
 /**
  * Returns level name from config.
  *
  * @param Config $config
  *
  * @return string
  */
 private function getLevelName(Config $config)
 {
     static $map = [FixerInterface::PSR0_LEVEL => 'PSR0', FixerInterface::PSR1_LEVEL => 'PSR1', FixerInterface::PSR2_LEVEL => 'PSR2', FixerInterface::SYMFONY_LEVEL => 'Symfony', FixerInterface::CONTRIB_LEVEL => 'Contrib'];
     return $map[$config->getLevel()];
 }
Example #21
0
 /**
  * Print files
  *
  * @param File[] $files
  * @param string $directory
  */
 public function printFiles($files, $directory)
 {
     foreach ($files as $file) {
         if (!file_exists(dirname($file->getFilename()))) {
             mkdir(dirname($file->getFilename()), 0755, true);
         }
         file_put_contents($file->getFilename(), $this->prettyPrinter->prettyPrintFile([$file->getNode()]));
     }
     if ($this->fixer !== null) {
         $config = Config::create()->setRiskyAllowed(true)->setRules(array('@Symfony' => true, 'empty_return' => false, 'concat_without_spaces' => false, 'double_arrow_multiline_whitespaces' => false, 'unalign_equals' => false, 'unalign_double_arrow' => false, 'align_double_arrow' => true, 'align_equals' => true, 'concat_with_spaces' => true, 'newline_after_open_tag' => true, 'ordered_use' => true, 'phpdoc_order' => true, 'short_array_syntax' => true))->finder(DefaultFinder::create()->in($directory));
         $resolver = new ConfigurationResolver();
         $resolver->setDefaultConfig($config);
         $resolver->resolve();
         $this->fixer->fix($config);
     }
 }
Example #22
0
 /**
  * Execute the code generation
  */
 public function generate()
 {
     /*
      * PROXY CONFIGURATION
      */
     $proxy = current(array_filter(array(getenv('HTTP_PROXY'), getenv('http_proxy')), 'strlen'));
     if ($proxy) {
         $parsedWsdlPath = Url::createFromUrl($this->config->getWsdlDocumentPath());
         // if not fetching the wsdl file from filesystem and a proxy has been set
         if ($parsedWsdlPath->getScheme()->get() !== 'file') {
             $proxy = Url::createFromUrl($proxy);
             libxml_set_streams_context(stream_context_get_default(array($proxy->getScheme()->get() => array('proxy' => 'tcp://' . $proxy->getAuthority() . $proxy->getRelativeUrl(), 'request_fulluri' => true))));
         }
     }
     unset($proxy);
     /*
      * LOAD THE WSDL DOCUMENT
      */
     $wsdlDocument = SimpleXMLElement::loadFile($this->config->getWsdlDocumentPath());
     $wsdlDocument->registerXPathNamespace('wsdl', static::WSDL_NS);
     $schemaReader = new SchemaReader();
     /* @var \Goetas\XML\XSDReader\Schema\Schema[] $schemas */
     $schemas = array();
     /* @var \Goetas\XML\XSDReader\Schema\Type\Type[] $types */
     $types = array();
     /*
      * LOAD THE XML SCHEMAS
      */
     // read the schemas included in the wsdl document
     foreach ($wsdlDocument->xpath('/wsdl:definitions/wsdl:types/xsd:schema') as $schemaNode) {
         $schemas[] = $schemaReader->readNode(dom_import_simplexml($schemaNode));
     }
     // exclude the schemas having the following namespaces
     $unusedSchemaNamespaces = array(SchemaReader::XML_NS, SchemaReader::XSD_NS);
     // recursively read all the schema chain
     $processedSchemas = array();
     while (!empty($schemas)) {
         /* @var \Goetas\XML\XSDReader\Schema\Schema $currentSchema */
         $currentSchema = array_shift($schemas);
         if (!in_array($currentSchema, $processedSchemas) and !in_array($currentSchema->getTargetNamespace(), $unusedSchemaNamespaces)) {
             $processedSchemas[] = $currentSchema;
             $schemas = array_merge($schemas, $currentSchema->getSchemas());
         }
     }
     $schemas = $processedSchemas;
     // cleanup
     unset($currentSchema);
     unset($processedSchemas);
     unset($unusedSchemaNamespaces);
     unset($schemaNode);
     unset($schemaReader);
     /*
      * LOAD THE DEFINED TYPES
      */
     // get the complete list of defined types
     foreach ($schemas as $schema) {
         $types = array_merge($types, $schema->getTypes());
     }
     /*
      * LOAD THE SERVICES
      */
     $services = $wsdlDocument->xpath('/wsdl:definitions/wsdl:portType');
     /*
      * CODE GENERATION
      */
     $classFactory = new ClassFactory($this->config, $schemas, $types);
     foreach ($types as $type) {
         if ($type instanceof SimpleType) {
             // build the inheritance chain of the current SimpleType
             /* @var \Goetas\XML\XSDReader\Schema\Type\SimpleType[] $inheritanceChain */
             $inheritanceChain = array($type->getRestriction());
             // loop through the type inheritance chain untill the base type
             while (end($inheritanceChain) !== null) {
                 $inheritanceChain[] = end($inheritanceChain)->getBase()->getParent();
             }
             // remove the null value
             array_pop($inheritanceChain);
             // remove the 'anySimpleType'
             array_pop($inheritanceChain);
             // now the last element of the chain is the base simple type
             // enums are built only of string enumerations
             if (end($inheritanceChain)->getBase()->getName() === 'string' and array_key_exists('enumeration', $type->getRestriction()->getChecks())) {
                 $className = $classFactory->createEnum($type);
                 $this->eventDispatcher->dispatch(Event::ENUM_CREATE, new Event($className));
             }
         } elseif ($type instanceof ComplexType) {
             $className = $classFactory->createDTO($type);
             $this->eventDispatcher->dispatch(Event::DTO_CREATE, new Event($className));
         }
     }
     foreach ($services as $service) {
         $className = $classFactory->createService($service);
         $this->eventDispatcher->dispatch(Event::SERVICE_CREATE, new Event($className));
     }
     $className = $classFactory->createClassmap();
     $this->eventDispatcher->dispatch(Event::CLASSMAP_CREATE, new Event($className));
     /*
      * GENERATED CODE FIX
      */
     // create the coding standards fixer
     $fixer = new Fixer();
     $config = new FixerConfig();
     $config->setDir($this->config->getOutputPath());
     // register all the existing fixers
     $fixer->registerBuiltInFixers();
     $config->fixers(array_filter($fixer->getFixers(), function (FixerInterface $fixer) {
         return $fixer->getLevel() === FixerInterface::PSR2_LEVEL;
     }));
     // fix the generated code
     $fixer->fix($config);
 }
Example #23
0
 /**
  * @covers Symfony\CS\Fixer::fix
  * @covers Symfony\CS\Fixer::fixFile
  * @covers Symfony\CS\Fixer::prepareFixers
  */
 public function testThatFixSuccessfully()
 {
     $fixer = new Fixer();
     $fixer->addFixer(new \Symfony\CS\Fixer\PSR2\VisibilityFixer());
     $fixer->addFixer(new \Symfony\CS\Fixer\PSR0\Psr0Fixer());
     //will be ignored cause of test keyword in namespace
     $config = Config::create()->finder(new \DirectoryIterator(__DIR__ . DIRECTORY_SEPARATOR . 'Fixtures' . DIRECTORY_SEPARATOR . 'FixerTest'));
     $config->fixers($fixer->getFixers());
     $changed = $fixer->fix($config, true, true);
     $pathToInvalidFile = __DIR__ . DIRECTORY_SEPARATOR . 'Fixtures' . DIRECTORY_SEPARATOR . 'FixerTest' . DIRECTORY_SEPARATOR . 'somefile.php';
     $this->assertCount(1, $changed);
     $this->assertCount(2, $changed[$pathToInvalidFile]);
     $this->assertSame(array('appliedFixers', 'diff'), array_keys($changed[$pathToInvalidFile]));
     $this->assertSame('visibility', $changed[$pathToInvalidFile]['appliedFixers'][0]);
 }
 public function main()
 {
     try {
         /*
          * PROPERTIES VALIDATION
          */
         // check if the proxy flag has been set
         $proxy = $this->getProject()->getUserProperty('proxy');
         $proxy = $proxy !== null ? filter_var($proxy, FILTER_VALIDATE_BOOLEAN) : true;
         // determine the url of the WSDL document
         $wsdlUrl = $this->getProject()->getUserProperty('wsdl.url');
         $wsdlUrl = $wsdlUrl ? $wsdlUrl : static::WSDL_URL;
         /*
          * PROXY CONFIGURATION
          */
         // read the proxy configuration from the environment variables
         $proxy = $proxy ? current(array_filter(array(getenv('HTTP_PROXY'), getenv('http_proxy')), 'strlen')) : null;
         // prepare an empty url for the stream context
         $streamContextProxyUrl = null;
         // if the proxy is configured in the system
         if ($proxy) {
             // parse the WSDL url
             $parsedWsdlPath = Url::createFromUrl($wsdlUrl);
             // parse the proxy url
             $proxy = Url::createFromUrl($proxy);
             // if not fetching the wsdl file from filesystem and a proxy has been configured
             if ($parsedWsdlPath->getScheme()->get() !== 'file') {
                 $streamContextProxyUrl = 'tcp://' . $proxy->getAuthority() . $proxy->getRelativeUrl();
                 libxml_set_streams_context(stream_context_get_default(array($proxy->getScheme()->get() => array('proxy' => $streamContextProxyUrl, 'request_fulluri' => true))));
             }
         }
         /*
          * INITIALIZATION
          */
         // prepare the path to the generated code
         $outputDir = $this->project->getBasedir() . '/src';
         $output = new ConsoleOutput();
         $progress = new ProgressBar($output, 100);
         $progress->setFormat(ProgressBar::getFormatDefinition('normal') . ' %message%...');
         $progress->setMessage('Starting');
         $progress->start();
         $progress->setMessage('Cleaning the environment');
         // clean the output directory
         array_map('unlink', glob($outputDir . '/*'));
         $progress->advance(10);
         /*
          * GENERATION
          */
         // prepare the generator configuration
         $progress->setMessage('Configuring the generator');
         $optionFeatures = array();
         if ($proxy) {
             /* @var \League\Url\UrlInterface $proxy */
             $optionFeatures['proxy_host'] = $proxy->getHost()->get();
             $optionFeatures['proxy_port'] = $proxy->getPort()->get();
         }
         $config = new Config($wsdlUrl, $outputDir);
         $config->setNoTypeConstructor(true);
         $config->setOptionFeatures($optionFeatures);
         $config->setCreateAccessors(false);
         $config->setWsdlCache(false);
         $progress->advance(10);
         // generate the code
         $progress->setMessage('Generating the code');
         $gen = new Generator();
         $gen->generate($config);
         $progress->advance(10);
         /*
          * FIX
          */
         // the 'optionFeatures' configuration options is misused by the generator:
         // it is correctly used as the default 'features' options of the service (its values are bitwised and put
         // in the service class constructor), but it is also used as the '$options' argument of the \SoapClient
         // class when it connects to the service to inspect it (hence the need to define the 'proxy_host' and
         // 'proxy_port' keys). this makes the generated code clash, so we need to fix it, removing the unneeded
         // values from the bitwise operation.
         $defaultFeatures = array('SOAP_SINGLE_ELEMENT_ARRAYS', 'SOAP_WAIT_ONE_WAY_CALLS');
         // fix the option 'features' management
         $fileContent = file_get_contents("{$outputDir}/ClabService.php");
         $fileContent = preg_replace('/(\\$options\\[\'features\'\\] = ).*/', '$1' . implode(' | ', $defaultFeatures) . ';', $fileContent, -1, $count);
         // if no features option has been found, they must be added manually
         if ($count === 0) {
             $fileContent = preg_replace('/parent::__construct/', "if (isset(\$options['features']) == false) {\n\$options['features'] = " . implode(' | ', $defaultFeatures) . ";\n}\n\nparent::__construct", $fileContent, -1, $count);
         }
         file_put_contents("{$outputDir}/ClabService.php", $fileContent);
         /*
          * LICENSE MANAGEMENT
          */
         $progress->setMessage('Applying the license to the generated files');
         // read the license header
         $licenseHeader = file_get_contents($this->project->getBasedir() . '/resources/license_header.txt');
         // print the license on top of every file
         foreach (glob($outputDir . '/*.php') as $sourceFile) {
             $fileContent = file_get_contents($sourceFile);
             $fileContent = preg_replace('/^(<\\?php)/', "\$1\n\n" . $licenseHeader, $fileContent);
             file_put_contents($sourceFile, $fileContent);
         }
         unset($sourceFile);
         $progress->advance(10);
         /*
          * CODING STANDARDS FIXES
          */
         // create the coding standards fixer
         $progress->setMessage('Configuring the Coding Standards fixer');
         $fixer = new Fixer();
         $csConfig = new CSConfig();
         $csConfig->setDir($outputDir);
         $progress->advance(10);
         // register all the existing fixers
         $fixer->registerBuiltInFixers();
         $progress->advance(10);
         // register all fixers from all PSR levels
         /* @var $csFixer \Symfony\CS\FixerInterface */
         $fixers = array();
         foreach ($fixer->getFixers() as $csFixer) {
             if ($csFixer->getLevel() === ($csFixer->getLevel() & FixerInterface::PSR2_LEVEL)) {
                 $fixers[] = $csFixer;
             }
         }
         // fix the generated code
         $progress->setMessage('Fixing the generated code');
         $csConfig->fixers($fixers);
         $progress->advance(10);
         $fixer->fix($csConfig);
         $progress->advance(10);
         $progress->setFormat(ProgressBar::getFormatDefinition('normal') . ' %message%');
         $progress->setMessage('Done');
         $progress->finish();
         $output->writeln('');
     } catch (\Exception $e) {
         $this->log($e->getMessage(), \Project::MSG_ERR);
     }
 }