From 3cf07703765656dc78531504aadfe37d47485855 Mon Sep 17 00:00:00 2001 From: Gabriel Caruso Date: Mon, 19 Nov 2018 01:32:28 -0200 Subject: [PATCH] Remove unnecessary ternary expressions --- src/PhpWord/Metadata/DocInfo.php | 2 +- src/PhpWord/Reader/MsDoc.php | 2 +- src/PhpWord/Reader/Word2007/AbstractPart.php | 2 +- src/PhpWord/Shared/ZipArchive.php | 6 +++--- tests/PhpWord/_includes/XmlDocument.php | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/PhpWord/Metadata/DocInfo.php b/src/PhpWord/Metadata/DocInfo.php index 27ef89ae..8a2f7d31 100644 --- a/src/PhpWord/Metadata/DocInfo.php +++ b/src/PhpWord/Metadata/DocInfo.php @@ -507,7 +507,7 @@ class DocInfo case 'date': // Date return strtotime($propertyValue); case 'bool': // Boolean - return ($propertyValue == 'true') ? true : false; + return $propertyValue == 'true'; } return $propertyValue; diff --git a/src/PhpWord/Reader/MsDoc.php b/src/PhpWord/Reader/MsDoc.php index d4945229..c1f65809 100644 --- a/src/PhpWord/Reader/MsDoc.php +++ b/src/PhpWord/Reader/MsDoc.php @@ -1619,7 +1619,7 @@ class MsDoc extends AbstractReader implements ReaderInterface break; // sprmCFData case 0x06: - $sprmCFData = dechex($operand) == 0x00 ? false : true; + $sprmCFData = dechex($operand) != 0x00; break; // sprmCFItalic case 0x36: diff --git a/src/PhpWord/Reader/Word2007/AbstractPart.php b/src/PhpWord/Reader/Word2007/AbstractPart.php index 5e5eb1d6..966d3882 100644 --- a/src/PhpWord/Reader/Word2007/AbstractPart.php +++ b/src/PhpWord/Reader/Word2007/AbstractPart.php @@ -336,7 +336,7 @@ abstract class AbstractPart } 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), diff --git a/src/PhpWord/Shared/ZipArchive.php b/src/PhpWord/Shared/ZipArchive.php index 2783e17e..0d26f9de 100644 --- a/src/PhpWord/Shared/ZipArchive.php +++ b/src/PhpWord/Shared/ZipArchive.php @@ -252,7 +252,7 @@ class ZipArchive unlink($this->tempDir . DIRECTORY_SEPARATOR . $localnameParts['basename']); } - return ($res == 0) ? false : true; + return $res != 0; } /** @@ -283,7 +283,7 @@ class ZipArchive // Remove temp file @unlink($this->tempDir . DIRECTORY_SEPARATOR . $filenameParts['basename']); - return ($res == 0) ? false : true; + return $res != 0; } /** @@ -303,7 +303,7 @@ class ZipArchive if (is_null($entries)) { $result = $zip->extract(PCLZIP_OPT_PATH, $destination); - return ($result > 0) ? true : false; + return $result > 0; } // Extract by entries diff --git a/tests/PhpWord/_includes/XmlDocument.php b/tests/PhpWord/_includes/XmlDocument.php index 7062ebbf..f51eaad8 100644 --- a/tests/PhpWord/_includes/XmlDocument.php +++ b/tests/PhpWord/_includes/XmlDocument.php @@ -163,7 +163,7 @@ class XmlDocument { $nodeList = $this->getNodeList($path, $file); - return !($nodeList->length == 0); + return $nodeList->length != 0; } /**