Inspekt\Cage::factory PHP Метод

factory() публичный статический Метод

Takes an array and wraps it inside an object. If $strict is not set to FALSE, the original array will be destroyed, and the data can only be accessed via the object's accessor methods
public static factory ( array &$source, string $conf_file = null, string $conf_section = null, boolean $strict = true ) : Cage
$source array
$conf_file string
$conf_section string
$strict boolean
Результат Cage
    public static function factory(array &$source, $conf_file = null, $conf_section = null, $strict = true)
    {
        $cage = new Cage();
        $cage->setSource($source);
        $cage->parseAndApplyAutoFilters($conf_file, $conf_section);
        if ($strict) {
            $source = null;
        }
        return $cage;
    }

Usage Example

Пример #1
0
 /**
  * Returns the $_FILES data wrapped in an Cage object
  *
  * This utilizes a singleton pattern to get around scoping issues
  *
  * @param string $config_file
  * @param boolean $strict whether or not to nullify the superglobal array
  * @return Cage
  */
 public static function makeFilesCage($config_file = null, $strict = true)
 {
     /**
      * @staticvar $_instance
      */
     static $_instance;
     if (!isset($_instance)) {
         $_instance = Cage::factory($_FILES, $config_file, '_FILES', $strict);
     }
     $GLOBALS['HTTP_POST_FILES'] = null;
     return $_instance;
 }
All Usage Examples Of Inspekt\Cage::factory