Format::__construct PHP Method

__construct() public method

DO NOT CALL THIS DIRECTLY, USE factory()
public __construct ( null $data = NULL, null $from_type = NULL )
$data null
$from_type null
    public function __construct($data = NULL, $from_type = NULL)
    {
        // Get the CodeIgniter reference
        $this->_CI =& get_instance();
        // Load the inflector helper
        $this->_CI->load->helper('inflector');
        // If the provided data is already formatted we should probably convert it to an array
        if ($from_type !== NULL) {
            if (method_exists($this, '_from_' . $from_type)) {
                $data = call_user_func([$this, '_from_' . $from_type], $data);
            } else {
                throw new Exception('Format class does not support conversion from "' . $from_type . '".');
            }
        }
        // Set the member variable to the data passed
        $this->_data = $data;
    }

Usage Example

Exemplo n.º 1
0
 public function __construct()
 {
     parent::__construct();
     $this->registerFormatName("PHP-KDevelop");
     $this->setTitle("PHP Manual");
     $this->setExt(Config::ext() === null ? ".php" : Config::ext());
 }
All Usage Examples Of Format::__construct