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.

Code Duplication    Length = 52-53 lines in 2 locations

src/Locator/EnvDirectoryLocator.php 1 location

@@ 22-73 (lines=52) @@
19
/**
20
 * @author Théo FIDRY <[email protected]>
21
 */
22
final class EnvDirectoryLocator implements FixtureLocatorInterface
23
{
24
    use NotClonableTrait;
25
26
    /**
27
     * @var string
28
     */
29
    private $fixturesPath;
30
31
    /**
32
     * @param string $fixturePath Path to which to look for fixtures relative to the bundle path.
33
     */
34
    public function __construct(string $fixturePath)
35
    {
36
        $this->fixturesPath = $fixturePath;
37
    }
38
39
    /**
40
     * Locate fixture files found inside a folder matching the environment name.
41
     *
42
     * For example, if the given fixture path is 'Resources/fixtures', it will try to locate
43
     * the files in the 'Resources/fixtures/dev' for each bundle passed ('dev' being the
44
     * environment).
45
     *
46
     * {@inheritdoc}
47
     */
48
    public function locateFiles(array $bundles, string $environment): array
49
    {
50
        $fixtureFiles = [];
51
        foreach ($bundles as $bundle) {
52
            $fixtureFiles = $fixtureFiles + $this->locateBundleFiles($bundle, $environment);
53
        }
54
55
        return $fixtureFiles;
56
    }
57
58
    private function locateBundleFiles(BundleInterface $bundle, string $environment): array
59
    {
60
        $path = sprintf('%s/%s/%s', $bundle->getPath(), $this->fixturesPath, $environment);
61
        if (false === file_exists($path)) {
62
            return [];
63
        }
64
65
        $files = SymfonyFinder::create()->files()->in($path)->name('/.*\.(ya?ml|php)$/i');
66
        $fixtureFiles = [];
67
        foreach ($files as $file) {
68
            $fixtureFiles[$file->getRealPath()] = true;
69
        }
70
71
        return array_keys($fixtureFiles);
72
    }
73
}
74

src/Locator/EnvFilesLocator.php 1 location

@@ 22-74 (lines=53) @@
19
/**
20
 * @author Théo FIDRY <[email protected]>
21
 */
22
final class EnvFilesLocator implements FixtureLocatorInterface
23
{
24
    use NotClonableTrait;
25
26
    /**
27
     * @var string
28
     */
29
    private $fixturesPath;
30
31
    /**
32
     * @param string $fixturePath Path to which to look for fixtures relative to the bundle path.
33
     */
34
    public function __construct(string $fixturePath)
35
    {
36
        $this->fixturesPath = $fixturePath;
37
    }
38
39
    /**
40
     * Locate fixture files found matching the environment name.
41
     *
42
     * For example, if the given fixture path is 'Resources/fixtures', it will try to locate
43
     * the files in the 'Resources/fixtures/*.dev.yml' for each bundle passed ('dev' being the
44
     * environment).
45
     *
46
     * {@inheritdoc}
47
     */
48
    public function locateFiles(array $bundles, string $environment): array
49
    {
50
        $fixtureFiles = [];
51
        foreach ($bundles as $bundle) {
52
            $fixtureFiles = $fixtureFiles + $this->locateBundleFiles($bundle, $environment);
53
        }
54
55
        return $fixtureFiles;
56
    }
57
58
    private function locateBundleFiles(BundleInterface $bundle, string $environment): array
59
    {
60
        $path = sprintf('%s/%s', $bundle->getPath(), $this->fixturesPath);
61
        if (false === file_exists($path)) {
62
            return [];
63
        }
64
65
        $pattern = sprintf('/.*\.%s(\..+)?\.(ya?ml|php)$/i', $environment);
66
        $files = SymfonyFinder::create()->files()->in($path)->name($pattern);
67
        $fixtureFiles = [];
68
        foreach ($files as $file) {
69
            $fixtureFiles[$file->getRealPath()] = true;
70
        }
71
72
        return array_keys($fixtureFiles);
73
    }
74
}
75