Export   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
c 1
b 0
f 0
dl 0
loc 33
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A openFile() 0 13 1
A writeRow() 0 3 1
A writeBlankRow() 0 4 1
A closeFile() 0 4 1
1
<?php
2
namespace GJClasses;
3
4
class Export
5
{
6
7
    public function openFile($base_filename, $append_data)
8
    {
9
        header('Content-Encoding: UTF-8');
10
        header('Content-Type: text/csv; charset=UTF-8');
11
        header("Content-Disposition: attachment; filename=\"" . $base_filename . "_" . $append_data . ".csv\"");
12
        header('Content-Transfer-Encoding: binary');
13
        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
14
        header("Pragma: no-cache");
15
16
        $open_file = fopen('php://output', 'w');
17
        fprintf($open_file, chr(0xEF) . chr(0xBB) . chr(0xBF));
18
19
        return $open_file;
20
    }
21
22
    public function writeRow($open_file, $row_contents)
23
    {
24
        fputcsv($open_file, $row_contents);
25
    }
26
27
    public function writeBlankRow($open_file)
28
    {
29
        $blank_line = array('');
30
        fputcsv($open_file, $blank_line);
31
    }
32
33
    public function closeFile($open_file)
34
    {
35
        fclose($open_file);
36
        return exit;
37
    }
38
39
}
40