public static function addDetector($name, $callable)
    {
        $name = strtolower($name);
        if (is_callable($callable)) {
            static::$_detectors[$name] = $callable;

            return;
        }
        if (isset(static::$_detectors[$name], $callable['options'])) {
            $callable = Hash::merge(static::$_detectors[$name], $callable);
        }
        static::$_detectors[$name] = $callable;
    }
public static function addDetector($name, $callable)
    {
        $name = strtolower($name);
        if (is_callable($callable)) {
            static::$_detectors[$name] = $callable;

            return;
        }
        if (isset(static::$_detectors[$name], $callable['options'])) {
            $callable = Hash::merge(static::$_detectors[$name], $callable);
        }
        static::$_detectors[$name] = $callable;
    }
public static function addDetector ( $ name , $ callable ) { $ name = strtolower ( $ name ) ; if ( is_callable ( $ callable ) ) { static :: $ _detectors [ $ name ] = $ callable ; return ; } if ( isset ( static :: $ _detectors [ $ name ] , $ callable [ 'options' ] ) ) { $ callable = Hash :: merge ( static :: $ _detectors [ $ name ] , $ callable ) ; } static :: $ _detectors [ $ name ] = $ callable ; }
Add a new detector to the list of detectors that a request can use.
There are several different formats and types of detectors that can be set.

### Callback detectors

Callback detectors allow you to provide a callable to handle the check.
The callback will receive the request object as its only parameter.

```
addDetector('custom', function ($request) { //Return a boolean });
addDetector('custom', ['SomeClass', 'somemethod']);
```

### Environment value comparison

An environment value comparison, compares a value fetched from `env()` to a known value
the environment value is equality checked against the provided value.

e.g `addDetector('post', ['env' => 'REQUEST_METHOD', 'value' => 'POST'])`

### Pattern value comparison

Pattern value comparison allows you to compare a value fetched from `env()` to a regular expression.

```
addDetector('iphone', ['env' => 'HTTP_USER_AGENT', 'pattern' => '/iPhone/i']);
```

### Option based comparison

Option based comparisons use a list of options to create a regular expression. Subsequent calls
to add an already defined options detector will merge the options.

```
addDetector('mobile', ['env' => 'HTTP_USER_AGENT', 'options' => ['Fennec']]);
```

### Request parameter detectors

Allows for custom detectors on the request parameters.

e.g `addDetector('requested', ['param' => 'requested', 'value' => 1]`

You can also make parameter detectors that accept multiple values
using the `options` key. This is useful when you want to check
if a request parameter is in a list of options.

`addDetector('extension', ['param' => 'ext', 'options' => ['pdf', 'csv']]`

@param string $name The name of the detector.
@param callable|array $callable A callable or options array for the detector definition.
@return void
Add a new detector to the list of detectors that a request can use . There are several different formats and types of detectors that can be set .