http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/d11wtq/boris/lib/Boris/Config.php ---------------------------------------------------------------------- diff --git a/vendor/d11wtq/boris/lib/Boris/Config.php b/vendor/d11wtq/boris/lib/Boris/Config.php deleted file mode 100644 index c3277a7..0000000 --- a/vendor/d11wtq/boris/lib/Boris/Config.php +++ /dev/null @@ -1,88 +0,0 @@ -<?php - -namespace Boris; - -/** - * Config handles loading configuration files for boris - */ -class Config -{ - private $_searchPaths; - private $_cascade = false; - private $_files = array(); - - /** - * Create a new Config instance, optionally with an array - * of paths to search for configuration files. - * - * Additionally, if the second, optional boolean argument is - * true, all existing configuration files will be loaded, and - * effectively merged. - * - * @param array $searchPaths - * @param bool $cascade - */ - public function __construct($searchPaths = null, $cascade = false) - { - if (is_null($searchPaths)) { - $searchPaths = array(); - - if ($userHome = getenv('HOME')) { - $searchPaths[] = "{$userHome}/.borisrc"; - } - - $searchPaths[] = getcwd() . '/.borisrc'; - } - - $this->_cascade = $cascade; - $this->_searchPaths = $searchPaths; - } - - /** - * Searches for configuration files in the available - * search paths, and applies them to the provided - * boris instance. - * - * Returns true if any configuration files were found. - * - * @param Boris\Boris $boris - * @return bool - */ - public function apply(Boris $boris) - { - $applied = false; - - foreach ($this->_searchPaths as $path) { - if (is_readable($path)) { - $this->_loadInIsolation($path, $boris); - - $applied = true; - $this->_files[] = $path; - - if (!$this->_cascade) { - break; - } - } - } - - return $applied; - } - - /** - * Returns an array of files that were loaded - * for this Config - * - * @return array - */ - public function loadedFiles() - { - return $this->_files; - } - - // -- Private Methods - - private function _loadInIsolation($path, $boris) - { - require $path; - } -}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/d11wtq/boris/lib/Boris/DumpInspector.php ---------------------------------------------------------------------- diff --git a/vendor/d11wtq/boris/lib/Boris/DumpInspector.php b/vendor/d11wtq/boris/lib/Boris/DumpInspector.php deleted file mode 100644 index ce884cd..0000000 --- a/vendor/d11wtq/boris/lib/Boris/DumpInspector.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -namespace Boris; - -/** - * Passes values through var_dump() to inspect them. - */ -class DumpInspector implements Inspector -{ - public function inspect($variable) - { - ob_start(); - var_dump($variable); - return sprintf(" â %s", trim(ob_get_clean())); - } -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/d11wtq/boris/lib/Boris/EvalWorker.php ---------------------------------------------------------------------- diff --git a/vendor/d11wtq/boris/lib/Boris/EvalWorker.php b/vendor/d11wtq/boris/lib/Boris/EvalWorker.php deleted file mode 100644 index 0792d09..0000000 --- a/vendor/d11wtq/boris/lib/Boris/EvalWorker.php +++ /dev/null @@ -1,275 +0,0 @@ -<?php - -namespace Boris; - -/** - * EvalWorker is responsible for evaluating PHP expressions in forked processes. - */ -class EvalWorker -{ - const ABNORMAL_EXIT = 255; - const DONE = "\0"; - const EXITED = "\1"; - const FAILED = "\2"; - const READY = "\3"; - - private $_socket; - private $_exports = array(); - private $_startHooks = array(); - private $_failureHooks = array(); - private $_ppid; - private $_pid; - private $_cancelled; - private $_inspector; - private $_userExceptionHandler; - - /** - * Create a new worker using the given socket for communication. - * - * @param resource $socket - */ - public function __construct($socket) - { - $this->_socket = $socket; - $this->_inspector = new DumpInspector(); - stream_set_blocking($socket, 0); - } - - /** - * Set local variables to be placed in the workers's scope. - * - * @param array|string $local - * @param mixed $value, if $local is a string - */ - public function setLocal($local, $value = null) - { - if (!is_array($local)) { - $local = array( - $local => $value - ); - } - - $this->_exports = array_merge($this->_exports, $local); - } - - /** - * Set hooks to run inside the worker before it starts looping. - * - * @param array $hooks - */ - public function setStartHooks($hooks) - { - $this->_startHooks = $hooks; - } - - /** - * Set hooks to run inside the worker after a fatal error is caught. - * - * @param array $hooks - */ - public function setFailureHooks($hooks) - { - $this->_failureHooks = $hooks; - } - - /** - * Set an Inspector object for Boris to output return values with. - * - * @param object $inspector any object the responds to inspect($v) - */ - public function setInspector($inspector) - { - $this->_inspector = $inspector; - } - - /** - * Start the worker. - * - * This method never returns. - */ - public function start() - { - $__scope = $this->_runHooks($this->_startHooks); - extract($__scope); - - $this->_write($this->_socket, self::READY); - - /* Note the naming of the local variables due to shared scope with the user here */ - for (;;) { - declare (ticks = 1); - // don't exit on ctrl-c - pcntl_signal(SIGINT, SIG_IGN, true); - - $this->_cancelled = false; - - $__input = $this->_transform($this->_read($this->_socket)); - - if ($__input === null) { - continue; - } - - $__response = self::DONE; - - $this->_ppid = posix_getpid(); - $this->_pid = pcntl_fork(); - - if ($this->_pid < 0) { - throw new \RuntimeException('Failed to fork child labourer'); - } elseif ($this->_pid > 0) { - // kill the child on ctrl-c - pcntl_signal(SIGINT, array( - $this, - 'cancelOperation' - ), true); - pcntl_waitpid($this->_pid, $__status); - - if (!$this->_cancelled && $__status != (self::ABNORMAL_EXIT << 8)) { - $__response = self::EXITED; - } else { - $this->_runHooks($this->_failureHooks); - $__response = self::FAILED; - } - } else { - // if the user has installed a custom exception handler, install a new - // one which calls it and then (if the custom handler didn't already exit) - // exits with the correct status. - // If not, leave the exception handler unset; we'll display - // an uncaught exception error and carry on. - $__oldexh = set_exception_handler(array( - $this, - 'delegateExceptionHandler' - )); - if ($__oldexh && !$this->_userExceptionHandler) { - $this->_userExceptionHandler = $__oldexh; // save the old handler (once) - } else { - restore_exception_handler(); - } - - // undo ctrl-c signal handling ready for user code execution - pcntl_signal(SIGINT, SIG_DFL, true); - $__pid = posix_getpid(); - - $__result = eval($__input); - - if (posix_getpid() != $__pid) { - // whatever the user entered caused a forked child - // (totally valid, but we don't want that child to loop and wait for input) - exit(0); - } - - if (preg_match('/\s*return\b/i', $__input)) { - fwrite(STDOUT, sprintf("%s\n", $this->_inspector->inspect($__result))); - } - $this->_expungeOldWorker(); - } - - $this->_write($this->_socket, $__response); - - if ($__response == self::EXITED) { - exit(0); - } - } - } - - /** - * While a child process is running, terminate it immediately. - */ - public function cancelOperation() - { - printf("Cancelling...\n"); - $this->_cancelled = true; - posix_kill($this->_pid, SIGKILL); - pcntl_signal_dispatch(); - } - - /** - * Call the user-defined exception handler, then exit correctly. - */ - public function delegateExceptionHandler($ex) - { - call_user_func($this->_userExceptionHandler, $ex); - exit(self::ABNORMAL_EXIT); - } - - // -- Private Methods - - private function _runHooks($hooks) - { - extract($this->_exports); - - foreach ($hooks as $__hook) { - if (is_string($__hook)) { - eval($__hook); - } elseif (is_callable($__hook)) { - call_user_func($__hook, $this, get_defined_vars()); - } else { - throw new \RuntimeException(sprintf('Hooks must be closures or strings of PHP code. Got [%s].', gettype($__hook))); - } - - // hooks may set locals - extract($this->_exports); - } - - return get_defined_vars(); - } - - private function _expungeOldWorker() - { - posix_kill($this->_ppid, SIGTERM); - pcntl_signal_dispatch(); - } - - private function _write($socket, $data) - { - if (!fwrite($socket, $data)) { - throw new \RuntimeException('Socket error: failed to write data'); - } - } - - private function _read($socket) - { - $read = array( - $socket - ); - $except = array( - $socket - ); - - if ($this->_select($read, $except) > 0) { - if ($read) { - return stream_get_contents($read[0]); - } else if ($except) { - throw new \UnexpectedValueException("Socket error: closed"); - } - } - } - - private function _select(&$read, &$except) - { - $write = null; - set_error_handler(function() - { - return true; - }, E_WARNING); - $result = stream_select($read, $write, $except, 10); - restore_error_handler(); - return $result; - } - - private function _transform($input) - { - if ($input === null) { - return null; - } - - $transforms = array( - 'exit' => 'exit(0)' - ); - - foreach ($transforms as $from => $to) { - $input = preg_replace('/^\s*' . preg_quote($from, '/') . '\s*;?\s*$/', $to . ';', $input); - } - - return $input; - } -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/d11wtq/boris/lib/Boris/ExportInspector.php ---------------------------------------------------------------------- diff --git a/vendor/d11wtq/boris/lib/Boris/ExportInspector.php b/vendor/d11wtq/boris/lib/Boris/ExportInspector.php deleted file mode 100644 index 68aca5a..0000000 --- a/vendor/d11wtq/boris/lib/Boris/ExportInspector.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php - -namespace Boris; - -/** - * Passes values through var_export() to inspect them. - */ -class ExportInspector implements Inspector -{ - public function inspect($variable) - { - return sprintf(" â %s", var_export($variable, true)); - } -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/d11wtq/boris/lib/Boris/Inspector.php ---------------------------------------------------------------------- diff --git a/vendor/d11wtq/boris/lib/Boris/Inspector.php b/vendor/d11wtq/boris/lib/Boris/Inspector.php deleted file mode 100644 index 5715d51..0000000 --- a/vendor/d11wtq/boris/lib/Boris/Inspector.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -namespace Boris; - -/** - * Something that is capable of returning a useful representation of a variable. - */ -interface Inspector -{ - /** - * Return a debug-friendly string representation of $variable. - * - * @param mixed $variable - * - * @return string - */ - public function inspect($variable); -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/d11wtq/boris/lib/Boris/ReadlineClient.php ---------------------------------------------------------------------- diff --git a/vendor/d11wtq/boris/lib/Boris/ReadlineClient.php b/vendor/d11wtq/boris/lib/Boris/ReadlineClient.php deleted file mode 100644 index 7cd8fd7..0000000 --- a/vendor/d11wtq/boris/lib/Boris/ReadlineClient.php +++ /dev/null @@ -1,106 +0,0 @@ -<?php - -namespace Boris; - -/** - * The Readline client is what the user spends their time entering text into. - * - * Input is collected and sent to {@link \Boris\EvalWorker} for processing. - */ -class ReadlineClient -{ - private $_socket; - private $_prompt; - private $_historyFile; - private $_clear = false; - - /** - * Create a new ReadlineClient using $socket for communication. - * - * @param resource $socket - */ - public function __construct($socket) - { - $this->_socket = $socket; - } - - /** - * Start the client with an prompt and readline history path. - * - * This method never returns. - * - * @param string $prompt - * @param string $historyFile - */ - public function start($prompt, $historyFile) - { - readline_read_history($historyFile); - - declare (ticks = 1); - pcntl_signal(SIGCHLD, SIG_IGN); - pcntl_signal(SIGINT, array( - $this, - 'clear' - ), true); - - // wait for the worker to finish executing hooks - if (fread($this->_socket, 1) != EvalWorker::READY) { - throw new \RuntimeException('EvalWorker failed to start'); - } - - $parser = new ShallowParser(); - $buf = ''; - $lineno = 1; - - for (;;) { - $this->_clear = false; - $line = readline(sprintf('[%d] %s', $lineno, ($buf == '' ? $prompt : str_pad('*> ', strlen($prompt), ' ', STR_PAD_LEFT)))); - - if ($this->_clear) { - $buf = ''; - continue; - } - - if (false === $line) { - $buf = 'exit(0);'; // ctrl-d acts like exit - } - - if (strlen($line) > 0) { - readline_add_history($line); - } - - $buf .= sprintf("%s\n", $line); - - if ($statements = $parser->statements($buf)) { - ++$lineno; - - $buf = ''; - foreach ($statements as $stmt) { - if (false === $written = fwrite($this->_socket, $stmt)) { - throw new \RuntimeException('Socket error: failed to write data'); - } - - if ($written > 0) { - $status = fread($this->_socket, 1); - if ($status == EvalWorker::EXITED) { - readline_write_history($historyFile); - echo "\n"; - exit(0); - } elseif ($status == EvalWorker::FAILED) { - break; - } - } - } - } - } - } - - /** - * Clear the input buffer. - */ - public function clear() - { - // FIXME: I'd love to have this send \r to readline so it puts the user on a blank line - $this->_clear = true; - } -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/d11wtq/boris/lib/Boris/ShallowParser.php ---------------------------------------------------------------------- diff --git a/vendor/d11wtq/boris/lib/Boris/ShallowParser.php b/vendor/d11wtq/boris/lib/Boris/ShallowParser.php deleted file mode 100644 index 75a1727..0000000 --- a/vendor/d11wtq/boris/lib/Boris/ShallowParser.php +++ /dev/null @@ -1,258 +0,0 @@ -<?php - -namespace Boris; - -/** - * The ShallowParser takes whatever is currently buffered and chunks it into individual statements. - */ -class ShallowParser -{ - private $_pairs = array('(' => ')', '{' => '}', '[' => ']', '"' => '"', "'" => "'", '//' => "\n", '#' => "\n", '/*' => '*/', '<<<' => '_heredoc_special_case_'); - - private $_initials; - - public function __construct() - { - $this->_initials = '/^(' . implode('|', array_map(array( - $this, - 'quote' - ), array_keys($this->_pairs))) . ')/'; - } - - /** - * Break the $buffer into chunks, with one for each highest-level construct possible. - * - * If the buffer is incomplete, returns an empty array. - * - * @param string $buffer - * - * @return array - */ - public function statements($buffer) - { - $result = $this->_createResult($buffer); - - while (strlen($result->buffer) > 0) { - $this->_resetResult($result); - - if ($result->state == '<<<') { - if (!$this->_initializeHeredoc($result)) { - continue; - } - } - - $rules = array( - '_scanUse', - '_scanEscapedChar', - '_scanRegion', - '_scanStateEntrant', - '_scanWsp', - '_scanChar' - ); - - foreach ($rules as $method) { - if ($this->$method($result)) { - break; - } - } - - if ($result->stop) { - break; - } - } - - if (!empty($result->statements) && trim($result->stmt) === '' && strlen($result->buffer) == 0) { - $this->_combineStatements($result); - $this->_prepareForDebug($result); - return $result->statements; - } - } - - public function quote($token) - { - return preg_quote($token, '/'); - } - - // -- Private Methods - - private function _createResult($buffer) - { - $result = new \stdClass(); - $result->buffer = $buffer; - $result->stmt = ''; - $result->state = null; - $result->states = array(); - $result->statements = array(); - $result->stop = false; - - return $result; - } - - private function _resetResult($result) - { - $result->stop = false; - $result->state = end($result->states); - $result->terminator = $result->state ? '/^(.*?' . preg_quote($this->_pairs[$result->state], '/') . ')/s' : null; - } - - private function _combineStatements($result) - { - $combined = array(); - - foreach ($result->statements as $scope) { - if (trim($scope) == ';' || substr(trim($scope), -1) != ';') { - $combined[] = ((string) array_pop($combined)) . $scope; - } else { - $combined[] = $scope; - } - } - - $result->statements = $combined; - } - - private function _prepareForDebug($result) - { - $result->statements[] = $this->_prepareDebugStmt(array_pop($result->statements)); - } - - private function _initializeHeredoc($result) - { - if (preg_match('/^([\'"]?)([a-z_][a-z0-9_]*)\\1/i', $result->buffer, $match)) { - $docId = $match[2]; - $result->stmt .= $match[0]; - $result->buffer = substr($result->buffer, strlen($match[0])); - - $result->terminator = '/^(.*?\n' . $docId . ');?\n/s'; - - return true; - } else { - return false; - } - } - - private function _scanWsp($result) - { - if (preg_match('/^\s+/', $result->buffer, $match)) { - if (!empty($result->statements) && $result->stmt === '') { - $result->statements[] = array_pop($result->statements) . $match[0]; - } else { - $result->stmt .= $match[0]; - } - $result->buffer = substr($result->buffer, strlen($match[0])); - - return true; - } else { - return false; - } - } - - private function _scanEscapedChar($result) - { - if (($result->state == '"' || $result->state == "'") && preg_match('/^[^' . $result->state . ']*?\\\\./s', $result->buffer, $match)) { - - $result->stmt .= $match[0]; - $result->buffer = substr($result->buffer, strlen($match[0])); - - return true; - } else { - return false; - } - } - - private function _scanRegion($result) - { - if (in_array($result->state, array( - '"', - "'", - '<<<', - '//', - '#', - '/*' - ))) { - if (preg_match($result->terminator, $result->buffer, $match)) { - $result->stmt .= $match[1]; - $result->buffer = substr($result->buffer, strlen($match[1])); - array_pop($result->states); - } else { - $result->stop = true; - } - - return true; - } else { - return false; - } - } - - private function _scanStateEntrant($result) - { - if (preg_match($this->_initials, $result->buffer, $match)) { - $result->stmt .= $match[0]; - $result->buffer = substr($result->buffer, strlen($match[0])); - $result->states[] = $match[0]; - - return true; - } else { - return false; - } - } - - private function _scanChar($result) - { - $chr = substr($result->buffer, 0, 1); - $result->stmt .= $chr; - $result->buffer = substr($result->buffer, 1); - if ($result->state && $chr == $this->_pairs[$result->state]) { - array_pop($result->states); - } - - if (empty($result->states) && ($chr == ';' || $chr == '}')) { - if (!$this->_isLambda($result->stmt) || $chr == ';') { - $result->statements[] = $result->stmt; - $result->stmt = ''; - } - } - - return true; - } - - private function _scanUse($result) - { - if (preg_match("/^use (.+?);/", $result->buffer, $use)) { - $result->buffer = substr($result->buffer, strlen($use[0])); - if (strpos($use[0], ' as ') !== false) { - list($class, $alias) = explode(' as ', $use[1]); - } else { - $class = $use[1]; - $alias = substr($use[1], strrpos($use[1], '\\') + 1); - } - $result->statements[] = sprintf("class_alias('%s', '%s');", $class, $alias); - return true; - } else { - return false; - } - } - - private function _isLambda($input) - { - return preg_match('/^([^=]*?=\s*)?function\s*\([^\)]*\)\s*(use\s*\([^\)]*\)\s*)?\s*\{.*\}\s*;?$/is', trim($input)); - } - - private function _isReturnable($input) - { - $input = trim($input); - if (substr($input, -1) == ';' && substr($input, 0, 1) != '{') { - return $this->_isLambda($input) || !preg_match('/^(' . 'echo|print|exit|die|goto|global|include|include_once|require|require_once|list|' . 'return|do|for|foreach|while|if|function|namespace|class|interface|abstract|switch|' . 'declare|throw|try|unset' . ')\b/i', $input); - } else { - return false; - } - } - - private function _prepareDebugStmt($input) - { - if ($this->_isReturnable($input) && !preg_match('/^\s*return/i', $input)) { - $input = sprintf('return %s', $input); - } - - return $input; - } -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/d11wtq/boris/lib/autoload.php ---------------------------------------------------------------------- diff --git a/vendor/d11wtq/boris/lib/autoload.php b/vendor/d11wtq/boris/lib/autoload.php deleted file mode 100644 index f090d70..0000000 --- a/vendor/d11wtq/boris/lib/autoload.php +++ /dev/null @@ -1,17 +0,0 @@ -<?php - -/** - * Custom autoloader for non-composer installations. - */ -spl_autoload_register(function($class) -{ - if ($class[0] == '\\') { - $class = substr($class, 1); - } - - $path = sprintf('%s/%s.php', __DIR__, implode('/', explode('\\', $class))); - - if (is_file($path)) { - require_once($path); - } -}); http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/d11wtq/boris/release.php ---------------------------------------------------------------------- diff --git a/vendor/d11wtq/boris/release.php b/vendor/d11wtq/boris/release.php deleted file mode 100755 index 7fafeeb..0000000 --- a/vendor/d11wtq/boris/release.php +++ /dev/null @@ -1,150 +0,0 @@ -#!/usr/bin/env php -<?php - -/** - * @author Chris Corbyn <[email protected]> - * - * Copyright © 2013-2014 Chris Corbyn. - */ - -/* Generate releases in Github */ - -namespace Boris; - -require __DIR__ . '/lib/autoload.php'; - -$args = getopt('hv:', array( - 'help', - 'version:' -)); - -if (count($args) != 1) { - help(); - exit(1); -} - -foreach ($args as $opt => $value) { - switch ($opt) { - case 'v': - case 'version': - version($value); - exit(0); - - case 'h': - case 'help': - help(); - exit(0); - - default: - unknown($opt); - exit(1); - } -} - -function help() -{ - echo <<<HELP -Boris release generator script. - -Usage: - ./release.php --version 1.2 Create a release for v1.2 - ./release.php --help Display this help message - -HELP; -} - -function version($newVersion) -{ - $token = get_token(); - $user = get_user(); - $repo = get_repo(); - $oldVersion = Boris::VERSION; - $phar = "boris.phar"; - - printf("Building version v%s...\n", $newVersion); - - printf(" Updating Boris::VERSION (%s) to %s...\n", $oldVersion, $newVersion); - `perl -pi -e 's/$oldVersion/$newVersion/' lib/Boris/Boris.php README.md`; - - printf(" Committing changes...\n"); - `git commit -am "Version bump to $newVersion"`; - - printf(" Pushing changes upstream...\n"); - `git push`; - - printf(" Creating tag v%s...\n", $newVersion); - `git tag -a "v$newVersion" -m "Auto-generated tag"`; - - printf(" Pushing tags upstream...\n"); - `git push --tags`; - - printf(" Creating release on github...\n"); - $response = `curl \ - -sL \ - -XPOST \ - -H "Authorization: token $token" \ - --data-binary '{"tag_name":"v$newVersion"}' \ - https://api.github.com/repos/$user/$repo/releases`; - - $json = json_decode($response, true); - $id = $json['id']; - - if (empty($id)) { - printf("Failed.\n"); - printf("%s\n", $response); - exit(1); - } - - printf(" Building phar...\n"); - `box build`; - - printf("Uploading phar to GitHub...\n"); - `curl -XPOST \ - -sL \ - -H "Authorization: token $token" \ - -H "Content-Type: application/octet-stream" \ - --data-binary @$phar \ - https://uploads.github.com/repos/$user/$repo/releases/$id/assets?name=$phar`; - - printf("Done.\n"); -} - -function get_token() -{ - if (getenv('GITHUB_TOKEN')) { - return getenv('GITHUB_TOKEN'); - } else { - printf("Missing environment variable \$GITHUB_TOKEN\n"); - exit(1); - } -} - -function get_origin() -{ - $remotes = `git remote -v`; - if (!preg_match('/^origin\s+(\S*?.git)\s+\(push\)/m', $remotes, $matches)) { - printf("Unable to find origin in $remotes\n"); - exit(1); - } - return $matches[1]; -} - -function get_user() -{ - $origin = get_origin(); - if (!preg_match('#^.*?[/:]([^/]+)/([^/]+)\.git$#', $origin, $matches)) { - printf("Don't know how to parse $origin\n"); - exit(1); - } - return $matches[1]; -} - -function get_repo() -{ - $origin = get_origin(); - if (!preg_match('#^.*?[/:]([^/]+)/([^/]+)\.git$#', $origin, $matches)) { - printf("Don't know how to parse $origin\n"); - exit(1); - } - return $matches[2]; -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/filp/whoops/LICENSE.md ---------------------------------------------------------------------- diff --git a/vendor/filp/whoops/LICENSE.md b/vendor/filp/whoops/LICENSE.md deleted file mode 100644 index 17707b3..0000000 --- a/vendor/filp/whoops/LICENSE.md +++ /dev/null @@ -1,19 +0,0 @@ -#The MIT License - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/filp/whoops/composer.json ---------------------------------------------------------------------- diff --git a/vendor/filp/whoops/composer.json b/vendor/filp/whoops/composer.json deleted file mode 100644 index 2c9b67e..0000000 --- a/vendor/filp/whoops/composer.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "filp/whoops", - "license": "MIT", - "description": "php error handling for cool kids", - "keywords": ["library", "error", "handling", "exception", "silex-provider", "whoops", "zf2"], - "homepage": "https://github.com/filp/whoops", - "authors": [ - { - "name": "Filipe Dobreira", - "homepage": "https://github.com/filp", - "role": "Developer" - } - ], - "require": { - "php": ">=5.3.0" - }, - "require-dev": { - "mockery/mockery": "0.9.*" - }, - "autoload": { - "psr-0": { - "Whoops": "src/" - }, - "classmap": [ - "src/deprecated" - ] - }, - "extra": { - "branch-alias": { - "dev-master": "1.2-dev" - } - } -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/filp/whoops/src/Whoops/Exception/ErrorException.php ---------------------------------------------------------------------- diff --git a/vendor/filp/whoops/src/Whoops/Exception/ErrorException.php b/vendor/filp/whoops/src/Whoops/Exception/ErrorException.php deleted file mode 100644 index d74e823..0000000 --- a/vendor/filp/whoops/src/Whoops/Exception/ErrorException.php +++ /dev/null @@ -1,17 +0,0 @@ -<?php -/** - * Whoops - php errors for cool kids - * @author Filipe Dobreira <http://github.com/filp> - */ - -namespace Whoops\Exception; - -use ErrorException as BaseErrorException; - -/** - * Wraps ErrorException; mostly used for typing (at least now) - * to easily cleanup the stack trace of redundant info. - */ -class ErrorException extends BaseErrorException -{ -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/filp/whoops/src/Whoops/Exception/Formatter.php ---------------------------------------------------------------------- diff --git a/vendor/filp/whoops/src/Whoops/Exception/Formatter.php b/vendor/filp/whoops/src/Whoops/Exception/Formatter.php deleted file mode 100644 index f14b8e2..0000000 --- a/vendor/filp/whoops/src/Whoops/Exception/Formatter.php +++ /dev/null @@ -1,74 +0,0 @@ -<?php -/** - * Whoops - php errors for cool kids - * @author Filipe Dobreira <http://github.com/filp> - */ - -namespace Whoops\Exception; - - -class Formatter -{ - /** - * Returns all basic information about the exception in a simple array - * for further convertion to other languages - * @param Inspector $inspector - * @param bool $shouldAddTrace - * @return array - */ - public static function formatExceptionAsDataArray(Inspector $inspector, $shouldAddTrace) - { - $exception = $inspector->getException(); - $response = array( - 'type' => get_class($exception), - 'message' => $exception->getMessage(), - 'file' => $exception->getFile(), - 'line' => $exception->getLine(), - ); - - if ($shouldAddTrace) { - $frames = $inspector->getFrames(); - $frameData = array(); - - foreach ($frames as $frame) { - /** @var Frame $frame */ - $frameData[] = array( - 'file' => $frame->getFile(), - 'line' => $frame->getLine(), - 'function' => $frame->getFunction(), - 'class' => $frame->getClass(), - 'args' => $frame->getArgs(), - ); - } - - $response['trace'] = $frameData; - } - - return $response; - } - - public static function formatExceptionPlain(Inspector $inspector) - { - $message = $inspector->getException()->getMessage(); - $frames = $inspector->getFrames(); - - $plain = $inspector->getExceptionName(); - $plain .= ' thrown with message "'; - $plain .= $message; - $plain .= '"'."\n\n"; - - $plain .= "Stacktrace:\n"; - foreach ($frames as $i => $frame) { - $plain .= "#". (count($frames) - $i - 1). " "; - $plain .= $frame->getClass() ?: ''; - $plain .= $frame->getClass() && $frame->getFunction() ? ":" : ""; - $plain .= $frame->getFunction() ?: ''; - $plain .= ' in '; - $plain .= ($frame->getFile() ?: '<#unknown>'); - $plain .= ':'; - $plain .= (int) $frame->getLine(). "\n"; - } - - return $plain; - } -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/filp/whoops/src/Whoops/Exception/Frame.php ---------------------------------------------------------------------- diff --git a/vendor/filp/whoops/src/Whoops/Exception/Frame.php b/vendor/filp/whoops/src/Whoops/Exception/Frame.php deleted file mode 100644 index 5aecd37..0000000 --- a/vendor/filp/whoops/src/Whoops/Exception/Frame.php +++ /dev/null @@ -1,269 +0,0 @@ -<?php -/** - * Whoops - php errors for cool kids - * @author Filipe Dobreira <http://github.com/filp> - */ - -namespace Whoops\Exception; - -use InvalidArgumentException; -use Serializable; - -class Frame implements Serializable -{ - /** - * @var array - */ - protected $frame; - - /** - * @var string - */ - protected $fileContentsCache; - - /** - * @var array[] - */ - protected $comments = array(); - - /** - * @param array[] - */ - public function __construct(array $frame) - { - $this->frame = $frame; - } - - /** - * @param bool $shortened - * @return string|null - */ - public function getFile($shortened = false) - { - if (empty($this->frame['file'])) { - return null; - } - - $file = $this->frame['file']; - - // Check if this frame occurred within an eval(). - // @todo: This can be made more reliable by checking if we've entered - // eval() in a previous trace, but will need some more work on the upper - // trace collector(s). - if (preg_match('/^(.*)\((\d+)\) : (?:eval\(\)\'d|assert) code$/', $file, $matches)) { - $file = $this->frame['file'] = $matches[1]; - $this->frame['line'] = (int) $matches[2]; - } - - if ($shortened && is_string($file)) { - // Replace the part of the path that all frames have in common, and add 'soft hyphens' for smoother line-breaks. - $dirname = dirname(dirname(dirname(dirname(dirname(dirname(__DIR__)))))); - $file = str_replace($dirname, "…", $file); - $file = str_replace("/", "/­", $file); - } - - return $file; - } - - /** - * @return int|null - */ - public function getLine() - { - return isset($this->frame['line']) ? $this->frame['line'] : null; - } - - /** - * @return string|null - */ - public function getClass() - { - return isset($this->frame['class']) ? $this->frame['class'] : null; - } - - /** - * @return string|null - */ - public function getFunction() - { - return isset($this->frame['function']) ? $this->frame['function'] : null; - } - - /** - * @return array - */ - public function getArgs() - { - return isset($this->frame['args']) ? (array) $this->frame['args'] : array(); - } - - /** - * Returns the full contents of the file for this frame, - * if it's known. - * @return string|null - */ - public function getFileContents() - { - if ($this->fileContentsCache === null && $filePath = $this->getFile()) { - // Leave the stage early when 'Unknown' is passed - // this would otherwise raise an exception when - // open_basedir is enabled. - if ($filePath === "Unknown") { - return null; - } - - // Return null if the file doesn't actually exist. - if (!is_file($filePath)) { - return null; - } - - $this->fileContentsCache = file_get_contents($filePath); - } - - return $this->fileContentsCache; - } - - /** - * Adds a comment to this frame, that can be received and - * used by other handlers. For example, the PrettyPage handler - * can attach these comments under the code for each frame. - * - * An interesting use for this would be, for example, code analysis - * & annotations. - * - * @param string $comment - * @param string $context Optional string identifying the origin of the comment - */ - public function addComment($comment, $context = 'global') - { - $this->comments[] = array( - 'comment' => $comment, - 'context' => $context, - ); - } - - /** - * Returns all comments for this frame. Optionally allows - * a filter to only retrieve comments from a specific - * context. - * - * @param string $filter - * @return array[] - */ - public function getComments($filter = null) - { - $comments = $this->comments; - - if ($filter !== null) { - $comments = array_filter($comments, function ($c) use ($filter) { - return $c['context'] == $filter; - }); - } - - return $comments; - } - - /** - * Returns the array containing the raw frame data from which - * this Frame object was built - * - * @return array - */ - public function getRawFrame() - { - return $this->frame; - } - - /** - * Returns the contents of the file for this frame as an - * array of lines, and optionally as a clamped range of lines. - * - * NOTE: lines are 0-indexed - * - * @example - * Get all lines for this file - * $frame->getFileLines(); // => array( 0 => '<?php', 1 => '...', ...) - * @example - * Get one line for this file, starting at line 10 (zero-indexed, remember!) - * $frame->getFileLines(9, 1); // array( 10 => '...', 11 => '...') - * - * @throws InvalidArgumentException if $length is less than or equal to 0 - * @param int $start - * @param int $length - * @return string[]|null - */ - public function getFileLines($start = 0, $length = null) - { - if (null !== ($contents = $this->getFileContents())) { - $lines = explode("\n", $contents); - - // Get a subset of lines from $start to $end - if ($length !== null) { - $start = (int) $start; - $length = (int) $length; - if ($start < 0) { - $start = 0; - } - - if ($length <= 0) { - throw new InvalidArgumentException( - "\$length($length) cannot be lower or equal to 0" - ); - } - - $lines = array_slice($lines, $start, $length, true); - } - - return $lines; - } - } - - /** - * Implements the Serializable interface, with special - * steps to also save the existing comments. - * - * @see Serializable::serialize - * @return string - */ - public function serialize() - { - $frame = $this->frame; - if (!empty($this->comments)) { - $frame['_comments'] = $this->comments; - } - - return serialize($frame); - } - - /** - * Unserializes the frame data, while also preserving - * any existing comment data. - * - * @see Serializable::unserialize - * @param string $serializedFrame - */ - public function unserialize($serializedFrame) - { - $frame = unserialize($serializedFrame); - - if (!empty($frame['_comments'])) { - $this->comments = $frame['_comments']; - unset($frame['_comments']); - } - - $this->frame = $frame; - } - - /** - * Compares Frame against one another - * @param Frame $frame - * @return bool - */ - public function equals(Frame $frame) - { - if (!$this->getFile() || $this->getFile() === 'Unknown' || !$this->getLine()) { - return false; - } - return $frame->getFile() === $this->getFile() && $frame->getLine() === $this->getLine(); - } -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/filp/whoops/src/Whoops/Exception/FrameCollection.php ---------------------------------------------------------------------- diff --git a/vendor/filp/whoops/src/Whoops/Exception/FrameCollection.php b/vendor/filp/whoops/src/Whoops/Exception/FrameCollection.php deleted file mode 100644 index 47fffb6..0000000 --- a/vendor/filp/whoops/src/Whoops/Exception/FrameCollection.php +++ /dev/null @@ -1,191 +0,0 @@ -<?php -/** - * Whoops - php errors for cool kids - * @author Filipe Dobreira <http://github.com/filp> - */ - -namespace Whoops\Exception; - -use ArrayAccess; -use ArrayIterator; -use Countable; -use IteratorAggregate; -use Serializable; -use UnexpectedValueException; - -/** - * Exposes a fluent interface for dealing with an ordered list - * of stack-trace frames. - */ -class FrameCollection implements ArrayAccess, IteratorAggregate, Serializable, Countable -{ - /** - * @var array[] - */ - private $frames; - - /** - * @param array $frames - */ - public function __construct(array $frames) - { - $this->frames = array_map(function ($frame) { - return new Frame($frame); - }, $frames); - } - - /** - * Filters frames using a callable, returns the same FrameCollection - * - * @param callable $callable - * @return FrameCollection - */ - public function filter($callable) - { - $this->frames = array_filter($this->frames, $callable); - return $this; - } - - /** - * Map the collection of frames - * - * @param callable $callable - * @return FrameCollection - */ - public function map($callable) - { - // Contain the map within a higher-order callable - // that enforces type-correctness for the $callable - $this->frames = array_map(function ($frame) use ($callable) { - $frame = call_user_func($callable, $frame); - - if (!$frame instanceof Frame) { - throw new UnexpectedValueException( - "Callable to " . __METHOD__ . " must return a Frame object" - ); - } - - return $frame; - }, $this->frames); - - return $this; - } - - /** - * Returns an array with all frames, does not affect - * the internal array. - * - * @todo If this gets any more complex than this, - * have getIterator use this method. - * @see FrameCollection::getIterator - * @return array - */ - public function getArray() - { - return $this->frames; - } - - /** - * @see IteratorAggregate::getIterator - * @return ArrayIterator - */ - public function getIterator() - { - return new ArrayIterator($this->frames); - } - - /** - * @see ArrayAccess::offsetExists - * @param int $offset - */ - public function offsetExists($offset) - { - return isset($this->frames[$offset]); - } - - /** - * @see ArrayAccess::offsetGet - * @param int $offset - */ - public function offsetGet($offset) - { - return $this->frames[$offset]; - } - - /** - * @see ArrayAccess::offsetSet - * @param int $offset - */ - public function offsetSet($offset, $value) - { - throw new \Exception(__CLASS__ . ' is read only'); - } - - /** - * @see ArrayAccess::offsetUnset - * @param int $offset - */ - public function offsetUnset($offset) - { - throw new \Exception(__CLASS__ . ' is read only'); - } - - /** - * @see Countable::count - * @return int - */ - public function count() - { - return count($this->frames); - } - - /** - * @see Serializable::serialize - * @return string - */ - public function serialize() - { - return serialize($this->frames); - } - - /** - * @see Serializable::unserialize - * @param string $serializedFrames - */ - public function unserialize($serializedFrames) - { - $this->frames = unserialize($serializedFrames); - } - - /** - * @param Frame[] $frames Array of Frame instances, usually from $e->getPrevious() - */ - public function prependFrames(array $frames) - { - $this->frames = array_merge($frames, $this->frames); - } - - /** - * Gets the innermost part of stack trace that is not the same as that of outer exception - * - * @param FrameCollection $parentFrames Outer exception frames to compare tail against - * @return Frame[] - */ - public function topDiff(FrameCollection $parentFrames) - { - $diff = $this->frames; - - $parentFrames = $parentFrames->getArray(); - $p = count($parentFrames)-1; - - for ($i = count($diff)-1; $i >= 0 && $p >= 0; $i--) { - /** @var Frame $tailFrame */ - $tailFrame = $diff[$i]; - if ($tailFrame->equals($parentFrames[$p])) { - unset($diff[$i]); - } - $p--; - } - return $diff; - } -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/filp/whoops/src/Whoops/Exception/Inspector.php ---------------------------------------------------------------------- diff --git a/vendor/filp/whoops/src/Whoops/Exception/Inspector.php b/vendor/filp/whoops/src/Whoops/Exception/Inspector.php deleted file mode 100644 index 06aeec3..0000000 --- a/vendor/filp/whoops/src/Whoops/Exception/Inspector.php +++ /dev/null @@ -1,161 +0,0 @@ -<?php -/** - * Whoops - php errors for cool kids - * @author Filipe Dobreira <http://github.com/filp> - */ - -namespace Whoops\Exception; - -use Exception; - -class Inspector -{ - /** - * @var Exception - */ - private $exception; - - /** - * @var \Whoops\Exception\FrameCollection - */ - private $frames; - - /** - * @var \Whoops\Exception\Inspector - */ - private $previousExceptionInspector; - - /** - * @param Exception $exception The exception to inspect - */ - public function __construct(Exception $exception) - { - $this->exception = $exception; - } - - /** - * @return Exception - */ - public function getException() - { - return $this->exception; - } - - /** - * @return string - */ - public function getExceptionName() - { - return get_class($this->exception); - } - - /** - * @return string - */ - public function getExceptionMessage() - { - return $this->exception->getMessage(); - } - - /** - * Does the wrapped Exception has a previous Exception? - * @return bool - */ - public function hasPreviousException() - { - return $this->previousExceptionInspector || $this->exception->getPrevious(); - } - - /** - * Returns an Inspector for a previous Exception, if any. - * @todo Clean this up a bit, cache stuff a bit better. - * @return Inspector - */ - public function getPreviousExceptionInspector() - { - if ($this->previousExceptionInspector === null) { - $previousException = $this->exception->getPrevious(); - - if ($previousException) { - $this->previousExceptionInspector = new Inspector($previousException); - } - } - - return $this->previousExceptionInspector; - } - - /** - * Returns an iterator for the inspected exception's - * frames. - * @return \Whoops\Exception\FrameCollection - */ - public function getFrames() - { - if ($this->frames === null) { - $frames = $this->exception->getTrace(); - - // If we're handling an ErrorException thrown by Whoops, - // get rid of the last frame, which matches the handleError method, - // and do not add the current exception to trace. We ensure that - // the next frame does have a filename / linenumber, though. - if ($this->exception instanceof ErrorException && empty($frames[1]['line'])) { - $frames = array($this->getFrameFromError($this->exception)); - } else { - $firstFrame = $this->getFrameFromException($this->exception); - array_unshift($frames, $firstFrame); - } - $this->frames = new FrameCollection($frames); - - if ($previousInspector = $this->getPreviousExceptionInspector()) { - // Keep outer frame on top of the inner one - $outerFrames = $this->frames; - $newFrames = clone $previousInspector->getFrames(); - // I assume it will always be set, but let's be safe - if (isset($newFrames[0])) { - $newFrames[0]->addComment( - $previousInspector->getExceptionMessage(), - 'Exception message:' - ); - } - $newFrames->prependFrames($outerFrames->topDiff($newFrames)); - $this->frames = $newFrames; - } - } - - return $this->frames; - } - - /** - * Given an exception, generates an array in the format - * generated by Exception::getTrace() - * @param Exception $exception - * @return array - */ - protected function getFrameFromException(Exception $exception) - { - return array( - 'file' => $exception->getFile(), - 'line' => $exception->getLine(), - 'class' => get_class($exception), - 'args' => array( - $exception->getMessage(), - ), - ); - } - - /** - * Given an error, generates an array in the format - * generated by ErrorException - * @param ErrorException $exception - * @return array - */ - protected function getFrameFromError(ErrorException $exception) - { - return array( - 'file' => $exception->getFile(), - 'line' => $exception->getLine(), - 'class' => null, - 'args' => array(), - ); - } -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/filp/whoops/src/Whoops/Handler/CallbackHandler.php ---------------------------------------------------------------------- diff --git a/vendor/filp/whoops/src/Whoops/Handler/CallbackHandler.php b/vendor/filp/whoops/src/Whoops/Handler/CallbackHandler.php deleted file mode 100644 index cc46e70..0000000 --- a/vendor/filp/whoops/src/Whoops/Handler/CallbackHandler.php +++ /dev/null @@ -1,52 +0,0 @@ -<?php -/** - * Whoops - php errors for cool kids - * @author Filipe Dobreira <http://github.com/filp> - */ - -namespace Whoops\Handler; - -use InvalidArgumentException; - -/** - * Wrapper for Closures passed as handlers. Can be used - * directly, or will be instantiated automagically by Whoops\Run - * if passed to Run::pushHandler - */ -class CallbackHandler extends Handler -{ - /** - * @var callable - */ - protected $callable; - - /** - * @throws InvalidArgumentException If argument is not callable - * @param callable $callable - */ - public function __construct($callable) - { - if (!is_callable($callable)) { - throw new InvalidArgumentException( - 'Argument to ' . __METHOD__ . ' must be valid callable' - ); - } - - $this->callable = $callable; - } - - /** - * @return int|null - */ - public function handle() - { - $exception = $this->getException(); - $inspector = $this->getInspector(); - $run = $this->getRun(); - $callable = $this->callable; - - // invoke the callable directly, to get simpler stacktraces (in comparison to call_user_func). - // this assumes that $callable is a properly typed php-callable, which we check in __construct(). - return $callable($exception, $inspector, $run); - } -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/filp/whoops/src/Whoops/Handler/Handler.php ---------------------------------------------------------------------- diff --git a/vendor/filp/whoops/src/Whoops/Handler/Handler.php b/vendor/filp/whoops/src/Whoops/Handler/Handler.php deleted file mode 100644 index d7e78f1..0000000 --- a/vendor/filp/whoops/src/Whoops/Handler/Handler.php +++ /dev/null @@ -1,89 +0,0 @@ -<?php -/** - * Whoops - php errors for cool kids - * @author Filipe Dobreira <http://github.com/filp> - */ - -namespace Whoops\Handler; - -use Exception; -use Whoops\Exception\Inspector; -use Whoops\Run; - -/** - * Abstract implementation of a Handler. - */ -abstract class Handler implements HandlerInterface -{ - /** - * Return constants that can be returned from Handler::handle - * to message the handler walker. - */ - const DONE = 0x10; // returning this is optional, only exists for - // semantic purposes - const LAST_HANDLER = 0x20; - const QUIT = 0x30; - - /** - * @var Run - */ - private $run; - - /** - * @var Inspector $inspector - */ - private $inspector; - - /** - * @var Exception $exception - */ - private $exception; - - /** - * @param Run $run - */ - public function setRun(Run $run) - { - $this->run = $run; - } - - /** - * @return Run - */ - protected function getRun() - { - return $this->run; - } - - /** - * @param Inspector $inspector - */ - public function setInspector(Inspector $inspector) - { - $this->inspector = $inspector; - } - - /** - * @return Inspector - */ - protected function getInspector() - { - return $this->inspector; - } - - /** - * @param Exception $exception - */ - public function setException(Exception $exception) - { - $this->exception = $exception; - } - - /** - * @return Exception - */ - protected function getException() - { - return $this->exception; - } -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/filp/whoops/src/Whoops/Handler/HandlerInterface.php ---------------------------------------------------------------------- diff --git a/vendor/filp/whoops/src/Whoops/Handler/HandlerInterface.php b/vendor/filp/whoops/src/Whoops/Handler/HandlerInterface.php deleted file mode 100644 index f50bc30..0000000 --- a/vendor/filp/whoops/src/Whoops/Handler/HandlerInterface.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php -/** - * Whoops - php errors for cool kids - * @author Filipe Dobreira <http://github.com/filp> - */ - -namespace Whoops\Handler; - -use Exception; -use Whoops\Exception\Inspector; -use Whoops\Run; - -interface HandlerInterface -{ - /** - * @return int|null A handler may return nothing, or a Handler::HANDLE_* constant - */ - public function handle(); - - /** - * @param Run $run - * @return void - */ - public function setRun(Run $run); - - /** - * @param Exception $exception - * @return void - */ - public function setException(Exception $exception); - - /** - * @param Inspector $inspector - * @return void - */ - public function setInspector(Inspector $inspector); -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/filp/whoops/src/Whoops/Handler/JsonResponseHandler.php ---------------------------------------------------------------------- diff --git a/vendor/filp/whoops/src/Whoops/Handler/JsonResponseHandler.php b/vendor/filp/whoops/src/Whoops/Handler/JsonResponseHandler.php deleted file mode 100644 index b997438..0000000 --- a/vendor/filp/whoops/src/Whoops/Handler/JsonResponseHandler.php +++ /dev/null @@ -1,90 +0,0 @@ -<?php -/** - * Whoops - php errors for cool kids - * @author Filipe Dobreira <http://github.com/filp> - */ - -namespace Whoops\Handler; - -use Whoops\Exception\Formatter; - -/** - * Catches an exception and converts it to a JSON - * response. Additionally can also return exception - * frames for consumption by an API. - */ -class JsonResponseHandler extends Handler -{ - /** - * @var bool - */ - private $returnFrames = false; - - /** - * @var bool - */ - private $onlyForAjaxRequests = false; - - /** - * @param bool|null $returnFrames - * @return bool|$this - */ - public function addTraceToOutput($returnFrames = null) - { - if (func_num_args() == 0) { - return $this->returnFrames; - } - - $this->returnFrames = (bool) $returnFrames; - return $this; - } - - /** - * @param bool|null $onlyForAjaxRequests - * @return null|bool - */ - public function onlyForAjaxRequests($onlyForAjaxRequests = null) - { - if (func_num_args() == 0) { - return $this->onlyForAjaxRequests; - } - - $this->onlyForAjaxRequests = (bool) $onlyForAjaxRequests; - } - - /** - * Check, if possible, that this execution was triggered by an AJAX request. - * - * @return bool - */ - private function isAjaxRequest() - { - return ( - !empty($_SERVER['HTTP_X_REQUESTED_WITH']) - && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'); - } - - /** - * @return int - */ - public function handle() - { - if ($this->onlyForAjaxRequests() && !$this->isAjaxRequest()) { - return Handler::DONE; - } - - $response = array( - 'error' => Formatter::formatExceptionAsDataArray( - $this->getInspector(), - $this->addTraceToOutput() - ), - ); - - if (\Whoops\Util\Misc::canSendHeaders()) { - header('Content-Type: application/json'); - } - - echo json_encode($response); - return Handler::QUIT; - } -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/filp/whoops/src/Whoops/Handler/PlainTextHandler.php ---------------------------------------------------------------------- diff --git a/vendor/filp/whoops/src/Whoops/Handler/PlainTextHandler.php b/vendor/filp/whoops/src/Whoops/Handler/PlainTextHandler.php deleted file mode 100644 index 0f0d5b4..0000000 --- a/vendor/filp/whoops/src/Whoops/Handler/PlainTextHandler.php +++ /dev/null @@ -1,331 +0,0 @@ -<?php -/** -* Whoops - php errors for cool kids -* @author Filipe Dobreira <http://github.com/filp> -* Plaintext handler for command line and logs. -* @author Pierre-Yves Landuré <https://howto.biapy.com/> -*/ - -namespace Whoops\Handler; - -use InvalidArgumentException; -use Psr\Log\LoggerInterface; -use Whoops\Exception\Frame; - -/** -* Handler outputing plaintext error messages. Can be used -* directly, or will be instantiated automagically by Whoops\Run -* if passed to Run::pushHandler -*/ -class PlainTextHandler extends Handler -{ - const VAR_DUMP_PREFIX = ' | '; - - /** - * @var \Psr\Log\LoggerInterface - */ - protected $logger; - - /** - * @var bool - */ - private $addTraceToOutput = true; - - /** - * @var bool|integer - */ - private $addTraceFunctionArgsToOutput = false; - - /** - * @var integer - */ - private $traceFunctionArgsOutputLimit = 1024; - - /** - * @var bool - */ - private $onlyForCommandLine = false; - - /** - * @var bool - */ - private $outputOnlyIfCommandLine = true; - - /** - * @var bool - */ - private $loggerOnly = false; - - /** - * Constructor. - * @throws InvalidArgumentException If argument is not null or a LoggerInterface - * @param \Psr\Log\LoggerInterface|null $logger - */ - public function __construct($logger = null) - { - $this->setLogger($logger); - } - - /** - * Set the output logger interface. - * @throws InvalidArgumentException If argument is not null or a LoggerInterface - * @param \Psr\Log\LoggerInterface|null $logger - */ - public function setLogger($logger = null) - { - if (! (is_null($logger) - || $logger instanceof LoggerInterface)) { - throw new InvalidArgumentException( - 'Argument to ' . __METHOD__ . - " must be a valid Logger Interface (aka. Monolog), " . - get_class($logger) . ' given.' - ); - } - - $this->logger = $logger; - } - - /** - * @return \Psr\Log\LoggerInterface|null - */ - public function getLogger() - { - return $this->logger; - } - - /** - * Add error trace to output. - * @param bool|null $addTraceToOutput - * @return bool|$this - */ - public function addTraceToOutput($addTraceToOutput = null) - { - if (func_num_args() == 0) { - return $this->addTraceToOutput; - } - - $this->addTraceToOutput = (bool) $addTraceToOutput; - return $this; - } - - /** - * Add error trace function arguments to output. - * Set to True for all frame args, or integer for the n first frame args. - * @param bool|integer|null $addTraceFunctionArgsToOutput - * @return null|bool|integer - */ - public function addTraceFunctionArgsToOutput($addTraceFunctionArgsToOutput = null) - { - if (func_num_args() == 0) { - return $this->addTraceFunctionArgsToOutput; - } - - if (! is_integer($addTraceFunctionArgsToOutput)) { - $this->addTraceFunctionArgsToOutput = (bool) $addTraceFunctionArgsToOutput; - } else { - $this->addTraceFunctionArgsToOutput = $addTraceFunctionArgsToOutput; - } - } - - /** - * Set the size limit in bytes of frame arguments var_dump output. - * If the limit is reached, the var_dump output is discarded. - * Prevent memory limit errors. - * @var integer - */ - public function setTraceFunctionArgsOutputLimit($traceFunctionArgsOutputLimit) - { - $this->traceFunctionArgsOutputLimit = (integer) $traceFunctionArgsOutputLimit; - } - - /** - * Get the size limit in bytes of frame arguments var_dump output. - * If the limit is reached, the var_dump output is discarded. - * Prevent memory limit errors. - * @return integer - */ - public function getTraceFunctionArgsOutputLimit() - { - return $this->traceFunctionArgsOutputLimit; - } - - /** - * Restrict error handling to command line calls. - * @param bool|null $onlyForCommandLine - * @return null|bool - */ - public function onlyForCommandLine($onlyForCommandLine = null) - { - if (func_num_args() == 0) { - return $this->onlyForCommandLine; - } - $this->onlyForCommandLine = (bool) $onlyForCommandLine; - } - - /** - * Output the error message only if using command line. - * else, output to logger if available. - * Allow to safely add this handler to web pages. - * @param bool|null $outputOnlyIfCommandLine - * @return null|bool - */ - public function outputOnlyIfCommandLine($outputOnlyIfCommandLine = null) - { - if (func_num_args() == 0) { - return $this->outputOnlyIfCommandLine; - } - $this->outputOnlyIfCommandLine = (bool) $outputOnlyIfCommandLine; - } - - /** - * Only output to logger. - * @param bool|null $loggerOnly - * @return null|bool - */ - public function loggerOnly($loggerOnly = null) - { - if (func_num_args() == 0) { - return $this->loggerOnly; - } - - $this->loggerOnly = (bool) $loggerOnly; - } - - /** - * Check, if possible, that this execution was triggered by a command line. - * @return bool - */ - private function isCommandLine() - { - return PHP_SAPI == 'cli'; - } - - /** - * Test if handler can process the exception.. - * @return bool - */ - private function canProcess() - { - return $this->isCommandLine() || !$this->onlyForCommandLine(); - } - - /** - * Test if handler can output to stdout. - * @return bool - */ - private function canOutput() - { - return ($this->isCommandLine() || ! $this->outputOnlyIfCommandLine()) - && ! $this->loggerOnly(); - } - - /** - * Get the frame args var_dump. - * @param \Whoops\Exception\Frame $frame [description] - * @param integer $line [description] - * @return string - */ - private function getFrameArgsOutput(Frame $frame, $line) - { - if ($this->addTraceFunctionArgsToOutput() === false - || $this->addTraceFunctionArgsToOutput() < $line) { - return ''; - } - - // Dump the arguments: - ob_start(); - var_dump($frame->getArgs()); - if (ob_get_length() > $this->getTraceFunctionArgsOutputLimit()) { - // The argument var_dump is to big. - // Discarded to limit memory usage. - ob_clean(); - return sprintf( - "\n%sArguments dump length greater than %d Bytes. Discarded.", - self::VAR_DUMP_PREFIX, - $this->getTraceFunctionArgsOutputLimit() - ); - } - - return sprintf("\n%s", - preg_replace('/^/m', self::VAR_DUMP_PREFIX, ob_get_clean()) - ); - } - - /** - * Get the exception trace as plain text. - * @return string - */ - private function getTraceOutput() - { - if (! $this->addTraceToOutput()) { - return ''; - } - $inspector = $this->getInspector(); - $frames = $inspector->getFrames(); - - $response = "\nStack trace:"; - - $line = 1; - foreach ($frames as $frame) { - /** @var Frame $frame */ - $class = $frame->getClass(); - - $template = "\n%3d. %s->%s() %s:%d%s"; - if (! $class) { - // Remove method arrow (->) from output. - $template = "\n%3d. %s%s() %s:%d%s"; - } - - $response .= sprintf( - $template, - $line, - $class, - $frame->getFunction(), - $frame->getFile(), - $frame->getLine(), - $this->getFrameArgsOutput($frame, $line) - ); - - $line++; - } - - return $response; - } - - /** - * @return int - */ - public function handle() - { - if (! $this->canProcess()) { - return Handler::DONE; - } - - $exception = $this->getException(); - - $response = sprintf("%s: %s in file %s on line %d%s\n", - get_class($exception), - $exception->getMessage(), - $exception->getFile(), - $exception->getLine(), - $this->getTraceOutput() - ); - - if ($this->getLogger()) { - $this->getLogger()->error($response); - } - - if (! $this->canOutput()) { - return Handler::DONE; - } - - if (class_exists('\Whoops\Util\Misc') - && \Whoops\Util\Misc::canSendHeaders()) { - header('Content-Type: text/plain'); - } - - echo $response; - - return Handler::QUIT; - } -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php ---------------------------------------------------------------------- diff --git a/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php b/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php deleted file mode 100644 index 83295e1..0000000 --- a/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php +++ /dev/null @@ -1,468 +0,0 @@ -<?php -/** - * Whoops - php errors for cool kids - * @author Filipe Dobreira <http://github.com/filp> - */ - -namespace Whoops\Handler; - -use InvalidArgumentException; -use RuntimeException; -use Whoops\Exception\Formatter; -use Whoops\Util\Misc; -use Whoops\Util\TemplateHelper; - -class PrettyPageHandler extends Handler -{ - /** - * Search paths to be scanned for resources, in the reverse - * order they're declared. - * - * @var array - */ - private $searchPaths = array(); - - /** - * Fast lookup cache for known resource locations. - * - * @var array - */ - private $resourceCache = array(); - - /** - * The name of the custom css file. - * - * @var string - */ - private $customCss = null; - - /** - * @var array[] - */ - private $extraTables = array(); - - /** - * @var bool - */ - private $handleUnconditionally = false; - - /** - * @var string - */ - private $pageTitle = "Whoops! There was an error."; - - /** - * A string identifier for a known IDE/text editor, or a closure - * that resolves a string that can be used to open a given file - * in an editor. If the string contains the special substrings - * %file or %line, they will be replaced with the correct data. - * - * @example - * "txmt://open?url=%file&line=%line" - * @var mixed $editor - */ - protected $editor; - - /** - * A list of known editor strings - * @var array - */ - protected $editors = array( - "sublime" => "subl://open?url=file://%file&line=%line", - "textmate" => "txmt://open?url=file://%file&line=%line", - "emacs" => "emacs://open?url=file://%file&line=%line", - "macvim" => "mvim://open/?url=file://%file&line=%line", - ); - - /** - * Constructor. - */ - public function __construct() - { - if (ini_get('xdebug.file_link_format') || extension_loaded('xdebug')) { - // Register editor using xdebug's file_link_format option. - $this->editors['xdebug'] = function ($file, $line) { - return str_replace(array('%f', '%l'), array($file, $line), ini_get('xdebug.file_link_format')); - }; - } - - // Add the default, local resource search path: - $this->searchPaths[] = __DIR__ . "/../Resources"; - } - - /** - * @return int|null - */ - public function handle() - { - if (!$this->handleUnconditionally()) { - // Check conditions for outputting HTML: - // @todo: Make this more robust - if (php_sapi_name() === 'cli') { - // Help users who have been relying on an internal test value - // fix their code to the proper method - if (isset($_ENV['whoops-test'])) { - throw new \Exception( - 'Use handleUnconditionally instead of whoops-test' - .' environment variable' - ); - } - - return Handler::DONE; - } - } - - // @todo: Make this more dynamic - $helper = new TemplateHelper(); - - $templateFile = $this->getResource("views/layout.html.php"); - $cssFile = $this->getResource("css/whoops.base.css"); - $zeptoFile = $this->getResource("js/zepto.min.js"); - $jsFile = $this->getResource("js/whoops.base.js"); - - if ($this->customCss) { - $customCssFile = $this->getResource($this->customCss); - } - - $inspector = $this->getInspector(); - $frames = $inspector->getFrames(); - - $code = $inspector->getException()->getCode(); - - if ($inspector->getException() instanceof \ErrorException) { - // ErrorExceptions wrap the php-error types within the "severity" property - $code = Misc::translateErrorCode($inspector->getException()->getSeverity()); - } - - // List of variables that will be passed to the layout template. - $vars = array( - "page_title" => $this->getPageTitle(), - - // @todo: Asset compiler - "stylesheet" => file_get_contents($cssFile), - "zepto" => file_get_contents($zeptoFile), - "javascript" => file_get_contents($jsFile), - - // Template paths: - "header" => $this->getResource("views/header.html.php"), - "frame_list" => $this->getResource("views/frame_list.html.php"), - "frame_code" => $this->getResource("views/frame_code.html.php"), - "env_details" => $this->getResource("views/env_details.html.php"), - - "title" => $this->getPageTitle(), - "name" => explode("\\", $inspector->getExceptionName()), - "message" => $inspector->getException()->getMessage(), - "code" => $code, - "plain_exception" => Formatter::formatExceptionPlain($inspector), - "frames" => $frames, - "has_frames" => !!count($frames), - "handler" => $this, - "handlers" => $this->getRun()->getHandlers(), - - "tables" => array( - "Server/Request Data" => $_SERVER, - "GET Data" => $_GET, - "POST Data" => $_POST, - "Files" => $_FILES, - "Cookies" => $_COOKIE, - "Session" => isset($_SESSION) ? $_SESSION : array(), - "Environment Variables" => $_ENV, - ), - ); - - if (isset($customCssFile)) { - $vars["stylesheet"] .= file_get_contents($customCssFile); - } - - // Add extra entries list of data tables: - // @todo: Consolidate addDataTable and addDataTableCallback - $extraTables = array_map(function ($table) { - return $table instanceof \Closure ? $table() : $table; - }, $this->getDataTables()); - $vars["tables"] = array_merge($extraTables, $vars["tables"]); - - $helper->setVariables($vars); - $helper->render($templateFile); - - return Handler::QUIT; - } - - /** - * Adds an entry to the list of tables displayed in the template. - * The expected data is a simple associative array. Any nested arrays - * will be flattened with print_r - * @param string $label - * @param array $data - */ - public function addDataTable($label, array $data) - { - $this->extraTables[$label] = $data; - } - - /** - * Lazily adds an entry to the list of tables displayed in the table. - * The supplied callback argument will be called when the error is rendered, - * it should produce a simple associative array. Any nested arrays will - * be flattened with print_r. - * - * @throws InvalidArgumentException If $callback is not callable - * @param string $label - * @param callable $callback Callable returning an associative array - */ - public function addDataTableCallback($label, /* callable */ $callback) - { - if (!is_callable($callback)) { - throw new InvalidArgumentException('Expecting callback argument to be callable'); - } - - $this->extraTables[$label] = function () use ($callback) { - try { - $result = call_user_func($callback); - - // Only return the result if it can be iterated over by foreach(). - return is_array($result) || $result instanceof \Traversable ? $result : array(); - } catch (\Exception $e) { - // Don't allow failure to break the rendering of the original exception. - return array(); - } - }; - } - - /** - * Returns all the extra data tables registered with this handler. - * Optionally accepts a 'label' parameter, to only return the data - * table under that label. - * @param string|null $label - * @return array[]|callable - */ - public function getDataTables($label = null) - { - if ($label !== null) { - return isset($this->extraTables[$label]) ? - $this->extraTables[$label] : array(); - } - - return $this->extraTables; - } - - /** - * Allows to disable all attempts to dynamically decide whether to - * handle or return prematurely. - * Set this to ensure that the handler will perform no matter what. - * @param bool|null $value - * @return bool|null - */ - public function handleUnconditionally($value = null) - { - if (func_num_args() == 0) { - return $this->handleUnconditionally; - } - - $this->handleUnconditionally = (bool) $value; - } - - /** - * Adds an editor resolver, identified by a string - * name, and that may be a string path, or a callable - * resolver. If the callable returns a string, it will - * be set as the file reference's href attribute. - * - * @example - * $run->addEditor('macvim', "mvim://open?url=file://%file&line=%line") - * @example - * $run->addEditor('remove-it', function($file, $line) { - * unlink($file); - * return "http://stackoverflow.com"; - * }); - * @param string $identifier - * @param string $resolver - */ - public function addEditor($identifier, $resolver) - { - $this->editors[$identifier] = $resolver; - } - - /** - * Set the editor to use to open referenced files, by a string - * identifier, or a callable that will be executed for every - * file reference, with a $file and $line argument, and should - * return a string. - * - * @example - * $run->setEditor(function($file, $line) { return "file:///{$file}"; }); - * @example - * $run->setEditor('sublime'); - * - * @throws InvalidArgumentException If invalid argument identifier provided - * @param string|callable $editor - */ - public function setEditor($editor) - { - if (!is_callable($editor) && !isset($this->editors[$editor])) { - throw new InvalidArgumentException( - "Unknown editor identifier: $editor. Known editors:" . - implode(",", array_keys($this->editors)) - ); - } - - $this->editor = $editor; - } - - /** - * Given a string file path, and an integer file line, - * executes the editor resolver and returns, if available, - * a string that may be used as the href property for that - * file reference. - * - * @throws InvalidArgumentException If editor resolver does not return a string - * @param string $filePath - * @param int $line - * @return false|string - */ - public function getEditorHref($filePath, $line) - { - if ($this->editor === null) { - return false; - } - - $editor = $this->editor; - if (is_string($editor)) { - $editor = $this->editors[$editor]; - } - - if (is_callable($editor)) { - $editor = call_user_func($editor, $filePath, $line); - } - - // Check that the editor is a string, and replace the - // %line and %file placeholders: - if (!is_string($editor)) { - throw new InvalidArgumentException( - __METHOD__ . " should always resolve to a string; got something else instead" - ); - } - - $editor = str_replace("%line", rawurlencode($line), $editor); - $editor = str_replace("%file", rawurlencode($filePath), $editor); - - return $editor; - } - - /** - * @param string $title - * @return void - */ - public function setPageTitle($title) - { - $this->pageTitle = (string) $title; - } - - /** - * @return string - */ - public function getPageTitle() - { - return $this->pageTitle; - } - - /** - * Adds a path to the list of paths to be searched for - * resources. - * - * @throws InvalidArgumnetException If $path is not a valid directory - * - * @param string $path - * @return void - */ - public function addResourcePath($path) - { - if (!is_dir($path)) { - throw new InvalidArgumentException( - "'$path' is not a valid directory" - ); - } - - array_unshift($this->searchPaths, $path); - } - - /** - * Adds a custom css file to be loaded. - * - * @param string $name - * @return void - */ - public function addCustomCss($name) - { - $this->customCss = $name; - } - - /** - * @return array - */ - public function getResourcePaths() - { - return $this->searchPaths; - } - - /** - * Finds a resource, by its relative path, in all available search paths. - * The search is performed starting at the last search path, and all the - * way back to the first, enabling a cascading-type system of overrides - * for all resources. - * - * @throws RuntimeException If resource cannot be found in any of the available paths - * - * @param string $resource - * @return string - */ - protected function getResource($resource) - { - // If the resource was found before, we can speed things up - // by caching its absolute, resolved path: - if (isset($this->resourceCache[$resource])) { - return $this->resourceCache[$resource]; - } - - // Search through available search paths, until we find the - // resource we're after: - foreach ($this->searchPaths as $path) { - $fullPath = $path . "/$resource"; - - if (is_file($fullPath)) { - // Cache the result: - $this->resourceCache[$resource] = $fullPath; - return $fullPath; - } - } - - // If we got this far, nothing was found. - throw new RuntimeException( - "Could not find resource '$resource' in any resource paths." - . "(searched: " . join(", ", $this->searchPaths). ")" - ); - } - - /** - * @deprecated - * - * @return string - */ - public function getResourcesPath() - { - $allPaths = $this->getResourcePaths(); - - // Compat: return only the first path added - return end($allPaths) ?: null; - } - - /** - * @deprecated - * - * @param string $resourcesPath - * @return void - */ - public function setResourcesPath($resourcesPath) - { - $this->addResourcePath($resourcesPath); - } -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/filp/whoops/src/Whoops/Handler/SoapResponseHandler.php ---------------------------------------------------------------------- diff --git a/vendor/filp/whoops/src/Whoops/Handler/SoapResponseHandler.php b/vendor/filp/whoops/src/Whoops/Handler/SoapResponseHandler.php deleted file mode 100644 index 2173dd7..0000000 --- a/vendor/filp/whoops/src/Whoops/Handler/SoapResponseHandler.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php -/** - * Whoops - php errors for cool kids - * @author Filipe Dobreira <http://github.com/filp> - */ - -namespace Whoops\Handler; - - -/** - * Catches an exception and converts it to an Soap XML - * response. - * - * @author Markus Staab <http://github.com/staabm> - */ -class SoapResponseHandler extends Handler -{ - /** - * @return int - */ - public function handle() - { - $exception = $this->getException(); - - echo $this->toXml($exception); - - return Handler::QUIT; - } - - /** - * Converts a Exception into a SoapFault XML - */ - private function toXml(\Exception $exception) - { - $xml = ''; - $xml .= '<?xml version="1.0" encoding="UTF-8"?>'; - $xml .= '<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">'; - $xml .= ' <SOAP-ENV:Body>'; - $xml .= ' <SOAP-ENV:Fault>'; - $xml .= ' <faultcode>'. htmlspecialchars($exception->getCode()) .'</faultcode>'; - $xml .= ' <faultstring>'. htmlspecialchars($exception->getMessage()) .'</faultstring>'; - $xml .= ' <detail><trace>'. htmlspecialchars($exception->getTraceAsString()) .'</trace></detail>'; - $xml .= ' </SOAP-ENV:Fault>'; - $xml .= ' </SOAP-ENV:Body>'; - $xml .= '</SOAP-ENV:Envelope>'; - - return $xml; - } -}
