Skip to content

Commit 3ab8437

Browse files
committed
#605 : Fixed PHPMD errors
1 parent 7ee6e27 commit 3ab8437

File tree

4 files changed

+25
-19
lines changed

4 files changed

+25
-19
lines changed

phpmd.xml.dist

+6
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,18 @@
66
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
77
<rule ref="rulesets/naming.xml">
88
<exclude name="LongVariable" />
9+
<exclude name="ShortClassName" />
910
</rule>
1011
<rule ref="rulesets/naming.xml/LongVariable">
1112
<properties>
1213
<property name="maximum" value="32" />
1314
</properties>
1415
</rule>
16+
<rule ref="rulesets/naming.xml/ShortClassName">
17+
<properties>
18+
<property name="minimum" value="2" />
19+
</properties>
20+
</rule>
1521
<rule ref="rulesets/design.xml/ExitExpression" />
1622
<rule ref="rulesets/design.xml/EvalExpression" />
1723
<rule ref="rulesets/design.xml/GotoStatement" />

src/PhpPresentation/Reader/PowerPoint97.php

+13-13
Original file line numberDiff line numberDiff line change
@@ -568,13 +568,13 @@ private function loadCurrentUserStream()
568568
$pos += 2;
569569

570570
// ansiUserName
571-
$ansiUserName = '';
571+
// $ansiUserName = '';
572572
do {
573573
$char = self::getInt1d($this->streamCurrentUser, $pos);
574574
if (($char >= 0x00 && $char <= 0x1F) || ($char >= 0x7F && $char <= 0x9F)) {
575575
$char = false;
576576
} else {
577-
$ansiUserName .= chr($char);
577+
// $ansiUserName .= chr($char);
578578
$pos += 1;
579579
}
580580
} while ($char !== false);
@@ -587,13 +587,13 @@ private function loadCurrentUserStream()
587587
}
588588

589589
// unicodeUserName
590-
$unicodeUserName = '';
590+
// $unicodeUserName = '';
591591
for ($inc = 0; $inc < $lenUserName; $inc++) {
592592
$char = self::getInt2d($this->streamCurrentUser, $pos);
593593
if (($char >= 0x00 && $char <= 0x1F) || ($char >= 0x7F && $char <= 0x9F)) {
594594
break;
595595
}
596-
$unicodeUserName .= chr($char);
596+
// $unicodeUserName .= chr($char);
597597
$pos += 2;
598598
}
599599
}
@@ -611,11 +611,11 @@ private function loadPowerpointDocumentStream()
611611
foreach ($this->rgPersistDirEntry as $offsetDir) {
612612
$pos = $offsetDir;
613613

614-
$rh = $this->loadRecordHeader($this->streamPowerpointDocument, $pos);
614+
$rHeader = $this->loadRecordHeader($this->streamPowerpointDocument, $pos);
615615
$pos += 8;
616-
$this->inMainType = $rh['recType'];
616+
$this->inMainType = $rHeader['recType'];
617617
$this->currentNote = null;
618-
switch ($rh['recType']) {
618+
switch ($rHeader['recType']) {
619619
case self::RT_DOCUMENT:
620620
$this->readRecordDocumentContainer($this->streamPowerpointDocument, $pos);
621621
break;
@@ -3168,19 +3168,19 @@ private function readStructureTextPFRun($stream, $pos, $strLenRT)
31683168
$arrayReturn['length'] += 2;
31693169
}
31703170
if ($masksData['bulletColor'] == 1) {
3171-
$red = self::getInt1d($stream, $pos + $arrayReturn['length']);
3171+
// $red = self::getInt1d($stream, $pos + $arrayReturn['length']);
31723172
$arrayReturn['length'] += 1;
3173-
$green = self::getInt1d($stream, $pos + $arrayReturn['length']);
3173+
// $green = self::getInt1d($stream, $pos + $arrayReturn['length']);
31743174
$arrayReturn['length'] += 1;
3175-
$blue = self::getInt1d($stream, $pos + $arrayReturn['length']);
3175+
// $blue = self::getInt1d($stream, $pos + $arrayReturn['length']);
31763176
$arrayReturn['length'] += 1;
31773177
$index = self::getInt1d($stream, $pos + $arrayReturn['length']);
31783178
$arrayReturn['length'] += 1;
31793179

31803180
if ($index == 0xFE) {
3181-
$strColor = str_pad(dechex($red), 2, STR_PAD_LEFT, '0');
3182-
$strColor .= str_pad(dechex($green), 2, STR_PAD_LEFT, '0');
3183-
$strColor .= str_pad(dechex($blue), 2, STR_PAD_LEFT, '0');
3181+
// $strColor = str_pad(dechex($red), 2, STR_PAD_LEFT, '0');
3182+
// $strColor .= str_pad(dechex($green), 2, STR_PAD_LEFT, '0');
3183+
// $strColor .= str_pad(dechex($blue), 2, STR_PAD_LEFT, '0');
31843184
}
31853185
}
31863186
if ($masksData['align'] == 1) {

src/PhpPresentation/Writer/ODPresentation.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,12 @@ public function save($pFilename)
107107
}
108108

109109
$class = __NAMESPACE__ . '\\ODPresentation\\' . $oFile->getBasename('.php');
110-
$o = new \ReflectionClass($class);
110+
$class = new \ReflectionClass($class);
111111

112-
if ($o->isAbstract() || !$o->isSubclassOf('PhpOffice\PhpPresentation\Writer\ODPresentation\AbstractDecoratorWriter')) {
112+
if ($class->isAbstract() || !$class->isSubclassOf('PhpOffice\PhpPresentation\Writer\ODPresentation\AbstractDecoratorWriter')) {
113113
continue;
114114
}
115-
$arrayFiles[$oFile->getBasename('.php')] = $o;
115+
$arrayFiles[$oFile->getBasename('.php')] = $class;
116116
}
117117

118118
ksort($arrayFiles);

src/PhpPresentation/Writer/PowerPoint2007.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,12 @@ public function save($pFilename)
109109
}
110110

111111
$class = __NAMESPACE__ . '\\PowerPoint2007\\' . $oFile->getBasename('.php');
112-
$o = new \ReflectionClass($class);
112+
$class = new \ReflectionClass($class);
113113

114-
if ($o->isAbstract() || !$o->isSubclassOf('PhpOffice\PhpPresentation\Writer\PowerPoint2007\AbstractDecoratorWriter')) {
114+
if ($class->isAbstract() || !$class->isSubclassOf('PhpOffice\PhpPresentation\Writer\PowerPoint2007\AbstractDecoratorWriter')) {
115115
continue;
116116
}
117-
$arrayFiles[$oFile->getBasename('.php')] = $o;
117+
$arrayFiles[$oFile->getBasename('.php')] = $class;
118118
}
119119

120120
ksort($arrayFiles);

0 commit comments

Comments
 (0)