GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 339665...0b0f67 )
by Carlos
02:26
created

FileToMemoryDictLoader::__construct()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 6

Duplication

Lines 10
Ratio 100 %

Code Coverage

Tests 9
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 10
loc 10
ccs 9
cts 9
cp 1
rs 9.4285
cc 3
eloc 6
nc 3
nop 1
crap 3
1
<?php
2
3
/*
4
 * This file is part of the overtrue/pinyin.
5
 *
6
 * (c) 2016 overtrue <[email protected]>
7
 */
8
9
namespace Overtrue\Pinyin;
10
11
use Closure;
12
13
/**
14
 * Dict File loader.
15
 */
16
class FileToMemoryDictLoader extends FileDictLoader implements DictLoaderInterface
17
{
18
    /**
19
     * Segment files
20
     *
21
     * @var array
22
     */
23
    protected $segments = array();
24
25
    /**
26
     * Constructor.
27
     *
28
     * @param string $path
29
     */
30 9 View Code Duplication
    public function __construct($path)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
31
    {
32 9
        parent::__construct($path);
33 9
        for ($i = 0; $i < 100; ++$i) {
34 9
            $segment = $this->path . '/' . sprintf($this->segmentName, $i);
35 9
            if (file_exists($segment)) {
36 9
                $this->segments[] = (array) include $segment;
37 9
            }
38 9
        }
39 9
    }
40
41
    /**
42
     * Load dict.
43
     *
44
     * @param Closure $callback
45
     */
46 9
    public function map(Closure $callback)
47
    {
48 9
        foreach ($this->segments as $dictionary) {
49 9
            $callback($dictionary);
50 9
        }
51
52 9
    }
53
}
54