PHP Class Camspiers\StatisticalClassifier\DataSource\DataArray

Author: Cam Spiers ([email protected])
Inheritance: implements Camspiers\StatisticalClassifier\DataSource\DataSourceInterface, implements Serializabl\Serializable
Show file Open project: camspiers/statistical-classifier Class Usage Examples

Protected Properties

Property Type Description
$config Holds the config class that setData needs to conforms to
$data array Should be in the form: array( array( 'category' => 'somecategory', 'document' => 'Some document' ) )
$processor Processes the data with the config

Public Methods

Method Description
__construct ( array $data = null ) Creates the data array
addDocument ( $category, $document )
getCategories ( )
getConfig ( ) : mixed Return the config for the data
getData ( )
hasCategory ( $category )
serialize ( ) : string Serialize the class
setConfig ( DataSourceConfiguration $config )
setData ( array $data )
unserialize ( string $data ) : null Restore the serialized class
write ( )

Protected Methods

Method Description
getProcessor ( ) : mixed Gets the processor
prepare ( ) Read the data and set it
read ( )
setProcessor ( Symfony\Component\Config\Definition\Processor $processor ) Sets the processor for the config

Method Details

__construct() public method

Creates the data array
public __construct ( array $data = null )
$data array The initial data

addDocument() public method

public addDocument ( $category, $document )

getCategories() public method

public getCategories ( )

getConfig() public method

Return the config for the data
public getConfig ( ) : mixed
return mixed

getData() public method

public getData ( )

getProcessor() protected method

Gets the processor
protected getProcessor ( ) : mixed
return mixed

hasCategory() public method

public hasCategory ( $category )

prepare() protected method

Read the data and set it
protected prepare ( )

read() protected method

protected read ( )

serialize() public method

Serialize the class
public serialize ( ) : string
return string The serialized data

setConfig() public method

public setConfig ( DataSourceConfiguration $config )
$config Camspiers\StatisticalClassifier\Config\DataSourceConfiguration

setData() public method

public setData ( array $data )
$data array

setProcessor() protected method

Sets the processor for the config
protected setProcessor ( Symfony\Component\Config\Definition\Processor $processor )
$processor Symfony\Component\Config\Definition\Processor

unserialize() public method

Restore the serialized class
public unserialize ( string $data ) : null
$data string The serialized data
return null

write() public method

public write ( )

Property Details

$config protected property

Holds the config class that setData needs to conforms to
protected $config

$data protected property

Should be in the form: array( array( 'category' => 'somecategory', 'document' => 'Some document' ) )
protected array $data
return array

$processor protected property

Processes the data with the config
protected $processor