From a0c6f2e5e071a287717e58f32c5b3cf6e219f321 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 7 Jul 2015 15:37:56 +0200 Subject: Use the decorator pattern --- core/command/app/checkcode.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'core/command') diff --git a/core/command/app/checkcode.php b/core/command/app/checkcode.php index a533ce767f3..3f4fb95868c 100644 --- a/core/command/app/checkcode.php +++ b/core/command/app/checkcode.php @@ -24,8 +24,10 @@ namespace OC\Core\Command\App; use OC\App\CodeChecker\CodeChecker; -use OC\App\CodeChecker\DeprecationList; -use OC\App\CodeChecker\PrivateList; +use OC\App\CodeChecker\DeprecationCheck; +use OC\App\CodeChecker\EmptyCheck; +use OC\App\CodeChecker\PrivateCheck; +use OC\App\CodeChecker\StrongComparisonCheck; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -52,12 +54,14 @@ class CheckCode extends Command { protected function execute(InputInterface $input, OutputInterface $output) { $appId = $input->getArgument('app-id'); + $checkList = new EmptyCheck(); if ($input->getOption('deprecated')) { - $list = new DeprecationList(); + $checkList = new DeprecationCheck($checkList); + $checkList = new StrongComparisonCheck($checkList); } else { - $list = new PrivateList(); + $checkList = new PrivateCheck($checkList); } - $codeChecker = new CodeChecker($list); + $codeChecker = new CodeChecker($checkList); $codeChecker->listen('CodeChecker', 'analyseFileBegin', function($params) use ($output) { if(OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) { -- cgit v1.2.3