프로퍼티 | 타입 | 설명 | |
---|---|---|---|
$_data | mixed | Data to parse | |
$_from_type | string | Type to convert from |
메소드 | 설명 | |
---|---|---|
__construct ( null $data = NULL, null $from_type = NULL ) | DO NOT CALL THIS DIRECTLY, USE factory() | |
factory ( mixed $data, string $from_type = NULL ) : object | Create an instance of the format class e.g: echo $this->format->factory(['foo' => 'bar'])->to_csv(); | |
to_array ( mixed | null $data = NULL ) : array | Format data as an array | |
to_csv ( mixed | null $data = NULL, string $delimiter = ',', string $enclosure = '"' ) : string | ||
to_html ( mixed | null $data = NULL ) : mixed | Format data as HTML | |
to_json ( mixed | null $data = NULL ) : string | Encode data as json | |
to_php ( mixed | null $data = NULL ) : mixed | Format data using a PHP structure | |
to_serialized ( mixed | null $data = NULL ) : string | Encode data as a serialized array | |
to_xml ( mixed | null $data = NULL, null $structure = NULL, string $basenode = 'xml' ) : mixed | Format data as XML |
메소드 | 설명 | |
---|---|---|
_from_csv ( string $data, string $delimiter = ',', string $enclosure = '"' ) : array | ||
_from_json ( string $data ) : mixed | ||
_from_php ( string $data ) : string | ||
_from_serialize ( string $data ) : mixed | ||
_from_xml ( string $data ) : array |
public __construct ( null $data = NULL, null $from_type = NULL ) | ||
$data | null | |
$from_type | null |
protected _from_csv ( string $data, string $delimiter = ',', string $enclosure = '"' ) : array | ||
$data | string | CSV string |
$delimiter | string | The optional delimiter parameter sets the field delimiter (one character only). NULL will use the default value (,) |
$enclosure | string | The optional enclosure parameter sets the field enclosure (one character only). NULL will use the default value (") |
리턴 | array | A multi-dimensional array with the outer array being the number of rows and the inner arrays the individual fields |
protected _from_json ( string $data ) : mixed | ||
$data | string | Encoded json string |
리턴 | mixed | Decoded json string with leading and trailing whitespace removed |
protected _from_serialize ( string $data ) : mixed | ||
$data | string | Data to unserialize |
리턴 | mixed | Unserialized data |
public to_csv ( mixed | null $data = NULL, string $delimiter = ',', string $enclosure = '"' ) : string | ||
$data | mixed | null | Optional data to pass, so as to override the data passed to the constructor |
$delimiter | string | The optional delimiter parameter sets the field delimiter (one character only). NULL will use the default value (,) |
$enclosure | string | The optional enclosure parameter sets the field enclosure (one character only). NULL will use the default value (") |
리턴 | string | A csv string |