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 0%

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 0
cts 14
cp 0
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
    public function render() {
16
      $html = '<select ' . Html::renderAttributes($this->getAttributes()) . ' >';
17
      $currentValue = $this->getValue();
18
19
      foreach ($this->options as $value => $text) {
20
        $html .= '<option'
21
          . ($currentValue == $value ? ' selected="1" ' : '')
22
          . ' value="' . $value . '"'
23
          . '>'
24
          . $text
25
          . '</option>';
26
      }
27
      $html .= '</select>';
28
      return $html;
29
    }
30
31
  }