Код: Выделить всё
public function SetData($TypeData, $DataContent){
$FunSuc = 1;
if (strtolower(trim($TypeData) == "file name")){
//File name will be filled
$this->FileName = $DataContent;
$FunSuc = 0;
}
if (strtolower(trim($TypeData) == "file type")){
$this->FileType = $DataContent;
//File Type will be filled
$FunSuc = 0;
}
if (strtolower(trim($TypeData) == "file path")){
//File Path will be set
$this->FilePath = $DataContent;
$FunSuc = 0;
}
if (strtolower(trim($TypeData) == "file content")){
//File content will be filled
$this->FileContent = $DataContent;
$FunSuc = 0;
}
if ($FunSuc == 0){
//will check if some of the type are found
if($this->Verbouse > 0){
echo "Data Storing Success";
}
}else{
if($this->Verbouse > 0){
echo "Data Storing Failed, unrecognized type data";
}
}
return $FunSuc;
}
Код: Выделить всё
public function SetData($TypeData, $DataContent) {
$FunSuc = 1;
$TypeData = strtolower(trim($TypeData));
if ($TypeData == "file name") $this->FileName = $DataContent;
elseif ($TypeData == "file type") $this->FileType = $DataContent;
elseif ($TypeData == "file path") $this->FilePath = $DataContent;
elseif ($TypeData == "file content") $this->FileContent = $DataContent;
$FunSuc = ($TypeData == "file name" || $TypeData == "file type" || $TypeData == "file path" || $TypeData == "file content") ? 0 : $FunSuc;
if ($this->Verbouse > 0) echo $FunSuc == 0 ? "Data Storing Success" : "Data Storing Failed, unrecognized type data";
return $FunSuc;
}
Подробнее здесь: https://stackoverflow.com/questions/795 ... 20-allowed