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

SelectLanguage::__construct()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 15
Code Lines 10

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 15
rs 9.4285
cc 3
eloc 10
nc 3
nop 4
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