original_string: public function extract() {
          foreach ($this->log as $line) {
              foreach ($this->messageGroupsJoined as $header => $keywords) {
                  $pattern = $this->getPattern($keywords);
  
                  if (preg_match($pattern, $line)) {
                      $this->appendToGroup($header, $line, $pattern);
                  }
              }
          }
  
          // Remove empty groups
          foreach (array_keys($this->messageGroups) as $groupKey) {
              if (true === empty($this->groups[$groupKey])) {
                  unset($this->messageGroups[$groupKey]);
              }
          }
  
          // The array_merge sorts $messageGroups basing on $groups
          return array_merge($this->messageGroups, $this->groups);
      }
code: public function extract() {
          foreach ($this->log as $line) {
              foreach ($this->messageGroupsJoined as $header => $keywords) {
                  $pattern = $this->getPattern($keywords);
  
                  if (preg_match($pattern, $line)) {
                      $this->appendToGroup($header, $line, $pattern);
                  }
              }
          }
  
          // Remove empty groups
          foreach (array_keys($this->messageGroups) as $groupKey) {
              if (true === empty($this->groups[$groupKey])) {
                  unset($this->messageGroups[$groupKey]);
              }
          }
  
          // The array_merge sorts $messageGroups basing on $groups
          return array_merge($this->messageGroups, $this->groups);
      }
code_tokens: public function extract ( ) { foreach ( $ this -> log as $ line ) { foreach ( $ this -> messageGroupsJoined as $ header => $ keywords ) { $ pattern = $ this -> getPattern ( $ keywords ) ; if ( preg_match ( $ pattern , $ line ) ) { $ this -> appendToGroup ( $ header , $ line , $ pattern ) ; } } } // Remove empty groups foreach ( array_keys ( $ this -> messageGroups ) as $ groupKey ) { if ( true === empty ( $ this -> groups [ $ groupKey ] ) ) { unset ( $ this -> messageGroups [ $ groupKey ] ) ; } } // The array_merge sorts $messageGroups basing on $groups return array_merge ( $ this -> messageGroups , $ this -> groups ) ; }
docstring: Groups messages and returns them.
  
  @return array
docstring_tokens: Groups messages and returns them .