FOSSology  4.7.1
Open Source License Compliance by Open Source Software
Fossology\Lib\Application\CustomTextExport Class Reference

Helper class to export custom text phrases as CSV/JSON from the DB. More...

Collaboration diagram for Fossology\Lib\Application\CustomTextExport:
Collaboration graph

Public Member Functions

 __construct (DbManager $dbManager)
 
 setDelimiter ($delimiter=',')
 Update the delimiter. More...
 
 setEnclosure ($enclosure='"')
 Update the enclosure. More...
 
 export ($cp_pk=0, $generateJson=false)
 Create the CSV/JSON export from the DB. More...
 

Protected Attributes

 $dbManager
 
 $delimiter = ','
 
 $enclosure = '"'
 

Private Member Functions

 createCsvContent ($result)
 Create CSV content from result array. More...
 
 createJson ($result)
 Create JSON content from result array. More...
 
 arrayToCsvLine ($array)
 Convert array to CSV line. More...
 

Detailed Description

Helper class to export custom text phrases as CSV/JSON from the DB.

Definition at line 21 of file CustomTextExport.php.

Constructor & Destructor Documentation

◆ __construct()

Fossology\Lib\Application\CustomTextExport::__construct ( DbManager  $dbManager)

Constructor

Parameters
DbManager$dbManagerDB manager to use.

Definition at line 37 of file CustomTextExport.php.

Member Function Documentation

◆ arrayToCsvLine()

Fossology\Lib\Application\CustomTextExport::arrayToCsvLine (   $array)
private

Convert array to CSV line.

Parameters
array$arrayArray to convert
Returns
string CSV line

Definition at line 178 of file CustomTextExport.php.

◆ createCsvContent()

Fossology\Lib\Application\CustomTextExport::createCsvContent (   $result)
private

Create CSV content from result array.

Parameters
array$resultDatabase result array
Returns
string CSV content

Definition at line 110 of file CustomTextExport.php.

◆ createJson()

Fossology\Lib\Application\CustomTextExport::createJson (   $result)
private

Create JSON content from result array.

Parameters
array$resultDatabase result array
Returns
string JSON content

Definition at line 152 of file CustomTextExport.php.

◆ export()

Fossology\Lib\Application\CustomTextExport::export (   $cp_pk = 0,
  $generateJson = false 
)

Create the CSV/JSON export from the DB.

Parameters
int$cp_pkSet the custom phrase ID to get only one phrase, set 0 to get all
bool$generateJsonWhether to generate JSON format instead of CSV
Returns
string csv or json content

Definition at line 66 of file CustomTextExport.php.

◆ setDelimiter()

Fossology\Lib\Application\CustomTextExport::setDelimiter (   $delimiter = ',')

Update the delimiter.

Parameters
string$delimiterNew delimiter to use.

Definition at line 46 of file CustomTextExport.php.

◆ setEnclosure()

Fossology\Lib\Application\CustomTextExport::setEnclosure (   $enclosure = '"')

Update the enclosure.

Parameters
string$enclosureNew enclosure to use.

Definition at line 55 of file CustomTextExport.php.

Member Data Documentation

◆ $dbManager

DbManager Fossology\Lib\Application\CustomTextExport::$dbManager
protected

DB manager in use

Definition at line 25 of file CustomTextExport.php.

◆ $delimiter

string Fossology\Lib\Application\CustomTextExport::$delimiter = ','
protected

Delimiter for CSV

Definition at line 28 of file CustomTextExport.php.

◆ $enclosure

string Fossology\Lib\Application\CustomTextExport::$enclosure = '"'
protected

Enclosure for CSV strings

Definition at line 31 of file CustomTextExport.php.


The documentation for this class was generated from the following file: