29
29
class Template
30
30
{
31
31
/**
32
- * ZipArchive object
32
+ * ZipArchive object.
33
33
*
34
34
* @var mixed
35
35
*/
@@ -61,20 +61,20 @@ class Template
61
61
*
62
62
* @since 0.12.0 Throws CreateTemporaryFileException and CopyFileException instead of Exception.
63
63
*
64
- * @param string $strFilename
64
+ * @param string $fileName The fully qualified template file name.
65
65
* @throws \PhpOffice\PhpWord\Exception\CreateTemporaryFileException
66
66
* @throws \PhpOffice\PhpWord\Exception\CopyFileException
67
67
*/
68
- public function __construct ($ strFilename )
68
+ public function __construct ($ fileName )
69
69
{
70
70
$ this ->tempFileName = tempnam (sys_get_temp_dir (), '' );
71
- if ($ this -> tempFileName === false ) {
71
+ if (false === $ this -> tempFileName ) {
72
72
throw new CreateTemporaryFileException ();
73
73
}
74
74
75
75
// 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 );
78
78
}
79
79
80
80
$ this ->zipClass = new ZipArchive ();
@@ -117,17 +117,17 @@ public function applyXslStyleSheet(&$xslDOMDocument, $xslOptions = array(), $xsl
117
117
118
118
$ processor ->importStylesheet ($ xslDOMDocument );
119
119
120
- if ($ processor ->setParameter ($ xslOptionsURI , $ xslOptions ) === false ) {
120
+ if (false === $ processor ->setParameter ($ xslOptionsURI , $ xslOptions )) {
121
121
throw new Exception ('Could not set values for the given XSL style sheet parameters. ' );
122
122
}
123
123
124
124
$ xmlDOMDocument = new \DOMDocument ();
125
- if ($ xmlDOMDocument ->loadXML ($ this ->documentXML ) === false ) {
125
+ if (false === $ xmlDOMDocument ->loadXML ($ this ->documentXML )) {
126
126
throw new Exception ('Could not load XML from the given template. ' );
127
127
}
128
128
129
129
$ xmlTransformed = $ processor ->transformToXml ($ xmlDOMDocument );
130
- if ($ xmlTransformed === false ) {
130
+ if (false === $ xmlTransformed ) {
131
131
throw new Exception ('Could not transform the given XML document. ' );
132
132
}
133
133
@@ -317,7 +317,7 @@ public function save()
317
317
}
318
318
319
319
// Close zip file
320
- if ($ this ->zipClass ->close () === false ) {
320
+ if (false === $ this ->zipClass ->close ()) {
321
321
throw new Exception ('Could not close zip file. ' );
322
322
}
323
323
@@ -327,18 +327,18 @@ public function save()
327
327
/**
328
328
* Save XML to defined name
329
329
*
330
- * @param string $strFilename
330
+ * @param string $fileName
331
331
* @since 0.8.0
332
332
*/
333
- public function saveAs ($ strFilename )
333
+ public function saveAs ($ fileName )
334
334
{
335
- $ tempFilename = $ this ->save ();
335
+ $ tempFileName = $ this ->save ();
336
336
337
- if (file_exists ($ strFilename )) {
338
- unlink ($ strFilename );
337
+ if (file_exists ($ fileName )) {
338
+ unlink ($ fileName );
339
339
}
340
340
341
- rename ($ tempFilename , $ strFilename );
341
+ rename ($ tempFileName , $ fileName );
342
342
}
343
343
344
344
/**
0 commit comments