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
Pull Request — master (#11)
by
unknown
06:26
created

Index::isValid()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/**
3
 * Created by ToOR.
4
 * Date: 10/05/17
5
 * Time: 17:17
6
 * Email: [email protected]
7
 */
8
9
namespace DoctrineElastic\Mapping;
10
11
12
use Doctrine\ORM\Mapping\Annotation;
13
14
/**
15
 * Represents a index for entity
16
 *
17
 * @author ToOR
18
 *
19
 * @Annotation
20
 * @Target("CLASS")
21
 */
22
class Index implements Annotation
23
{
24
    /** @var  string */
25
    public $name;
26
27
    /** @var  string */
28
    public $translogDurability;
29
30
    /** @var  string */
31
    public $translogSyncInterval;
32
33
    /** @var  string */
34
    public $translogFlushThreshouldSize;
35
36
    /** @var  string */
37
    public $refreshInterval;
38
39
    /**
40
     * @return string
41
     */
42
    public function getName()
43
    {
44
        return $this->name;
45
    }
46
47
    /**
48
     * @param string $name
49
     * @return Index
50
     */
51
    public function setName($name)
52
    {
53
        $this->name = $name;
54
        return $this;
55
    }
56
57
    /**
58
     * @return string
59
     */
60
    public function getTranslogDurability()
61
    {
62
        return $this->translogDurability;
63
    }
64
65
    /**
66
     * @param string $translogDurability
67
     * @return Index
68
     */
69
    public function setTranslogDurability($translogDurability)
70
    {
71
        $this->translogDurability = $translogDurability;
72
        return $this;
73
    }
74
75
    /**
76
     * @return string
77
     */
78
    public function getTranslogSyncInterval()
79
    {
80
        return $this->translogSyncInterval;
81
    }
82
83
    /**
84
     * @param string $translogSyncInterval
85
     * @return Index
86
     */
87
    public function setTranslogSyncInterval($translogSyncInterval)
88
    {
89
        $this->translogSyncInterval = $translogSyncInterval;
90
        return $this;
91
    }
92
93
    /**
94
     * @return string
95
     */
96
    public function getTranslogFlushThreshouldSize()
97
    {
98
        return $this->translogFlushThreshouldSize;
99
    }
100
101
    /**
102
     * @param string $translogFlushThreshouldSize
103
     * @return Index
104
     */
105
    public function setTranslogFlushThreshouldSize($translogFlushThreshouldSize)
106
    {
107
        $this->translogFlushThreshouldSize = $translogFlushThreshouldSize;
108
        return $this;
109
    }
110
111
    public function isValid()
112
    {
113
        return is_string($this->name);
114
    }
115
116 View Code Duplication
    public function getErrorMessage() {
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...
117
        $baseMessage = "'%s' property wasn't set in %s annotation";
118
119
        if (!is_string($this->name)) {
120
            return sprintf($baseMessage, 'name', get_class($this));
121
        }
122
123
        return null;
124
    }
125
126
    public function getArrayCopy() {
127
        return [
128
            'name'     => $this->name,
129
            'settings' => [
130
                'index' => [
131
                    'refresh_interval' => $this->refreshInterval,
132
                    'index.translog.durability' => $this->translogDurability,
133
                    'index.translog.sync_interval' => $this->translogSyncInterval,
134
                    'index.translog.flush_threshold_size' => $this->translogFlushThreshouldSize
135
                ]
136
            ]
137
        ];
138
    }
139
}