diff --git a/Bin/autoload.php b/Bin/autoload.php index 389affe..da148b8 100644 --- a/Bin/autoload.php +++ b/Bin/autoload.php @@ -17,36 +17,29 @@ if ( ! defined('BEDROCK_ROOT_DIRECTORY' ) ) { define('BEDROCK_ROOT_DIRECTORY', dirname(__DIR__) . DIRECTORY_SEPARATOR); } if ( ! defined('BEDROCK_CONFIG_DIRECTORY' ) ) { - define('BEDROCK_CONFIG_DIRECTORY', BEDROCK_ROOT_DIRECTORY . 'config' . DIRECTORY_SEPARATOR); + define('BEDROCK_CONFIG_DIRECTORY', BEDROCK_ROOT_DIRECTORY . 'Config' . DIRECTORY_SEPARATOR); } if ( ! defined('BEDROCK_CONSTANTS_LOADED' ) ) { require_once BEDROCK_CONFIG_DIRECTORY . 'constants.php'; } -if ( ! class_exists( 'TheTempusProject\Bedrock\Classes\Autoloader' ) ) { - if ( file_exists( BEDROCK_CLASSES_DIRECTORY . 'autoloader.php' ) ) { - require_once BEDROCK_CLASSES_DIRECTORY . 'autoloader.php'; - } -} -if ( ! class_exists( 'TheTempusProject\Bedrock\App' ) ) { - if ( file_exists( BEDROCK_ROOT_DIRECTORY . 'app.php' ) ) { - require_once BEDROCK_ROOT_DIRECTORY . 'app.php'; - } +if ( class_exists( 'TheTempusProject\Hermes\Classes\Autoloader' ) ) { + $autoloader = new Autoloader; + $autoloader->setRootFolder( BEDROCK_ROOT_DIRECTORY ); + $autoloader->addNamespace( + 'TheTempusProject\Bedrock', + 'Bin' + ); + $autoloader->addNamespace( + 'TheTempusProject\Bedrock\Classes', + 'Classes' + ); + $autoloader->addNamespace( + 'TheTempusProject\Bedrock\Functions', + 'Functions' + ); + $autoloader->register(); } -$autoloader = new Autoloader; -$autoloader->setRootFolder( BEDROCK_ROOT_DIRECTORY ); -$autoloader->addNamespace( - 'TheTempusProject\Bedrock', - 'bin' -); -$autoloader->addNamespace( - 'TheTempusProject\Bedrock\Classes', - 'classes' -); -$autoloader->addNamespace( - 'TheTempusProject\Bedrock\Functions', - 'functions' -); -$autoloader->register(); +require_once 'Bedrock.php'; define( 'BEDROCK_AUTOLOADED', true ); diff --git a/Classes/CustomException.php b/Classes/CustomException.php deleted file mode 100644 index ef50b09..0000000 --- a/Classes/CustomException.php +++ /dev/null @@ -1,78 +0,0 @@ - - * @link https://TheTempusProject.com/Core - * @license https://opensource.org/licenses/MIT [MIT LICENSE] - */ -namespace TheTempusProject\Bedrock\Classes; - -use Exception; -use TheTempusProject\Hermes\Functions\Redirect; -use TheTempusProject\Canary\Bin\Canary as Debug; - -class CustomException extends Exception { - private $originFunction = null; - private $exceptionName = null; - private $originClass = null; - private $data = null; - - /** - * This function allows the application to deal with errors - * in a dynamic way by letting you customize the response - * - * @param string $type - The type of the exception being called/thrown. - * @param string $data - Any additional data being passed with the exception. - * - * @example - throw new CustomException('model'); - Calls the model-missing exception - */ - public function __construct( $type, $data = null ) { - $this->originFunction = debug_backtrace()[1]['function']; - $this->originClass = debug_backtrace()[1]['class']; - $this->exceptionName = $type; - $this->data = $data; - switch ( $type ) { - case 'model': - Debug::error( 'Model not found: ' . $data ); - break; - case 'dbConnection': - Debug::error( 'Error Connecting to the database: ' . $data ); - break; - case 'DB': - Debug::error( 'Unspecified database error: ' . $data ); - break; - case 'view': - Debug::error( 'View not found: ' . $data ); - break; - case 'controller': - Debug::error( 'Controller not found: ' . $data ); - Redirect::to( 404 ); - break; - case 'defaultController': - Debug::error( 'DEFAULT Controller not found: ' . $data ); - Redirect::to( 404 ); - break; - case 'method': - Debug::error( 'Method not found: ' . $data ); - Redirect::to( 404 ); - break; - case 'simpleView': - Debug::error( 'View not found: ' . $data ); - break; - case 'defaultMethod': - Debug::error( 'DEFAULT Method not found: ' . $data ); - Redirect::to( 404 ); - break; - default: - Debug::error( 'Default exception: ' . $data ); - break; - } - } -} diff --git a/Classes/Database.php b/Classes/Database.php index 350291f..abc4dd6 100644 --- a/Classes/Database.php +++ b/Classes/Database.php @@ -16,6 +16,7 @@ namespace TheTempusProject\Bedrock\Classes; use PDO; use PDOException; use TheTempusProject\Canary\Bin\Canary as Debug; +use TheTempusProject\Canary\Classes\CustomException; class Database { public static $instance = null; diff --git a/Classes/Pagination.php b/Classes/Pagination.php index e95fdcc..2ab3a02 100644 --- a/Classes/Pagination.php +++ b/Classes/Pagination.php @@ -18,6 +18,7 @@ use TheTempusProject\Bedrock\Classes\Config; use TheTempusProject\Bedrock\Functions\Check; use TheTempusProject\Canary\Bin\Canary as Debug; use TheTempusProject\Houdini\Classes\Components; +use TheTempusProject\Houdini\Classes\Views; class Pagination extends Template { //The settings that will not change