[refactoring] PSR-4 support through composer, mass-renaming all *.class.php to *.php to adhere to PSR-4

This commit is contained in:
Pepijn Over 2015-02-27 15:18:37 +01:00
parent dc54bf14ea
commit 1123603f64
50 changed files with 11 additions and 21 deletions

View File

@ -16,5 +16,15 @@
"symfony/http-foundation": "2.6.*",
"php-pushover/php-pushover": "dev-master",
"twig/twig": "1.*"
},
"autoload": {
"files": [
"./src/includes/psmconfig.inc.php",
"./src/includes/functions.inc.php",
"./src/includes/password_compatibility_library.inc.php"
],
"psr-4": {
"psm\\": "src/psm/"
}
}
}

2
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "925f4c971570ca4d3a856019cdd79add",
"hash": "deb9fd4bbeb05c2d3cf1fc7cf51c6f00",
"packages": [
{
"name": "php-pushover/php-pushover",

View File

@ -63,26 +63,6 @@ if(!file_exists($vendor_autoload)) {
}
require_once $vendor_autoload;
spl_autoload_register(function($class) {
// remove leading \
$class = ltrim($class, '\\');
$path_parts = explode('\\', $class);
$filename = array_pop($path_parts);
$path = PSM_PATH_SRC . implode(DIRECTORY_SEPARATOR, $path_parts) .
DIRECTORY_SEPARATOR .
$filename . '.class.php'
;
if(file_exists($path)) {
require_once $path;
return;
}
});
$includes = glob(PSM_PATH_SRC . 'includes/*.inc.php');
foreach($includes as $file) {
include_once $file;
}
$router = new psm\Router();
// this may seem insignificant, but right now lots of functions depend on the following global var definition:
$db = $router->getService('db');