-
Notifications
You must be signed in to change notification settings - Fork 34
classes_system_objects
WDF internal replacement for $GLOBALS usage.
Namespace: ScavixWDF
Creates a buffer that can be used instead of $GLOBALS variable. Optionally, buffers can be mapped to a SESSION variable.
Definition: public static function GetBuffer($name, $initial_data)
Returns: \ScavixWDF\WdfBuffer
Parameters:
-
string $name
Buffer identifier -
array|callable $initial_data
Array with initial data or callback returning this initial data
Sets up a LOCK for a given name. On Linux system uses the /run/lock folder to create a lock file. If this succeeds returns true. If not and a timeout is given will try for that amount of seconds. If still fails trhows an exception if $exceptiononfailure is true or returns false. In all other OS see system_get_lock().
Definition: public static function GetLock($name, $timeout, $exceptiononfailure=true)
Returns: bool
True on success, else false
Parameters:
-
string $name
Lock name -
int $timeout
Seconds to wait/retry (default 10) -
bool $exceptiononfailure
If true will throw an exception if lock cannot be created (default: true)
Checks if there's a buffer present.
Definition: public static function HasBuffer($name)
Returns: bool
True if present, else false
Parameters:
-
string $name
Buffer identifier
Helper to easily check if something was already done.
Definition: public static function Once($id)
Returns: bool
True, if has already been called with $id, else false
Parameters:
-
mixed $id
An ID value
Releases a LOCK.
Definition: public static function ReleaseLock($name)
Returns: bool
True if successful, else false
Parameters:
-
array|string $name
The LOCK name as single string or array of lock names to release
Implements buffering methods.
Namespace: ScavixWDF
Implements: <>
Removes all data from the buffer.
Definition: public function clear()
Returns: void
IMPLEMENTS Iterator::current
Removes data from the buffer.
Definition: public function del($name)
Returns: mixed
The removed value if present, else null
Parameters:
-
string $name
The key for the data
Returns all data as assiciative array.
Definition: public function dump()
Returns: array
Returns data from the buffer.
Definition: public function get($name, $default=null)
Returns: mixed
The removed value if present, else null
Parameters:
-
string $name
The key for the data -
mixed $default
A default value, can be a callable too that will get the name and must return the value;
Returns true, if there's data stored with the given name.
Definition: public function has($name)
Returns: bool
Parameters:
-
string $name
The key for the data
Returns true if some data has been changed. This is true, if WdfBuffer::set or WdfBuffer::set have been used and if they effectively did something.
Definition: public function hasChanged()
Returns: bool
INTERNAL see JsonSerializable
IMPLEMENTS Iterator::key
Returns an array of data keys.
Definition: public function keys()
Returns: array
Maps this buffer to a $_SESSION variable. Mapping to the session means that from now on all data will be stored into $_SESSION[$name] and that getting data will transparently use that variable too.
Definition: public function mapToSession($name=false)
Returns: \ScavixWDF\WdfBuffer
Parameters:
-
string $name
Name of session variable
IMPLEMENTS Iterator::next
IMPLEMENTS Iterator::rewind
Stores data in the buffer.
Definition: public function set($name, $value)
Returns: mixed
The value given
Parameters:
-
string $name
The key for the data -
mixed $value
The data to store
IMPLEMENTS Iterator::valid
We use this to test access to controllers. All controllers must implement this interface
Namespace: ScavixWDF
Defines an objects that handles log-string creation itself.
Namespace: ScavixWDF
Transparently wraps Exceptions thus providing a way to catch them easily while still having the original Exception information. Using static WdfException() method you can pass in multiple arguments. ScavixWDF will try to detect if there's an exception object given and use it (the first one detected) as inner exception object.
WdfException::Raise('My simple test');
WdfException::Raise('My simple test2',$obj_to_debug_1,'and',$obj_to_debug_2);
try{ $i=42/0; }catch(Exception $ex){ WdfException::Raise('That was stupid!',$ex); }
Namespace: ScavixWDF
Extends: Exception
Subclasses: ToDoException, WdfDbException
Thrown when something still needs investigation
We use this like this: ToDoException::Raise('Not yet implemented')
Namespace: ScavixWDF
Extends: WdfException » Exception
Thrown from all database related system parts All code in the model essential (essentials/model.php + essentials/model/*) use this instead of WdfException. Just to have everyting nicely wrapped.
Namespace: ScavixWDF
Extends: WdfException » Exception
Returns the arguments used
Definition: public function getArguments()
Returns: array
The arguments
Returns an array with error information
Definition: public function getErrorInfo()
Returns: array
Returns a string merged from the SQL statement and the arguments
Definition: public function getMergedSql()
Returns: string
Merged SQL statement
Returns the SQL string used
Definition: public function getSql()
Returns: string
SQL
INTERNAL Helper method to detect if this represents an Exception indicating a duplicate key
INTERNAL Helper method to detect if this represents an Exception indicating a missing table.
INTERNAL Wraps a \PDOException, optionally with the triggering statement
INTERNAL Raises an Exception for a failed DB Statement.
Thrown when some process reached a state where graceful but immidiate termination is required.
We use this like this: TerminationException::WithCode('HTTP_500','Server responded with 500, cannot do that now')
Namespace: ScavixWDF
Returns the reason string.
Definition: public function getReason()
Returns: string
The reason this exception was thrown of.
Raises a silent TerminationException.
Definition: public static function Silent(string $reason, $args)
Returns: void
Parameters:
-
string $reason
The reason for the Exception -
array $args
Additional arguments to be logged.
Raises a verbose TerminationException.
Definition: public static function Verbose(string $reason, $args)
Returns: void
Parameters:
-
string $reason
The reason for the Exception -
array $args
Additional arguments to be logged.
Writes the exception to the log if it is verbose.
Definition: public function writeLog()
Returns: void