/** * Main method that starts the command line runner. * * @return integer The exit code. */ public static function main() { $command = new Command(); return $command->run(); }
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * @copyright 2008-2015 Manuel Pichler. All rights reserved. * @license http://www.opensource.org/licenses/bsd-license.php BSD License */ use PDepend\TextUI\Command; // PEAR/svn workaround if (strpos('@php_bin@', '@php_bin') === 0) { set_include_path('.' . PATH_SEPARATOR . dirname(__FILE__) . '/../main/php'); } require_once __DIR__ . '/../../vendor/autoload.php'; // Allow as much memory as possible by default if (extension_loaded('suhosin') && is_numeric(ini_get('suhosin.memory_limit'))) { $limit = ini_get('memory_limit'); if (preg_match('(^(\\d+)([BKMGT]))', $limit, $match)) { $shift = array('B' => 0, 'K' => 10, 'M' => 20, 'G' => 30, 'T' => 40); $limit = $match[1] * (1 << $shift[$match[2]]); } if (ini_get('suhosin.memory_limit') > $limit && $limit > -1) { ini_set('memory_limit', ini_get('suhosin.memory_limit')); } } else { ini_set('memory_limit', -1); } exit(Command::main());
/** * Executes the text ui command and returns the exit code and the output as * an array <b>array($exitCode, $output)</b>. * * @param array $argv The cli parameters. * * @return array(mixed) */ private function executeCommand(array $argv = null) { $this->prepareArgv($argv); ob_start(); $command = new Command(); $exitCode = $command->run(); $output = ob_get_contents(); ob_end_clean(); return array($exitCode, $output); }