@@ -49,25 +49,25 @@ abstract class AbstractWriter implements WriterInterface
49
49
private $ diskCachingDirectory = './ ' ;
50
50
51
51
/**
52
- * Original file name
52
+ * Temporary directory
53
53
*
54
54
* @var string
55
55
*/
56
- private $ originalFilename ;
56
+ private $ tempDir = '' ;
57
57
58
58
/**
59
- * Temporary file name
59
+ * Original file name
60
60
*
61
61
* @var string
62
62
*/
63
- private $ tempFilename ;
63
+ private $ originalFilename ;
64
64
65
65
/**
66
- * Temporary directory
66
+ * Temporary file name
67
67
*
68
68
* @var string
69
69
*/
70
- private $ tempDir ;
70
+ private $ tempFilename ;
71
71
72
72
/**
73
73
* Get PhpWord object
@@ -88,7 +88,7 @@ public function getPhpWord()
88
88
* Set PhpWord object
89
89
*
90
90
* @param PhpWord
91
- * @return $this
91
+ * @return self
92
92
*/
93
93
public function setPhpWord (PhpWord $ phpWord = null )
94
94
{
@@ -126,7 +126,7 @@ public function getUseDiskCaching()
126
126
*
127
127
* @param boolean $pValue
128
128
* @param string $pDirectory
129
- * @return $this
129
+ * @return self
130
130
*/
131
131
public function setUseDiskCaching ($ pValue = false , $ pDirectory = null )
132
132
{
@@ -153,6 +153,32 @@ public function getDiskCachingDirectory()
153
153
return $ this ->diskCachingDirectory ;
154
154
}
155
155
156
+ /**
157
+ * Get temporary directory
158
+ *
159
+ * @return string
160
+ */
161
+ public function getTempDir ()
162
+ {
163
+ return $ this ->tempDir ;
164
+ }
165
+
166
+ /**
167
+ * Set temporary directory
168
+ *
169
+ * @param string $value
170
+ * @return self
171
+ */
172
+ public function setTempDir ($ value )
173
+ {
174
+ if (!is_dir ($ value )) {
175
+ mkdir ($ value );
176
+ }
177
+ $ this ->tempDir = $ value ;
178
+
179
+ return $ this ;
180
+ }
181
+
156
182
/**
157
183
* Get temporary file name
158
184
*
@@ -164,7 +190,7 @@ public function getDiskCachingDirectory()
164
190
protected function getTempFile ($ filename )
165
191
{
166
192
// Temporary directory
167
- $ this ->setTempDir ();
193
+ $ this ->setTempDir (sys_get_temp_dir () . ' /PHPWordWriter/ ' );
168
194
169
195
// Temporary file
170
196
$ this ->originalFilename = $ filename ;
@@ -179,26 +205,6 @@ protected function getTempFile($filename)
179
205
return $ this ->tempFilename ;
180
206
}
181
207
182
- /**
183
- * Get temporary directory
184
- */
185
- protected function getTempDir ()
186
- {
187
- return $ this ->tempDir ;
188
- }
189
-
190
- /**
191
- * Set temporary directory
192
- */
193
- protected function setTempDir ()
194
- {
195
- $ tempDir = sys_get_temp_dir () . '/PHPWordMedia/ ' ;
196
- if (!is_dir ($ tempDir )) {
197
- mkdir ($ tempDir );
198
- }
199
- $ this ->tempDir = $ tempDir ;
200
- }
201
-
202
208
/**
203
209
* Cleanup temporary file
204
210
*/
0 commit comments