-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'creme332:main' into Incomplete-OrderModel
- Loading branch information
Showing
16 changed files
with
203 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Steamy\Controller; | ||
|
||
use Steamy\Core\Controller; | ||
|
||
class Error | ||
{ | ||
use Controller; | ||
|
||
private array $view_data; | ||
|
||
public function __construct() | ||
{ | ||
$this->view_data['error_message'] = '500 - Internal server error'; | ||
$this->view_data['extended_error_message'] = 'Something bad happened'; | ||
} | ||
|
||
public function handleDatabaseError(): void | ||
{ | ||
$this->view_data['extended_error_message'] = 'Unable to connect to database.'; | ||
|
||
$this->view( | ||
'Error', | ||
$this->view_data, | ||
template_title: "Error", | ||
enableIndexing: false | ||
); | ||
} | ||
|
||
public function handlePageNotFoundError($extended_error_message = 'Ensure that you have properly typed the URL.' | ||
): void { | ||
$this->view_data['error_message'] = '404 - Page not found'; | ||
$this->view_data['extended_error_message'] = $extended_error_message; | ||
|
||
$this->view( | ||
'Error', | ||
$this->view_data, | ||
template_title: "Page not found", | ||
enableIndexing: false | ||
); | ||
} | ||
|
||
public function handleUnknownError(): void | ||
{ | ||
$this->view_data['extended_error_message'] = 'The server has encountered a situation | ||
it does not know how to handle.'; | ||
|
||
$this->view( | ||
'Error', | ||
$this->view_data, | ||
template_title: "Unknown error", | ||
enableIndexing: false | ||
); | ||
} | ||
|
||
public function index(): void | ||
{ | ||
$this->handlePageNotFoundError(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.