Skip to content

Clean elses #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/Common/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ public static function fileExists($pFilename)
$zip->close();

return $returnValue;
} else {
return false;
}
} else {
// Regular file_exists
return file_exists($pFilename);

return false;
}

// Regular file_exists
return file_exists($pFilename);
}

/**
Expand Down
34 changes: 17 additions & 17 deletions src/Common/Microsoft/OLERead.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,26 +186,26 @@ public function getStream($stream)
}

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

if ($numBlocks == 0) {
return '';
}
$numBlocks = $this->props[$stream]['size'] / self::BIG_BLOCK_SIZE;
if ($this->props[$stream]['size'] % self::BIG_BLOCK_SIZE != 0) {
++$numBlocks;
}

$block = $this->props[$stream]['startBlock'];
if ($numBlocks == 0) {
return '';
}

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

return $streamData;
while ($block != -2) {
$pos = ($block + 1) * self::BIG_BLOCK_SIZE;
$streamData .= substr($this->data, $pos, self::BIG_BLOCK_SIZE);
$block = self::getInt4d($this->bigBlockChain, $block*4);
}

return $streamData;
}

/**
Expand Down Expand Up @@ -259,10 +259,10 @@ private function readPropertySets()
'type' => $type,
'startBlock' => $startBlock,
'size' => $size);

// tmp helper to simplify checks
$upName = strtoupper($name);

switch ($upName) {
case 'ROOT ENTRY':
case 'R':
Expand Down
16 changes: 8 additions & 8 deletions src/Common/XMLReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ public function getDomFromZip($zipFile, $xmlFile)

if ($content === false) {
return false;
} else {
return $this->getDomFromString($content);
}

return $this->getDomFromString($content);
}

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

if (is_null($contextNode)) {
return $this->xpath->query($path);
} else {
return $this->xpath->query($path, $contextNode);
}

return $this->xpath->query($path, $contextNode);
}

/**
Expand All @@ -112,9 +112,9 @@ public function getElement($path, \DOMElement $contextNode = null)
$elements = $this->getElements($path, $contextNode);
if ($elements->length > 0) {
return $elements->item(0);
} else {
return null;
}

return null;
}

/**
Expand Down Expand Up @@ -156,9 +156,9 @@ public function getValue($path, \DOMElement $contextNode = null)
$elements = $this->getElements($path, $contextNode);
if ($elements->length > 0) {
return $elements->item(0)->nodeValue;
} else {
return null;
}

return null;
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/Common/XMLWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ public function getData()
{
if ($this->tempFileName == '') {
return $this->outputMemory(true);
} else {
$this->flush();
return file_get_contents($this->tempFileName);
}

$this->flush();
return file_get_contents($this->tempFileName);
}


Expand Down