diff options
author | Chris Cornutt <enygma@phpdeveloper.org> | 2015-07-21 16:19:25 -0500 |
---|---|---|
committer | Chris Cornutt <enygma@phpdeveloper.org> | 2015-07-21 16:19:25 -0500 |
commit | 6abdc560501debc0fd8ec74e2399b4001b82919c (patch) | |
tree | 9c690a02eff8caa79aaa7ee558da095bb2608199 | |
parent | a53719cb8a4e442dbc5a2e26ad2c4e5dc2922b6a (diff) | |
download | gatekeeper-6abdc560501debc0fd8ec74e2399b4001b82919c.zip gatekeeper-6abdc560501debc0fd8ec74e2399b4001b82919c.tar.gz gatekeeper-6abdc560501debc0fd8ec74e2399b4001b82919c.tar.bz2 |
adding the "getLastError" method to get the last reported error on the data source
-rw-r--r-- | src/Psecio/Gatekeeper/DataSource.php | 6 | ||||
-rw-r--r-- | src/Psecio/Gatekeeper/Gatekeeper.php | 10 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/Psecio/Gatekeeper/DataSource.php b/src/Psecio/Gatekeeper/DataSource.php index 8b57a8e..3ddd1b3 100644 --- a/src/Psecio/Gatekeeper/DataSource.php +++ b/src/Psecio/Gatekeeper/DataSource.php @@ -11,6 +11,12 @@ abstract class DataSource public $config = array(); /** + * Last error from a datasource request + * @var string + */ + public $lastError = ''; + + /** * Init the object and set the configuration * @param array $config Configuration settings */ diff --git a/src/Psecio/Gatekeeper/Gatekeeper.php b/src/Psecio/Gatekeeper/Gatekeeper.php index 31e638a..10c2b84 100644 --- a/src/Psecio/Gatekeeper/Gatekeeper.php +++ b/src/Psecio/Gatekeeper/Gatekeeper.php @@ -204,6 +204,16 @@ class Gatekeeper } /** + * Get the last error message from the current datasource + * + * @return string Error message (or empty string) + */ + public static function getLastError() + { + return self::getDatasource()->lastError; + } + + /** * Get the current list of restrictions * * @return array Set of restrictions |