Select   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 22
ccs 11
cts 11
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A render() 0 15 3
1
<?php
2
3
  namespace Fiv\Form\Element;
4
5
  /**
6
   * Generate <select></select> html tag
7
   *
8
   * @author Ivan Shcherbak <[email protected]>
9
   */
10
  class Select extends Multiple {
11
12
    /**
13
     * @return string
14
     */
15 1
    public function render() {
16 1
      $html = '<select ' . Html::renderAttributes($this->getAttributes()) . ' >';
17 1
      $currentValue = $this->getValue();
18
19 1
      foreach ($this->options as $value => $text) {
20
        $html .= '<option'
21 1
          . ($currentValue == $value ? ' selected="1" ' : '')
22 1
          . ' value="' . $value . '"'
23 1
          . '>'
24 1
          . $text
25 1
          . '</option>';
26
      }
27 1
      $html .= '</select>';
28 1
      return $html;
29
    }
30
31
  }