PHP Class Fakerino\Core\FakeDataFactory

Author: Nicola Pietroluongo ([email protected])
Inheritance: implements Fakerino\Core\FakeDataFactoryInterface
Datei anzeigen Open project: fakerino/fakerino Class Usage Examples

Public Methods

Method Description
__construct ( Fakerino\Core\FakeHandler\HandlerInterface $fakeHandler, Fakerino\Core\Database\DbInterface $db, Fakerino\Core\Template\TemplateInterface $template ) It receives: the handlers priority for the fake request, the DbInterface for the fakeTable operation, and the TemplateInterface for the fakeTemplate operation.
__toString ( ) : string
fake ( string | array | null $elementName = null ) : FakeDataFactory Setups the fake element and initializes the output.
fakeEntity ( object | null $entity = null ) : boolean Fills the given entity with fake data.
fakeTable ( string | null $tableName = null ) : array Fills the given table with fake data.
fakeTemplate ( string $file ) : string Fakes a template file.
num ( integer $num = 1 ) : FakeDataFactory Sets $num for iterate the fake process.
seed ( integer | null $seed = null ) : FakeDataFactory
toArray ( ) : array
toJson ( ) : string

Private Methods

Method Description
arrayToString ( $arr )
getElementToFake ( $elementsName )
startFake ( $elementName, $num )

Method Details

__construct() public method

It receives: the handlers priority for the fake request, the DbInterface for the fakeTable operation, and the TemplateInterface for the fakeTemplate operation.
public __construct ( Fakerino\Core\FakeHandler\HandlerInterface $fakeHandler, Fakerino\Core\Database\DbInterface $db, Fakerino\Core\Template\TemplateInterface $template )
$fakeHandler Fakerino\Core\FakeHandler\HandlerInterface
$db Fakerino\Core\Database\DbInterface
$template Fakerino\Core\Template\TemplateInterface

__toString() public method

public __toString ( ) : string
return string

fake() public method

Setups the fake element and initializes the output.
public fake ( string | array | null $elementName = null ) : FakeDataFactory
$elementName string | array | null
return FakeDataFactory $this

fakeEntity() public method

Fills the given entity with fake data.
public fakeEntity ( object | null $entity = null ) : boolean
$entity object | null
return boolean

fakeTable() public method

Fills the given table with fake data.
public fakeTable ( string | null $tableName = null ) : array
$tableName string | null
return array $rows

fakeTemplate() public method

Fakes a template file.
public fakeTemplate ( string $file ) : string
$file string
return string

num() public method

Sets $num for iterate the fake process.
public num ( integer $num = 1 ) : FakeDataFactory
$num integer
return FakeDataFactory $this

seed() public method

public seed ( integer | null $seed = null ) : FakeDataFactory
$seed integer | null
return FakeDataFactory $this

toArray() public method

public toArray ( ) : array
return array

toJson() public method

public toJson ( ) : string
return string json