original_string: public function get_enrolment_plugins($onlyenabled = true) {
          if ($this->_plugins === null) {
              $this->_plugins = enrol_get_plugins(true);
          }
  
          if ($onlyenabled) {
              return $this->_plugins;
          }
  
          if ($this->_allplugins === null) {
              // Make sure we have the same objects in _allplugins and _plugins.
              $this->_allplugins = $this->_plugins;
              foreach (enrol_get_plugins(false) as $name=>$plugin) {
                  if (!isset($this->_allplugins[$name])) {
                      $this->_allplugins[$name] = $plugin;
                  }
              }
          }
  
          return $this->_allplugins;
      }
code: public function get_enrolment_plugins($onlyenabled = true) {
          if ($this->_plugins === null) {
              $this->_plugins = enrol_get_plugins(true);
          }
  
          if ($onlyenabled) {
              return $this->_plugins;
          }
  
          if ($this->_allplugins === null) {
              // Make sure we have the same objects in _allplugins and _plugins.
              $this->_allplugins = $this->_plugins;
              foreach (enrol_get_plugins(false) as $name=>$plugin) {
                  if (!isset($this->_allplugins[$name])) {
                      $this->_allplugins[$name] = $plugin;
                  }
              }
          }
  
          return $this->_allplugins;
      }
code_tokens: public function get_enrolment_plugins ( $ onlyenabled = true ) { if ( $ this -> _plugins === null ) { $ this -> _plugins = enrol_get_plugins ( true ) ; } if ( $ onlyenabled ) { return $ this -> _plugins ; } if ( $ this -> _allplugins === null ) { // Make sure we have the same objects in _allplugins and _plugins. $ this -> _allplugins = $ this -> _plugins ; foreach ( enrol_get_plugins ( false ) as $ name => $ plugin ) { if ( ! isset ( $ this -> _allplugins [ $ name ] ) ) { $ this -> _allplugins [ $ name ] = $ plugin ; } } } return $ this -> _allplugins ; }
docstring: Gets all of the enrolment plugins that are available for this course.
  
  @param bool $onlyenabled return only enabled enrol plugins
  @return array
docstring_tokens: Gets all of the enrolment plugins that are available for this course .