original_string: public function add(FormField $field)
      {
          $segments = $this->getSegments($field->getName());
  
          $target = &$this->fields;
          while ($segments) {
              if (!\is_array($target)) {
                  $target = [];
              }
              $path = array_shift($segments);
              if ('' === $path) {
                  $target = &$target[];
              } else {
                  $target = &$target[$path];
              }
          }
          $target = $field;
      }
code: public function add(FormField $field)
      {
          $segments = $this->getSegments($field->getName());
  
          $target = &$this->fields;
          while ($segments) {
              if (!\is_array($target)) {
                  $target = [];
              }
              $path = array_shift($segments);
              if ('' === $path) {
                  $target = &$target[];
              } else {
                  $target = &$target[$path];
              }
          }
          $target = $field;
      }
code_tokens: public function add ( FormField $ field ) { $ segments = $ this -> getSegments ( $ field -> getName ( ) ) ; $ target = & $ this -> fields ; while ( $ segments ) { if ( ! \ is_array ( $ target ) ) { $ target = [ ] ; } $ path = array_shift ( $ segments ) ; if ( '' === $ path ) { $ target = & $ target [ ] ; } else { $ target = & $ target [ $ path ] ; } } $ target = $ field ; }
docstring: Adds a field to the registry.
docstring_tokens: Adds a field to the registry .