class CsvWriter extends AbstractStreamWriter

Class CsvWriter

Properties

protected $tmpFile from AbstractStreamWriter
protected string $delimiter Delimiter in csv file
protected string $enclosure String enclosure in csv file
protected bool $utf8Encoding Indicates if file is in utf8 encoding
protected array|null $header File header

Methods

__construct(string $delimiter = ',', string $enclosure = '"', resource $stream = null, bool $utf8Encoding = false)

No description

setStream(mixed $stream)

Set Stream Resource

resource
getStream()

Get underlying stream resource

mixed
prepare()

Prepare the writer before writing the items

$this
finish()

Wrap up the writer after all items have been written

setCloseStreamOnFinish(bool $closeStreamOnFinish = true)

Should underlying stream be closed on finish?

bool
getCloseStreamOnFinish()

Is Stream closed on finish?

static string
convertCollection(mixed $collection)

No description

mixed
writeCollection(mixed $collection)

No description

string
writeCustomCollection(mixed $collection)

No description

mixed
writeItem(CSVEntityInterface $entity)

No description

mixed
writeCustomItem(PrimaryKeyInterface $entity)

No description

__destruct()

Destructor

Details

at line 50
__construct(string $delimiter = ',', string $enclosure = '"', resource $stream = null, bool $utf8Encoding = false)

Parameters

string $delimiter
string $enclosure
resource $stream
bool $utf8Encoding

in AbstractStreamWriter at line 49
AbstractStreamWriter setStream(mixed $stream)

Set Stream Resource

Parameters

mixed $stream

Return Value

AbstractStreamWriter

in AbstractStreamWriter at line 68
resource getStream()

Get underlying stream resource

Return Value

resource

at line 63
mixed prepare()

Prepare the writer before writing the items

Return Value

mixed

in AbstractStreamWriter at line 89
$this finish()

Wrap up the writer after all items have been written

Return Value

$this

in AbstractStreamWriter at line 105
AbstractStreamWriter setCloseStreamOnFinish(bool $closeStreamOnFinish = true)

Should underlying stream be closed on finish?

Parameters

bool $closeStreamOnFinish

Return Value

AbstractStreamWriter

in AbstractStreamWriter at line 117
bool getCloseStreamOnFinish()

Is Stream closed on finish?

Return Value

bool

in AbstractStreamWriter at line 127
static string convertCollection(mixed $collection)

Parameters

mixed $collection

Return Value

string

in AbstractStreamWriter at line 145
mixed writeCollection(mixed $collection)

Parameters

mixed $collection

Return Value

mixed

in AbstractStreamWriter at line 160
string writeCustomCollection(mixed $collection)

Parameters

mixed $collection

Return Value

string

at line 75
mixed writeItem(CSVEntityInterface $entity)

Parameters

CSVEntityInterface $entity

Return Value

mixed

at line 90
mixed writeCustomItem(PrimaryKeyInterface $entity)

Parameters

PrimaryKeyInterface $entity

Return Value

mixed

at line 110
__destruct()

Destructor