From b39593f7028d0723a69437c3a2e5265e4d53e9c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Miko=C5=82ajuk?= Date: Tue, 16 Jun 2015 11:35:10 +0200 Subject: [PATCH] Phplint A simple wrapper around the `php -l ` command. --- Tool/Phplint.php | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Tool/Phplint.php diff --git a/Tool/Phplint.php b/Tool/Phplint.php new file mode 100644 index 0000000..916c8eb --- /dev/null +++ b/Tool/Phplint.php @@ -0,0 +1,42 @@ + 'src', + 'command' => "find", + 'threshold' => 0, + 'timeout' => 1200 + ]; + + public function composeCommand() + { + return "{$this->composeReportCommand()} | grep -v 'No syntax error' | wc -l"; + } + + public function composeReportCommand() + { + return "{$this->configuration['command']} {$this->configuration['directory']} -name '*.php' -exec php -l {} \\;"; + } + + public function getThreshold() + { + return isset($this->configuration['threshold']) ? $this->configuration['threshold'] : 0; + } + + public function getErrorMessage() + { + return 'The PHP Lint threshold is exceeded'; + } + + public function getSuccessMessage() + { + return 'The PHP Lint threshold passed'; + } +}