I want to develop modules for OpenCart, but I am new to OOP in PHP. I am having difficulty interpreting OpenCart code.
I know what the following statement means in PHP i.e. accessing methods and variable of a class via $this which is a reference to the calling object.
$this->custom_function();
$this->defined_variable;
however I do not understand a statement like this. $this->config->get('config_template') or this $this->request->get['field'] etc.
Can you guys help me understand this. How it is to be read/ interpreted ?
It’s called method/property chaining and is used when you don’t want to set variables for objects that your going use only once. It’s the same as accessing multidimensional arrays. E.g. with arrays you write
$arr['one']['two']['three']and if the arrays were objects you would write$obj->one->two->threeNote that open cart source is pretty ugly. I would recommend learning with something less complex and obscure