First commit
This commit is contained in:
commit
c6e2478c40
13918 changed files with 2303184 additions and 0 deletions
13
vendor/psy/psysh/bin/build
vendored
Executable file
13
vendor/psy/psysh/bin/build
vendored
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
cd "${BASH_SOURCE%/*}/.."
|
||||
|
||||
echo "Building phar"
|
||||
./bin/build-vendor
|
||||
php -d 'phar.readonly=0' ./bin/build-phar
|
||||
|
||||
echo "Building compat phar"
|
||||
./bin/build-vendor-compat
|
||||
php -d 'phar.readonly=0' ./bin/build-phar --compat
|
312
vendor/psy/psysh/bin/build-manual
vendored
Executable file
312
vendor/psy/psysh/bin/build-manual
vendored
Executable file
|
@ -0,0 +1,312 @@
|
|||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Psy Shell.
|
||||
*
|
||||
* (c) 2012-2017 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
define('WRAP_WIDTH', 100);
|
||||
|
||||
$count = 0;
|
||||
|
||||
if (count($argv) !== 3 || !is_dir($argv[1])) {
|
||||
echo "usage: build_manual path/to/manual output_filename.db\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
function htmlwrap($text, $width = null)
|
||||
{
|
||||
if ($width === null) {
|
||||
$width = WRAP_WIDTH;
|
||||
}
|
||||
|
||||
$len = strlen($text);
|
||||
|
||||
$return = array();
|
||||
$lastSpace = null;
|
||||
$inTag = false;
|
||||
$i = $tagWidth = 0;
|
||||
do {
|
||||
switch (substr($text, $i, 1)) {
|
||||
case "\n":
|
||||
$return[] = trim(substr($text, 0, $i));
|
||||
$text = substr($text, $i);
|
||||
$len = strlen($text);
|
||||
|
||||
$i = $lastSpace = 0;
|
||||
continue;
|
||||
|
||||
case ' ':
|
||||
if (!$inTag) {
|
||||
$lastSpace = $i;
|
||||
}
|
||||
break;
|
||||
|
||||
case '<':
|
||||
$inTag = true;
|
||||
break;
|
||||
|
||||
case '>':
|
||||
$inTag = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if ($inTag) {
|
||||
$tagWidth++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
|
||||
if (!$inTag && ($i - $tagWidth > $width)) {
|
||||
$lastSpace = $lastSpace ?: $width;
|
||||
|
||||
$return[] = trim(substr($text, 0, $lastSpace));
|
||||
$text = substr($text, $lastSpace);
|
||||
$len = strlen($text);
|
||||
|
||||
$i = $tagWidth = 0;
|
||||
}
|
||||
} while ($i < $len);
|
||||
|
||||
$return[] = trim($text);
|
||||
|
||||
return implode("\n", $return);
|
||||
}
|
||||
|
||||
function extract_paragraphs($element)
|
||||
{
|
||||
$paragraphs = array();
|
||||
foreach ($element->getElementsByTagName('para') as $p) {
|
||||
$text = '';
|
||||
foreach ($p->childNodes as $child) {
|
||||
// @todo figure out if there's something we can do with tables.
|
||||
if ($child instanceof DOMElement && $child->tagName === 'table') {
|
||||
continue;
|
||||
}
|
||||
|
||||
// skip references, because ugh.
|
||||
if (preg_match('{^\s*&[a-z][a-z\.]+;\s*$}', $child->textContent)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$text .= $child->ownerDocument->saveXML($child);
|
||||
}
|
||||
|
||||
if ($text = trim(preg_replace('{\n[ \t]+}', ' ', $text))) {
|
||||
$paragraphs[] = $text;
|
||||
}
|
||||
}
|
||||
|
||||
return implode("\n\n", $paragraphs);
|
||||
}
|
||||
|
||||
function format_doc($doc)
|
||||
{
|
||||
$chunks = array();
|
||||
|
||||
if (!empty($doc['description'])) {
|
||||
$chunks[] = '<comment>Description:</comment>';
|
||||
$chunks[] = indent_text(htmlwrap(thunk_tags($doc['description']), WRAP_WIDTH - 2));
|
||||
$chunks[] = '';
|
||||
}
|
||||
|
||||
if (!empty($doc['params'])) {
|
||||
$chunks[] = '<comment>Param:</comment>';
|
||||
|
||||
$typeMax = max(array_map(function ($param) {
|
||||
return strlen($param['type']);
|
||||
}, $doc['params']));
|
||||
|
||||
$max = max(array_map(function ($param) {
|
||||
return strlen($param['name']);
|
||||
}, $doc['params']));
|
||||
|
||||
$template = ' <info>%-' . $typeMax . 's</info> <strong>%-' . $max . 's</strong> %s';
|
||||
$indent = str_repeat(' ', $typeMax + $max + 6);
|
||||
$wrapWidth = WRAP_WIDTH - strlen($indent);
|
||||
|
||||
foreach ($doc['params'] as $param) {
|
||||
$desc = indent_text(htmlwrap(thunk_tags($param['description']), $wrapWidth), $indent, false);
|
||||
$chunks[] = sprintf($template, $param['type'], $param['name'], $desc);
|
||||
}
|
||||
$chunks[] = '';
|
||||
}
|
||||
|
||||
if (isset($doc['return']) || isset($doc['return_type'])) {
|
||||
$chunks[] = '<comment>Return:</comment>';
|
||||
|
||||
$type = isset($doc['return_type']) ? $doc['return_type'] : 'unknown';
|
||||
$desc = isset($doc['return']) ? $doc['return'] : '';
|
||||
|
||||
$indent = str_repeat(' ', strlen($type) + 4);
|
||||
$wrapWidth = WRAP_WIDTH - strlen($indent);
|
||||
|
||||
if (!empty($desc)) {
|
||||
$desc = indent_text(htmlwrap(thunk_tags($doc['return']), $wrapWidth), $indent, false);
|
||||
}
|
||||
|
||||
$chunks[] = sprintf(' <info>%s</info> %s', $type, $desc);
|
||||
$chunks[] = '';
|
||||
}
|
||||
|
||||
array_pop($chunks); // get rid of the trailing newline
|
||||
|
||||
return implode("\n", $chunks);
|
||||
}
|
||||
|
||||
function thunk_tags($text)
|
||||
{
|
||||
$tagMap = array(
|
||||
'parameter>' => 'strong>',
|
||||
'function>' => 'strong>',
|
||||
'literal>' => 'return>',
|
||||
'type>' => 'info>',
|
||||
'constant>' => 'info>',
|
||||
);
|
||||
|
||||
$andBack = array(
|
||||
'&' => '&',
|
||||
'&true;' => '<return>true</return>',
|
||||
'&false;' => '<return>false</return>',
|
||||
'&null;' => '<return>null</return>',
|
||||
);
|
||||
|
||||
return strtr(strip_tags(strtr($text, $tagMap), '<strong><return><info>'), $andBack);
|
||||
}
|
||||
|
||||
function indent_text($text, $indent = ' ', $leading = true)
|
||||
{
|
||||
return ($leading ? $indent : '') . str_replace("\n", "\n" . $indent, $text);
|
||||
}
|
||||
|
||||
function find_type($xml, $paramName)
|
||||
{
|
||||
foreach ($xml->getElementsByTagName('methodparam') as $param) {
|
||||
if ($type = $param->getElementsByTagName('type')->item(0)) {
|
||||
if ($parameter = $param->getElementsByTagName('parameter')->item(0)) {
|
||||
if ($paramName === $parameter->textContent) {
|
||||
return $type->textContent;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function format_function_doc($xml)
|
||||
{
|
||||
$doc = array();
|
||||
$refsect1s = $xml->getElementsByTagName('refsect1');
|
||||
foreach ($refsect1s as $refsect1) {
|
||||
$role = $refsect1->getAttribute('role');
|
||||
switch ($role) {
|
||||
case 'description':
|
||||
$doc['description'] = extract_paragraphs($refsect1);
|
||||
|
||||
if ($synopsis = $refsect1->getElementsByTagName('methodsynopsis')->item(0)) {
|
||||
foreach ($synopsis->childNodes as $node) {
|
||||
if ($node instanceof DOMElement && $node->tagName === 'type') {
|
||||
$doc['return_type'] = $node->textContent;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'returnvalues':
|
||||
// do nothing.
|
||||
$doc['return'] = extract_paragraphs($refsect1);
|
||||
break;
|
||||
|
||||
case 'parameters':
|
||||
$params = array();
|
||||
$vars = $refsect1->getElementsByTagName('varlistentry');
|
||||
foreach ($vars as $var) {
|
||||
if ($name = $var->getElementsByTagName('parameter')->item(0)) {
|
||||
$params[] = array(
|
||||
'name' => '$' . $name->textContent,
|
||||
'type' => find_type($xml, $name->textContent),
|
||||
'description' => extract_paragraphs($var),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$doc['params'] = $params;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// and the purpose
|
||||
if ($purpose = $xml->getElementsByTagName('refpurpose')->item(0)) {
|
||||
$desc = htmlwrap($purpose->textContent);
|
||||
if (isset($doc['description'])) {
|
||||
$desc .= "\n\n" . $doc['description'];
|
||||
}
|
||||
|
||||
$doc['description'] = trim($desc);
|
||||
}
|
||||
|
||||
$ids = array();
|
||||
foreach ($xml->getElementsByTagName('refname') as $ref) {
|
||||
$ids[] = $ref->textContent;
|
||||
}
|
||||
|
||||
return array($ids, format_doc($doc));
|
||||
}
|
||||
|
||||
function format_class_doc($xml)
|
||||
{
|
||||
// @todo implement this
|
||||
return array(array(), null);
|
||||
}
|
||||
|
||||
$dir = new RecursiveDirectoryIterator($argv[1]);
|
||||
$filter = new RecursiveCallbackFilterIterator($dir, function ($current, $key, $iterator) {
|
||||
return $current->getFilename()[0] !== '.' &&
|
||||
($current->isDir() || $current->getExtension() === 'xml') &&
|
||||
strpos($current->getFilename(), 'entities.') !== 0 &&
|
||||
$current->getFilename() !== 'pdo_4d'; // Temporarily blacklist this one, the docs are weird.
|
||||
});
|
||||
$iterator = new RecursiveIteratorIterator($filter);
|
||||
|
||||
$docs = array();
|
||||
foreach ($iterator as $file) {
|
||||
$xmlstr = str_replace('&', '&', file_get_contents($file));
|
||||
|
||||
$xml = new DOMDocument();
|
||||
$xml->preserveWhiteSpace = false;
|
||||
|
||||
if (!@$xml->loadXml($xmlstr)) {
|
||||
echo "XML Parse Error: $file\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($xml->getElementsByTagName('refentry')->length !== 0) {
|
||||
list($ids, $doc) = format_function_doc($xml);
|
||||
} elseif ($xml->getElementsByTagName('classref')->length !== 0) {
|
||||
list($ids, $doc) = format_class_doc($xml);
|
||||
} else {
|
||||
$ids = array();
|
||||
$doc = null;
|
||||
}
|
||||
|
||||
foreach ($ids as $id) {
|
||||
$docs[$id] = $doc;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_file($argv[2])) {
|
||||
unlink($argv[2]);
|
||||
}
|
||||
|
||||
$db = new PDO('sqlite:' . $argv[2]);
|
||||
|
||||
$db->query('CREATE TABLE php_manual (id char(256) PRIMARY KEY, doc TEXT)');
|
||||
$cmd = $db->prepare('INSERT INTO php_manual (id, doc) VALUES (?, ?)');
|
||||
foreach ($docs as $id => $doc) {
|
||||
$cmd->execute(array($id, $doc));
|
||||
}
|
38
vendor/psy/psysh/bin/build-phar
vendored
Executable file
38
vendor/psy/psysh/bin/build-phar
vendored
Executable file
|
@ -0,0 +1,38 @@
|
|||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Psy Shell.
|
||||
*
|
||||
* (c) 2012-2017 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
if (!is_file(dirname(__DIR__) . '/vendor/autoload.php')) {
|
||||
throw new RuntimeException('Missing PsySH dev dependencies in ' . dirname(__DIR__) . '/vendor/' . ', install with `composer.phar install --dev`.');
|
||||
}
|
||||
|
||||
require dirname(__DIR__) . '/vendor/autoload.php';
|
||||
|
||||
if (!class_exists('Symfony\Component\Finder\Finder')) {
|
||||
throw new RuntimeException('Missing PsySH dev dependencies, install with `composer.phar install --dev`.');
|
||||
}
|
||||
|
||||
if (!is_file(dirname(__DIR__) . '/build-vendor/autoload.php')) {
|
||||
throw new RuntimeException('Missing phar vendor dependencies, install with bin/build-vendor');
|
||||
}
|
||||
|
||||
use Psy\Compiler;
|
||||
|
||||
error_reporting(-1);
|
||||
ini_set('display_errors', 1);
|
||||
|
||||
$compiler = new Compiler();
|
||||
|
||||
if (isset($_SERVER['argv']) && isset($_SERVER['argv'][1]) && $_SERVER['argv'][1] === '--compat') {
|
||||
$compiler->compile('psysh-compat.phar');
|
||||
} else {
|
||||
$compiler->compile();
|
||||
}
|
10
vendor/psy/psysh/bin/build-vendor
vendored
Executable file
10
vendor/psy/psysh/bin/build-vendor
vendored
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
cd "${BASH_SOURCE%/*}/.."
|
||||
|
||||
rm -rf build-vendor
|
||||
|
||||
COMPOSER_VENDOR_DIR=build-vendor composer update \
|
||||
--prefer-stable --no-dev --no-progress --classmap-authoritative --no-interaction --verbose
|
21
vendor/psy/psysh/bin/build-vendor-compat
vendored
Executable file
21
vendor/psy/psysh/bin/build-vendor-compat
vendored
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
cd "${BASH_SOURCE%/*}/.."
|
||||
|
||||
rm -rf build-vendor
|
||||
rm composer*.lock
|
||||
|
||||
cp composer.json composer-compat.json
|
||||
|
||||
if [[ $(php --version) = PHP\ 5.3* ]]; then
|
||||
HOA_VERSION=^1.14
|
||||
fi
|
||||
|
||||
COMPOSER=composer-compat.json COMPOSER_VENDOR_DIR=build-vendor \
|
||||
composer require symfony/intl hoa/console $HOA_VERSION --no-progress --no-update --no-interaction --verbose
|
||||
|
||||
COMPOSER=composer-compat.json COMPOSER_VENDOR_DIR=build-vendor \
|
||||
composer update --prefer-stable --no-dev --no-progress --classmap-authoritative --no-interaction --verbose
|
||||
|
55
vendor/psy/psysh/bin/package
vendored
Executable file
55
vendor/psy/psysh/bin/package
vendored
Executable file
|
@ -0,0 +1,55 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
cd "${BASH_SOURCE%/*}/.."
|
||||
|
||||
USAGE="usage: bin/package [-v PACKAGE_VERSION]"
|
||||
|
||||
while getopts ":v:h" opt; do
|
||||
case $opt in
|
||||
v)
|
||||
PKG_VERSION=$OPTARG
|
||||
;;
|
||||
h)
|
||||
echo $USAGE >&2
|
||||
exit
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG" >&2
|
||||
echo $USAGE >&2
|
||||
exit 1
|
||||
;;
|
||||
:)
|
||||
echo "Option -$OPTARG requires an argument" >&2
|
||||
echo $USAGE >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -z "$PKG_VERSION" ]; then
|
||||
PKG_VERSION=$(git describe --tag --exact-match)
|
||||
fi
|
||||
|
||||
if [[ $(php --version) = PHP\ 5.3* ]]; then
|
||||
PKG_VERSION=${PKG_VERSION}-php53
|
||||
fi
|
||||
|
||||
echo "Packaging $PKG_VERSION"
|
||||
|
||||
mkdir -p dist || exit 1
|
||||
|
||||
./bin/build || exit 1
|
||||
chmod +x *.phar
|
||||
|
||||
echo "Creating tarballs"
|
||||
|
||||
# Support BSD tar because OS X :(
|
||||
if [[ $(tar --version) = bsdtar* ]]; then
|
||||
tar -s "/.*/psysh/" -czf dist/psysh-${PKG_VERSION}.tar.gz psysh.phar
|
||||
tar -s "/.*/psysh/" -czf dist/psysh-${PKG_VERSION}-compat.tar.gz psysh-compat.phar
|
||||
else
|
||||
tar --transform "s/.*/psysh/" -czf dist/psysh-${PKG_VERSION}.tar.gz psysh.phar
|
||||
tar --transform "s/.*/psysh/" -czf dist/psysh-${PKG_VERSION}-compat.tar.gz psysh-compat.phar
|
||||
fi
|
135
vendor/psy/psysh/bin/psysh
vendored
Executable file
135
vendor/psy/psysh/bin/psysh
vendored
Executable file
|
@ -0,0 +1,135 @@
|
|||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Psy Shell.
|
||||
*
|
||||
* (c) 2012-2017 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
// Try to find an autoloader for a local psysh version.
|
||||
// We'll wrap this whole mess in a Closure so it doesn't leak any globals.
|
||||
call_user_func(function () {
|
||||
$cwd = null;
|
||||
|
||||
// Find the cwd arg (if present)
|
||||
$argv = isset($_SERVER['argv']) ? $_SERVER['argv'] : array();
|
||||
foreach ($argv as $i => $arg) {
|
||||
if ($arg === '--cwd') {
|
||||
if ($i >= count($argv) - 1) {
|
||||
echo 'Missing --cwd argument.' . PHP_EOL;
|
||||
exit(1);
|
||||
}
|
||||
$cwd = $argv[$i + 1];
|
||||
break;
|
||||
}
|
||||
|
||||
if (preg_match('/^--cwd=/', $arg)) {
|
||||
$cwd = substr($arg, 6);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Or fall back to the actual cwd
|
||||
if (!isset($cwd)) {
|
||||
$cwd = getcwd();
|
||||
}
|
||||
|
||||
$cwd = str_replace('\\', '/', $cwd);
|
||||
|
||||
$chunks = explode('/', $cwd);
|
||||
while (!empty($chunks)) {
|
||||
$path = implode('/', $chunks);
|
||||
|
||||
// Find composer.json
|
||||
if (is_file($path . '/composer.json')) {
|
||||
if ($cfg = json_decode(file_get_contents($path . '/composer.json'), true)) {
|
||||
if (isset($cfg['name']) && $cfg['name'] === 'psy/psysh') {
|
||||
// We're inside the psysh project. Let's use the local
|
||||
// Composer autoload.
|
||||
if (is_file($path . '/vendor/autoload.php')) {
|
||||
require $path . '/vendor/autoload.php';
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Or a composer.lock
|
||||
if (is_file($path . '/composer.lock')) {
|
||||
if ($cfg = json_decode(file_get_contents($path . '/composer.lock'), true)) {
|
||||
foreach (array_merge($cfg['packages'], $cfg['packages-dev']) as $pkg) {
|
||||
if (isset($pkg['name']) && $pkg['name'] === 'psy/psysh') {
|
||||
// We're inside a project which requires psysh. We'll
|
||||
// use the local Composer autoload.
|
||||
if (is_file($path . '/vendor/autoload.php')) {
|
||||
require $path . '/vendor/autoload.php';
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
array_pop($chunks);
|
||||
}
|
||||
});
|
||||
|
||||
// We didn't find an autoloader for a local version, so use the autoloader that
|
||||
// came with this script.
|
||||
if (!class_exists('Psy\Shell')) {
|
||||
/* <<< */
|
||||
if (is_file(__DIR__ . '/../vendor/autoload.php')) {
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
} elseif (is_file(__DIR__ . '/../../../autoload.php')) {
|
||||
require __DIR__ . '/../../../autoload.php';
|
||||
} else {
|
||||
echo 'PsySH dependencies not found, be sure to run `composer install`.' . PHP_EOL;
|
||||
echo 'See https://getcomposer.org to get Composer.' . PHP_EOL;
|
||||
exit(1);
|
||||
}
|
||||
/* >>> */
|
||||
}
|
||||
|
||||
// If the psysh binary was included directly, assume they just wanted an
|
||||
// autoloader and bail early.
|
||||
if (version_compare(PHP_VERSION, '5.3.6', '<')) {
|
||||
$trace = debug_backtrace();
|
||||
} elseif (version_compare(PHP_VERSION, '5.4.0', '<')) {
|
||||
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
||||
} else {
|
||||
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
|
||||
}
|
||||
|
||||
if (Psy\Shell::isIncluded($trace)) {
|
||||
unset($trace);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Clean up after ourselves.
|
||||
unset($trace);
|
||||
|
||||
// If the local version is too old, we can't do this
|
||||
if (!function_exists('Psy\bin')) {
|
||||
$argv = $_SERVER['argv'];
|
||||
$first = array_shift($argv);
|
||||
if (preg_match('/php(\.exe)?$/', $first)) {
|
||||
array_shift($argv);
|
||||
}
|
||||
array_unshift($argv, 'vendor/bin/psysh');
|
||||
|
||||
echo 'A local PsySH dependency was found, but it cannot be loaded. Please update to' . PHP_EOL;
|
||||
echo 'the latest version, or run the local copy directly, e.g.:' . PHP_EOL;
|
||||
echo PHP_EOL;
|
||||
echo ' ' . implode(' ', $argv) . PHP_EOL;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// And go!
|
||||
call_user_func(Psy\bin());
|
Loading…
Add table
Add a link
Reference in a new issue