From 0efd0ab52cf15518a467f80158be20accc8e86d7 Mon Sep 17 00:00:00 2001 From: wapmorgan Date: Thu, 9 May 2019 18:24:55 +0300 Subject: [PATCH] Add version flag --- bin/phpca | 6 ++++-- src/PhpCodeAnalyzer.php | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/bin/phpca b/bin/phpca index 45c8c99..0a7d0d6 100755 --- a/bin/phpca +++ b/bin/phpca @@ -6,17 +6,19 @@ require $vendor_dir.'/autoload.php'; use wapmorgan\PhpCodeAnalyzer\PhpCodeAnalyzer; -$version = file_exists(__DIR__.'/version.txt') ? trim(file_get_contents(__DIR__.'/version.txt')) : null; +$version = file_exists(__DIR__.'/version.txt') ? trim(file_get_contents(__DIR__.'/version.txt')) : PhpCodeAnalyzer::VERSION; $doc = <<] [--no-report] [--no-progress] [--since-version=] FILES... phpca [-v] [-q] [--output=] --extension= FILES... phpca -h + phpca --version Options: -h --help Show this text -v --verbose Show more debug text + --version Show version. -q --quiet Don't print any messages --output= Path where to generate XML report --extension= Look for usage a specific extension @@ -26,7 +28,7 @@ Options: DOC; -$args = Docopt::handle($doc); +$args = Docopt::handle($doc, ['version' => $version]); if (isset($args['--verbose']) && $args['--verbose']) $_ENV['verbose'] = true; diff --git a/src/PhpCodeAnalyzer.php b/src/PhpCodeAnalyzer.php index ab43b04..6573c73 100644 --- a/src/PhpCodeAnalyzer.php +++ b/src/PhpCodeAnalyzer.php @@ -43,6 +43,8 @@ function array_filter_by_column($source, $needle, $column) { } class PhpCodeAnalyzer { + const VERSION = '1.0.6'; + private $functionsSet = array(); private $classesSet = array(); private $constantsSet = array();