1212
1313namespace MoodlePluginCI \Command ;
1414
15+ use MoodlePluginCI \Bridge \MoodlePlugin ;
1516use Symfony \Component \Console \Input \InputInterface ;
1617use Symfony \Component \Console \Output \OutputInterface ;
1718use Symfony \Component \Filesystem \Filesystem ;
1819use Symfony \Component \Process \ProcessBuilder ;
19- use MoodlePluginCI \Bridge \MoodlePlugin ;
2020
2121class PHPDocCommand extends AbstractMoodleCommand
2222{
@@ -42,8 +42,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
4242
4343 // We need local_moodlecheck plugin to run this check.
4444 $ pluginlocation = __DIR__ .'/../../vendor/moodlehq/moodle-local_moodlecheck ' ;
45- $ plugin = new MoodlePlugin ($ pluginlocation );
46- $ directory = $ this ->moodle ->getComponentInstallDirectory ($ plugin ->getComponent ());
45+ $ plugin = new MoodlePlugin ($ pluginlocation );
46+ $ directory = $ this ->moodle ->getComponentInstallDirectory ($ plugin ->getComponent ());
4747 if (!is_dir ($ directory )) {
4848 // Copy plugin into Moodle if it does not exist.
4949 $ filesystem = new Filesystem ();
@@ -54,7 +54,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
5454 ProcessBuilder::create ()
5555 ->setPrefix ('php ' )
5656 ->add ('local/moodlecheck/cli/moodlecheck.php ' )
57- ->add ('-p= ' . $ this ->plugin ->directory )
57+ ->add ('-p= ' . $ this ->plugin ->directory )
5858 ->add ('-f=text ' )
5959 ->setTimeout (null )
6060 ->setWorkingDirectory ($ this ->moodle ->directory )
@@ -69,6 +69,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
6969 // moodlecheck.php does not return valid exit status,
7070 // We have to parse output to see if there are errors.
7171 $ results = $ process ->getOutput ();
72+
7273 return (preg_match ('/\s+Line/ ' , $ results )) ? 1 : 0 ;
7374 }
7475}
0 commit comments