original_string: public function get_components_contexts($component = '') {
  
          // If we already have a list created then just return that, as it's up-to-date.
          if (!empty($this->contexts)) {
              return $this->get_component_contexts($component);
          }
  
          $components = $this->get_components_with_tests();
  
          $this->contexts = array();
          foreach ($components as $componentname => $componentpath) {
              if (false !== strpos($componentname, 'theme_')) {
                  continue;
              }
              $componentpath = self::clean_path($componentpath);
  
              if (!file_exists($componentpath . self::get_behat_tests_path())) {
                  continue;
              }
              $diriterator = new DirectoryIterator($componentpath . self::get_behat_tests_path());
              $regite = new RegexIterator($diriterator, '|^behat_.*\.php$|');
  
              // All behat_*.php inside self::get_behat_tests_path() are added as steps definitions files.
              foreach ($regite as $file) {
                  $key = $file->getBasename('.php');
                  $this->contexts[$key] = $file->getPathname();
              }
          }
  
          // Sort contexts with there name.
          ksort($this->contexts);
  
          return $this->get_component_contexts($component);
      }
code: public function get_components_contexts($component = '') {
  
          // If we already have a list created then just return that, as it's up-to-date.
          if (!empty($this->contexts)) {
              return $this->get_component_contexts($component);
          }
  
          $components = $this->get_components_with_tests();
  
          $this->contexts = array();
          foreach ($components as $componentname => $componentpath) {
              if (false !== strpos($componentname, 'theme_')) {
                  continue;
              }
              $componentpath = self::clean_path($componentpath);
  
              if (!file_exists($componentpath . self::get_behat_tests_path())) {
                  continue;
              }
              $diriterator = new DirectoryIterator($componentpath . self::get_behat_tests_path());
              $regite = new RegexIterator($diriterator, '|^behat_.*\.php$|');
  
              // All behat_*.php inside self::get_behat_tests_path() are added as steps definitions files.
              foreach ($regite as $file) {
                  $key = $file->getBasename('.php');
                  $this->contexts[$key] = $file->getPathname();
              }
          }
  
          // Sort contexts with there name.
          ksort($this->contexts);
  
          return $this->get_component_contexts($component);
      }
code_tokens: public function get_components_contexts ( $ component = '' ) { // If we already have a list created then just return that, as it's up-to-date. if ( ! empty ( $ this -> contexts ) ) { return $ this -> get_component_contexts ( $ component ) ; } $ components = $ this -> get_components_with_tests ( ) ; $ this -> contexts = array ( ) ; foreach ( $ components as $ componentname => $ componentpath ) { if ( false !== strpos ( $ componentname , 'theme_' ) ) { continue ; } $ componentpath = self :: clean_path ( $ componentpath ) ; if ( ! file_exists ( $ componentpath . self :: get_behat_tests_path ( ) ) ) { continue ; } $ diriterator = new DirectoryIterator ( $ componentpath . self :: get_behat_tests_path ( ) ) ; $ regite = new RegexIterator ( $ diriterator , '|^behat_.*\.php$|' ) ; // All behat_*.php inside self::get_behat_tests_path() are added as steps definitions files. foreach ( $ regite as $ file ) { $ key = $ file -> getBasename ( '.php' ) ; $ this -> contexts [ $ key ] = $ file -> getPathname ( ) ; } } // Sort contexts with there name. ksort ( $ this -> contexts ) ; return $ this -> get_component_contexts ( $ component ) ; }
docstring: Gets the list of Moodle behat contexts
  
  Class name as a key and the filepath as value
  
  Externalized from update_config_file() to use
  it from the steps definitions web interface
  
  @param  string $component Restricts the obtained steps definitions to the specified component
  @return array
docstring_tokens: Gets the list of Moodle behat contexts