tables
1 year ago
assets.php
1 year ago
baseObject.php
1 year ago
cache.php
1 year ago
controller.php
1 year ago
date.php
1 year ago
db.php
1 year ago
dispatcher.php
1 year ago
errors.php
1 year ago
field.php
1 year ago
fieldAdapter.php
1 year ago
frame.php
1 year ago
helper.php
1 year ago
html.php
1 year ago
installer.php
1 year ago
installerDbUpdater.php
1 year ago
modInstaller.php
1 year ago
model.php
1 year ago
module.php
1 year ago
req.php
1 year ago
response.php
1 year ago
table.php
1 year ago
uri.php
1 year ago
user.php
1 year ago
utils.php
1 year ago
validator.php
1 year ago
view.php
1 year ago
baseObject.php
33 lines
| 1 | <?php |
| 2 | if ( ! defined( 'ABSPATH' ) ) { |
| 3 | exit; |
| 4 | } |
| 5 | abstract class WaicBaseObject { |
| 6 | protected $_internalErrors = array(); |
| 7 | protected $_haveErrors = false; |
| 8 | public function pushError( $error, $key = '' ) { |
| 9 | if (is_array($error)) { |
| 10 | $this->_internalErrors = array_merge($this->_internalErrors, $error); |
| 11 | } elseif (empty($key)) { |
| 12 | $this->_internalErrors[] = $error; |
| 13 | } else { |
| 14 | $this->_internalErrors[ $key ] = $error; |
| 15 | } |
| 16 | $this->_haveErrors = true; |
| 17 | } |
| 18 | public function getErrors() { |
| 19 | return $this->_internalErrors; |
| 20 | } |
| 21 | public function haveErrors() { |
| 22 | return $this->_haveErrors; |
| 23 | } |
| 24 | public function getLastError() { |
| 25 | if ($this->_haveErrors) { |
| 26 | $keys = array_keys($this->_internalErrors); |
| 27 | return $this->_internalErrors[$keys[count($keys)-1]]; |
| 28 | } |
| 29 | return ''; |
| 30 | } |
| 31 | |
| 32 | } |
| 33 |