mirror of
https://github.com/standardebooks/web.git
synced 2025-07-21 23:04:57 -04:00
Add Composer autoloading functions and PHPStan for testing
This commit is contained in:
parent
e198c4db65
commit
f5d7d4e02a
1518 changed files with 169063 additions and 30 deletions
|
@ -1,4 +1,6 @@
|
|||
<?
|
||||
// Auto-included by Composer in composer.json to satisfy PHPStan
|
||||
|
||||
const EBOOKS_PER_PAGE = 12;
|
||||
const SORT_NEWEST = 'newest';
|
||||
const SORT_AUTHOR_ALPHA = 'author-alpha';
|
||||
|
|
31
lib/Core.php
31
lib/Core.php
|
@ -3,35 +3,8 @@ mb_internal_encoding('UTF-8');
|
|||
mb_http_output('UTF-8');
|
||||
date_default_timezone_set('UTC');
|
||||
|
||||
require_once('Constants.php');
|
||||
|
||||
// Convenience alias of var_dump.
|
||||
function vd($var){
|
||||
var_dump($var);
|
||||
}
|
||||
|
||||
// var_dump($var) then die().
|
||||
function vdd($var){
|
||||
var_dump($var);
|
||||
die();
|
||||
}
|
||||
|
||||
// var_dump into a string.
|
||||
function vds($var){
|
||||
ob_start();
|
||||
var_dump($var);
|
||||
$str = ob_get_contents();
|
||||
ob_end_clean();
|
||||
return $str;
|
||||
}
|
||||
|
||||
spl_autoload_register(function($class){
|
||||
try{
|
||||
include($class . '.php');
|
||||
}
|
||||
catch(\Exception $ex){
|
||||
}
|
||||
});
|
||||
// Composer auto-loads the lib/ directory in composer.json
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
// Custom error handler to output more details about the specific Apache request that caused an exception.
|
||||
set_exception_handler(function($ex){
|
||||
|
|
24
lib/CoreFunctions.php
Normal file
24
lib/CoreFunctions.php
Normal file
|
@ -0,0 +1,24 @@
|
|||
<?
|
||||
// Auto-included by Composer in composer.json
|
||||
// These functions are broken out of Core.php to satisfy PHPStan
|
||||
|
||||
// Convenience alias of var_dump.
|
||||
function vd($var){
|
||||
var_dump($var);
|
||||
}
|
||||
|
||||
// var_dump($var) then die().
|
||||
function vdd($var){
|
||||
var_dump($var);
|
||||
die();
|
||||
}
|
||||
|
||||
// var_dump into a string.
|
||||
function vds($var){
|
||||
ob_start();
|
||||
var_dump($var);
|
||||
$str = ob_get_contents();
|
||||
ob_end_clean();
|
||||
return $str;
|
||||
}
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue