@@ -136,7 +136,7 @@ public function __construct(string $pathDir, string $filename, array $options =
136136 // Test folder
137137 $ realPath = realpath ($ pathDir );
138138 if (false === $ realPath || !is_writable ($ realPath )) {
139- throw new \Exception (sprintf ('Folder %s does not exist or is not writable ' , $ pathDir ));
139+ throw new \Exception (\ sprintf ('Folder %s does not exist or is not writable ' , $ pathDir ));
140140 }
141141
142142 $ this ->pathDir = $ realPath ;
@@ -168,7 +168,7 @@ public function __construct(string $pathDir, string $filename, array $options =
168168 protected function open (): void
169169 {
170170 if (\is_resource ($ this ->handle )) {
171- throw new \Exception (sprintf ('The file %s is already open ' , $ this ->filename ));
171+ throw new \Exception (\ sprintf ('The file %s is already open ' , $ this ->filename ));
172172 }
173173 ++$ this ->fileNumber ;
174174 $ this ->lines = 0 ;
@@ -179,11 +179,11 @@ protected function open(): void
179179 $ this ->currentPathname = $ this ->pathDir .'/ ' .$ filename .'.csv ' ;
180180 $ this ->handle = fopen ($ this ->currentPathname , 'wb ' ); // Binary is forced. EOL = "\n"
181181 if (false === $ this ->handle ) {
182- throw new \Exception (sprintf ('Error during the opening of the %s file ' , $ this ->filename ));
182+ throw new \Exception (\ sprintf ('Error during the opening of the %s file ' , $ this ->filename ));
183183 }
184184 if ($ this ->addUtf8Bom ) {
185185 if (false === fwrite ($ this ->handle , \chr (0xEF ).\chr (0xBB ).\chr (0xBF ))) {
186- throw new \Exception (sprintf ('Error during the UTF8-BOM writing in %s file ' , $ this ->filename ));
186+ throw new \Exception (\ sprintf ('Error during the UTF8-BOM writing in %s file ' , $ this ->filename ));
187187 }
188188 }
189189 if (null !== $ this ->header && \count ($ this ->header ) > 0 ) {
@@ -204,13 +204,13 @@ public function close(): void
204204
205205 if ($ this ->unixToDos ) { // PHP < 8.1
206206 if (\PHP_OS_FAMILY === 'Linux ' ) {
207- $ command = sprintf ('%s %s 2> /dev/null ' , $ this ->unixToDosPath , $ this ->currentPathname );
207+ $ command = \ sprintf ('%s %s 2> /dev/null ' , $ this ->unixToDosPath , $ this ->currentPathname );
208208 } else {
209- $ command = sprintf ('%s %s ' , $ this ->unixToDosPath , $ this ->currentPathname );
209+ $ command = \ sprintf ('%s %s ' , $ this ->unixToDosPath , $ this ->currentPathname );
210210 }
211211 exec ($ command , $ output , $ returnVar );
212212 if (0 !== $ returnVar ) {
213- throw new \Exception (sprintf ('Unix2dos error (%s file) ' , $ this ->filename ));
213+ throw new \Exception (\ sprintf ('Unix2dos error (%s file) ' , $ this ->filename ));
214214 }
215215 }
216216 }
@@ -233,7 +233,7 @@ protected function newFile(): void
233233 public function write ($ data ): void
234234 {
235235 if (!\is_resource ($ this ->handle )) {
236- throw new \Exception (sprintf ('Handle does not exist. File %s ' , $ this ->filename ));
236+ throw new \Exception (\ sprintf ('Handle does not exist. File %s ' , $ this ->filename ));
237237 }
238238
239239 // New file
@@ -250,7 +250,7 @@ public function write($data): void
250250 $ result = fputcsv ($ this ->handle , $ data , $ this ->delimiter , $ this ->enclosure , $ this ->escape );
251251 }
252252 if (false === $ result ) {
253- throw new \Exception (sprintf ('Error during the writing in %s file ' , $ this ->filename ));
253+ throw new \Exception (\ sprintf ('Error during the writing in %s file ' , $ this ->filename ));
254254 }
255255
256256 ++$ this ->lines ;
0 commit comments