Skip to content

Commit

Permalink
Merge e2e0eda into ee77db7
Browse files Browse the repository at this point in the history
  • Loading branch information
noodlesegg committed Oct 10, 2017
2 parents ee77db7 + e2e0eda commit 93e651c
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 33 deletions.
5 changes: 2 additions & 3 deletions src/PhpPresentation/HashTable.php
Expand Up @@ -79,13 +79,12 @@ public function add(ComparableInterface $pSource)
{
// Determine hashcode
$hashIndex = $pSource->getHashIndex();

$hashCode = $pSource->getHashCode();

if (is_null($hashIndex)) {
$hashCode = $pSource->getHashCode();
} elseif (isset($this->keyMap[$hashIndex])) {
$hashCode = $this->keyMap[$hashIndex];
} else {
$hashCode = $pSource->getHashCode();
}

// Add value
Expand Down
11 changes: 4 additions & 7 deletions src/PhpPresentation/PhpPresentation.php
Expand Up @@ -223,9 +223,8 @@ public function removeSlideByIndex($index = 0)
{
if ($index > count($this->slideCollection) - 1) {
throw new \Exception("Slide index is out of bounds.");
} else {
array_splice($this->slideCollection, $index, 1);
}
}
array_splice($this->slideCollection, $index, 1);

return $this;
}
Expand All @@ -241,9 +240,8 @@ public function getSlide($index = 0)
{
if ($index > count($this->slideCollection) - 1) {
throw new \Exception("Slide index is out of bounds.");
} else {
return $this->slideCollection[$index];
}
return $this->slideCollection[$index];
}

/**
Expand Down Expand Up @@ -306,9 +304,8 @@ public function setActiveSlideIndex($index = 0)
{
if ($index > count($this->slideCollection) - 1) {
throw new \Exception("Active slide index is out of bounds.");
} else {
$this->activeSlideIndex = $index;
}
$this->activeSlideIndex = $index;

return $this->getActiveSlide();
}
Expand Down
6 changes: 2 additions & 4 deletions src/PhpPresentation/Shape/RichText/Paragraph.php
Expand Up @@ -259,12 +259,10 @@ public function getRichTextElements()
*/
public function setRichTextElements($pElements = null)
{
if (is_array($pElements)) {
$this->richTextElements = $pElements;
} else {
if (!is_array($pElements)) {
throw new \Exception("Invalid \PhpOffice\PhpPresentation\Shape\RichText\TextElementInterface[] array passed.");
}

$this->richTextElements = $pElements;
return $this;
}

Expand Down
19 changes: 7 additions & 12 deletions src/PhpPresentation/Shape/Table/Cell.php
Expand Up @@ -164,21 +164,18 @@ public function getParagraph($index = 0)
public function createParagraph()
{
$this->richTextParagraphs[] = new Paragraph();
$totalRichTextParagraphs = count($this->richTextParagraphs);
$this->activeParagraph = $totalRichTextParagraphs - 1;

if (count($this->richTextParagraphs) > 1) {
if ($totalRichTextParagraphs > 1) {
$alignment = clone $this->getActiveParagraph()->getAlignment();
$font = clone $this->getActiveParagraph()->getFont();
$bulletStyle = clone $this->getActiveParagraph()->getBulletStyle();

$this->activeParagraph = count($this->richTextParagraphs) - 1;

$this->getActiveParagraph()->setAlignment($alignment);
$this->getActiveParagraph()->setFont($font);
$this->getActiveParagraph()->setBulletStyle($bulletStyle);
} else {
$this->activeParagraph = count($this->richTextParagraphs) - 1;
}

}
return $this->getActiveParagraph();
}

Expand Down Expand Up @@ -279,13 +276,11 @@ public function getParagraphs()
*/
public function setParagraphs($paragraphs = null)
{
if (is_array($paragraphs)) {
$this->richTextParagraphs = $paragraphs;
$this->activeParagraph = count($this->richTextParagraphs) - 1;
} else {
if (!is_array($paragraphs)) {
throw new \Exception("Invalid \PhpOffice\PhpPresentation\Shape\RichText\Paragraph[] array passed.");
}

$this->richTextParagraphs = $paragraphs;
$this->activeParagraph = count($this->richTextParagraphs) - 1;
return $this;
}

Expand Down
4 changes: 1 addition & 3 deletions src/PhpPresentation/Shape/Table/Row.php
Expand Up @@ -118,11 +118,9 @@ public function nextCell()
$this->activeCellIndex++;
if (isset($this->cells[$this->activeCellIndex])) {
$this->cells[$this->activeCellIndex]->setFill(clone $this->getFill());

return $this->cells[$this->activeCellIndex];
} else {
throw new \Exception("Cell count out of bounds.");
}
throw new \Exception("Cell count out of bounds.");
}

/**
Expand Down
4 changes: 0 additions & 4 deletions src/PhpPresentation/Writer/ODPresentation/Content.php
Expand Up @@ -484,8 +484,6 @@ public function writeShapeTxt(XMLWriter $objWriter, RichText $shape)
$objWriter->startElement('text:line-break');
$objWriter->endElement();
$objWriter->endElement();
} else {
//echo '<pre>'.print_r($richtext, true).'</pre>';
}
}
$objWriter->endElement();
Expand Down Expand Up @@ -549,8 +547,6 @@ public function writeShapeTxt(XMLWriter $objWriter, RichText $shape)
$objWriter->startElement('text:line-break');
$objWriter->endElement();
$objWriter->endElement();
} else {
//echo '<pre>'.print_r($richtext, true).'</pre>';
}
}
$objWriter->endElement();
Expand Down

0 comments on commit 93e651c

Please sign in to comment.