@@ 50-60 (lines=11) @@ | ||
47 | * |
|
48 | * @param Closure $callback |
|
49 | */ |
|
50 | public function map(Closure $callback) |
|
51 | { |
|
52 | for ($i = 0; $i < 100; ++$i) { |
|
53 | $segment = $this->path.'/'.sprintf($this->segmentName, $i); |
|
54 | ||
55 | if (file_exists($segment)) { |
|
56 | $dictionary = (array) include $segment; |
|
57 | $callback($dictionary); |
|
58 | } |
|
59 | } |
|
60 | } |
|
61 | ||
62 | /** |
|
63 | * Load surname dict. |
@@ 54-65 (lines=12) @@ | ||
51 | * |
|
52 | * @param string $path |
|
53 | */ |
|
54 | public function __construct($path) |
|
55 | { |
|
56 | $this->path = $path; |
|
57 | ||
58 | for ($i = 0; $i < 100; ++$i) { |
|
59 | $segment = $path.'/'.sprintf($this->segmentName, $i); |
|
60 | ||
61 | if (file_exists($segment)) { |
|
62 | $this->segments[] = (array) include $segment; |
|
63 | } |
|
64 | } |
|
65 | } |
|
66 | ||
67 | /** |
|
68 | * Load dict. |