Code Duplication    Length = 30-30 lines in 2 locations

src/Validator/DecisionTableValidator.php 2 locations

@@ 132-161 (lines=30) @@
129
    /**
130
     * @return void
131
     */
132
    private function validateInputs()
133
    {
134
        if (empty($this->builder->getInputs()) === true) {
135
            $this->errors[] = 'at least one input is required';
136
            return;
137
        }
138
        
139
        $i = 1;
140
        foreach ($this->builder->getInputs() as $input) {
141
            if (empty($input->getLabel()) === true) {
142
                $this->errors[] = sprintf('input no. %s: label is required', (string) $i);
143
            }
144
            
145
            if (empty($input->getName()) === true) {
146
                $this->errors[] = sprintf('input no. %s: name is required', (string) $i);
147
            }
148
            
149
            if (empty($input->getType()) === true) {
150
                $this->errors[] = sprintf('input no. %s: type is required', (string) $i);
151
            } else if (in_array($input->getType(), VariableType::ALLOWED_VARIABLE_TYPES) === false) {
152
                $this->errors[] = sprintf(
153
                    'input no. %s: type must be one of: %s',
154
                    (string) $i,
155
                    implode(', ', VariableType::ALLOWED_VARIABLE_TYPES)
156
                );
157
            }
158
            
159
            $i++;
160
        }
161
    }
162
163
    /**
164
     * @return void
@@ 166-195 (lines=30) @@
163
    /**
164
     * @return void
165
     */
166
    private function validateOutputs()
167
    {
168
        if (empty($this->builder->getOutputs()) === true) {
169
            $this->errors[] = 'at least one output is required';
170
            return;
171
        }
172
        
173
        $i = 1;
174
        foreach ($this->builder->getOutputs() as $output) {
175
            if (empty($output->getLabel()) === true) {
176
                $this->errors[] = sprintf('output no. %s: label is required', (string) $i);
177
            }
178
            
179
            if (empty($output->getName()) === true) {
180
                $this->errors[] = sprintf('output no. %s: name is required', (string) $i);
181
            }
182
            
183
            if (empty($output->getType()) === true) {
184
                $this->errors[] = sprintf('output no. %s: type is required', (string) $i);
185
            } else if (in_array($output->getType(), VariableType::ALLOWED_VARIABLE_TYPES) === false) {
186
                $this->errors[] = sprintf(
187
                    'output no. %s: type must be one of: %s',
188
                    (string) $i,
189
                    implode(', ', VariableType::ALLOWED_VARIABLE_TYPES)
190
                );
191
            }
192
            
193
            $i++;
194
        }
195
    }
196
197
    /**
198
     * @return void