@@ -41,19 +41,19 @@ class CSVWriter
41
41
*/
42
42
public function open ($ file , array $ options = [])
43
43
{
44
- if (is_resource ($ file ) AND (get_resource_type ($ file ) === 'stream ' )) {
44
+ if (\ is_resource ($ file ) AND (\ get_resource_type ($ file ) === 'stream ' )) {
45
45
$ this ->resource = $ file ;
46
46
$ this ->owns_resource = FALSE ;
47
- } elseif (is_string ($ file )) {
48
- $ this ->resource = fopen ($ file , 'w ' );
47
+ } elseif (\ is_string ($ file )) {
48
+ $ this ->resource = \ fopen ($ file , 'w ' );
49
49
$ this ->owns_resource = TRUE ;
50
50
} else {
51
51
throw new \InvalidArgumentException (
52
52
'Expected `file` to be string or an existing resource '
53
53
);
54
54
}
55
55
$ this ->expect_schema = NULL ;
56
- $ this ->options = array_merge ($ this ->options , $ options );
56
+ $ this ->options = \ array_merge ($ this ->options , $ options );
57
57
}
58
58
59
59
/**
@@ -65,24 +65,24 @@ public function write(array $row)
65
65
throw new \LogicException ('Cannot write to a closed file ' );
66
66
}
67
67
68
- $ row_schema = array_keys ($ row );
68
+ $ row_schema = \ array_keys ($ row );
69
69
70
70
if ($ this ->expect_schema === NULL ) {
71
71
if ($ this ->options ['write_utf8_bom ' ]) {
72
- fputs ($ this ->resource , static ::UTF8_BOM );
72
+ \ fputs ($ this ->resource , static ::UTF8_BOM );
73
73
}
74
74
$ this ->expect_schema = $ row_schema ;
75
- fputcsv ($ this ->resource , $ this ->expect_schema );
75
+ \ fputcsv ($ this ->resource , $ this ->expect_schema );
76
76
} elseif ($ this ->expect_schema !== $ row_schema ) {
77
77
throw MismatchedSchemaException::forSchema ($ this ->expect_schema , $ row_schema );
78
78
}
79
79
80
- fputcsv ($ this ->resource , $ row );
80
+ \ fputcsv ($ this ->resource , $ row );
81
81
}
82
82
83
83
protected function isResourceOpen ()
84
84
{
85
- return $ this ->resource && (get_resource_type ($ this ->resource ) === 'stream ' );
85
+ return $ this ->resource && (\ get_resource_type ($ this ->resource ) === 'stream ' );
86
86
}
87
87
88
88
public function close ()
@@ -92,7 +92,7 @@ public function close()
92
92
}
93
93
94
94
if ($ this ->owns_resource ) {
95
- fclose ($ this ->resource );
95
+ \ fclose ($ this ->resource );
96
96
}
97
97
98
98
$ this ->resource = NULL ;
0 commit comments