# Producer

class Producer extends Producer

## Constants

FEATURES_KEY |

## Properties

protected string | $_name |  | from Producer
protected | $_classes |  | from Base
protected IImporter | $_importer |  | from Producer
protected array | $_importer_data |  | from Producer
protected array | $_features |  | from Producer
protected IGroup | $_active_group |  | from Producer
protected array | $_groups |  | from Producer
protected array | $_methods |  | from Producer
protected array | $_parameters |  | from Producer
protected string | $_methods_cmp_str |  | from Producer
protected string | $_parameters_cmp_str |  | from Producer
protected Manager | $_manager |  | from Producer

## Methods

string
getName()

Returns the name.

from Base
boolean
setName(string $name)

Sets the name.

from Base
array
getClasses()

Returns all declared classes.

from Base
__construct(Manager $manager = null)

Creates the producer instance.

from Producer
parse()

Loads the importer, validation and extracting of the datas.

setManager(Manager $manager)

Sets the manager.

from Producer
getManager()

Returns the manager.

from Producer
array
getGroups()

Returns the groups.

from Producer
array
getFeatures()

Returns the features.

from Producer
array
getMethods()

Returns the methods that the producer should look for.

from Producer
import(IImporter $importer)

Starts the importing process.

from Producer
export(IExporter $exporter)

Starts the exporting process.

from Producer
transform(IImporter $from, IExporter $to)

Will do the import and export in one call.

from Producer
Feature
addFeature(string $name, array $methods)

Adds a feature to the producer.

from Producer
IGroup
addGroup(string $name, array $value)

Adds a group to the producer.

from Producer
IMethod
createMethod(string $method, array $params)

Adds a method to the producer that will be assigned to a feature.

from Producer
loadAndValidate()

Will start the load process inside of the importer and validates the datas that will be returned by this method.

extractLayers()

Extracts the different layers, methods and parameters.

extractLayer(string $key, mixed $layer, type $parent = null)

Extracts the actual layer with a given key, manage the parent and adds (if found) features, groups and childrens to the producer.

## Details

###
in Base at line 30
`final string getName()`

Returns the name.

#### Return Value

string |

###
in Base at line 41
`final boolean setName(string $name)`

Sets the name.

#### Parameters

string | $name |

#### Return Value

boolean |

###
in Base at line 57
`array getClasses()`

Returns all declared classes.

We need this way, because the autoloader will try to include the class file if we use "class_exists" or similar functions.

#### Return Value

array |

###
in Producer at line 90
`__construct(Manager $manager = null)`

Creates the producer instance.

#### Parameters

Manager | $manager | Our manager as reference back.

###
at line 40
`parse()`

Loads the importer, validation and extracting of the datas.

###
in Producer at line 103
`setManager(Manager $manager)`

Sets the manager.

#### Parameters

Manager | $manager |

###
in Producer at line 113
`getManager()`

Returns the manager.

###
in Producer at line 123
`array getGroups()`

Returns the groups.

#### Return Value

array | of \jtl\Connector\Feature\Group\IGroup

###
in Producer at line 133
`array getFeatures()`

Returns the features.

#### Return Value

array | of \jtl\Connector\Feature\Feature\IFeature

###
in Producer at line 143
`array getMethods()`

Returns the methods that the producer should look for.

#### Return Value

array | of string

###
in Producer at line 158
`import(IImporter $importer)`

Starts the importing process.

#### Parameters

IImporter | $importer |

#### See also

self::parse() |

###
in Producer at line 174
`export(IExporter $exporter)`

Starts the exporting process.

#### Parameters

IExporter | $exporter | The exporter object, that implements the IExporter interface to be conform to this manager/producer.

#### See also

$exporter->load() |

###
in Producer at line 192
`transform(IImporter $from, IExporter $to)`

Will do the import and export in one call.

#### Parameters

IImporter | $from |
IExporter | $to |

###
in Producer at line 205
`protected Feature addFeature(string $name, array $methods)`

Adds a feature to the producer.

#### Parameters

string | $name | The name of the new feature.
array | $methods | An array with the

#### Return Value

Feature |

###
in Producer at line 222
`protected IGroup addGroup(string $name, array $value)`

Adds a group to the producer.

#### Parameters

string | $name | The name of th new group.
array | $value | The params for the new group.

#### Return Value

IGroup |

###
in Producer at line 244
`protected IMethod createMethod(string $method, array $params)`

Adds a method to the producer that will be assigned to a feature.

#### Parameters

string | $method | The name of the new method.
array | $params | The params array for the new method.

#### Return Value

IMethod |

#### Exceptions

ExceptionProducer | If the setter for a parameter doesn't exists in the method class, we need to inform the caller about the inconsistency.

###
at line 19
`protected loadAndValidate()`

Will start the load process inside of the importer and validates the datas that will be returned by this method.

#### Exceptions

Producer | If the datas param contains no array, is empty, or doesn't contain the feature key we need to inform the caller about the inconsistency.

###
at line 52
`protected extractLayers()`

Extracts the different layers, methods and parameters.

#### Exceptions

Producer | If there are no methods or parameters, we need to notify the caller about the inconsistency.

###
at line 85
`protected extractLayer(string $key, mixed $layer, type $parent = null)`

Extracts the actual layer with a given key, manage the parent and adds (if found) features, groups and childrens to the producer.

#### Parameters

string | $key | The actual key inside of the feature array.
mixed | $layer | The data.
type | $parent | If there is a active group, all children will be added to the parent.