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 ( d7e77a...de0430 )
by Beñat
04:49
created

Hooks::rootDir()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the CS library.
5
 *
6
 * Copyright (c) 2015-present LIN3S <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace LIN3S\CS\Composer;
13
14
use LIN3S\CS\Application;
15
use LIN3S\CS\Checker\EsLint;
16
use LIN3S\CS\Checker\PhpCsFixer;
17
use LIN3S\CS\Checker\ScssLint;
18
use Symfony\Component\Filesystem\Filesystem;
19
20
/**
21
 * @author Beñat Espiña <[email protected]>
22
 */
23
final class Hooks
24
{
25 View Code Duplication
    public static function addHooks()
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...
26
    {
27
        $hooksDirectory = self::rootDir() . '/.git/hooks';
28
        $fileSystem = new Filesystem();
29
30
        try {
31
            if ($fileSystem->exists($hooksDirectory)) {
32
                $fileSystem->remove($hooksDirectory);
33
            }
34
            $fileSystem->symlink(__DIR__ . '/../Hooks', $hooksDirectory, true);
35
        } catch (\Exception $exception) {
36
            echo sprintf("Something wrong happens during the symlink process: \n%s\n", $exception->getMessage());
37
        }
38
    }
39
40 View Code Duplication
    public static function buildDistFile()
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...
41
    {
42
        $distFile = self::rootDir() . '/.lin3s_cs.yml.dist';
43
        $fileSystem = new Filesystem();
44
45
        try {
46
            if ($fileSystem->exists($distFile)) {
47
                return;
48
            }
49
            $fileSystem->copy(self::lin3sCsRootDir() . '/.lin3s_cs.yml.dist', $distFile);
50
        } catch (\Exception $exception) {
51
            echo sprintf("Something wrong happens during the touch process: \n%s\n", $exception->getMessage());
52
        }
53
    }
54
55
    public static function addFiles()
56
    {
57
        $app = new Application();
58
        ScssLint::file($app->parameters());
59
        EsLint::file($app->parameters());
60
        PhpCsFixer::file($app->parameters());
61
62
        $editorConfig = self::rootDir() . '/.editorconfig';
63
        $fileSystem = new Filesystem();
64
65
        try {
66
            $fileSystem->remove($editorConfig);
67
            $fileSystem->symlink(self::lin3sCsRootDir() . '/.editorconfig', $editorConfig, true);
68
        } catch (\Exception $exception) {
69
            echo sprintf("Something wrong happens during the symlink process: \n%s\n", $exception->getMessage());
70
        }
71
    }
72
73
    private function rootDir()
74
    {
75
        return __DIR__ . '/../../../../../../..';
76
    }
77
78
    private function lin3sCsRootDir()
79
    {
80
        return __DIR__ . '/../..';
81
    }
82
}
83