Skip to content

Commit

Permalink
Remove unnecessary ternary expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
carusogabriel committed Nov 19, 2018
1 parent 49eb9d1 commit 3cf0770
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/PhpWord/Metadata/DocInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ public static function convertProperty($propertyValue, $propertyType)
case 'date': // Date
return strtotime($propertyValue);
case 'bool': // Boolean
return ($propertyValue == 'true') ? true : false;
return $propertyValue == 'true';
}

return $propertyValue;
Expand Down
2 changes: 1 addition & 1 deletion src/PhpWord/Reader/MsDoc.php
Original file line number Diff line number Diff line change
Expand Up @@ -1619,7 +1619,7 @@ private function readPrl($data, $pos, $cbNum)
break;
// sprmCFData
case 0x06:
$sprmCFData = dechex($operand) == 0x00 ? false : true;
$sprmCFData = dechex($operand) != 0x00;
break;
// sprmCFItalic
case 0x36:
Expand Down
2 changes: 1 addition & 1 deletion src/PhpWord/Reader/Word2007/AbstractPart.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ protected function readTable(XMLReader $xmlReader, \DOMElement $domNode, $parent
} elseif ('w:tr' == $tblNode->nodeName) { // Row
$rowHeight = $xmlReader->getAttribute('w:val', $tblNode, 'w:trPr/w:trHeight');
$rowHRule = $xmlReader->getAttribute('w:hRule', $tblNode, 'w:trPr/w:trHeight');
$rowHRule = $rowHRule == 'exact' ? true : false;
$rowHRule = $rowHRule == 'exact';
$rowStyle = array(
'tblHeader' => $xmlReader->elementExists('w:trPr/w:tblHeader', $tblNode),
'cantSplit' => $xmlReader->elementExists('w:trPr/w:cantSplit', $tblNode),
Expand Down
6 changes: 3 additions & 3 deletions src/PhpWord/Shared/ZipArchive.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public function pclzipAddFile($filename, $localname = null)
unlink($this->tempDir . DIRECTORY_SEPARATOR . $localnameParts['basename']);
}

return ($res == 0) ? false : true;
return $res != 0;
}

/**
Expand Down Expand Up @@ -283,7 +283,7 @@ public function pclzipAddFromString($localname, $contents)
// Remove temp file
@unlink($this->tempDir . DIRECTORY_SEPARATOR . $filenameParts['basename']);

return ($res == 0) ? false : true;
return $res != 0;
}

/**
Expand All @@ -303,7 +303,7 @@ public function pclzipExtractTo($destination, $entries = null)
if (is_null($entries)) {
$result = $zip->extract(PCLZIP_OPT_PATH, $destination);

return ($result > 0) ? true : false;
return $result > 0;
}

// Extract by entries
Expand Down
2 changes: 1 addition & 1 deletion tests/PhpWord/_includes/XmlDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public function elementExists($path, $file = 'word/document.xml')
{
$nodeList = $this->getNodeList($path, $file);

return !($nodeList->length == 0);
return $nodeList->length != 0;
}

/**
Expand Down

0 comments on commit 3cf0770

Please sign in to comment.