Passed
Push — 1.10.x ( e22269...acc912 )
by
unknown
49:56
created

SelectLanguage   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 21
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 15 3
1
<?php
2
/* For licensing terms, see /license.txt */
3
4
/**
5
* A dropdownlist with all languages to use with QuickForm
6
*/
7
class SelectLanguage extends HTML_QuickForm_select
8
{
9
	/**
10
	 * Class constructor
11
	 */
12
    public function __construct($elementName = null, $elementLabel = null, $options = null, $attributes = null)
13
	{
14
		parent::__construct($elementName, $elementLabel, $options, $attributes);
15
		// Get all languages
16
		$languages = api_get_languages();
17
		$this->_options = array();
18
		$this->_values = array();
0 ignored issues
show
Documentation Bug introduced by
It seems like array() of type array is incompatible with the declared type string of property $_values.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
19
		foreach ($languages['name'] as $index => $name) {
20
			if($languages['folder'][$index] == api_get_setting('platformLanguage')) {
21
				$this->addOption($name,$languages['folder'][$index],array('selected'=>'selected'));
22
			} else {
23
				$this->addOption($name,$languages['folder'][$index]);
24
			}
25
		}
26
	}
27
}
28