Skip to content

Commit c446028

Browse files
author
Roman Syroeshko
committed
[Changed] Refactored Template a little.
1 parent 75c8e7e commit c446028

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/PhpWord/Template.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
class Template
3030
{
3131
/**
32-
* ZipArchive object
32+
* ZipArchive object.
3333
*
3434
* @var mixed
3535
*/
@@ -61,20 +61,20 @@ class Template
6161
*
6262
* @since 0.12.0 Throws CreateTemporaryFileException and CopyFileException instead of Exception.
6363
*
64-
* @param string $strFilename
64+
* @param string $fileName The fully qualified template file name.
6565
* @throws \PhpOffice\PhpWord\Exception\CreateTemporaryFileException
6666
* @throws \PhpOffice\PhpWord\Exception\CopyFileException
6767
*/
68-
public function __construct($strFilename)
68+
public function __construct($fileName)
6969
{
7070
$this->tempFileName = tempnam(sys_get_temp_dir(), '');
71-
if ($this->tempFileName === false) {
71+
if (false === $this->tempFileName) {
7272
throw new CreateTemporaryFileException();
7373
}
7474

7575
// Copy the source File to the temp File
76-
if (false === copy($strFilename, $this->tempFileName)) {
77-
throw new CopyFileException($strFilename, $this->tempFileName);
76+
if (false === copy($fileName, $this->tempFileName)) {
77+
throw new CopyFileException($fileName, $this->tempFileName);
7878
}
7979

8080
$this->zipClass = new ZipArchive();
@@ -117,17 +117,17 @@ public function applyXslStyleSheet(&$xslDOMDocument, $xslOptions = array(), $xsl
117117

118118
$processor->importStylesheet($xslDOMDocument);
119119

120-
if ($processor->setParameter($xslOptionsURI, $xslOptions) === false) {
120+
if (false === $processor->setParameter($xslOptionsURI, $xslOptions)) {
121121
throw new Exception('Could not set values for the given XSL style sheet parameters.');
122122
}
123123

124124
$xmlDOMDocument = new \DOMDocument();
125-
if ($xmlDOMDocument->loadXML($this->documentXML) === false) {
125+
if (false === $xmlDOMDocument->loadXML($this->documentXML)) {
126126
throw new Exception('Could not load XML from the given template.');
127127
}
128128

129129
$xmlTransformed = $processor->transformToXml($xmlDOMDocument);
130-
if ($xmlTransformed === false) {
130+
if (false === $xmlTransformed) {
131131
throw new Exception('Could not transform the given XML document.');
132132
}
133133

@@ -317,7 +317,7 @@ public function save()
317317
}
318318

319319
// Close zip file
320-
if ($this->zipClass->close() === false) {
320+
if (false === $this->zipClass->close()) {
321321
throw new Exception('Could not close zip file.');
322322
}
323323

@@ -327,18 +327,18 @@ public function save()
327327
/**
328328
* Save XML to defined name
329329
*
330-
* @param string $strFilename
330+
* @param string $fileName
331331
* @since 0.8.0
332332
*/
333-
public function saveAs($strFilename)
333+
public function saveAs($fileName)
334334
{
335-
$tempFilename = $this->save();
335+
$tempFileName = $this->save();
336336

337-
if (file_exists($strFilename)) {
338-
unlink($strFilename);
337+
if (file_exists($fileName)) {
338+
unlink($fileName);
339339
}
340340

341-
rename($tempFilename, $strFilename);
341+
rename($tempFileName, $fileName);
342342
}
343343

344344
/**

0 commit comments

Comments
 (0)