$this in enrol_page_hook method in lib.php file of enrol/self plugin

Re: $this in enrol_page_hook method in lib.php file of enrol/self plugin

by Matteo Scaramuccia -
Number of replies: 0
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Salim,
if the code you're exploring is e.g. the snippet below:

class enrol_self_plugin extends enrol_plugin {
...
    public function enrol_page_hook(stdClass $instance) {
...
            if ($instance->id == $instanceid) {
                if ($data = $form->get_data()) {
                    $this->enrol_self($instance, $data);
                }
            }

$this is the instance of the class enrol_self_plugin, when its public method enrol_page_hook will be called on that instance.

It's plain OOP (in PHP):

  1. http://www.php.net/manual/en/language.oop5.basic.php
  2. https://phpro.org/tutorials/Object-Oriented-Programming-with-PHP.html

HTH,
Matteo