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 = 70-71 lines in 2 locations

src/Framework/Repository/Generators/PresenterGenerator.php 1 location

@@ 5-75 (lines=71) @@
2
3
namespace Milkmeowo\Framework\Repository\Generators;
4
5
class PresenterGenerator extends Generator
6
{
7
    /**
8
     * Get stub name.
9
     *
10
     * @var string
11
     */
12
    protected $stub = 'presenter/presenter';
13
14
    /**
15
     * Get root namespace.
16
     *
17
     * @return string
18
     */
19
    public function getRootNamespace()
20
    {
21
        return parent::getRootNamespace().parent::getConfigGeneratorClassPath($this->getPathConfigNode());
22
    }
23
24
    /**
25
     * Get generator path config node.
26
     *
27
     * @return string
28
     */
29
    public function getPathConfigNode()
30
    {
31
        return 'presenters';
32
    }
33
34
    /**
35
     * Get array replacements.
36
     *
37
     * @return array
38
     */
39
    public function getReplacements()
40
    {
41
        $transformerGenerator = new TransformerGenerator([
42
            'name' => $this->name,
43
        ]);
44
        $transformer = $transformerGenerator->getRootNamespace().'\\'.$transformerGenerator->getName().'Transformer';
45
        $transformer = str_replace([
46
            '\\',
47
            '/',
48
        ], '\\', $transformer);
49
        echo $transformer;
50
51
        return array_merge(parent::getReplacements(), [
52
            'transformer' => $transformer,
53
        ]);
54
    }
55
56
    /**
57
     * Get destination path for generated file.
58
     *
59
     * @return string
60
     */
61
    public function getPath()
62
    {
63
        return $this->getBasePath().'/'.parent::getConfigGeneratorClassPath($this->getPathConfigNode(), true).'/'.$this->getName().'Presenter.php';
64
    }
65
66
    /**
67
     * Get base path of destination file.
68
     *
69
     * @return string
70
     */
71
    public function getBasePath()
72
    {
73
        return config('repository.generator.basePath', app()->path());
74
    }
75
}
76

src/Framework/Repository/Generators/TransformerGenerator.php 1 location

@@ 5-74 (lines=70) @@
2
3
namespace Milkmeowo\Framework\Repository\Generators;
4
5
class TransformerGenerator extends Generator
6
{
7
    /**
8
     * Get stub name.
9
     *
10
     * @var string
11
     */
12
    protected $stub = 'transformer/transformer';
13
14
    /**
15
     * Get root namespace.
16
     *
17
     * @return string
18
     */
19
    public function getRootNamespace()
20
    {
21
        return parent::getRootNamespace().parent::getConfigGeneratorClassPath($this->getPathConfigNode());
22
    }
23
24
    /**
25
     * Get generator path config node.
26
     *
27
     * @return string
28
     */
29
    public function getPathConfigNode()
30
    {
31
        return 'transformers';
32
    }
33
34
    /**
35
     * Get destination path for generated file.
36
     *
37
     * @return string
38
     */
39
    public function getPath()
40
    {
41
        return $this->getBasePath().'/'.parent::getConfigGeneratorClassPath($this->getPathConfigNode(), true).'/'.$this->getName().'Transformer.php';
42
    }
43
44
    /**
45
     * Get base path of destination file.
46
     *
47
     * @return string
48
     */
49
    public function getBasePath()
50
    {
51
        return config('repository.generator.basePath', app()->path());
52
    }
53
54
    /**
55
     * Get array replacements.
56
     *
57
     * @return array
58
     */
59
    public function getReplacements()
60
    {
61
        $modelGenerator = new ModelGenerator([
62
            'name' => $this->name,
63
        ]);
64
        $model = $modelGenerator->getRootNamespace().'\\'.$modelGenerator->getName();
65
        $model = str_replace([
66
            '\\',
67
            '/',
68
        ], '\\', $model);
69
70
        return array_merge(parent::getReplacements(), [
71
            'model' => $model,
72
        ]);
73
    }
74
}
75