77 * For the full copyright and license information, please view the LICENSE
88 * file that was distributed with this source code.
99 */
10+
1011namespace sclable \xmlLint \console \command ;
1112
1213use sclable \xmlLint \data \FileReport ;
14+ use Symfony \Component \Finder \Finder ;
15+ use Symfony \Component \Finder \SplFileInfo ;
1316use sclable \xmlLint \validator \ValidationFactory ;
17+ use Symfony \Component \Console \Input \InputOption ;
1418use sclable \xmlLint \validator \ValidationInterface ;
1519use Symfony \Component \Console \Input \InputArgument ;
1620use Symfony \Component \Console \Input \InputInterface ;
17- use Symfony \Component \Console \Input \InputOption ;
1821use Symfony \Component \Console \Output \OutputInterface ;
19- use Symfony \Component \Finder \Finder ;
20- use Symfony \Component \Finder \SplFileInfo ;
2122
2223/**
23- * Class LintCommand
24+ * Class LintCommand.
2425 *
2526 *
26- * @package sclable\xmlLint\console\command
2727 * @author Michael Rutz <[email protected] > 2828 *
2929 * @const string COMMAND_NAME the name of the command
@@ -35,9 +35,9 @@ class LintCommand extends Command
3535 const COMMAND_NAME = 'lint ' ;
3636 const ARGUMENT_FILE = 'file ' ;
3737 const OPTION_RECURSIVE = 'recursive ' ;
38- const OPTION_EXCLUDE = 'exclude ' ;
39- const OPTION_PATTERN = 'pattern ' ;
40- const OPTION_NO_XSD = 'skip-xsd ' ;
38+ const OPTION_EXCLUDE = 'exclude ' ;
39+ const OPTION_PATTERN = 'pattern ' ;
40+ const OPTION_NO_XSD = 'skip-xsd ' ;
4141
4242 /** @var OutputInterface */
4343 protected $ output ;
@@ -55,7 +55,7 @@ class LintCommand extends Command
5555 private $ start ;
5656
5757 /**
58- * @inheritdoc
58+ * { @inheritdoc}
5959 */
6060 protected function configure ()
6161 {
@@ -97,7 +97,7 @@ protected function configure()
9797 }
9898
9999 /**
100- * @inheritdoc
100+ * { @inheritdoc}
101101 */
102102 protected function execute (InputInterface $ input , OutputInterface $ output )
103103 {
@@ -122,7 +122,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
122122
123123 $ output ->writeln ('' );
124124
125- if ($ status === false ) {
125+ if (false === $ status ) {
126126 $ this ->printReportsOfFilesWithProblems ();
127127 }
128128
@@ -136,8 +136,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
136136 }
137137
138138 /**
139- * lint the content of a directory, recursive if defined
139+ * lint the content of a directory, recursive if defined.
140+ *
140141 * @param string $dir path/to/dir
142+ *
141143 * @return bool
142144 */
143145 private function lintDir ($ dir )
@@ -173,7 +175,7 @@ private function lintDir($dir)
173175 /** @var SplFileInfo $file */
174176 foreach ($ finder as $ file ) {
175177 $ ret = $ this ->lintFile ($ file ) && $ ret ;
176- if (++$ counter % 30 == 0 ) {
178+ if (0 == ++$ counter % 30 ) {
177179 $ this ->output ->writeln (sprintf (
178180 ' %8d/%d %6.2f%% ' ,
179181 $ counter ,
@@ -187,14 +189,14 @@ private function lintDir($dir)
187189 }
188190
189191 /**
190- * format and print the errors from the queue to the output
192+ * format and print the errors from the queue to the output.
191193 */
192194 private function printReportsOfFilesWithProblems ()
193195 {
194196 $ this ->output ->writeln (PHP_EOL . '<error>errors:</error> ' );
195197
196198 foreach ($ this ->reports as $ report ) {
197- if ($ report ->hasProblems () === false ) {
199+ if (false === $ report ->hasProblems ()) {
198200 continue ;
199201 }
200202
@@ -212,13 +214,14 @@ private function printReportsOfFilesWithProblems()
212214 }
213215
214216 /**
215- * lint a file, pass errors to the queue
217+ * lint a file, pass errors to the queue.
218+ *
216219 * @param \SplFileInfo $file
220+ *
217221 * @return bool
218222 */
219223 private function lintFile (\SplFileInfo $ file )
220224 {
221-
222225 if ($ this ->output ->getVerbosity () >= OutputInterface::VERBOSITY_VERBOSE ) {
223226 $ this ->output ->write ('lint file ' . $ file . ' ... ' );
224227 }
@@ -228,13 +231,13 @@ private function lintFile(\SplFileInfo $file)
228231 $ status = $ this ->validator ->validateFile ($ report );
229232
230233 if ($ this ->output ->getVerbosity () >= OutputInterface::VERBOSITY_VERBOSE ) {
231- if ($ status === false ) {
234+ if (false === $ status ) {
232235 $ this ->output ->writeln ('<error>errors</error> ' );
233236 } else {
234237 $ this ->output ->writeln ('<info>passed.</info> ' );
235238 }
236239 } else {
237- if ($ status === false ) {
240+ if (false === $ status ) {
238241 $ this ->output ->write ('<error>F</error> ' );
239242 } else {
240243 $ this ->output ->write ('. ' );
0 commit comments