Completed
Pull Request — master (#23)
by Vitaliy
03:07
created

ExampleMessageForm   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 23
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B isValid() 0 16 5
1
<?php
2
3
  namespace Tests\Fiv\Form\Fixtures;
4
5
  use Fiv\Form\Form;
6
7
  /**
8
   *
9
   */
10
  class ExampleMessageForm extends Form {
11
12
    /**
13
     * @return bool
14
     */
15
    public function isValid() {
16
      if (!parent::isValid()) {
17
        return false;
18
      }
19
20
      if (
21
        $this->getElements()['emailFrom']->getValue() == '[email protected]'
22
        and $this->getElements()['emailTo']->getValue() == '[email protected]'
23
        and $this->getElements()['message']->getValue() == 'copy message text'
24
      ) {
25
        $this->validationResult = false;
26
        $this->addError('message duplicate error');
27
      }
28
29
      return $this->validationResult;
30
    }
31
32
  }