Skip to content

Commit bb41d13

Browse files
authored
Merge pull request #18 from carusogabriel/clean-elses
Clean elses
2 parents b5198e9 + 67bc52a commit bb41d13

File tree

4 files changed

+33
-33
lines changed

4 files changed

+33
-33
lines changed

src/Common/File.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ public static function fileExists($pFilename)
4343
$zip->close();
4444

4545
return $returnValue;
46-
} else {
47-
return false;
4846
}
49-
} else {
50-
// Regular file_exists
51-
return file_exists($pFilename);
47+
48+
return false;
5249
}
50+
51+
// Regular file_exists
52+
return file_exists($pFilename);
5353
}
5454

5555
/**

src/Common/Microsoft/OLERead.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -186,26 +186,26 @@ public function getStream($stream)
186186
}
187187

188188
return $streamData;
189-
} else {
190-
$numBlocks = $this->props[$stream]['size'] / self::BIG_BLOCK_SIZE;
191-
if ($this->props[$stream]['size'] % self::BIG_BLOCK_SIZE != 0) {
192-
++$numBlocks;
193-
}
189+
}
194190

195-
if ($numBlocks == 0) {
196-
return '';
197-
}
191+
$numBlocks = $this->props[$stream]['size'] / self::BIG_BLOCK_SIZE;
192+
if ($this->props[$stream]['size'] % self::BIG_BLOCK_SIZE != 0) {
193+
++$numBlocks;
194+
}
198195

199-
$block = $this->props[$stream]['startBlock'];
196+
if ($numBlocks == 0) {
197+
return '';
198+
}
200199

201-
while ($block != -2) {
202-
$pos = ($block + 1) * self::BIG_BLOCK_SIZE;
203-
$streamData .= substr($this->data, $pos, self::BIG_BLOCK_SIZE);
204-
$block = self::getInt4d($this->bigBlockChain, $block*4);
205-
}
200+
$block = $this->props[$stream]['startBlock'];
206201

207-
return $streamData;
202+
while ($block != -2) {
203+
$pos = ($block + 1) * self::BIG_BLOCK_SIZE;
204+
$streamData .= substr($this->data, $pos, self::BIG_BLOCK_SIZE);
205+
$block = self::getInt4d($this->bigBlockChain, $block*4);
208206
}
207+
208+
return $streamData;
209209
}
210210

211211
/**
@@ -259,10 +259,10 @@ private function readPropertySets()
259259
'type' => $type,
260260
'startBlock' => $startBlock,
261261
'size' => $size);
262-
262+
263263
// tmp helper to simplify checks
264264
$upName = strtoupper($name);
265-
265+
266266
switch ($upName) {
267267
case 'ROOT ENTRY':
268268
case 'R':

src/Common/XMLReader.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ public function getDomFromZip($zipFile, $xmlFile)
5858

5959
if ($content === false) {
6060
return false;
61-
} else {
62-
return $this->getDomFromString($content);
6361
}
62+
63+
return $this->getDomFromString($content);
6464
}
6565

6666
/**
@@ -95,9 +95,9 @@ public function getElements($path, \DOMElement $contextNode = null)
9595

9696
if (is_null($contextNode)) {
9797
return $this->xpath->query($path);
98-
} else {
99-
return $this->xpath->query($path, $contextNode);
10098
}
99+
100+
return $this->xpath->query($path, $contextNode);
101101
}
102102

103103
/**
@@ -112,9 +112,9 @@ public function getElement($path, \DOMElement $contextNode = null)
112112
$elements = $this->getElements($path, $contextNode);
113113
if ($elements->length > 0) {
114114
return $elements->item(0);
115-
} else {
116-
return null;
117115
}
116+
117+
return null;
118118
}
119119

120120
/**
@@ -156,9 +156,9 @@ public function getValue($path, \DOMElement $contextNode = null)
156156
$elements = $this->getElements($path, $contextNode);
157157
if ($elements->length > 0) {
158158
return $elements->item(0)->nodeValue;
159-
} else {
160-
return null;
161159
}
160+
161+
return null;
162162
}
163163

164164
/**

src/Common/XMLWriter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,10 @@ public function getData()
100100
{
101101
if ($this->tempFileName == '') {
102102
return $this->outputMemory(true);
103-
} else {
104-
$this->flush();
105-
return file_get_contents($this->tempFileName);
106103
}
104+
105+
$this->flush();
106+
return file_get_contents($this->tempFileName);
107107
}
108108

109109

0 commit comments

Comments
 (0)