\TriTan\CommonTriggerError

Summary

Methods
Properties
Constants
trigger()
deprecatedFunction()
deprecatedClass()
deprecatedMethod()
deprecatedArgument()
deprecatedHook()
incorrectlyCalled()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

trigger()

trigger(string  $message, string  $level = E_USER_NOTICE) 

Wrapper function for the core PHP function: trigger_error.

This function makes the error a little more understandable for the end user to track down the issue.

Parameters

string $message

Custom message to print.

string $level

Predefined PHP error constant.

deprecatedFunction()

deprecatedFunction(string  $function_name, string  $release, string  $replacement = null) 

Mark a function as deprecated and inform when it has been used.

There is a hook deprecated_function_run that will be called that can be used to get the backtrace up to what file and function called the deprecated function.

Default behavior is to trigger a user error if APP_ENV is set to DEV.

This function is to be used in every function that is deprecated.

Parameters

string $function_name

The function that was called.

string $release

The release of TriTan CMS that deprecated the function.

string $replacement

Optional. The function that should have been called. Default null.

deprecatedClass()

deprecatedClass(string  $class_name, string  $release, string  $replacement = null) 

Mark a class as deprecated and inform when it has been used.

There is a hook deprecated_class_run that will be called that can be used to get the backtrace up to what file, function/class called the deprecated class.

Default behavior is to trigger a user error if APP_ENV is set to DEV.

This function is to be used in every class that is deprecated.

Parameters

string $class_name

The class that was called.

string $release

The release of TriTan CMS that deprecated the class.

string $replacement

Optional. The class that should have been called. Default null.

deprecatedMethod()

deprecatedMethod(string  $method_name, string  $release, string  $replacement = null) 

Mark a class's method as deprecated and inform when it has been used.

There is a hook deprecated_class_method_run that will be called that can be used to get the backtrace up to what file, function/class called the deprecated method.

Default behavior is to trigger a user error if APP_ENV is set to DEV.

This function is to be used in every class's method that is deprecated.

Parameters

string $method_name

The class method that was called.

string $release

The release of TriTan CMS that deprecated the class's method.

string $replacement

Optional. The class method that should have been called. Default null.

deprecatedArgument()

deprecatedArgument(string  $function_name, string  $release, string  $message = null) 

Mark a function argument as deprecated and inform when it has been used.

This function is to be used whenever a deprecated function argument is used. Before this function is called, the argument must be checked for whether it was used by comparing it to its default value or evaluating whether it is empty.

There is a hook deprecated_argument_run that will be called that can be used to get the backtrace up to what file and function used the deprecated argument.

Default behavior is to trigger a user error if APP_ENV is set to DEV.

Example Usage:

 $trigger = new TriTan\Common\TriggerError(new TriTan\Common\Context\GlobalContext());
 if ( ! empty( $deprecated ) ) {
     $trigger->deprecatedArgument( __FUNCTION__, '0.9' );
 }

Parameters

string $function_name

The function that was called.

string $release

The release of TriTan CMS that deprecated the argument used.

string $message

Optional. A message regarding the change. Default null.

deprecatedHook()

deprecatedHook(string  $hook, string  $release, string  $replacement = null, string  $message = null) 

Marks a deprecated action or filter hook as deprecated and throws a notice.

Default behavior is to trigger a user error if APP_ENV is set to DEV.

Parameters

string $hook

The hook that was used.

string $release

The release of TriTan CMS that deprecated the hook.

string $replacement

Optional. The hook that should have been used.

string $message

Optional. A message regarding the change.

incorrectlyCalled()

incorrectlyCalled(string  $function_name, string  $message, string  $release) 

Mark something as being incorrectly called.

There is a hook incorrectly_called_run that will be called that can be used to get the backtrace up to what file and function called the deprecated function.

Default behavior is to trigger a user error if APP_ENV is set to DEV.

Parameters

string $function_name

The function that was called.

string $message

A message explaining what has been done incorrectly.

string $release

The release of TriTan CMS where the message was added.