Completed
Push — master ( 76e8cc...c0fccf )
by GIT
44:13 queued 24:08
created
tests/bootstrap.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,23 +1,23 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( PHP_SAPI !== 'cli' ) {
4
-	die( 'Not an entry point' );
3
+if (PHP_SAPI !== 'cli') {
4
+	die('Not an entry point');
5 5
 }
6 6
 
7
-error_reporting( E_ALL | E_STRICT );
8
-date_default_timezone_set( 'UTC' );
9
-ini_set( 'display_errors', 1 );
7
+error_reporting(E_ALL | E_STRICT);
8
+date_default_timezone_set('UTC');
9
+ini_set('display_errors', 1);
10 10
 
11 11
 global $IP;
12 12
 
13 13
 //if ( !is_readable( $autoloaderClassPath = __DIR__ . '/../../SemanticMediaWiki/tests/autoloader.php' ) ) {
14
-if ( !is_readable( $autoloaderClassPath = $IP . '/extensions/SemanticMediaWiki/tests/autoloader.php' ) ) {
15
-	die( "\nThe Semantic MediaWiki test autoloader is not available\n" );
14
+if (!is_readable($autoloaderClassPath = $IP.'/extensions/SemanticMediaWiki/tests/autoloader.php')) {
15
+	die("\nThe Semantic MediaWiki test autoloader is not available\n");
16 16
 }
17 17
 
18 18
 // if ( !class_exists( 'SemanticFormsSelect' ) || ( $version = SemanticFormsSelect::getVersion() ) === null ) {
19
-if ( ExtensionRegistry::getInstance()->isLoaded( 'SemanticFormsSelect' ) ) {
20
-	die( "\nSemantic Forms Select is not available, please check your Composer or LocalSettings.\n" );
19
+if (ExtensionRegistry::getInstance()->isLoaded('SemanticFormsSelect')) {
20
+	die("\nSemantic Forms Select is not available, please check your Composer or LocalSettings.\n");
21 21
 }
22 22
 
23 23
 //print sprintf( "\n%-20s%s\n", "Semantic Forms Select: ", ExtensionRegistry::getInstance()->isLoaded( 'SemanticFormsSelect' ) );
@@ -26,4 +26,4 @@  discard block
 block discarded – undo
26 26
 $autoloader = require $autoloaderClassPath;
27 27
 //$autoloader->addPsr4( 'SFS\\Tests\\', __DIR__ . '/phpunit/Unit' );
28 28
 //$autoloader->addPsr4( 'SFS\\Tests\\Integration\\', __DIR__ . '/phpunit/Integration' );
29
-unset( $autoloader );
29
+unset($autoloader);
Please login to merge, or discard this patch.
tests/phpunit/Unit/ApiSemanticFormsSelectRequestProcessorTest.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	) {
67 67
 
68 68
 		$parameters = [ 'approach' => 'smw', 'query' => 'foo, baa, gaah',
69
-		                     'sep'      => ',' ];
69
+							 'sep'      => ',' ];
70 70
 
71 71
 		$this->assertInternalType(
72 72
 			'object',
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	public function testSetDebugFlag_doProcessQueryFor() {
92 92
 		$this->ApiSFSRP->setDebugFlag( true );
93 93
 		$parameters = [ 'approach' => 'smw', 'query' => 'my Query,query2',
94
-		                     'sep'      => ',' ];
94
+							 'sep'      => ',' ];
95 95
 
96 96
 		$this->assertInternalType(
97 97
 			'object',
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -24,13 +24,13 @@  discard block
 block discarded – undo
24 24
 
25 25
 	protected function setUp(): void {
26 26
 		parent::setUp();
27
-		$parser = $this->getMockBuilder( '\Parser' )
27
+		$parser = $this->getMockBuilder('\Parser')
28 28
 			->disableOriginalConstructor()->getMock();
29
-		$this->ApiSFSRP = new ApiSemanticFormsSelectRequestProcessor( $parser );
29
+		$this->ApiSFSRP = new ApiSemanticFormsSelectRequestProcessor($parser);
30 30
 	}
31 31
 
32 32
 	protected function tearDown(): void {
33
-		unset( $this->ApiSFSRP );
33
+		unset($this->ApiSFSRP);
34 34
 		parent::tearDown();
35 35
 	}
36 36
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 
45 45
 		$parameters = [];
46 46
 
47
-		$this->setExpectedException( 'InvalidArgumentException' );
47
+		$this->setExpectedException('InvalidArgumentException');
48 48
 		$this->ApiSFSRP->getJsonDecodedResultValuesForRequestParameters(
49 49
 			$parameters
50 50
 		);
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
 	public function testJsonResultValuesFromRequestParameters() {
54 54
 
55
-		$parameters = [ 'query' => 'foo', 'sep' => ',' ];
55
+		$parameters = ['query' => 'foo', 'sep' => ','];
56 56
 
57 57
 		$this->assertInternalType(
58 58
 			'object',
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
 	public function testJsonResultValuesFromRequestParameters_doProcessQueryFor(
66 66
 	) {
67 67
 
68
-		$parameters = [ 'approach' => 'smw', 'query' => 'foo, baa, gaah',
69
-		                     'sep'      => ',' ];
68
+		$parameters = ['approach' => 'smw', 'query' => 'foo, baa, gaah',
69
+		                     'sep'      => ','];
70 70
 
71 71
 		$this->assertInternalType(
72 72
 			'object',
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
 	}
78 78
 
79 79
 	public function testSetDebugFlag() {
80
-		$this->ApiSFSRP->setDebugFlag( true );
81
-		$parameters = [ 'query' => 'foo , function', 'sep' => ',' ];
80
+		$this->ApiSFSRP->setDebugFlag(true);
81
+		$parameters = ['query' => 'foo , function', 'sep' => ','];
82 82
 
83 83
 		$this->assertInternalType(
84 84
 			'object',
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
 	}
90 90
 
91 91
 	public function testSetDebugFlag_doProcessQueryFor() {
92
-		$this->ApiSFSRP->setDebugFlag( true );
93
-		$parameters = [ 'approach' => 'smw', 'query' => 'my Query,query2',
94
-		                     'sep'      => ',' ];
92
+		$this->ApiSFSRP->setDebugFlag(true);
93
+		$parameters = ['approach' => 'smw', 'query' => 'my Query,query2',
94
+		                     'sep'      => ','];
95 95
 
96 96
 		$this->assertInternalType(
97 97
 			'object',
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
 	public function testGetFormattedValuesFrom() {
105 105
 		$sep = ",";
106 106
 		$values = "my Query,query2";
107
-		$result = [ "", "my Query", "query2" ];
107
+		$result = ["", "my Query", "query2"];
108 108
 		$formattedValues = $this->invokeMethod(
109
-			$this->ApiSFSRP, 'getFormattedValuesFrom', [ $sep, $values ]
109
+			$this->ApiSFSRP, 'getFormattedValuesFrom', [$sep, $values]
110 110
 		);
111
-		$this->assertEquals( $result, $formattedValues );
111
+		$this->assertEquals($result, $formattedValues);
112 112
 	}
113 113
 
114 114
 	/**
@@ -120,14 +120,14 @@  discard block
 block discarded – undo
120 120
 	 *
121 121
 	 * @return mixed Method return.
122 122
 	 */
123
-	public function invokeMethod( &$object, $methodName,
123
+	public function invokeMethod(&$object, $methodName,
124 124
 		array $parameters = []
125 125
 	) {
126
-		$reflection = new \ReflectionClass( get_class( $object ) );
127
-		$method = $reflection->getMethod( $methodName );
128
-		$method->setAccessible( true );
126
+		$reflection = new \ReflectionClass(get_class($object));
127
+		$method = $reflection->getMethod($methodName);
128
+		$method->setAccessible(true);
129 129
 
130
-		return $method->invokeArgs( $object, $parameters );
130
+		return $method->invokeArgs($object, $parameters);
131 131
 	}
132 132
 
133 133
 
Please login to merge, or discard this patch.
tests/phpunit/Unit/SemanticFormsSelectInputTest.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
 		$isDisabled = false;
27 27
 
28 28
 		$otherArgs = [ 'template' => 'Foo', 'field' => '',
29
-		                    'function' => 'Bar', 'is_list' => true ];
29
+							'function' => 'Bar', 'is_list' => true ];
30 30
 
31 31
 		$parserOutput = $this->getMockBuilder( '\ParserOutput' )
32 32
 			->disableOriginalConstructor()->getMock();
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -25,17 +25,17 @@  discard block
 block discarded – undo
25 25
 		$isMandatory = false;
26 26
 		$isDisabled = false;
27 27
 
28
-		$otherArgs = [ 'template' => 'Foo', 'field' => '',
29
-		                    'function' => 'Bar', 'is_list' => true ];
28
+		$otherArgs = ['template' => 'Foo', 'field' => '',
29
+		                    'function' => 'Bar', 'is_list' => true];
30 30
 
31
-		$parserOutput = $this->getMockBuilder( '\ParserOutput' )
31
+		$parserOutput = $this->getMockBuilder('\ParserOutput')
32 32
 			->disableOriginalConstructor()->getMock();
33 33
 
34
-		$parser = $this->getMockBuilder( '\Parser' )
34
+		$parser = $this->getMockBuilder('\Parser')
35 35
 			->disableOriginalConstructor()->getMock();
36 36
 
37
-		$parser->expects( $this->any() )->method( 'getOutput' )->will(
38
-				$this->returnValue( $parserOutput )
37
+		$parser->expects($this->any())->method('getOutput')->will(
38
+				$this->returnValue($parserOutput)
39 39
 			);
40 40
 		$this->SFSInput = new SemanticFormsSelectInput(
41 41
 			$value, $inputName, $isMandatory, $isDisabled, $otherArgs
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	}
44 44
 
45 45
 	protected function tearDown(): void {
46
-		unset( $this->SelectField );
46
+		unset($this->SelectField);
47 47
 		parent::tearDown();
48 48
 	}
49 49
 
@@ -70,14 +70,14 @@  discard block
 block discarded – undo
70 70
 
71 71
 	public function testGetParameters() {
72 72
 
73
-		$this->assertInternalType( 'array', $this->SFSInput->getParameters() );
73
+		$this->assertInternalType('array', $this->SFSInput->getParameters());
74 74
 	}
75 75
 
76 76
 
77 77
 	public function testGetResourceModuleNames() {
78
-		$rsmn = [ 'ext.sf_select.scriptselect' ];
78
+		$rsmn = ['ext.sf_select.scriptselect'];
79 79
 
80
-		$this->assertEquals( $rsmn, $this->SFSInput->getResourceModuleNames() );
80
+		$this->assertEquals($rsmn, $this->SFSInput->getResourceModuleNames());
81 81
 	}
82 82
 
83 83
 }
Please login to merge, or discard this patch.
src/Output.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	 *
27 27
 	 * @param array $data
28 28
 	 */
29
-	public static function addToHeadItem( Array $data = [] ) {
29
+	public static function addToHeadItem(Array $data = []) {
30 30
 		return self::$headItems[] = $data;
31 31
 	}
32 32
 
@@ -35,11 +35,11 @@  discard block
 block discarded – undo
35 35
 	 *
36 36
 	 */
37 37
 	public static function commitToParserOutput() {
38
-		global $wgOut;	# is there a better way to get $output/$parser without using a global? (testability!)
38
+		global $wgOut; # is there a better way to get $output/$parser without using a global? (testability!)
39 39
 
40 40
 		// to be used in JS like:
41 41
 		// var SFSelect_fobjs = $.parseJSON( mw.config.get( 'sf_select' ) );
42
-		$wgOut->addJsConfigVars('sf_select', json_encode( self::$headItems ));
42
+		$wgOut->addJsConfigVars('sf_select', json_encode(self::$headItems));
43 43
 
44 44
 		//self::$resourceModules = array();
45 45
 		//self::$headItems = array();
Please login to merge, or discard this patch.
SemanticFormsSelect.hooks.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -16,14 +16,14 @@  discard block
 block discarded – undo
16 16
 	 * @param $parser Parser
17 17
 	 * @return bool
18 18
 	 */
19
-	public static function onSemanticFormsSelectSetup ( & $parser ) {
19
+	public static function onSemanticFormsSelectSetup(& $parser) {
20 20
 
21
-		if ( !defined( 'PF_VERSION' ) ) {
22
-			die( '<b>Error:</b><a href="https://github.com/SemanticMediaWiki/SemanticFormsSelect/">Semantic Forms Select</a> requires the <a href="https://www.mediawiki.org/wiki/Extension:PageForms">Page Forms</a> extension. Please install and activate this extension first.' );
21
+		if (!defined('PF_VERSION')) {
22
+			die('<b>Error:</b><a href="https://github.com/SemanticMediaWiki/SemanticFormsSelect/">Semantic Forms Select</a> requires the <a href="https://www.mediawiki.org/wiki/Extension:PageForms">Page Forms</a> extension. Please install and activate this extension first.');
23 23
 		}
24 24
 
25
-		if ( isset( $GLOBALS['wgPageFormsFormPrinter'] ) ) {
26
-			$GLOBALS['wgPageFormsFormPrinter']->registerInputType( \SFS\SemanticFormsSelectInput::class );
25
+		if (isset($GLOBALS['wgPageFormsFormPrinter'])) {
26
+			$GLOBALS['wgPageFormsFormPrinter']->registerInputType(\SFS\SemanticFormsSelectInput::class);
27 27
 		}
28 28
 
29 29
 		return true;
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	
32 32
 	public static function onRegistration() {
33 33
 
34
-		if ( isset( $GLOBALS['wgAPIModules'] ) ) {
34
+		if (isset($GLOBALS['wgAPIModules'])) {
35 35
 			$GLOBALS['wgAPIModules']['sformsselect'] = \SFS\ApiSemanticFormsSelect::class;
36 36
 		}
37 37
 	}
Please login to merge, or discard this patch.
src/SelectField.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	private $mValues = null;
22 22
 	private $mHasStaticValues = false;
23 23
 
24
-	private $mData = [];    # array with all parameters
24
+	private $mData = []; # array with all parameters
25 25
 	private $mQuery = "";
26 26
 	private $mFunction = "";
27 27
 	private $mSelectIsMultiple = false;
@@ -33,18 +33,18 @@  discard block
 block discarded – undo
33 33
 	private $mLabel = false;
34 34
 	private $mDelimiter = ",";
35 35
 
36
-	public function __construct( & $parser ) {
36
+	public function __construct(& $parser) {
37 37
 		$this->mParser = $parser;
38 38
 	}
39 39
 
40 40
 	/**
41 41
 	 * Convenience function to process all parameters at once
42 42
 	 */
43
-	public function processParameters( $input_name = "", $other_args ) {
44
-		if ( array_key_exists( "query", $other_args ) ) {
45
-			$this->setQuery( $other_args );
46
-		} elseif ( array_key_exists( "function", $other_args ) ) {
47
-			$this->setFunction( $other_args );
43
+	public function processParameters($input_name = "", $other_args) {
44
+		if (array_key_exists("query", $other_args)) {
45
+			$this->setQuery($other_args);
46
+		} elseif (array_key_exists("function", $other_args)) {
47
+			$this->setFunction($other_args);
48 48
 		}
49 49
 	}
50 50
 
@@ -57,88 +57,88 @@  discard block
 block discarded – undo
57 57
 		return $this->mData;
58 58
 	}
59 59
 
60
-	public function setQuery( $other_args ) {
60
+	public function setQuery($other_args) {
61 61
 		$querystr = $other_args["query"];
62
-		$querystr = str_replace( [ "~", "(", ")" ], [ "=", "[", "]" ], $querystr );
62
+		$querystr = str_replace(["~", "(", ")"], ["=", "[", "]"], $querystr);
63 63
 
64 64
 		//$this->mSelectField["query"] = $query;
65 65
 		$this->mQuery = $querystr;
66 66
 		$this->mData['selectquery'] = $querystr;
67 67
 
68 68
 		// unparametrized query
69
-		if ( strpos( $querystr, '@@@@' ) === false ) {
70
-			$rawparams = explode( ";", $querystr );
69
+		if (strpos($querystr, '@@@@') === false) {
70
+			$rawparams = explode(";", $querystr);
71 71
 
72 72
 			// there is no need to run the parser, $query has been parsed already
73 73
 			//$params[0] = $wgParser->replaceVariables( $params[0] );
74 74
 
75
-			list( $query, $params ) = QueryProcessor::getQueryAndParamsFromFunctionParams( $rawparams, SMW_OUTPUT_WIKI, QueryProcessor::INLINE_QUERY, false );
75
+			list($query, $params) = QueryProcessor::getQueryAndParamsFromFunctionParams($rawparams, SMW_OUTPUT_WIKI, QueryProcessor::INLINE_QUERY, false);
76 76
 			
77
-			$result = QueryProcessor::getResultFromQuery( $query, $params, SMW_OUTPUT_WIKI, QueryProcessor::INLINE_QUERY );
77
+			$result = QueryProcessor::getResultFromQuery($query, $params, SMW_OUTPUT_WIKI, QueryProcessor::INLINE_QUERY);
78 78
 		
79
-			$this->mValues = $this->getFormattedValuesFrom( $this->mDelimiter, $result );
79
+			$this->mValues = $this->getFormattedValuesFrom($this->mDelimiter, $result);
80 80
 		
81
-			$this->setHasStaticValues( true );
81
+			$this->setHasStaticValues(true);
82 82
 		}
83 83
 	}
84 84
 
85
-	public function setFunction( $other_args ) {
85
+	public function setFunction($other_args) {
86 86
 		#global $wgParser;
87 87
 
88 88
 		$function = $other_args["function"];
89
-		$function = '{{#' . $function . '}}';
90
-		$function = str_replace( [ "~", "(", ")" ], [ "=", "[", "]" ], $function );
89
+		$function = '{{#'.$function.'}}';
90
+		$function = str_replace(["~", "(", ")"], ["=", "[", "]"], $function);
91 91
 
92 92
 		//$this->mSelectField["function"] = $function;
93 93
 		$this->mFunction = $function;
94 94
 		$this->mData['selectfunction'] = $function;
95 95
 
96 96
 		// unparametrized function
97
-		if ( strpos( $function, '@@@@' ) === false ) {
98
-			$f = str_replace( ";", "|", $function );
97
+		if (strpos($function, '@@@@') === false) {
98
+			$f = str_replace(";", "|", $function);
99 99
 
100
-			$this->setValues( $this->mParser->replaceVariables( $f ) );
100
+			$this->setValues($this->mParser->replaceVariables($f));
101 101
 
102
-			$this->setHasStaticValues( true );
102
+			$this->setHasStaticValues(true);
103 103
 		}
104 104
 	}
105 105
 
106
-	public function setSelectIsMultiple( Array $other_args ) {
107
-		$this->mSelectIsMultiple = array_key_exists( "part_of_multiple", $other_args );
106
+	public function setSelectIsMultiple(Array $other_args) {
107
+		$this->mSelectIsMultiple = array_key_exists("part_of_multiple", $other_args);
108 108
 		$this->mData["selectismultiple"] = $this->mSelectIsMultiple;
109 109
 	}
110 110
 
111
-	public function setSelectTemplate( $input_name = "" ) {
112
-		$index = strpos( $input_name, "[" );
113
-		$this->mSelectTemplate = substr( $input_name, 0, $index );
111
+	public function setSelectTemplate($input_name = "") {
112
+		$index = strpos($input_name, "[");
113
+		$this->mSelectTemplate = substr($input_name, 0, $index);
114 114
 		$this->mData['selecttemplate'] = $this->mSelectTemplate;
115 115
 	}
116 116
 
117
-	public function setSelectField( $input_name = "" ) {
118
-		$index = strrpos( $input_name, "[" );
119
-		$this->mSelectField = substr( $input_name, $index + 1, strlen( $input_name ) - $index - 2 );
117
+	public function setSelectField($input_name = "") {
118
+		$index = strrpos($input_name, "[");
119
+		$this->mSelectField = substr($input_name, $index + 1, strlen($input_name) - $index - 2);
120 120
 		$this->mData['selectfield'] = $this->mSelectField;
121 121
 	}
122 122
 
123
-	public function setValueTemplate( Array $other_args ) {
123
+	public function setValueTemplate(Array $other_args) {
124 124
 		$this->mValueTemplate =
125
-			array_key_exists( "sametemplate", $other_args ) ? $this->mSelectTemplate : $other_args["template"];
125
+			array_key_exists("sametemplate", $other_args) ? $this->mSelectTemplate : $other_args["template"];
126 126
 		$this->mData["valuetemplate"] = $this->mValueTemplate;
127 127
 	}
128 128
 
129
-	public function setValueField( Array $other_args ) {
129
+	public function setValueField(Array $other_args) {
130 130
 		$this->mValueField = $other_args["field"];
131 131
 		$this->mData["valuefield"] = $this->mValueField;
132 132
 
133 133
 	}
134 134
 
135
-	public function setSelectRemove( Array $other_args ) {
136
-		$this->mSelectRemove = array_key_exists( 'rmdiv', $other_args );
135
+	public function setSelectRemove(Array $other_args) {
136
+		$this->mSelectRemove = array_key_exists('rmdiv', $other_args);
137 137
 		$this->mData['selectrm'] = $this->mSelectRemove;
138 138
 	}
139 139
 
140
-	public function setLabel( Array $other_args ) {
141
-		$this->mLabel = array_key_exists( 'label', $other_args );
140
+	public function setLabel(Array $other_args) {
141
+		$this->mLabel = array_key_exists('label', $other_args);
142 142
 		$this->mData['label'] = $this->mLabel;
143 143
 	}
144 144
 
@@ -146,15 +146,15 @@  discard block
 block discarded – undo
146 146
 	 * setDelimiter
147 147
 	 * @param array $other_args
148 148
 	 */
149
-	public function setDelimiter( Array $other_args ) {
149
+	public function setDelimiter(Array $other_args) {
150 150
 		
151 151
 		$this->mDelimiter = $GLOBALS['wgPageFormsListSeparator'];
152 152
 		
153
-		if ( array_key_exists( 'sep', $other_args ) ) {
153
+		if (array_key_exists('sep', $other_args)) {
154 154
 			$this->mDelimiter = $other_args['sep'];
155 155
 		} else {
156 156
 			// Adding Backcompatibility
157
-			if ( array_key_exists( 'delimiter', $other_args ) ) {
157
+			if (array_key_exists('delimiter', $other_args)) {
158 158
 				$this->mDelimiter = $other_args['delimiter'];
159 159
 			}
160 160
 		}
@@ -174,10 +174,10 @@  discard block
 block discarded – undo
174 174
 	 * setValues
175 175
 	 * @param string $values (comma separated, fully parsed list of values)
176 176
 	 */
177
-	private function setValues( $values ) {
178
-		$values = explode( $this->mDelimiter, $values );
179
-		$values = array_map( "trim", $values );
180
-		$values = array_unique( $values );
177
+	private function setValues($values) {
178
+		$values = explode($this->mDelimiter, $values);
179
+		$values = array_map("trim", $values);
180
+		$values = array_unique($values);
181 181
 		$this->mValues = $values;
182 182
 	}
183 183
 
@@ -185,21 +185,21 @@  discard block
 block discarded – undo
185 185
 		return $this->mHasStaticValues;
186 186
 	}
187 187
 
188
-	private function setHasStaticValues( $StaticValues ) {
188
+	private function setHasStaticValues($StaticValues) {
189 189
 		$this->mHasStaticValues = $StaticValues;
190 190
 	}
191 191
 	
192 192
 	/** Copied from ApiSemanticFormsSelectRequestProcessor */
193 193
 	
194
-	private function getFormattedValuesFrom( $sep, $values ) {
194
+	private function getFormattedValuesFrom($sep, $values) {
195 195
 
196
-		if ( strpos( $values, $sep ) === false ) {
197
-			return [ $values ];
196
+		if (strpos($values, $sep) === false) {
197
+			return [$values];
198 198
 		}
199 199
 
200
-		$values = explode( $sep, $values );
201
-		$values = array_map( "trim", $values );
202
-		$values = array_unique( $values );
200
+		$values = explode($sep, $values);
201
+		$values = array_map("trim", $values);
202
+		$values = array_unique($values);
203 203
 
204 204
 		// TODO: sorting here will destroy any sort defined in the query, e.g. in case sorting for labels (instead of mainlable)
205 205
 		//sort( $values );
Please login to merge, or discard this patch.
src/ApiSemanticFormsSelectRequestProcessor.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	 *
34 34
 	 * @param Parser $parser
35 35
 	 */
36
-	public function __construct( Parser $parser ) {
36
+	public function __construct(Parser $parser) {
37 37
 		$this->parser = $parser;
38 38
 	}
39 39
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	 *
43 43
 	 * @param boolean $debugFlag
44 44
 	 */
45
-	public function setDebugFlag( $debugFlag ) {
45
+	public function setDebugFlag($debugFlag) {
46 46
 		$this->debugFlag = $debugFlag;
47 47
 	}
48 48
 
@@ -53,95 +53,95 @@  discard block
 block discarded – undo
53 53
 	 *
54 54
 	 * @return string
55 55
 	 */
56
-	public function getJsonDecodedResultValuesForRequestParameters( array $parameters ) {
56
+	public function getJsonDecodedResultValuesForRequestParameters(array $parameters) {
57 57
 
58
-		if ( !isset( $parameters['query'] ) || !isset( $parameters['sep'] ) ) {
59
-			throw new InvalidArgumentException( 'Missing an query parameter' );
58
+		if (!isset($parameters['query']) || !isset($parameters['sep'])) {
59
+			throw new InvalidArgumentException('Missing an query parameter');
60 60
 		}
61 61
 
62 62
 		$this->parser->firstCallInit();
63 63
 		$json = [];
64 64
 
65
-		if ( isset( $parameters['approach'] ) && $parameters['approach'] == 'smw' ) {
66
-			$json = $this->doProcessQueryFor( $parameters['query'], $parameters['sep'] );
65
+		if (isset($parameters['approach']) && $parameters['approach'] == 'smw') {
66
+			$json = $this->doProcessQueryFor($parameters['query'], $parameters['sep']);
67 67
 		} else {
68
-			$json = $this->doProcessFunctionFor( $parameters['query'], $parameters['sep'] );
68
+			$json = $this->doProcessFunctionFor($parameters['query'], $parameters['sep']);
69 69
 		}
70 70
 
71 71
 		// I have no idea why we first encode and and then decode here??
72 72
 
73
-		return json_decode( $json );
73
+		return json_decode($json);
74 74
 	}
75 75
 
76
-	private function doProcessQueryFor( $querystr, $sep = "," ) {
76
+	private function doProcessQueryFor($querystr, $sep = ",") {
77 77
 
78 78
 		$querystr = str_replace(
79
-			[ "&lt;", "&gt;", "sep=;" ],
80
-			[ "<", ">", "sep={$sep};" ],
79
+			["&lt;", "&gt;", "sep=;"],
80
+			["<", ">", "sep={$sep};"],
81 81
 			$querystr
82 82
 		);
83 83
 
84
-		$rawparams = explode( ";", $querystr );
85
-		$f = str_replace( ";", "|", $rawparams[0] );
84
+		$rawparams = explode(";", $querystr);
85
+		$f = str_replace(";", "|", $rawparams[0]);
86 86
 
87
-		$rawparams[0] = $this->parser->replaceVariables( $f );
87
+		$rawparams[0] = $this->parser->replaceVariables($f);
88 88
 
89
-		if ( $this->debugFlag ) {
90
-			error_log( implode( "|", $rawparams ) );
89
+		if ($this->debugFlag) {
90
+			error_log(implode("|", $rawparams));
91 91
 		}
92 92
 
93 93
 		
94
-		list( $query, $params ) = QueryProcessor::getQueryAndParamsFromFunctionParams( $rawparams, SMW_OUTPUT_WIKI, QueryProcessor::INLINE_QUERY, false );
94
+		list($query, $params) = QueryProcessor::getQueryAndParamsFromFunctionParams($rawparams, SMW_OUTPUT_WIKI, QueryProcessor::INLINE_QUERY, false);
95 95
 			
96
-		$result = QueryProcessor::getResultFromQuery( $query, $params, SMW_OUTPUT_WIKI, QueryProcessor::INLINE_QUERY );
96
+		$result = QueryProcessor::getResultFromQuery($query, $params, SMW_OUTPUT_WIKI, QueryProcessor::INLINE_QUERY);
97 97
 		
98 98
 		
99
-		$values = $this->getFormattedValuesFrom( $sep, $result );
99
+		$values = $this->getFormattedValuesFrom($sep, $result);
100 100
 
101
-		return json_encode( [
101
+		return json_encode([
102 102
 			"values" => $values,
103
-			"count"  => count( $values )
104
-		] );
103
+			"count"  => count($values)
104
+		]);
105 105
 	}
106 106
 
107
-	private function doProcessFunctionFor( $query, $sep = "," ) {
107
+	private function doProcessFunctionFor($query, $sep = ",") {
108 108
 
109 109
 		$query = str_replace(
110
-			[ "&lt;", "&gt;", "sep=;" ],
111
-			[ "<", ">", "sep={$sep};" ],
110
+			["&lt;", "&gt;", "sep=;"],
111
+			["<", ">", "sep={$sep};"],
112 112
 			$query
113 113
 		);
114 114
 
115
-		$f = str_replace( ";", "|", $query );
115
+		$f = str_replace(";", "|", $query);
116 116
 
117
-		if ( $this->debugFlag ) {
118
-			error_log( $f );
117
+		if ($this->debugFlag) {
118
+			error_log($f);
119 119
 		}
120 120
 
121 121
 		$values = $this->getFormattedValuesFrom(
122 122
 			$sep,
123
-			$this->parser->replaceVariables( $f )
123
+			$this->parser->replaceVariables($f)
124 124
 		);
125 125
 
126
-		return json_encode( [
126
+		return json_encode([
127 127
 			"values" => $values,
128
-			"count"  => count( $values )
129
-		] );
128
+			"count"  => count($values)
129
+		]);
130 130
 	}
131 131
 
132
-	private function getFormattedValuesFrom( $sep, $values ) {
132
+	private function getFormattedValuesFrom($sep, $values) {
133 133
 
134
-		if ( strpos( $values, $sep ) === false ) {
135
-			return [ $values ];
134
+		if (strpos($values, $sep) === false) {
135
+			return [$values];
136 136
 		}
137 137
 
138
-		$values = explode( $sep, $values );
139
-		$values = array_map( "trim", $values );
140
-		$values = array_unique( $values );
138
+		$values = explode($sep, $values);
139
+		$values = array_map("trim", $values);
140
+		$values = array_unique($values);
141 141
 
142 142
 		// TODO: sorting here will destroy any sort defined in the query, e.g. in case sorting for labels (instead of mainlable)
143 143
 		//sort( $values );
144
-		array_unshift( $values, "" );
144
+		array_unshift($values, "");
145 145
 
146 146
 		return $values;
147 147
 	}
Please login to merge, or discard this patch.
src/ApiSemanticFormsSelect.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -25,21 +25,21 @@  discard block
 block discarded – undo
25 25
 	 */
26 26
 	public function execute() {
27 27
 		$parser = $this->getParser();
28
-		$parser->setTitle( Title::newFromText( 'NO TITLE' ) );
28
+		$parser->setTitle(Title::newFromText('NO TITLE'));
29 29
 		$parser->mOptions = new ParserOptions();
30 30
 		$parser->resetOutput();
31 31
 
32
-		$apiRequestProcessor = new \SFS\ApiSemanticFormsSelectRequestProcessor( $parser );
33
-		$apiRequestProcessor->setDebugFlag( $GLOBALS['wgSF_Select_debug'] );
32
+		$apiRequestProcessor = new \SFS\ApiSemanticFormsSelectRequestProcessor($parser);
33
+		$apiRequestProcessor->setDebugFlag($GLOBALS['wgSF_Select_debug']);
34 34
 
35 35
 		$resultValues = $apiRequestProcessor->getJsonDecodedResultValuesForRequestParameters(
36 36
 			$this->extractRequestParams()
37 37
 		);
38 38
 
39 39
 		$result = $this->getResult();
40
-		$result->setIndexedTagName( $resultValues->values, 'value' );
41
-		$result->addValue( $this->getModuleName(), 'values', $resultValues->values );
42
-		$result->addValue( $this->getModuleName(), 'count', $resultValues->count );
40
+		$result->setIndexedTagName($resultValues->values, 'value');
41
+		$result->addValue($this->getModuleName(), 'values', $resultValues->values);
42
+		$result->addValue($this->getModuleName(), 'count', $resultValues->count);
43 43
 
44 44
 		return true;
45 45
 	}
@@ -87,18 +87,18 @@  discard block
 block discarded – undo
87 87
 	 * @see ApiBase::getVersion
88 88
 	 */
89 89
 	public function getVersion() {
90
-		return __CLASS__ . ': 1.1';
90
+		return __CLASS__.': 1.1';
91 91
 	}
92 92
 
93 93
 	// Compatibility helper for MW < 1.32
94 94
 	private function getParser(): Parser {
95
-		if ( class_exists( \MediaWiki\MediaWikiServices::class ) ) {
95
+		if (class_exists(\MediaWiki\MediaWikiServices::class)) {
96 96
 			$services = \MediaWiki\MediaWikiServices::getInstance();
97
-			if ( is_callable( $services, 'getParserFactory' ) ) {
97
+			if (is_callable($services, 'getParserFactory')) {
98 98
 				return $services->getParserFactory()->create();
99 99
 			}
100 100
 		}
101
-		return new Parser( $GLOBALS['wgParserConf'] );
101
+		return new Parser($GLOBALS['wgParserConf']);
102 102
 	}
103 103
 
104 104
 }
Please login to merge, or discard this patch.
src/SemanticFormsSelectInput.php 1 patch
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -27,11 +27,11 @@  discard block
 block discarded – undo
27 27
 
28 28
 	private $mSelectField;
29 29
 
30
-	public function __construct( $inputNumber, $curValue, $inputName, $disabled, $otherArgs ) {
31
-		parent::__construct( $inputNumber, $curValue, $inputName, $disabled, $otherArgs );
30
+	public function __construct($inputNumber, $curValue, $inputName, $disabled, $otherArgs) {
31
+		parent::__construct($inputNumber, $curValue, $inputName, $disabled, $otherArgs);
32 32
 
33 33
 		// SelectField is a simple value object - we accept creating it in the constructor
34
-		$this->mSelectField = new SelectField( $GLOBALS['wgParser'] );
34
+		$this->mSelectField = new SelectField($GLOBALS['wgParser']);
35 35
 	}
36 36
 
37 37
 	public static function getName() {
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
 	 * This is currently just a wrapper for getHTML().
60 60
 	 */
61 61
 	public function getHtmlText() {
62
-		return self::getHTML( $this->mCurrentValue, $this->mInputName, $this->mIsMandatory, $this->mIsDisabled,
63
-			$this->mOtherArgs );
62
+		return self::getHTML($this->mCurrentValue, $this->mInputName, $this->mIsMandatory, $this->mIsDisabled,
63
+			$this->mOtherArgs);
64 64
 	}
65 65
 
66 66
 	/**
@@ -74,35 +74,35 @@  discard block
 block discarded – undo
74 74
 	 * @param    string[] $other_args Array of other field parameters
75 75
 	 * @return string
76 76
 	 */
77
-	public function getHTML( $cur_value = "", $input_name = "", $is_mandatory, $is_disabled, Array $other_args ) {
77
+	public function getHTML($cur_value = "", $input_name = "", $is_mandatory, $is_disabled, Array $other_args) {
78 78
 		global $wgPageFormsFieldNum, $wgUser;
79 79
 
80 80
 		// shortcut to the SelectField object
81 81
 		$selectField = $this->mSelectField;
82 82
 
83 83
 		// get 'delimiter' before 'query' or 'function'
84
-		$selectField->setDelimiter( $other_args );
84
+		$selectField->setDelimiter($other_args);
85 85
 
86
-		if ( array_key_exists( "query", $other_args ) ) {
87
-			$selectField->setQuery( $other_args );
88
-		} elseif ( array_key_exists( "function", $other_args ) ) {
89
-			$selectField->setFunction( $other_args );
86
+		if (array_key_exists("query", $other_args)) {
87
+			$selectField->setQuery($other_args);
88
+		} elseif (array_key_exists("function", $other_args)) {
89
+			$selectField->setFunction($other_args);
90 90
 		}
91 91
 		
92
-		if ( array_key_exists( "label", $other_args ) ) {
93
-			$selectField->setLabel( $other_args );
92
+		if (array_key_exists("label", $other_args)) {
93
+			$selectField->setLabel($other_args);
94 94
 		}
95 95
 
96 96
 		// parameters are only required if values needs to be retrieved dynamically
97
-		if ( !$selectField->hasStaticValues() ) {
98
-			$selectField->setSelectIsMultiple( $other_args );
99
-			$selectField->setSelectTemplate( $input_name );
100
-			$selectField->setSelectField( $input_name );
101
-			$selectField->setValueTemplate( $other_args );
102
-			$selectField->setValueField( $other_args );
103
-			$selectField->setSelectRemove( $other_args );
104
-
105
-			$item = Output::addToHeadItem( $selectField->getData() );
97
+		if (!$selectField->hasStaticValues()) {
98
+			$selectField->setSelectIsMultiple($other_args);
99
+			$selectField->setSelectTemplate($input_name);
100
+			$selectField->setSelectField($input_name);
101
+			$selectField->setValueTemplate($other_args);
102
+			$selectField->setValueField($other_args);
103
+			$selectField->setSelectRemove($other_args);
104
+
105
+			$item = Output::addToHeadItem($selectField->getData());
106 106
 		}
107 107
 
108 108
 		Output::commitToParserOutput();
@@ -112,51 +112,51 @@  discard block
 block discarded – undo
112 112
 		$extraatt = "";
113 113
 		$is_list = false;
114 114
 
115
-		if ( array_key_exists( 'is_list', $other_args ) && $other_args['is_list'] == true ) {
115
+		if (array_key_exists('is_list', $other_args) && $other_args['is_list'] == true) {
116 116
 			$is_list = true;
117 117
 		}
118 118
 
119
-		if ( $is_list ) {
119
+		if ($is_list) {
120 120
 			$extraatt = ' multiple="multiple" ';
121 121
 		}
122 122
 
123
-		if ( array_key_exists( "size", $other_args ) ) {
123
+		if (array_key_exists("size", $other_args)) {
124 124
 			$extraatt .= " size=\"{$other_args['size']}\"";
125 125
 		}
126 126
 
127 127
 		$classes = [];
128
-		if ( $is_mandatory ) {
128
+		if ($is_mandatory) {
129 129
 			$classes[] = "mandatoryField";
130 130
 		}
131
-		if ( array_key_exists( "class", $other_args ) ) {
131
+		if (array_key_exists("class", $other_args)) {
132 132
 			$classes[] = $other_args['class'];
133 133
 		}
134
-		if ( $classes ) {
135
-			$cstr = implode( " ", $classes );
134
+		if ($classes) {
135
+			$cstr = implode(" ", $classes);
136 136
 			$extraatt .= " class=\"$cstr\"";
137 137
 		}
138 138
 
139 139
 		$inname = $input_name;
140
-		if ( $is_list ) {
140
+		if ($is_list) {
141 141
 			$inname .= '[]';
142 142
 		}
143 143
 
144 144
 		// TODO Use Html::
145 145
 
146 146
 		$spanextra = $is_mandatory ? 'mandatoryFieldSpan' : '';
147
-		$is_single_select = (!$is_list) ? 'select-sfs-single' : '' ;
147
+		$is_single_select = (!$is_list) ? 'select-sfs-single' : '';
148 148
 		$ret = "<span class=\"inputSpan select-sfs $is_single_select $spanextra\"><select name='$inname' id='input_$wgPageFormsFieldNum' $extraatt>";
149 149
 
150 150
 		$curvalues = null;
151
-		if ( $cur_value ) {
152
-			if ( $cur_value === 'current user' ) {
151
+		if ($cur_value) {
152
+			if ($cur_value === 'current user') {
153 153
 				$cur_value = $wgUser->getName();
154 154
 			}
155
-			if ( is_array( $cur_value ) ) {
155
+			if (is_array($cur_value)) {
156 156
 				$curvalues = $cur_value;
157 157
 			} else {
158 158
 				// delimiter for $cur_value is always ',' - PF seems to ignore $wgPageFormsListSeparator
159
-				$curvalues = array_map( "trim", explode( $selectField->getDelimiter(), $cur_value ) );
159
+				$curvalues = array_map("trim", explode($selectField->getDelimiter(), $cur_value));
160 160
 			}
161 161
 
162 162
 		} else {
@@ -165,38 +165,38 @@  discard block
 block discarded – undo
165 165
 
166 166
 		
167 167
 		$labelArray = [];
168
-		if ( array_key_exists( "label", $other_args ) && $curvalues ) {
168
+		if (array_key_exists("label", $other_args) && $curvalues) {
169 169
 			// $labelArray = $this->getLabels( $curvalues );
170 170
 		}
171 171
 
172 172
 		// TODO handle empty value case.
173 173
 		$ret .= "<option></option>";
174 174
 
175
-		if ( $selectField->hasStaticValues() ) {
175
+		if ($selectField->hasStaticValues()) {
176 176
 			
177 177
 			$values = $selectField->getValues();
178 178
 			
179
-			if ( array_key_exists( "label", $other_args ) && $values ) {
180
-				$labelArray = $this->getLabels( $values );
179
+			if (array_key_exists("label", $other_args) && $values) {
180
+				$labelArray = $this->getLabels($values);
181 181
 			}
182 182
 			
183
-			if ( is_array( $values ) ) {
183
+			if (is_array($values)) {
184 184
 				
185
-				foreach ( $values as $val ) {
185
+				foreach ($values as $val) {
186 186
 					
187 187
 					$selected = "";
188 188
 											
189
-					if ( array_key_exists( $val, $labelArray ) ) {
189
+					if (array_key_exists($val, $labelArray)) {
190 190
 					
191
-						if ( in_array( $labelArray[ $val ][0], $curvalues ) ) {
191
+						if (in_array($labelArray[$val][0], $curvalues)) {
192 192
 							$selected = " selected='selected'";
193 193
 						}
194 194
 						
195
-						$ret.="<option".$selected." value='".$labelArray[ $val ][0]."'>".$labelArray[ $val ][1]."</option>";
195
+						$ret .= "<option".$selected." value='".$labelArray[$val][0]."'>".$labelArray[$val][1]."</option>";
196 196
 					
197 197
 					} else {
198 198
 						
199
-						if ( in_array( $val, $curvalues ) ) {
199
+						if (in_array($val, $curvalues)) {
200 200
 							$selected = " selected='selected'";
201 201
 						}
202 202
 
@@ -206,22 +206,22 @@  discard block
 block discarded – undo
206 206
 			}
207 207
 		} else {
208 208
 			
209
-			foreach ( $curvalues as $cur ) {
209
+			foreach ($curvalues as $cur) {
210 210
 				$selected = "";
211 211
 				
212
-				if ( array_key_exists( $cur, $labelArray ) ) {
212
+				if (array_key_exists($cur, $labelArray)) {
213 213
 					
214
-					if ( in_array( $labelArray[ $cur ][0], $curvalues ) ) {
214
+					if (in_array($labelArray[$cur][0], $curvalues)) {
215 215
 						$selected = " selected='selected'";
216 216
 					}
217 217
 					
218
-					$ret.="<option".$selected." value='".$labelArray[ $cur ][0]."'>".$labelArray[ $cur ][1]."</option>";
218
+					$ret .= "<option".$selected." value='".$labelArray[$cur][0]."'>".$labelArray[$cur][1]."</option>";
219 219
 					
220 220
 				} else {
221
-					if ( in_array( $cur, $curvalues ) ) {
221
+					if (in_array($cur, $curvalues)) {
222 222
 						$selected = " selected='selected'";
223 223
 					}
224
-					$ret.="<option".$selected.">$cur</option>";
224
+					$ret .= "<option".$selected.">$cur</option>";
225 225
 				}
226 226
 			}
227 227
 
@@ -230,8 +230,8 @@  discard block
 block discarded – undo
230 230
 		$ret .= "</select></span>";
231 231
 		$ret .= "<span id=\"info_$wgPageFormsFieldNum\" class=\"errorMessage\"></span>";
232 232
 
233
-		if ( $other_args["is_list"] ) {
234
-			$hiddenname = $input_name . '[is_list]';
233
+		if ($other_args["is_list"]) {
234
+			$hiddenname = $input_name.'[is_list]';
235 235
 			$ret .= "<input type='hidden' name='$hiddenname' value='1' />";
236 236
 		}
237 237
 
@@ -239,49 +239,49 @@  discard block
 block discarded – undo
239 239
 	}
240 240
 	
241 241
 		
242
-	private function getLabels( $labels ) {
242
+	private function getLabels($labels) {
243 243
 		
244
-		$labelArray = [ ];
244
+		$labelArray = [];
245 245
 
246
-		if ( is_array( $labels ) ) {
247
-			foreach ( $labels as $label ) {
246
+		if (is_array($labels)) {
247
+			foreach ($labels as $label) {
248 248
 				
249 249
 				$labelKey = $label;
250 250
 				$labelValue = $label;
251 251
 				
252 252
 				// Tricky thing if ( ) already in name
253
-				if ( strpos( $label, ")" ) && strpos( $label, "(" ) ) {
253
+				if (strpos($label, ")") && strpos($label, "(")) {
254 254
 				
255 255
 					// Check Break
256 256
 					$openBr = 0;
257 257
 					$doneBr = 0;
258 258
 					$num = 0;
259 259
 					
260
-					$labelArr = str_split ( $label );
260
+					$labelArr = str_split($label);
261 261
 					
262
-					$end = count( $labelArr ) - 1;
262
+					$end = count($labelArr) - 1;
263 263
 					$iter = $end;
264 264
 					
265 265
 					$endBr = $end;
266 266
 					$startBr = 0;
267 267
 					
268
-					while ( $doneBr == 0 && $iter >= 0 ) {
268
+					while ($doneBr == 0 && $iter >= 0) {
269 269
 					
270
-						$char = $labelArr[ $iter ];
270
+						$char = $labelArr[$iter];
271 271
 						
272
-						if ( $char == ")" ) {
272
+						if ($char == ")") {
273 273
 							$openBr = $openBr - 1;
274 274
 							
275
-							if ( $num == 0 ) {
275
+							if ($num == 0) {
276 276
 								$endBr = $iter;
277 277
 								$num = $num + 1;
278 278
 							}
279 279
 						}
280 280
 						
281
-						if ( $char == "(" ) {
281
+						if ($char == "(") {
282 282
 							$openBr = $openBr + 1;
283 283
 							
284
-							if ( $num > 0 && $openBr == 0 ) {
284
+							if ($num > 0 && $openBr == 0) {
285 285
 								$startBr = $iter;
286 286
 								$doneBr = 1;
287 287
 							}
@@ -291,12 +291,12 @@  discard block
 block discarded – undo
291 291
 						
292 292
 					}
293 293
 					
294
-					$labelValue = implode( "", array_slice( $labelArr, $startBr+1, $endBr-$startBr-1 ) );			
295
-					$labelKey = implode( "", array_slice( $labelArr, 0, $startBr-1 ) );
294
+					$labelValue = implode("", array_slice($labelArr, $startBr + 1, $endBr - $startBr - 1));			
295
+					$labelKey = implode("", array_slice($labelArr, 0, $startBr - 1));
296 296
 				
297 297
 				}
298 298
 				
299
-				$labelArray[ $label ] = [ $labelKey, $labelValue ] ;
299
+				$labelArray[$label] = [$labelKey, $labelValue];
300 300
 			}
301 301
 		
302 302
 		}
Please login to merge, or discard this patch.