CategoryArchivesGenerator
extends PageGenerator
in package
Table of Contents
Properties
- $categoryId : int|null
- $compiler : Compiler
- $destination : Destination
- $httpClient : Browser
- $logger : Logger
- $maxPage : int|null
- $maxPublishCount : int
- $monthRange : array<string|int, mixed>
- $shouldGenerateNextPage : bool
Methods
- __construct() : mixed
- Generator constructor.
- run() : PromiseInterface<string|int, void>
- setCategoryId() : void
- setMaxPage() : void
- setMonthRange() : void
- getArchiveContext() : array{bid: int, date: string, cid?: int}
- getFileName() : string
- getName() : string
- handle() : PromiseInterface<string|int, void>
- handleError() : void
- onBeforeRequest() : void
- // Do something before sending HTTP request
- request() : PromiseInterface<string|int, void>
- shouldGenerateNextPage() : bool
- 次のページを生成するかどうか
- writeContents() : void
Properties
$categoryId
protected
int|null
$categoryId
$compiler
protected
Compiler
$compiler
$destination
protected
Destination
$destination
$httpClient
protected
Browser
$httpClient
$logger
protected
Logger
$logger
$maxPage
protected
int|null
$maxPage
= 1
$maxPublishCount
protected
int
$maxPublishCount
$monthRange
protected
array<string|int, mixed>
$monthRange
= []
$shouldGenerateNextPage
protected
bool
$shouldGenerateNextPage
= true
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
run() : PromiseInterface<string|int, void>
Tags
Return values
PromiseInterface<string|int, void>setCategoryId()
public
setCategoryId(int $categoryId) : void
Parameters
- $categoryId : int
setMaxPage()
public
setMaxPage(int $maxPage) : void
Parameters
- $maxPage : int
setMonthRange()
public
setMonthRange(array<string|int, string> $monthRange) : void
Parameters
- $monthRange : array<string|int, string>
getArchiveContext()
protected
getArchiveContext(string $date) : array{bid: int, date: string, cid?: int}
Parameters
- $date : string
Return values
array{bid: int, date: string, cid?: int}getFileName()
protected
getFileName(int $page) : string
Parameters
- $page : int
Return values
stringgetName()
protected
getName() : string
Return values
stringhandle()
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
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
writeContents(string $path, string $data) : void
Parameters
- $path : string
- $data : string