Skip to content

Commit bff49cd

Browse files
author
evilebottnawi
committed
fix: update composer autoload
1 parent a7edf92 commit bff49cd

File tree

10 files changed

+375
-20
lines changed

10 files changed

+375
-20
lines changed

vendor/autoload.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
require_once __DIR__ . '/composer/autoload_real.php';
66

7-
return ComposerAutoloaderInit437ad47e064758a069eff5a4b7eef79f::getLoader();
7+
return ComposerAutoloaderInitb076677c42f1a3b9647c849d14b74511::getLoader();

vendor/bin/sentry

Lines changed: 0 additions & 1 deletion
This file was deleted.

vendor/bin/sentry

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
// Maximize error reporting
5+
error_reporting(E_ALL | E_STRICT);
6+
7+
// TODO: if we could get rid of this and have composer figure things out it'd make it
8+
// a bit more sane
9+
require(dirname(__file__) . '/../lib/Raven/Autoloader.php');
10+
Raven_Autoloader::register();
11+
12+
function raven_cli_test($command, $args)
13+
{
14+
// Do something silly
15+
try {
16+
throw new Exception('This is a test exception sent from the Raven CLI.');
17+
} catch (Exception $ex) {
18+
return $ex;
19+
}
20+
}
21+
22+
function cmd_test($dsn)
23+
{
24+
// Parse DSN as a test
25+
try {
26+
if (empty(Raven_Client::parseDSN($dsn))) {
27+
exit('ERROR: Missing DSN value');
28+
}
29+
} catch (InvalidArgumentException $ex) {
30+
exit("ERROR: There was an error parsing your DSN:\n " . $ex->getMessage());
31+
}
32+
33+
$client = new Raven_Client($dsn, array(
34+
'trace' => true,
35+
'curl_method' => 'sync',
36+
'app_path' => realpath(__DIR__ . '/..'),
37+
'base_path' => realpath(__DIR__ . '/..'),
38+
));
39+
40+
$config = get_object_vars($client);
41+
$required_keys = array('server', 'project', 'public_key', 'secret_key');
42+
43+
echo "Client configuration:\n";
44+
foreach ($required_keys as $key) {
45+
if (empty($config[$key])) {
46+
exit("ERROR: Missing configuration for $key");
47+
}
48+
if (is_array($config[$key])) {
49+
echo "-> $key: [".implode(", ", $config[$key])."]\n";
50+
} else {
51+
echo "-> $key: $config[$key]\n";
52+
}
53+
54+
}
55+
echo "\n";
56+
57+
echo "Sending a test event:\n";
58+
59+
$ex = raven_cli_test("command name", array("foo" => "bar"));
60+
$event_id = $client->captureException($ex);
61+
62+
echo "-> event ID: $event_id\n";
63+
64+
$last_error = $client->getLastError();
65+
if (!empty($last_error)) {
66+
exit("ERROR: There was an error sending the test event:\n " . $last_error);
67+
}
68+
69+
echo "\n";
70+
echo "Done!";
71+
}
72+
73+
74+
function main() {
75+
global $argv;
76+
77+
if (!isset($argv[1])) {
78+
exit('Usage: sentry test <dsn>');
79+
}
80+
81+
$cmd = $argv[1];
82+
83+
switch ($cmd) {
84+
case 'test':
85+
cmd_test(@$argv[2]);
86+
break;
87+
default:
88+
exit('Usage: sentry test <dsn>');
89+
}
90+
}
91+
92+
main();

vendor/composer/ClassLoader.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@
4343
class ClassLoader
4444
{
4545
// PSR-4
46-
private $firstCharsPsr4 = array();
47-
private $prefixLengthsPsr4 = array(); // For BC with legacy static maps
46+
private $prefixLengthsPsr4 = array();
4847
private $prefixDirsPsr4 = array();
4948
private $fallbackDirsPsr4 = array();
5049

@@ -171,10 +170,11 @@ public function addPsr4($prefix, $paths, $prepend = false)
171170
}
172171
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
173172
// Register directories for a new namespace.
174-
if ('\\' !== substr($prefix, -1)) {
173+
$length = strlen($prefix);
174+
if ('\\' !== $prefix[$length - 1]) {
175175
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
176176
}
177-
$this->firstCharsPsr4[$prefix[0]] = true;
177+
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
178178
$this->prefixDirsPsr4[$prefix] = (array) $paths;
179179
} elseif ($prepend) {
180180
// Prepend directories for an already registered namespace.
@@ -221,10 +221,11 @@ public function setPsr4($prefix, $paths)
221221
if (!$prefix) {
222222
$this->fallbackDirsPsr4 = (array) $paths;
223223
} else {
224-
if ('\\' !== substr($prefix, -1)) {
224+
$length = strlen($prefix);
225+
if ('\\' !== $prefix[$length - 1]) {
225226
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
226227
}
227-
$this->firstCharsPsr4[$prefix[0]] = true;
228+
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
228229
$this->prefixDirsPsr4[$prefix] = (array) $paths;
229230
}
230231
}
@@ -372,7 +373,7 @@ private function findFileWithExtension($class, $ext)
372373
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
373374

374375
$first = $class[0];
375-
if (isset($this->firstCharsPsr4[$first]) || isset($this->prefixLengthsPsr4[$first])) {
376+
if (isset($this->prefixLengthsPsr4[$first])) {
376377
$subPath = $class;
377378
while (false !== $lastPos = strrpos($subPath, '\\')) {
378379
$subPath = substr($subPath, 0, $lastPos);

vendor/composer/autoload_real.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// autoload_real.php @generated by Composer
44

5-
class ComposerAutoloaderInit437ad47e064758a069eff5a4b7eef79f
5+
class ComposerAutoloaderInitb076677c42f1a3b9647c849d14b74511
66
{
77
private static $loader;
88

@@ -19,15 +19,15 @@ public static function getLoader()
1919
return self::$loader;
2020
}
2121

22-
spl_autoload_register(array('ComposerAutoloaderInit437ad47e064758a069eff5a4b7eef79f', 'loadClassLoader'), true, true);
22+
spl_autoload_register(array('ComposerAutoloaderInitb076677c42f1a3b9647c849d14b74511', 'loadClassLoader'), true, true);
2323
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24-
spl_autoload_unregister(array('ComposerAutoloaderInit437ad47e064758a069eff5a4b7eef79f', 'loadClassLoader'));
24+
spl_autoload_unregister(array('ComposerAutoloaderInitb076677c42f1a3b9647c849d14b74511', 'loadClassLoader'));
2525

2626
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
2727
if ($useStaticLoader) {
2828
require_once __DIR__ . '/autoload_static.php';
2929

30-
call_user_func(\Composer\Autoload\ComposerStaticInit437ad47e064758a069eff5a4b7eef79f::getInitializer($loader));
30+
call_user_func(\Composer\Autoload\ComposerStaticInitb076677c42f1a3b9647c849d14b74511::getInitializer($loader));
3131
} else {
3232
$map = require __DIR__ . '/autoload_namespaces.php';
3333
foreach ($map as $namespace => $path) {

vendor/composer/autoload_static.php

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,17 @@
44

55
namespace Composer\Autoload;
66

7-
class ComposerStaticInit437ad47e064758a069eff5a4b7eef79f
7+
class ComposerStaticInitb076677c42f1a3b9647c849d14b74511
88
{
9-
public static $firstCharsPsr4 = array (
10-
'I' => true,
11-
'C' => true,
9+
public static $prefixLengthsPsr4 = array (
10+
'I' =>
11+
array (
12+
'Itgalaxy\\SentryIntegration\\' => 27,
13+
),
14+
'C' =>
15+
array (
16+
'Composer\\Installers\\' => 20,
17+
),
1218
);
1319

1420
public static $prefixDirsPsr4 = array (
@@ -35,9 +41,9 @@ class ComposerStaticInit437ad47e064758a069eff5a4b7eef79f
3541
public static function getInitializer(ClassLoader $loader)
3642
{
3743
return \Closure::bind(function () use ($loader) {
38-
$loader->firstCharsPsr4 = ComposerStaticInit437ad47e064758a069eff5a4b7eef79f::$firstCharsPsr4;
39-
$loader->prefixDirsPsr4 = ComposerStaticInit437ad47e064758a069eff5a4b7eef79f::$prefixDirsPsr4;
40-
$loader->prefixesPsr0 = ComposerStaticInit437ad47e064758a069eff5a4b7eef79f::$prefixesPsr0;
44+
$loader->prefixLengthsPsr4 = ComposerStaticInitb076677c42f1a3b9647c849d14b74511::$prefixLengthsPsr4;
45+
$loader->prefixDirsPsr4 = ComposerStaticInitb076677c42f1a3b9647c849d14b74511::$prefixDirsPsr4;
46+
$loader->prefixesPsr0 = ComposerStaticInitb076677c42f1a3b9647c849d14b74511::$prefixesPsr0;
4147

4248
}, null, ClassLoader::class);
4349
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
namespace Composer\Installers;
3+
4+
/**
5+
* Plugin/theme installer for majima
6+
* @author David Neustadt
7+
*/
8+
class MajimaInstaller extends BaseInstaller
9+
{
10+
protected $locations = array(
11+
'plugin' => 'plugins/{$name}/',
12+
);
13+
14+
/**
15+
* Transforms the names
16+
* @param array $vars
17+
* @return array
18+
*/
19+
public function inflectPackageVars($vars)
20+
{
21+
return $this->correctPluginName($vars);
22+
}
23+
24+
/**
25+
* Change hyphenated names to camelcase
26+
* @param array $vars
27+
* @return array
28+
*/
29+
private function correctPluginName($vars)
30+
{
31+
$camelCasedName = preg_replace_callback('/(-[a-z])/', function ($matches) {
32+
return strtoupper($matches[0][1]);
33+
}, $vars['name']);
34+
$vars['name'] = ucfirst($camelCasedName);
35+
return $vars;
36+
}
37+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
namespace Composer\Installers;
3+
4+
/**
5+
* An installer to handle MODX specifics when installing packages.
6+
*/
7+
class ModxInstaller extends BaseInstaller
8+
{
9+
protected $locations = array(
10+
'extra' => 'core/packages/{$name}/'
11+
);
12+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?php
2+
namespace Composer\Installers;
3+
4+
class PxcmsInstaller extends BaseInstaller
5+
{
6+
protected $locations = array(
7+
'module' => 'app/Modules/{$name}/',
8+
'theme' => 'themes/{$name}/',
9+
);
10+
11+
/**
12+
* Format package name.
13+
*
14+
* @param array $vars
15+
*
16+
* @return array
17+
*/
18+
public function inflectPackageVars($vars)
19+
{
20+
if ($vars['type'] === 'pxcms-module') {
21+
return $this->inflectModuleVars($vars);
22+
}
23+
24+
if ($vars['type'] === 'pxcms-theme') {
25+
return $this->inflectThemeVars($vars);
26+
}
27+
28+
return $vars;
29+
}
30+
31+
/**
32+
* For package type pxcms-module, cut off a trailing '-plugin' if present.
33+
*
34+
* return string
35+
*/
36+
protected function inflectModuleVars($vars)
37+
{
38+
$vars['name'] = str_replace('pxcms-', '', $vars['name']); // strip out pxcms- just incase (legacy)
39+
$vars['name'] = str_replace('module-', '', $vars['name']); // strip out module-
40+
$vars['name'] = preg_replace('/-module$/', '', $vars['name']); // strip out -module
41+
$vars['name'] = str_replace('-', '_', $vars['name']); // make -'s be _'s
42+
$vars['name'] = ucwords($vars['name']); // make module name camelcased
43+
44+
return $vars;
45+
}
46+
47+
48+
/**
49+
* For package type pxcms-module, cut off a trailing '-plugin' if present.
50+
*
51+
* return string
52+
*/
53+
protected function inflectThemeVars($vars)
54+
{
55+
$vars['name'] = str_replace('pxcms-', '', $vars['name']); // strip out pxcms- just incase (legacy)
56+
$vars['name'] = str_replace('theme-', '', $vars['name']); // strip out theme-
57+
$vars['name'] = preg_replace('/-theme$/', '', $vars['name']); // strip out -theme
58+
$vars['name'] = str_replace('-', '_', $vars['name']); // make -'s be _'s
59+
$vars['name'] = ucwords($vars['name']); // make module name camelcased
60+
61+
return $vars;
62+
}
63+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
namespace Composer\Installers;
4+
5+
class SiteDirectInstaller extends BaseInstaller
6+
{
7+
protected $locations = array(
8+
'module' => 'modules/{$vendor}/{$name}/',
9+
'plugin' => 'plugins/{$vendor}/{$name}/'
10+
);
11+
12+
public function inflectPackageVars($vars)
13+
{
14+
return $this->parseVars($vars);
15+
}
16+
17+
protected function parseVars($vars)
18+
{
19+
$vars['vendor'] = strtolower($vars['vendor']) == 'sitedirect' ? 'SiteDirect' : $vars['vendor'];
20+
$vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
21+
$vars['name'] = str_replace(' ', '', ucwords($vars['name']));
22+
23+
return $vars;
24+
}
25+
}

0 commit comments

Comments
 (0)