PHP Class Overtrue\Pinyin\GeneratorFileDictLoader

Inheritance: implements Overtrue\Pinyin\DictLoaderInterface
Show file Open project: overtrue/pinyin

Protected Properties

Property Type Description
$handles array SplFileObjects.
$path string Data directory.
$segmentName string Words segment name.

Public Methods

Method Description
__construct ( string $path ) Constructor.
map ( Closure $callback ) Load dict.
mapSurname ( Closure $callback ) Load surname dict.

Protected Methods

Method Description
getGenerator ( array $handles ) get Generator syntax.
openFile ( string $filename, $mode = 'r' ) : SplFileObject Construct a new file object.

Method Details

__construct() public method

Constructor.
public __construct ( string $path )
$path string

getGenerator() protected method

get Generator syntax.
protected getGenerator ( array $handles )
$handles array SplFileObjects

map() public method

Load dict.
public map ( Closure $callback )
$callback Closure

mapSurname() public method

Load surname dict.
public mapSurname ( Closure $callback )
$callback Closure

openFile() protected method

Construct a new file object.
protected openFile ( string $filename, $mode = 'r' ) : SplFileObject
$filename string file path
return SplFileObject

Property Details

$handles protected property

SplFileObjects.
protected array $handles
return array

$path protected property

Data directory.
protected string $path
return string

$segmentName protected property

Words segment name.
protected string $segmentName
return string