[Changed] Refactored Template a little.

This commit is contained in:
Roman Syroeshko 2014-07-02 17:49:53 +04:00
parent c446028acc
commit e1164f8989

View File

@ -36,28 +36,28 @@ class Template
private $zipClass; private $zipClass;
/** /**
* Temporary file name * Temporary file name.
* *
* @var string * @var string
*/ */
private $tempFileName; private $tempFileName;
/** /**
* Document XML * Document XML.
* *
* @var string * @var string
*/ */
private $documentXML; private $documentXML;
/** /**
* Document header XML * Document header XML.
* *
* @var string[] * @var string[]
*/ */
private $headerXMLs = array(); private $headerXMLs = array();
/** /**
* Create a new Template Object * Create a new Template Object.
* *
* @since 0.12.0 Throws CreateTemporaryFileException and CopyFileException instead of Exception. * @since 0.12.0 Throws CreateTemporaryFileException and CopyFileException instead of Exception.
* *
@ -97,18 +97,19 @@ class Template
} }
/** /**
* Document footer XML * Document footer XML.
* *
* @var string[] * @var string[]
*/ */
private $footerXMLs = array(); private $footerXMLs = array();
/** /**
* Applies XSL style sheet to template's parts * Applies XSL style sheet to template's parts.
* *
* @param \DOMDocument $xslDOMDocument * @param \DOMDocument $xslDOMDocument
* @param array $xslOptions * @param array $xslOptions
* @param string $xslOptionsURI * @param string $xslOptionsURI
* @return void
* @throws \PhpOffice\PhpWord\Exception\Exception * @throws \PhpOffice\PhpWord\Exception\Exception
*/ */
public function applyXslStyleSheet(&$xslDOMDocument, $xslOptions = array(), $xslOptionsURI = '') public function applyXslStyleSheet(&$xslDOMDocument, $xslOptions = array(), $xslOptionsURI = '')
@ -135,11 +136,12 @@ class Template
} }
/** /**
* Set a Template value * Set a Template value.
* *
* @param mixed $search * @param mixed $search
* @param mixed $replace * @param mixed $replace
* @param integer $limit * @param integer $limit
* @return void
*/ */
public function setValue($search, $replace, $limit = -1) public function setValue($search, $replace, $limit = -1)
{ {
@ -155,7 +157,8 @@ class Template
} }
/** /**
* Returns array of all variables in template * Returns array of all variables in template.
*
* @return string[] * @return string[]
*/ */
public function getVariables() public function getVariables()
@ -174,7 +177,7 @@ class Template
} }
/** /**
* Clone a table row in a template document * Clone a table row in a template document.
* *
* @param string $search * @param string $search
* @param integer $numberOfClones * @param integer $numberOfClones
@ -230,7 +233,7 @@ class Template
} }
/** /**
* Clone a block * Clone a block.
* *
* @param string $blockname * @param string $blockname
* @param integer $clones * @param integer $clones
@ -266,10 +269,11 @@ class Template
} }
/** /**
* Replace a block * Replace a block.
* *
* @param string $blockname * @param string $blockname
* @param string $replacement * @param string $replacement
* @return void
*/ */
public function replaceBlock($blockname, $replacement) public function replaceBlock($blockname, $replacement)
{ {
@ -289,9 +293,10 @@ class Template
} }
/** /**
* Delete a block of text * Delete a block of text.
* *
* @param string $blockname * @param string $blockname
* @return void
*/ */
public function deleteBlock($blockname) public function deleteBlock($blockname)
{ {
@ -299,7 +304,7 @@ class Template
} }
/** /**
* Save XML to temporary file * Save XML to temporary file.
* *
* @return string * @return string
* @throws \PhpOffice\PhpWord\Exception\Exception * @throws \PhpOffice\PhpWord\Exception\Exception
@ -325,10 +330,12 @@ class Template
} }
/** /**
* Save XML to defined name * Save XML to defined name.
*
* @since 0.8.0
* *
* @param string $fileName * @param string $fileName
* @since 0.8.0 * @return void
*/ */
public function saveAs($fileName) public function saveAs($fileName)
{ {
@ -375,7 +382,8 @@ class Template
} }
/** /**
* Find all variables in $documentPartXML * Find all variables in $documentPartXML.
*
* @param string $documentPartXML * @param string $documentPartXML
* @return string[] * @return string[]
*/ */
@ -387,7 +395,8 @@ class Template
} }
/** /**
* Get the name of the footer file for $index * Get the name of the footer file for $index.
*
* @param integer $index * @param integer $index
* @return string * @return string
*/ */
@ -397,7 +406,8 @@ class Template
} }
/** /**
* Get the name of the header file for $index * Get the name of the header file for $index.
*
* @param integer $index * @param integer $index
* @return string * @return string
*/ */
@ -407,7 +417,7 @@ class Template
} }
/** /**
* Find the start position of the nearest table row before $offset * Find the start position of the nearest table row before $offset.
* *
* @param integer $offset * @param integer $offset
* @return integer * @return integer
@ -426,7 +436,7 @@ class Template
} }
/** /**
* Find the end position of the nearest table row after $offset * Find the end position of the nearest table row after $offset.
* *
* @param integer $offset * @param integer $offset
* @return integer * @return integer
@ -438,7 +448,7 @@ class Template
} }
/** /**
* Get a slice of a string * Get a slice of a string.
* *
* @param integer $startPosition * @param integer $startPosition
* @param integer $endPosition * @param integer $endPosition