create a common private method that does the processing and then public methods that use them
public function select($fields){
return $this->builddata($fields, 'fields');
}
public function from($tables){
return $this->builddata($tables, 'tables');
}
private function builddata($data, $storage) {
if(is_array($data)){
$data = implode(',', $data);
}
$this->$storage = $data; // variable variable
return $this;
}