Reimplemented #498.

This commit is contained in:
Roman Syroeshko 2015-04-14 22:47:41 +03:00
parent a5c3645717
commit b7387be3fd
2 changed files with 11 additions and 10 deletions

View File

@ -9,6 +9,7 @@ This is the changelog between releases of PHPWord. Releases are listed in revers
Place announcement text here. Place announcement text here.
### Changes ### Changes
- Changed visibility of all private properties and methods of ``TemplateProcessor`` to ``protected``. - RomanSyroeshko #498
- Improved performance of ``TemplateProcessor::setValue()``. - @RomanSyroeshko #513 - Improved performance of ``TemplateProcessor::setValue()``. - @RomanSyroeshko #513
- Renamed ``align`` option of ``Paragraph`` style into ``alignment``. Note: accessor and mutator methods are renamed too. - @RomanSyroeshko - Renamed ``align`` option of ``Paragraph`` style into ``alignment``. Note: accessor and mutator methods are renamed too. - @RomanSyroeshko

View File

@ -30,33 +30,33 @@ class TemplateProcessor
* *
* @var mixed * @var mixed
*/ */
private $zipClass; protected $zipClass;
/** /**
* @var string Temporary document filename (with path). * @var string Temporary document filename (with path).
*/ */
private $temporaryDocumentFilename; protected $temporaryDocumentFilename;
/** /**
* Content of main document part (in XML format) of the temporary document. * Content of main document part (in XML format) of the temporary document.
* *
* @var string * @var string
*/ */
private $temporaryDocumentMainPart; protected $temporaryDocumentMainPart;
/** /**
* Content of headers (in XML format) of the temporary document. * Content of headers (in XML format) of the temporary document.
* *
* @var string[] * @var string[]
*/ */
private $temporaryDocumentHeaders = array(); protected $temporaryDocumentHeaders = array();
/** /**
* Content of footers (in XML format) of the temporary document. * Content of footers (in XML format) of the temporary document.
* *
* @var string[] * @var string[]
*/ */
private $temporaryDocumentFooters = array(); protected $temporaryDocumentFooters = array();
/** /**
* @since 0.12.0 Throws CreateTemporaryFileException and CopyFileException instead of Exception. * @since 0.12.0 Throws CreateTemporaryFileException and CopyFileException instead of Exception.
@ -410,7 +410,7 @@ class TemplateProcessor
* @param integer $index * @param integer $index
* @return string * @return string
*/ */
private function getFooterName($index) protected function getFooterName($index)
{ {
return sprintf('word/footer%d.xml', $index); return sprintf('word/footer%d.xml', $index);
} }
@ -421,7 +421,7 @@ class TemplateProcessor
* @param integer $index * @param integer $index
* @return string * @return string
*/ */
private function getHeaderName($index) protected function getHeaderName($index)
{ {
return sprintf('word/header%d.xml', $index); return sprintf('word/header%d.xml', $index);
} }
@ -433,7 +433,7 @@ class TemplateProcessor
* @return integer * @return integer
* @throws \PhpOffice\PhpWord\Exception\Exception * @throws \PhpOffice\PhpWord\Exception\Exception
*/ */
private function findRowStart($offset) protected function findRowStart($offset)
{ {
$rowStart = strrpos($this->temporaryDocumentMainPart, '<w:tr ', ((strlen($this->temporaryDocumentMainPart) - $offset) * -1)); $rowStart = strrpos($this->temporaryDocumentMainPart, '<w:tr ', ((strlen($this->temporaryDocumentMainPart) - $offset) * -1));
@ -453,7 +453,7 @@ class TemplateProcessor
* @param integer $offset * @param integer $offset
* @return integer * @return integer
*/ */
private function findRowEnd($offset) protected function findRowEnd($offset)
{ {
return strpos($this->temporaryDocumentMainPart, '</w:tr>', $offset) + 7; return strpos($this->temporaryDocumentMainPart, '</w:tr>', $offset) + 7;
} }
@ -465,7 +465,7 @@ class TemplateProcessor
* @param integer $endPosition * @param integer $endPosition
* @return string * @return string
*/ */
private function getSlice($startPosition, $endPosition = 0) protected function getSlice($startPosition, $endPosition = 0)
{ {
if (!$endPosition) { if (!$endPosition) {
$endPosition = strlen($this->temporaryDocumentMainPart); $endPosition = strlen($this->temporaryDocumentMainPart);