Merge branch 'develop' into develop_tmp

This commit is contained in:
DE TROOSTEMBERGH Antoine 2021-04-14 22:19:05 +02:00
commit 8efd9ff9da
2 changed files with 43 additions and 44 deletions

View File

@ -19,9 +19,9 @@
<rule ref="rulesets/design.xml/GotoStatement" />
<rule ref="rulesets/design.xml/DepthOfInheritance" />
<rule ref="rulesets/design.xml/CouplingBetweenObjects">
<!-- AbstractContainer needs more coupling (default: 13) -->
<!-- AbstractContainer and Html need more coupling (default: 13) -->
<properties>
<property name="maximum" value="20" />
<property name="maximum" value="25" />
</properties>
</rule>
<rule ref="rulesets/design.xml/NumberOfChildren">
@ -30,6 +30,5 @@
<property name="minimum" value="30" />
</properties>
</rule>
<rule ref="rulesets/unusedcode.xml" />
<rule ref="rulesets/controversial.xml" />
</ruleset>

View File

@ -14,6 +14,7 @@
* @copyright 2010-2018 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Shared;
use PhpOffice\PhpWord\Exception\Exception;
@ -54,8 +55,6 @@ class OLERead
const START_BLOCK_POS = 0x74;
const SIZE_POS = 0x78;
public $wrkdocument = null;
public $wrk1Table = null;
public $wrkData = null;
@ -63,7 +62,6 @@ class OLERead
public $summaryInformation = null;
public $docSummaryInfos = null;
/**
* Read the file
*
@ -75,7 +73,7 @@ class OLERead
{
// Check if file exists and is readable
if (!is_readable($sFileName)) {
throw new Exception("Could not open " . $sFileName . " for reading! File does not exist, or it is not readable.");
throw new Exception('Could not open ' . $sFileName . ' for reading! File does not exist, or it is not readable.');
}
// Get the file identifier
@ -170,6 +168,7 @@ class OLERead
/**
* Extract binary stream data
*
* @param mixed $stream
* @return string
*/
public function getStream($stream)
@ -231,6 +230,7 @@ class OLERead
$data .= substr($this->data, $pos, self::BIG_BLOCK_SIZE);
$block = self::getInt4d($this->bigBlockChain, $block * 4);
}
return $data;
}
@ -259,14 +259,13 @@ class OLERead
$size = self::getInt4d($data, self::SIZE_POS);
$name = str_replace("\x00", "", substr($data, 0, $nameSize));
$name = str_replace("\x00", '', substr($data, 0, $nameSize));
$this->props[] = array(
'name' => $name,
'type' => $type,
'startBlock' => $startBlock,
'size' => $size);
'size' => $size, );
// tmp helper to simplify checks
$upName = strtoupper($name);
@ -318,6 +317,7 @@ class OLERead
} else {
$ord24 = ($or24 & 127) << 24;
}
return ord($data[$pos]) | (ord($data[$pos + 1]) << 8) | (ord($data[$pos + 2]) << 16) | $ord24;
}
}