Inspekt\Inspekt::makeSuperCage PHP Méthode

makeSuperCage() public static méthode

Returns a SuperglobalsCage object, which wraps ALL input superglobals
public static makeSuperCage ( string $config_file = null, boolean $strict = true ) : SuperglobalsCage
$config_file string
$strict boolean whether or not to nullify the superglobal
Résultat SuperglobalsCage
    public static function makeSuperCage($config_file = null, $strict = true)
    {
        /**
         * @staticvar $_instance
         */
        static $_scinstance;
        if (!isset($_scinstance)) {
            $_scinstance = SuperglobalsCage::Factory($config_file, $strict);
        }
        return $_scinstance;
    }

Usage Example

Exemple #1
0
/**
 * a wrapper to retrieve input from either the get or post Inspekt cages
 *
 * @param string $key the key you're trying to retrieve
 * @param string $accessor the name of the accessor method to use
 * @return mixed  null if key does not exist
 * @author Ed Finkler
 */
function getInputGP($key, $accessor)
{
    /*
        this returns the singleton
    */
    $sc = Inspekt::makeSuperCage();
    if ($sc->get->keyExists($key)) {
        return $sc->get->{$accessor}($key);
    } elseif ($sc->post->keyExists($key)) {
        return $sc->post->{$accessor}($key);
    } else {
        return null;
    }
}
All Usage Examples Of Inspekt\Inspekt::makeSuperCage