Generator
in package
AbstractYes
Table of Contents
Constants
- PUBLISH_INTERVAL_SECONDS = 500000
Properties
- $compiler : Compiler
- $destination : Destination
- $httpClient : Browser
- $logger : Logger
- $maxPublishCount : int
Methods
- __construct() : mixed
- Generator constructor.
- run() : PromiseInterface<string|int, void>
- handle() : PromiseInterface<string|int, void>
- handleError() : void
- onBeforeRequest() : void
- // Do something before sending HTTP request
- request() : PromiseInterface<string|int, void>
- shouldGenerateNextPage() : bool
- 次のページを生成するかどうか
- writeContents() : void
- createHttpClient() : Browser
- generate() : PromiseInterface<string|int, array<string|int, void>>
Constants
PUBLISH_INTERVAL_SECONDS
private
int
PUBLISH_INTERVAL_SECONDS
= 500000
Properties
$compiler
protected
Compiler
$compiler
$destination
protected
Destination
$destination
$httpClient
protected
Browser
$httpClient
$logger
protected
Logger
$logger
$maxPublishCount
protected
int
$maxPublishCount
Methods
__construct()
Generator constructor.
public
__construct(Compiler $compiler, Destination $destination, Logger $logger[, int $maxPublishCount = 5 ][, string $nameServer = '8.8.8.8' ]) : mixed
Parameters
- $compiler : Compiler
- $destination : Destination
- $logger : Logger
- $maxPublishCount : int = 5
- $nameServer : string = '8.8.8.8'
run()
public
abstract run() : PromiseInterface<string|int, void>
Return values
PromiseInterface<string|int, void>handle()
protected
final handle(array<string|int, Page> $pages) : PromiseInterface<string|int, void>
Parameters
- $pages : array<string|int, Page>
Return values
PromiseInterface<string|int, void>handleError()
protected
abstract handleError(Throwable $th, string $url) : void
Parameters
- $th : Throwable
- $url : string
onBeforeRequest()
// Do something before sending HTTP request
protected
onBeforeRequest(Page $page) : void
Parameters
- $page : Page
request()
protected
final request(string $url[, callable $onSuccess = null ][, callable $onFailure = null ]) : PromiseInterface<string|int, void>
Parameters
- $url : string
- $onSuccess : callable = null
- $onFailure : callable = null
Return values
PromiseInterface<string|int, void>shouldGenerateNextPage()
次のページを生成するかどうか
protected
shouldGenerateNextPage() : bool
Return values
boolwriteContents()
protected
abstract writeContents(string $path, string $data) : void
Parameters
- $path : string
- $data : string
createHttpClient()
private
createHttpClient(string $nameServer) : Browser
Parameters
- $nameServer : string
Return values
Browsergenerate()
private
generate([array<string|int, Page> $pages = [] ]) : PromiseInterface<string|int, array<string|int, void>>
Parameters
- $pages : array<string|int, Page> = []