diff --git a/src/PhpSpreadsheet/Calculation/DateTime.php b/src/PhpSpreadsheet/Calculation/DateTime.php index 844ebd40..3c39db2a 100644 --- a/src/PhpSpreadsheet/Calculation/DateTime.php +++ b/src/PhpSpreadsheet/Calculation/DateTime.php @@ -1090,7 +1090,7 @@ class DateTime return $startDate; } - $decrementing = ($endDays < 0) ? true : false; + $decrementing = $endDays < 0; // Adjust the start date if it falls over a weekend diff --git a/src/PhpSpreadsheet/Chart/Renderer/JpGraph.php b/src/PhpSpreadsheet/Chart/Renderer/JpGraph.php index 28d1b2c5..b6034b2c 100644 --- a/src/PhpSpreadsheet/Chart/Renderer/JpGraph.php +++ b/src/PhpSpreadsheet/Chart/Renderer/JpGraph.php @@ -229,7 +229,7 @@ class JpGraph implements IRenderer // Rotate for bar rather than column chart $rotation = $this->chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotDirection(); - $reverse = ($rotation == 'bar') ? true : false; + $reverse = $rotation == 'bar'; $xAxisLabel = $this->chart->getXAxisLabel(); if ($xAxisLabel !== null) { diff --git a/src/PhpSpreadsheet/NamedRange.php b/src/PhpSpreadsheet/NamedRange.php index 764884a0..1f94d5a4 100644 --- a/src/PhpSpreadsheet/NamedRange.php +++ b/src/PhpSpreadsheet/NamedRange.php @@ -205,7 +205,7 @@ class NamedRange public function setScope(Worksheet $value = null) { $this->scope = $value; - $this->localOnly = ($value == null) ? false : true; + $this->localOnly = $value != null; return $this; } diff --git a/src/PhpSpreadsheet/Reader/Gnumeric.php b/src/PhpSpreadsheet/Reader/Gnumeric.php index dd92f153..228fb717 100644 --- a/src/PhpSpreadsheet/Reader/Gnumeric.php +++ b/src/PhpSpreadsheet/Reader/Gnumeric.php @@ -432,7 +432,7 @@ class Gnumeric extends BaseReader break; case '20': // Boolean $type = DataType::TYPE_BOOL; - $cell = ($cell == 'TRUE') ? true : false; + $cell = $cell == 'TRUE'; break; case '30': // Integer @@ -536,8 +536,8 @@ class Gnumeric extends BaseReader break; } - $styleArray['alignment']['wrapText'] = ($styleAttributes['WrapText'] == '1') ? true : false; - $styleArray['alignment']['shrinkToFit'] = ($styleAttributes['ShrinkToFit'] == '1') ? true : false; + $styleArray['alignment']['wrapText'] = $styleAttributes['WrapText'] == '1'; + $styleArray['alignment']['shrinkToFit'] = $styleAttributes['ShrinkToFit'] == '1'; $styleArray['alignment']['indent'] = ((int) ($styleAttributes['Indent']) > 0) ? $styleAttributes['indent'] : 0; $RGB = self::parseGnumericColour($styleAttributes['Fore']); @@ -635,9 +635,9 @@ class Gnumeric extends BaseReader $fontAttributes = $styleRegion->Style->Font->attributes(); $styleArray['font']['name'] = (string) $styleRegion->Style->Font; $styleArray['font']['size'] = (int) ($fontAttributes['Unit']); - $styleArray['font']['bold'] = ($fontAttributes['Bold'] == '1') ? true : false; - $styleArray['font']['italic'] = ($fontAttributes['Italic'] == '1') ? true : false; - $styleArray['font']['strikethrough'] = ($fontAttributes['StrikeThrough'] == '1') ? true : false; + $styleArray['font']['bold'] = $fontAttributes['Bold'] == '1'; + $styleArray['font']['italic'] = $fontAttributes['Italic'] == '1'; + $styleArray['font']['strikethrough'] = $fontAttributes['StrikeThrough'] == '1'; switch ($fontAttributes['Underline']) { case '1': $styleArray['font']['underline'] = Font::UNDERLINE_SINGLE; @@ -714,7 +714,7 @@ class Gnumeric extends BaseReader $columnAttributes = $columnOverride->attributes(); $column = $columnAttributes['No']; $columnWidth = $columnAttributes['Unit'] / 5.4; - $hidden = ((isset($columnAttributes['Hidden'])) && ($columnAttributes['Hidden'] == '1')) ? true : false; + $hidden = (isset($columnAttributes['Hidden'])) && ($columnAttributes['Hidden'] == '1'); $columnCount = (isset($columnAttributes['Count'])) ? $columnAttributes['Count'] : 1; while ($c < $column) { $spreadsheet->getActiveSheet()->getColumnDimension(Coordinate::stringFromColumnIndex($c + 1))->setWidth($defaultWidth); @@ -744,7 +744,7 @@ class Gnumeric extends BaseReader $rowAttributes = $rowOverride->attributes(); $row = $rowAttributes['No']; $rowHeight = $rowAttributes['Unit']; - $hidden = ((isset($rowAttributes['Hidden'])) && ($rowAttributes['Hidden'] == '1')) ? true : false; + $hidden = (isset($rowAttributes['Hidden'])) && ($rowAttributes['Hidden'] == '1'); $rowCount = (isset($rowAttributes['Count'])) ? $rowAttributes['Count'] : 1; while ($r < $row) { ++$r; diff --git a/src/PhpSpreadsheet/Worksheet/Worksheet.php b/src/PhpSpreadsheet/Worksheet/Worksheet.php index f4ee4b60..e9d93af2 100644 --- a/src/PhpSpreadsheet/Worksheet/Worksheet.php +++ b/src/PhpSpreadsheet/Worksheet/Worksheet.php @@ -3059,6 +3059,6 @@ class Worksheet implements IComparable */ public function hasCodeName() { - return !($this->codeName === null); + return $this->codeName !== null; } }