I have this is a piece of code which is part of a custom library for CI 3.1:
class NavigationMenu
{
protected $CI;
public function __construct($params = ['config' => 'navigation'])
{
$this->CI =& get_instance();
$this->CI->load->helper('url');
$this->CI->config->load($params['config'], true);
$this->CI->load->model('nav_model', 'nav');
}
....
}
The file 'navigation.php` have the following code:
$config['navigation_open'] = '<ul class="nav">';
$config['navigation_close'] = '</ul>';
$config['item_open'] = '<li>';
$config['item_open_active_class'] = 'active';
I have notice that $params passed to the constructor reads as:
array (size=10)
'navigation_open' => string '<ul class="nav">' (length=16)
'navigation_close' => string '</ul>' (length=5)
'item_open' => string '<li>' (length=4)
'item_open_active_class' => string 'active' (length=6)
Why? Is this a default behavior from CI? From PHP constructor and I am not aware of it? Or something is wrong in my code and I am not seeing it?
