Skip to content

Commit

Permalink
Migrate from PSR-0 to PSR-4.
Browse files Browse the repository at this point in the history
  • Loading branch information
nrk committed Jul 14, 2014
1 parent 959734c commit d226923
Show file tree
Hide file tree
Showing 263 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
* file that was distributed with this source code.
*/

require __DIR__.'/lib/Predis/Autoloader.php';
require __DIR__.'/lib/Autoloader.php';

Predis\Autoloader::register();
4 changes: 2 additions & 2 deletions bin/create-command-test
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class CommandTestCaseGenerator

$options = array(
'overwrite' => false,
'tests' => __DIR__.'/../tests',
'tests' => __DIR__.'/../tests/Predis',
);

foreach ($getops as $option => $value) {
Expand Down Expand Up @@ -93,7 +93,7 @@ class CommandTestCaseGenerator
}

$options['fqn'] = "Predis\\Command\\{$options['class']}";
$options['path'] = "Predis/Command/{$options['class']}.php";
$options['path'] = "Command/{$options['class']}.php";

$source = __DIR__.'/../lib/'.$options['path'];
if (!file_exists($source)) {
Expand Down
2 changes: 1 addition & 1 deletion bin/create-phar
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function getPharStub($options)
Phar::mapPhar('predis.phar');
spl_autoload_register(function (\$class) {
if (strpos(\$class, 'Predis\\\\') === 0) {
\$file = 'phar://predis.phar/'.strtr(\$class, '\\\', '/').'.php';
\$file = 'phar://predis.phar/'.strtr(substr(\$class, 7), '\\\', '/').'.php';
if (file_exists(\$file)) {
require \$file;
return true;
Expand Down
7 changes: 3 additions & 4 deletions bin/create-single-file
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class CommandLine
$getops = getopt(implode(array_keys($parameters)), $parameters);

$options = array(
'source' => __DIR__ . "/../lib/",
'source' => __DIR__ . "/../lib",
'output' => PredisFile::NS_ROOT . '.php',
'exclude' => array(),
);
Expand Down Expand Up @@ -82,17 +82,16 @@ class PredisFile

public static function from($libraryPath, array $exclude = array())
{
$nsroot = self::NS_ROOT;
$predisFile = new PredisFile();
$libIterator = new RecursiveDirectoryIterator("$libraryPath$nsroot");
$libIterator = new RecursiveDirectoryIterator($libraryPath);

foreach (new RecursiveIteratorIterator($libIterator) as $classFile)
{
if (!$classFile->isFile()) {
continue;
}

$namespace = strtr(str_replace($libraryPath, '', $classFile->getPath()), '/', '\\');
$namespace = self::NS_ROOT.strtr(str_replace($libraryPath, '', $classFile->getPath()), '/', '\\');

if (in_array(sprintf('%s\\%s', $namespace, $classFile->getBasename('.php')), $exclude)) {
continue;
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"ext-curl": "Allows access to Webdis when paired with phpiredis"
},
"autoload": {
"psr-0": {"Predis": "lib/"}
"psr-4": {"Predis\\": "lib/"}
},
"extra": {
"branch-alias": {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<filter>
<whitelist>
<directory suffix=".php">lib/Predis/</directory>
<directory suffix=".php">lib/</directory>
</whitelist>
</filter>

Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.travisci
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<filter>
<whitelist>
<directory suffix=".php">lib/Predis/</directory>
<directory suffix=".php">lib/</directory>
</whitelist>
</filter>

Expand Down

0 comments on commit d226923

Please sign in to comment.