original_string: public function getData($name, $attr)
      {
          if (empty($name)) {
              return $attr;
          }
  
          $value = $this->Data->getValue($name);
  
          if ($value !== null) {
              $isCheckbox = (isset($attr['type']) && $attr['type'] == 'checkbox');
              $isRadio = (isset($attr['type']) && $attr['type'] == 'radio');
              $isSelect = (isset($attr['type']) && $attr['type'] == 'select');
  
              if ($isCheckbox) {
                  $attr[] = 'checked';
              } elseif ($isRadio) {
                  $attr['checked'] = $value;
              } elseif ($isSelect) {
                  $attr['selected'] = $value;
              } else {
                  $attr['value'] = $value;
              }
          }
  
          return $attr;
      }
code: public function getData($name, $attr)
      {
          if (empty($name)) {
              return $attr;
          }
  
          $value = $this->Data->getValue($name);
  
          if ($value !== null) {
              $isCheckbox = (isset($attr['type']) && $attr['type'] == 'checkbox');
              $isRadio = (isset($attr['type']) && $attr['type'] == 'radio');
              $isSelect = (isset($attr['type']) && $attr['type'] == 'select');
  
              if ($isCheckbox) {
                  $attr[] = 'checked';
              } elseif ($isRadio) {
                  $attr['checked'] = $value;
              } elseif ($isSelect) {
                  $attr['selected'] = $value;
              } else {
                  $attr['value'] = $value;
              }
          }
  
          return $attr;
      }
code_tokens: public function getData ( $ name , $ attr ) { if ( empty ( $ name ) ) { return $ attr ; } $ value = $ this -> Data -> getValue ( $ name ) ; if ( $ value !== null ) { $ isCheckbox = ( isset ( $ attr [ 'type' ] ) && $ attr [ 'type' ] == 'checkbox' ) ; $ isRadio = ( isset ( $ attr [ 'type' ] ) && $ attr [ 'type' ] == 'radio' ) ; $ isSelect = ( isset ( $ attr [ 'type' ] ) && $ attr [ 'type' ] == 'select' ) ; if ( $ isCheckbox ) { $ attr [ ] = 'checked' ; } elseif ( $ isRadio ) { $ attr [ 'checked' ] = $ value ; } elseif ( $ isSelect ) { $ attr [ 'selected' ] = $ value ; } else { $ attr [ 'value' ] = $ value ; } } return $ attr ; }
docstring: use the Data interface and find any post data
  
  @param   string          input name (dot notation for multi-dimensional array)
  @param   array   Array of attributes for the tag
  @return  array   Return the attribute array with added post data
docstring_tokens: use the Data interface and find any post data