Skip to content

Commit 0efd0ab

Browse files
committed
Add version flag
1 parent 89d06ea commit 0efd0ab

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

bin/phpca

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,19 @@ require $vendor_dir.'/autoload.php';
66

77
use wapmorgan\PhpCodeAnalyzer\PhpCodeAnalyzer;
88

9-
$version = file_exists(__DIR__.'/version.txt') ? trim(file_get_contents(__DIR__.'/version.txt')) : null;
9+
$version = file_exists(__DIR__.'/version.txt') ? trim(file_get_contents(__DIR__.'/version.txt')) : PhpCodeAnalyzer::VERSION;
1010
$doc = <<<DOC
1111
PhpCodeAnalyzer $version
1212
Usage:
1313
phpca [-v] [-q] [--output=<path>] [--no-report] [--no-progress] [--since-version=<version>] FILES...
1414
phpca [-v] [-q] [--output=<path>] --extension=<ext> FILES...
1515
phpca -h
16+
phpca --version
1617
1718
Options:
1819
-h --help Show this text
1920
-v --verbose Show more debug text
21+
--version Show version.
2022
-q --quiet Don't print any messages
2123
--output=<path> Path where to generate XML report
2224
--extension=<ext> Look for usage a specific extension
@@ -26,7 +28,7 @@ Options:
2628
2729
DOC;
2830

29-
$args = Docopt::handle($doc);
31+
$args = Docopt::handle($doc, ['version' => $version]);
3032

3133
if (isset($args['--verbose']) && $args['--verbose'])
3234
$_ENV['verbose'] = true;

src/PhpCodeAnalyzer.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ function array_filter_by_column($source, $needle, $column) {
4343
}
4444

4545
class PhpCodeAnalyzer {
46+
const VERSION = '1.0.6';
47+
4648
private $functionsSet = array();
4749
private $classesSet = array();
4850
private $constantsSet = array();

0 commit comments

Comments
 (0)