original_string: protected function set_selected($selected) {
          if ((string)$selected === (string)$this->id) {
              $this->selected = true;
              // This tab is selected. No need to travel through subtree.
              return true;
          }
          foreach ($this->subtree as $subitem) {
              if ($subitem->set_selected($selected)) {
                  // This tab has child that is selected. Mark it as activated. No need to check other children.
                  $this->activated = true;
                  return true;
              }
          }
          return false;
      }
code: protected function set_selected($selected) {
          if ((string)$selected === (string)$this->id) {
              $this->selected = true;
              // This tab is selected. No need to travel through subtree.
              return true;
          }
          foreach ($this->subtree as $subitem) {
              if ($subitem->set_selected($selected)) {
                  // This tab has child that is selected. Mark it as activated. No need to check other children.
                  $this->activated = true;
                  return true;
              }
          }
          return false;
      }
code_tokens: protected function set_selected ( $ selected ) { if ( ( string ) $ selected === ( string ) $ this -> id ) { $ this -> selected = true ; // This tab is selected. No need to travel through subtree. return true ; } foreach ( $ this -> subtree as $ subitem ) { if ( $ subitem -> set_selected ( $ selected ) ) { // This tab has child that is selected. Mark it as activated. No need to check other children. $ this -> activated = true ; return true ; } } return false ; }
docstring: Travels through tree and finds the tab to mark as selected, all parents are automatically marked as activated
  
  @param string $selected the id of the selected tab (whatever row it's on),
  if null marks all tabs as unselected
  @return bool whether this tab is selected or contains selected tab in its subtree
docstring_tokens: Travels through tree and finds the tab to mark as selected all parents are automatically marked as activated