예제 #1
0
 protected function setArgumentHandlers()
 {
     parent::setArgumentHandlers()->addArgumentHandler(function ($script, $argument, $remote) {
         if (sizeof($remote) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $remote, $script->getName()));
         }
         $script->setRemote(reset($remote));
     }, array('-tr', '--to-remote'), '<string>', $this->locale->_('<string> will be used as remote'))->addArgumentHandler(function ($script, $argument, $branch) {
         if (sizeof($branch) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->setBranch(reset($branch));
     }, array('-ib', '--in-branch'), '<string>', $this->locale->_('<string> will be used as remote branch'))->addArgumentHandler(function ($script, $argument, $tagFile) {
         if (sizeof($tagFile) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->setTagFile(reset($tagFile));
     }, array('-ib', '--in-branch'), '<path>', $this->locale->_('File <path> will be used to store last tag'));
     return $this;
 }
예제 #2
0
 protected function setArgumentHandlers()
 {
     $builder = $this;
     return parent::setArgumentHandlers()->addArgumentHandler(function ($script, $argument, $files) use($builder) {
         if (sizeof($files) <= 0) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         foreach ($files as $file) {
             if (file_exists($file) === false) {
                 throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Runner configuration file path \'%s\' is invalid'), $file));
             }
             if (is_readable($file) === false) {
                 throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Unable to read runner configuration file \'%s\''), $file));
             }
             $script->addRunnerConfigurationFile($file);
         }
     }, array('-rc', '--runner-configuration-files'), '<file>', $this->locale->_('Use <file> as configuration file for runner'))->addArgumentHandler(function ($script, $argument, $path) {
         if (sizeof($path) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->setPhpPath(current($path));
     }, array('-p', '--php'), '<path>', $this->locale->_('Path to PHP binary'))->addArgumentHandler(function ($script, $argument, $directory) {
         if (sizeof($directory) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->setWorkingDirectory(current($directory));
     }, array('-w', '--working-directory'), '<directory>', $this->locale->_('Checkout file from repository in <directory>'))->addArgumentHandler(function ($script, $argument, $directory) {
         if (sizeof($directory) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->setDestinationDirectory(current($directory));
     }, array('-d', '--destination-directory'), '<directory>', $this->locale->_('Save phar in <directory>'))->addArgumentHandler(function ($script, $argument, $directory) {
         if (sizeof($directory) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->setScoreDirectory(current($directory));
     }, array('-sd', '--score-directory'), '<directory>', $this->locale->_('Save score in <directory>'))->addArgumentHandler(function ($script, $argument, $directory) {
         if (sizeof($directory) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->setErrorsDirectory(current($directory));
     }, array('-ed', '--errors-directory'), '<directory>', $this->locale->_('Save errors in <directory>'))->addArgumentHandler(function ($script, $argument, $url) {
         if (sizeof($url) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->getVcs()->setRepositoryUrl(current($url));
     }, array('-r', '--repository-url'), '<url>', $this->locale->_('Url of repository'))->addArgumentHandler(function ($script, $argument, $file) {
         if (sizeof($file) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->setRevisionFile(current($file));
     }, array('-rf', '--revision-file'), '<file>', $this->locale->_('Save last revision in <file>'))->addArgumentHandler(function ($script, $argument, $version) {
         if (sizeof($version) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->setVersion(current($version));
     }, array('-v', '--version'), '<string>', $this->locale->_('Version <string> will be used as version name'))->addArgumentHandler(function ($script, $argument, $unitTestRunnerScript) {
         if (sizeof($unitTestRunnerScript) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->setUnitTestRunnerScript(current($unitTestRunnerScript));
     }, array('-utrs', '--unit-test-runner-script'))->addArgumentHandler(function ($script, $argument, $pharGeneratorScript) {
         if (sizeof($pharGeneratorScript) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->setPharGeneratorScript(current($pharGeneratorScript));
     }, array('-pgs', '--phar-generator-script'))->addArgumentHandler(function ($script, $argument, $reportTitle) {
         if (sizeof($reportTitle) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->setReportTitle(current($reportTitle));
     }, array('-rt', '--report-title'));
 }
예제 #3
0
파일: pusher.php 프로젝트: xihewang/atoum
 protected function setArgumentHandlers()
 {
     parent::setArgumentHandlers()->addArgumentHandler(function ($script, $argument, $remote) {
         if (sizeof($remote) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $remote, $script->getName()));
         }
         $script->setRemote(reset($remote));
     }, array('-tr', '--to-remote'), '<string>', $this->locale->_('<string> will be used as remote'))->addArgumentHandler(function ($script, $argument, $tagFile) {
         if (sizeof($tagFile) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->setTagFile(reset($tagFile));
     }, array('-tf', '--tag-file'), '<path>', $this->locale->_('File <path> will be used to store last tag'))->addArgumentHandler(function ($script, $argument, $value) {
         $script->tagMajorVersion();
     }, array('-MR', '--major-release'), null, $this->locale->_('Tag a new major version'))->addArgumentHandler(function ($script, $argument, $value) {
         $script->tagMinorVersion();
     }, array('-mr', '--minor-release'), null, $this->locale->_('Tag a new minor version'))->addArgumentHandler(function ($script, $argument, $value) {
         $script->tagPatchVersion();
     }, array('-pr', '--patch-release'), null, $this->locale->_('Tag a new patch version'));
     return $this;
 }
예제 #4
0
파일: runner.php 프로젝트: eroluysal/atoum
 protected function setArgumentHandlers()
 {
     parent::setArgumentHandlers()->addArgumentHandler(function ($script, $argument, $values) {
         if (sizeof($values) !== 0) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->version();
     }, array('-v', '--version'), null, $this->locale->_('Display version'))->addArgumentHandler(function ($script, $argument, $values) {
         if (sizeof($values) !== 0) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->resetVerbosityLevel();
         $verbosityLevel = substr_count($argument, '+');
         while ($verbosityLevel--) {
             $script->increaseVerbosityLevel();
         }
     }, array('+verbose', '++verbose'), null, $this->locale->_('Enable verbose mode'))->addArgumentHandler(function ($script, $argument, $values) {
         if (sizeof($values) === 0) {
             $values = array(getcwd());
         }
         $script->init(current($values));
     }, array('--init'), '<path/to/directory>', $this->locale->_('Create configuration and bootstrap files in <path/to/directory> (Optional, default: %s)', $this->getDirectory()))->addArgumentHandler(function ($script, $argument, $path) {
         if (sizeof($path) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->setPhpPath(reset($path));
     }, array('-p', '--php'), '<path/to/php/binary>', $this->locale->_('Path to PHP binary which must be used to run tests'))->addArgumentHandler(function ($script, $argument, $defaultReportTitle) {
         if (sizeof($defaultReportTitle) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->setDefaultReportTitle(reset($defaultReportTitle));
     }, array('-drt', '--default-report-title'), '<string>', $this->locale->_('Define default report title with <string>'))->addArgumentHandler(function ($script, $argument, $file) {
         if (sizeof($file) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->setScoreFile(reset($file));
     }, array('-sf', '--score-file'), '<file>', $this->locale->_('Save score in file <file>'))->addArgumentHandler(function ($script, $argument, $maxChildrenNumber) {
         if (sizeof($maxChildrenNumber) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->setMaxChildrenNumber(reset($maxChildrenNumber));
     }, array('-mcn', '--max-children-number'), '<integer>', $this->locale->_('Maximum number of sub-processus which will be run simultaneously'))->addArgumentHandler(function ($script, $argument, $empty) {
         if ($empty) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->disableCodeCoverage();
     }, array('-ncc', '--no-code-coverage'), null, $this->locale->_('Disable code coverage'))->addArgumentHandler(function ($script, $argument, $directories) {
         if (sizeof($directories) <= 0) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->excludeDirectoriesFromCoverage($directories);
     }, array('-nccid', '--no-code-coverage-in-directories'), '<directory>...', $this->locale->_('Disable code coverage in directories <directory>'))->addArgumentHandler(function ($script, $argument, $namespaces) {
         if (sizeof($namespaces) <= 0) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->excludeNamespacesFromCoverage($namespaces);
     }, array('-nccfns', '--no-code-coverage-for-namespaces'), '<namespace>...', $this->locale->_('Disable code coverage for namespaces <namespace>'))->addArgumentHandler(function ($script, $argument, $classes) {
         if (sizeof($classes) <= 0) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->excludeClassesFromCoverage($classes);
     }, array('-nccfc', '--no-code-coverage-for-classes'), '<class>...', $this->locale->_('Disable code coverage for classes <class>'))->addArgumentHandler(function ($script, $argument, $classes) {
         if (sizeof($classes) <= 0) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->excludeMethodsFromCoverage($classes);
     }, array('-nccfm', '--no-code-coverage-for-methods'), '<method>...', $this->locale->_('Disable code coverage for methods <method>'))->addArgumentHandler(function ($script, $argument, $empty) {
         if ($empty) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->enableBranchesAndPathsCoverage();
     }, array('-ebpc', '--enable-branch-and-path-coverage'), null, $this->locale->_('Enable branch and path coverage'))->addArgumentHandler(function ($script, $argument, $files) {
         if (sizeof($files) <= 0) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->addTests($files);
     }, array('-f', '--files'), '<file>...', $this->locale->_('Execute all unit test files <file>'))->addArgumentHandler(function ($script, $argument, $directories) {
         if (sizeof($directories) <= 0) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->addTestsFromDirectories($directories);
     }, array('-d', '--directories'), '<directory>...', $this->locale->_('Execute unit test files in all <directory>'))->addArgumentHandler(function ($script, $argument, $extensions) {
         if (sizeof($extensions) <= 0) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->acceptTestFileExtensions($extensions);
     }, array('-tfe', '--test-file-extensions'), '<extension>...', $this->locale->_('Execute unit test files with one of extensions <extension>'))->addArgumentHandler(function ($script, $argument, $patterns) {
         if (sizeof($patterns) <= 0) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->addTestsFromPatterns($patterns);
     }, array('-g', '--glob'), '<pattern>...', $this->locale->_('Execute unit test files which match <pattern>'))->addArgumentHandler(function ($script, $argument, $tags) {
         if (sizeof($tags) <= 0) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->testTags($tags);
     }, array('-t', '--tags'), '<tag>...', $this->locale->_('Execute only unit test with tags <tag>'))->addArgumentHandler(function ($script, $argument, $methods) {
         if (sizeof($methods) <= 0) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         foreach ($methods as $method) {
             $method = explode('::', $method);
             if (sizeof($method) != 2) {
                 throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
             }
             $script->testMethod($method[0], $method[1]);
         }
     }, array('-m', '--methods'), '<class::method>...', $this->locale->_('Execute all <class::method>, * may be used as wildcard for class name or method name'))->addArgumentHandler(function ($script, $argument, $namespaces) {
         if (sizeof($namespaces) <= 0) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->testNamespaces($namespaces);
     }, array('-ns', '--namespaces'), '<namespace>...', $this->locale->_('Execute all classes in all namespaces <namespace>'))->addArgumentHandler(function ($script, $argument, $values) {
         if ($values) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->enableLoopMode();
     }, array('-l', '--loop'), null, $this->locale->_('Execute tests in an infinite loop'))->addArgumentHandler(function ($script, $argument, $values) {
         if (sizeof($values) !== 0) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->disableLoopMode();
     }, array('--disable-loop-mode'), null, null, 3)->addArgumentHandler(function ($script, $argument, $values) {
         if (sizeof($values) !== 0) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->testIt();
     }, array('--test-it'), null, $this->locale->_('Execute atoum unit tests'))->addArgumentHandler(function ($script, $argument, $values) {
         $script->writeError('--test-all argument is deprecated, please do $runner->addTestsFromDirectory(\'path/to/default/tests/directory\') in a configuration file and use atoum without any argument instead');
     }, array('--test-all'), null, $this->locale->_('DEPRECATED, please do $runner->addTestsFromDirectory(\'path/to/default/tests/directory\') in a configuration file and use atoum without any argument instead'))->addArgumentHandler(function ($script, $argument, $values) {
         if ($values) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         \mageekguy\atoum\cli::forceTerminal();
     }, array('-ft', '--force-terminal'), null, $this->locale->_('Force output as in terminal'))->addArgumentHandler(function ($script, $argument, $values) {
         if (sizeof($values) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->setBootstrapFile($values[0]);
     }, array('-bf', '--bootstrap-file'), '<file>', $this->locale->_('Include <file> before executing each test method'), 2)->addArgumentHandler(function ($script, $argument, $values) {
         if (sizeof($values) != 0) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $lightReport = new atoum\reports\realtime\cli\light();
         $lightReport->addWriter($script->getOutputWriter());
         $script->setReport($lightReport);
     }, array('-ulr', '--use-light-report'), null, $this->locale->_('Use "light" CLI report'), PHP_INT_MAX)->addArgumentHandler(function ($script, $argument, $values) {
         if (sizeof($values) != 0) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $tapReport = new atoum\reports\realtime\tap();
         $tapReport->addWriter($script->getOutputWriter());
         $script->setReport($tapReport);
     }, array('-utr', '--use-tap-report'), null, $this->locale->_('Use TAP report'), PHP_INT_MAX)->addArgumentHandler(function ($script, $argument, $values) {
         if (sizeof($values) != 0) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->enableDebugMode();
     }, array('--debug'), null, $this->locale->_('Enable debug mode'))->addArgumentHandler(function ($script, $argument, $values) {
         if (sizeof($values) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->setXdebugConfig($values[0]);
     }, array('-xc', '--xdebug-config'), null, $this->locale->_('Set XDEBUG_CONFIG variable'))->addArgumentHandler(function ($script, $argument, $values) {
         $script->failIfVoidMethods();
     }, array('-fivm', '--fail-if-void-methods'), null, $this->locale->_('Make the test suite fail if there is at least one void test method'))->addArgumentHandler(function ($script, $argument, $values) {
         $script->failIfSkippedMethods();
     }, array('-fism', '--fail-if-skipped-methods'), null, $this->locale->_('Make the test suite fail if there is at least one skipped test method'));
     $this->setDefaultArgumentHandler(function ($script, $argument) {
         try {
             $script->getRunner()->addTest($argument);
         } catch (\exception $exception) {
             return false;
         }
         return true;
     });
     return $this;
 }
예제 #5
0
파일: treemap.php 프로젝트: xihewang/atoum
 protected function setArgumentHandlers()
 {
     return parent::setArgumentHandlers()->addArgumentHandler(function ($script, $argument, $projectName) {
         if (sizeof($projectName) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->setProjectName(current($projectName));
     }, array('-pn', '--project-name'), '<string>', $this->locale->_('Set project name <string>'))->addArgumentHandler(function ($script, $argument, $projectUrl) {
         if (sizeof($projectUrl) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getUrl()));
         }
         $script->setProjectUrl(current($projectUrl));
     }, array('-pu', '--project-url'), '<string>', $this->locale->_('Set project url <string>'))->addArgumentHandler(function ($script, $argument, $codeUrl) {
         if (sizeof($codeUrl) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getUrl()));
         }
         $script->setCodeUrl(current($codeUrl));
     }, array('-cu', '--code-url'), '<string>', $this->locale->_('Set code url <string>'))->addArgumentHandler(function ($script, $argument, $directories) {
         if (sizeof($directories) <= 0) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         foreach ($directories as $directory) {
             $script->addDirectory($directory);
         }
     }, array('-d', '--directories'), '<directory>...', $this->locale->_('Scan all directories <directory>'))->addArgumentHandler(function ($script, $argument, $outputDirectory) {
         if (sizeof($outputDirectory) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->setOutputDirectory(current($outputDirectory));
     }, array('-od', '--output-directory'), '<directory>', $this->locale->_('Generate treemap in directory <directory>'))->addArgumentHandler(function ($script, $argument, $value) {
         if (sizeof($value) != 0) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->getOnlyJsonFile(true);
     }, array('-ojf', '--only-json-file'), null, $this->locale->_('Generate only JSON file'))->addArgumentHandler(function ($script, $argument, $value) {
         if (sizeof($value) != 0) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->addAnalyzer(new analyzers\sloc());
     }, array('--sloc'), null, $this->locale->_('Count source line of code (SLOC)'))->addArgumentHandler(function ($script, $argument, $value) {
         if (sizeof($value) != 0) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->addAnalyzer(new analyzers\token());
     }, array('--php-token'), null, $this->locale->_('Count PHP tokens'))->addArgumentHandler(function ($script, $argument, $value) {
         if (sizeof($value) != 0) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->addAnalyzer(new analyzers\size());
     }, array('--file-size'), null, $this->locale->_('Get file size'))->addArgumentHandler(function ($script, $argument, $htmlDirectory) {
         if (sizeof($htmlDirectory) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->setHtmlDirectory(current($htmlDirectory));
     }, array('-hd', '--html-directory'), '<directory>', $this->locale->_('Use html files in <directory> to generate treemap'));
 }