| @@ -144,9 +144,7 @@ discard block | ||
| 144 | 144 | |
| 145 | 145 |  				if ( $c == '[' ) { | 
| 146 | 146 | $uncompleted_square_brackets++; | 
| 147 | - } | |
| 148 | - | |
| 149 | -				elseif ( $c == ']' ) { | |
| 147 | +				} elseif ( $c == ']' ) { | |
| 150 | 148 | $uncompleted_square_brackets--; | 
| 151 | 149 | } | 
| 152 | 150 | } | 
| @@ -240,8 +238,7 @@ discard block | ||
| 240 | 238 |  			foreach ( $params as $param ) { | 
| 241 | 239 | $parameters[$param->getName()] = $param->getValue(); | 
| 242 | 240 | } | 
| 243 | - } | |
| 244 | -		else { | |
| 241 | +		} else { | |
| 245 | 242 | $parameters = $params; | 
| 246 | 243 | } | 
| 247 | 244 | |
| @@ -21,13 +21,13 @@ discard block | ||
| 21 | 21 | /** | 
| 22 | 22 | * Comparison helper function, used in sorting results. | 
| 23 | 23 | */ | 
| 24 | -	public static function compareQueryResults( $a, $b ) { | |
| 24 | +	public static function compareQueryResults($a, $b) { | |
| 25 | 25 | |
| 26 | -		if ( $a->getSerialization() == $b->getSerialization() ) { | |
| 26 | +		if ($a->getSerialization() == $b->getSerialization()) { | |
| 27 | 27 | return 0; | 
| 28 | 28 | } | 
| 29 | 29 | |
| 30 | - return ( $a->getSerialization() < $b->getSerialization() ) ? -1 : 1; | |
| 30 | + return ($a->getSerialization() < $b->getSerialization()) ? -1 : 1; | |
| 31 | 31 | } | 
| 32 | 32 | |
| 33 | 33 | /** | 
| @@ -37,20 +37,20 @@ discard block | ||
| 37 | 37 | * | 
| 38 | 38 | * @return string | 
| 39 | 39 | */ | 
| 40 | -	public static function doCompoundQuery( Parser &$parser ) { | |
| 40 | +	public static function doCompoundQuery(Parser&$parser) { | |
| 41 | 41 | global $smwgQEnabled, $smwgIQRunningNumber; | 
| 42 | 42 | |
| 43 | -		if ( !$smwgQEnabled ) { | |
| 44 | - return smwfEncodeMessages( [ wfMessage( 'smw_iq_disabled' )->inContentLanguage()->text() ] ); | |
| 43 | +		if (!$smwgQEnabled) { | |
| 44 | +			return smwfEncodeMessages([wfMessage('smw_iq_disabled')->inContentLanguage()->text()]); | |
| 45 | 45 | } | 
| 46 | 46 | |
| 47 | 47 | $smwgIQRunningNumber++; | 
| 48 | 48 | |
| 49 | 49 | $params = func_get_args(); | 
| 50 | - array_shift( $params ); // We already know the $parser. | |
| 50 | + array_shift($params); // We already know the $parser. | |
| 51 | 51 | |
| 52 | - list( $queryParams, $otherParams ) = self::separateParams( $params ); | |
| 53 | - list( $queryResult, $otherParams ) = self::queryAndMergeResults( $queryParams, $otherParams ); | |
| 52 | + list($queryParams, $otherParams) = self::separateParams($params); | |
| 53 | + list($queryResult, $otherParams) = self::queryAndMergeResults($queryParams, $otherParams); | |
| 54 | 54 | |
| 55 | 55 | return self::getResultFromQueryResult( | 
| 56 | 56 | $queryResult, | 
| @@ -65,25 +65,25 @@ discard block | ||
| 65 | 65 | * @param $params | 
| 66 | 66 | * @return array | 
| 67 | 67 | */ | 
| 68 | -	public static function separateParams( $params ) { | |
| 68 | +	public static function separateParams($params) { | |
| 69 | 69 | $queryParams = []; | 
| 70 | 70 | $otherParams = []; | 
| 71 | 71 | |
| 72 | -		foreach ( $params as $param ) { | |
| 72 | +		foreach ($params as $param) { | |
| 73 | 73 | // Very primitive heuristic - if the parameter | 
| 74 | 74 | // includes a square bracket, then it's a | 
| 75 | 75 | // sub-query; otherwise it's a regular parameter. | 
| 76 | -			if ( strpos( $param, '[' ) !== false ) { | |
| 76 | +			if (strpos($param, '[') !== false) { | |
| 77 | 77 | $queryParams[] = $param; | 
| 78 | 78 |  			} else { | 
| 79 | - $parts = explode( '=', $param, 2 ); | |
| 79 | +				$parts = explode('=', $param, 2); | |
| 80 | 80 | |
| 81 | -				if ( count( $parts ) >= 2 ) { | |
| 82 | - $otherParams[strtolower( trim( $parts[0] ) )] = $parts[1]; // don't trim here, some params care for " " | |
| 81 | +				if (count($parts) >= 2) { | |
| 82 | + $otherParams[strtolower(trim($parts[0]))] = $parts[1]; // don't trim here, some params care for " " | |
| 83 | 83 | } | 
| 84 | 84 | } | 
| 85 | 85 | } | 
| 86 | - return [ $queryParams, $otherParams ]; | |
| 86 | + return [$queryParams, $otherParams]; | |
| 87 | 87 | } | 
| 88 | 88 | |
| 89 | 89 | /** | 
| @@ -93,36 +93,36 @@ discard block | ||
| 93 | 93 | * @param $otherParams | 
| 94 | 94 | * @return array | 
| 95 | 95 | */ | 
| 96 | -	public static function queryAndMergeResults( $queryParams, $otherParams ) { | |
| 96 | +	public static function queryAndMergeResults($queryParams, $otherParams) { | |
| 97 | 97 | $results = []; | 
| 98 | 98 | $printRequests = []; | 
| 99 | 99 | |
| 100 | -		foreach ( $queryParams as $param ) { | |
| 101 | - $subQueryParams = self::getSubParams( $param ); | |
| 100 | +		foreach ($queryParams as $param) { | |
| 101 | + $subQueryParams = self::getSubParams($param); | |
| 102 | 102 | |
| 103 | -			if ( array_key_exists( 'format', $otherParams ) && !array_key_exists( 'format', $subQueryParams ) ) { | |
| 103 | +			if (array_key_exists('format', $otherParams) && !array_key_exists('format', $subQueryParams)) { | |
| 104 | 104 | $subQueryParams['format'] = $otherParams['format']; | 
| 105 | 105 | } | 
| 106 | 106 | |
| 107 | 107 | $nextResult = self::getQueryResultFromFunctionParams($subQueryParams); | 
| 108 | 108 | |
| 109 | - $results = self::mergeSMWQueryResults( $results, $nextResult->getResults() ); | |
| 110 | - $printRequests = self::mergeSMWPrintRequests( $printRequests, $nextResult->getPrintRequests() ); | |
| 109 | + $results = self::mergeSMWQueryResults($results, $nextResult->getResults()); | |
| 110 | + $printRequests = self::mergeSMWPrintRequests($printRequests, $nextResult->getPrintRequests()); | |
| 111 | 111 | } | 
| 112 | 112 | |
| 113 | 113 | // Sort results so that they'll show up by page name | 
| 114 | -		if( !isset($otherParams['unsorted']) || !strcmp( $otherParams['unsorted'], 'on' ) ) { | |
| 115 | - uasort( $results, [ '\SCQ\CompoundQueryProcessor', 'compareQueryResults' ] ); | |
| 114 | +		if (!isset($otherParams['unsorted']) || !strcmp($otherParams['unsorted'], 'on')) { | |
| 115 | + uasort($results, ['\SCQ\CompoundQueryProcessor', 'compareQueryResults']); | |
| 116 | 116 | } | 
| 117 | 117 | |
| 118 | - $queryResult = new CompoundQueryResult( $printRequests, new Query(), $results, smwfGetStore() ); | |
| 118 | + $queryResult = new CompoundQueryResult($printRequests, new Query(), $results, smwfGetStore()); | |
| 119 | 119 | |
| 120 | -		if ( version_compare( SMW_VERSION, '1.6.1', '>' ) ) { | |
| 121 | - self::addThisPrintout( $printRequests, $otherParams ); | |
| 122 | - $otherParams = self::getProcessedParams( $otherParams, $printRequests ); | |
| 120 | +		if (version_compare(SMW_VERSION, '1.6.1', '>')) { | |
| 121 | + self::addThisPrintout($printRequests, $otherParams); | |
| 122 | + $otherParams = self::getProcessedParams($otherParams, $printRequests); | |
| 123 | 123 | } | 
| 124 | 124 | |
| 125 | - return [ $queryResult, $otherParams ]; | |
| 125 | + return [$queryResult, $otherParams]; | |
| 126 | 126 | } | 
| 127 | 127 | |
| 128 | 128 | /** | 
| @@ -134,31 +134,31 @@ discard block | ||
| 134 | 134 | * | 
| 135 | 135 | * @return array | 
| 136 | 136 | */ | 
| 137 | -	protected static function getSubParams( $param ) { | |
| 137 | +	protected static function getSubParams($param) { | |
| 138 | 138 | $sub_params = []; | 
| 139 | 139 | $sub_param = ''; | 
| 140 | 140 | $uncompleted_square_brackets = 0; | 
| 141 | 141 | |
| 142 | -		for ( $i = 0; $i < strlen( $param ); $i++ ) { | |
| 142 | +		for ($i = 0; $i < strlen($param); $i++) { | |
| 143 | 143 | $c = $param[$i]; | 
| 144 | 144 | |
| 145 | -			if ( ( $c == ';' ) && ( $uncompleted_square_brackets <= 0 ) ) { | |
| 146 | - $sub_params[] = trim( $sub_param ); | |
| 145 | +			if (($c == ';') && ($uncompleted_square_brackets <= 0)) { | |
| 146 | + $sub_params[] = trim($sub_param); | |
| 147 | 147 | $sub_param = ''; | 
| 148 | 148 |  			} else { | 
| 149 | 149 | $sub_param .= $c; | 
| 150 | 150 | |
| 151 | -				if ( $c == '[' ) { | |
| 151 | +				if ($c == '[') { | |
| 152 | 152 | $uncompleted_square_brackets++; | 
| 153 | 153 | } | 
| 154 | 154 | |
| 155 | -				elseif ( $c == ']' ) { | |
| 155 | +				elseif ($c == ']') { | |
| 156 | 156 | $uncompleted_square_brackets--; | 
| 157 | 157 | } | 
| 158 | 158 | } | 
| 159 | 159 | } | 
| 160 | 160 | |
| 161 | - $sub_params[] = trim( $sub_param ); | |
| 161 | + $sub_params[] = trim($sub_param); | |
| 162 | 162 | |
| 163 | 163 | return $sub_params; | 
| 164 | 164 | } | 
| @@ -170,10 +170,10 @@ discard block | ||
| 170 | 170 | * | 
| 171 | 171 | * @return SMWQueryResult | 
| 172 | 172 | */ | 
| 173 | -	protected static function getQueryResultFromFunctionParams( $rawParams, $context = QueryProcessor::INLINE_QUERY, $showMode = false ) { | |
| 174 | - list( $querystring, $params, $printouts ) = self::getComponentsFromFunctionParams( $rawParams, $showMode ); | |
| 173 | +	protected static function getQueryResultFromFunctionParams($rawParams, $context = QueryProcessor::INLINE_QUERY, $showMode = false) { | |
| 174 | + list($querystring, $params, $printouts) = self::getComponentsFromFunctionParams($rawParams, $showMode); | |
| 175 | 175 | |
| 176 | - return self::getQueryResultFromQueryString( $querystring, $params, $printouts, $context ); | |
| 176 | + return self::getQueryResultFromQueryString($querystring, $params, $printouts, $context); | |
| 177 | 177 | } | 
| 178 | 178 | |
| 179 | 179 | /** | 
| @@ -184,19 +184,19 @@ discard block | ||
| 184 | 184 | * | 
| 185 | 185 | * @return array | 
| 186 | 186 | */ | 
| 187 | -	protected static function mergeSMWQueryResults( $result1, $result2 ) { | |
| 188 | -		if ( $result1 == null ) { | |
| 187 | +	protected static function mergeSMWQueryResults($result1, $result2) { | |
| 188 | +		if ($result1 == null) { | |
| 189 | 189 | return $result2; | 
| 190 | 190 | } | 
| 191 | 191 | |
| 192 | 192 | $existing_page_names = []; | 
| 193 | -		foreach ( $result1 as $r1 ) { | |
| 193 | +		foreach ($result1 as $r1) { | |
| 194 | 194 | $existing_page_names[] = $r1->getSerialization(); | 
| 195 | 195 | } | 
| 196 | 196 | |
| 197 | -		foreach ( $result2 as $r2 ) { | |
| 197 | +		foreach ($result2 as $r2) { | |
| 198 | 198 | $page_name = $r2->getSerialization(); | 
| 199 | -			if ( ! in_array( $page_name, $existing_page_names ) ) { | |
| 199 | +			if (!in_array($page_name, $existing_page_names)) { | |
| 200 | 200 | $result1[] = $r2; | 
| 201 | 201 | } | 
| 202 | 202 | } | 
| @@ -204,15 +204,15 @@ discard block | ||
| 204 | 204 | return $result1; | 
| 205 | 205 | } | 
| 206 | 206 | |
| 207 | -	protected static function mergeSMWPrintRequests( $printRequests1, $printRequests2 ) { | |
| 207 | +	protected static function mergeSMWPrintRequests($printRequests1, $printRequests2) { | |
| 208 | 208 | $existingPrintoutLabels = []; | 
| 209 | -		foreach ( $printRequests1 as $p1 ) { | |
| 209 | +		foreach ($printRequests1 as $p1) { | |
| 210 | 210 | $existingPrintoutLabels[] = $p1->getLabel(); | 
| 211 | 211 | } | 
| 212 | 212 | |
| 213 | -		foreach ( $printRequests2 as $p2 ) { | |
| 213 | +		foreach ($printRequests2 as $p2) { | |
| 214 | 214 | $label = $p2->getLabel(); | 
| 215 | -			if ( ! in_array( $label, $existingPrintoutLabels ) ) { | |
| 215 | +			if (!in_array($label, $existingPrintoutLabels)) { | |
| 216 | 216 | $printRequests1[] = $p2; | 
| 217 | 217 | } | 
| 218 | 218 | } | 
| @@ -228,20 +228,20 @@ discard block | ||
| 228 | 228 | * | 
| 229 | 229 | * @return SMWQueryResult | 
| 230 | 230 | */ | 
| 231 | -	protected static function getQueryResultFromQueryString( $querystring, array $params, $extraPrintouts, $context = QueryProcessor::INLINE_QUERY ) { | |
| 231 | +	protected static function getQueryResultFromQueryString($querystring, array $params, $extraPrintouts, $context = QueryProcessor::INLINE_QUERY) { | |
| 232 | 232 | |
| 233 | -		if ( version_compare( SMW_VERSION, '1.6.1', '>' ) ) { | |
| 234 | - QueryProcessor::addThisPrintout( $extraPrintouts, $params ); | |
| 235 | - $params = self::getProcessedParams( $params, $extraPrintouts, false ); | |
| 233 | +		if (version_compare(SMW_VERSION, '1.6.1', '>')) { | |
| 234 | + QueryProcessor::addThisPrintout($extraPrintouts, $params); | |
| 235 | + $params = self::getProcessedParams($params, $extraPrintouts, false); | |
| 236 | 236 | } | 
| 237 | 237 | |
| 238 | - $query = self::createQuery( $querystring, $params, $context, null, $extraPrintouts ); | |
| 239 | - $queryResult = smwfGetStore()->getQueryResult( $query ); | |
| 238 | + $query = self::createQuery($querystring, $params, $context, null, $extraPrintouts); | |
| 239 | + $queryResult = smwfGetStore()->getQueryResult($query); | |
| 240 | 240 | |
| 241 | 241 | $parameters = []; | 
| 242 | 242 | |
| 243 | -		if ( version_compare( SMW_VERSION, '1.7.2', '>' ) ) { | |
| 244 | -			foreach ( $params as $param ) { | |
| 243 | +		if (version_compare(SMW_VERSION, '1.7.2', '>')) { | |
| 244 | +			foreach ($params as $param) { | |
| 245 | 245 | $parameters[$param->getName()] = $param->getValue(); | 
| 246 | 246 | } | 
| 247 | 247 | } | 
| @@ -249,7 +249,7 @@ discard block | ||
| 249 | 249 | $parameters = $params; | 
| 250 | 250 | } | 
| 251 | 251 | |
| 252 | -		foreach ( $queryResult->getResults() as $wikiPage ) { | |
| 252 | +		foreach ($queryResult->getResults() as $wikiPage) { | |
| 253 | 253 | $wikiPage->display_options = $parameters; | 
| 254 | 254 | } | 
| 255 | 255 | |
| @@ -268,20 +268,20 @@ discard block | ||
| 268 | 268 | * | 
| 269 | 269 | * @return string | 
| 270 | 270 | */ | 
| 271 | -	protected static function getResultFromQueryResult( CompoundQueryResult $res, array $params, $outputmode, $context = QueryProcessor::INLINE_QUERY, $format = '' ) { | |
| 271 | +	protected static function getResultFromQueryResult(CompoundQueryResult $res, array $params, $outputmode, $context = QueryProcessor::INLINE_QUERY, $format = '') { | |
| 272 | 272 | |
| 273 | -		if ( version_compare( SMW_VERSION, '1.6.1', '>' ) ) { | |
| 273 | +		if (version_compare(SMW_VERSION, '1.6.1', '>')) { | |
| 274 | 274 | $format = $params['format']; | 
| 275 | 275 | |
| 276 | -			if ( version_compare( SMW_VERSION, '1.7.2', '>' ) ) { | |
| 276 | +			if (version_compare(SMW_VERSION, '1.7.2', '>')) { | |
| 277 | 277 | $format = $format->getValue(); | 
| 278 | 278 | } | 
| 279 | 279 |  		} else { | 
| 280 | - $format = self::getResultFormat( $params ); | |
| 280 | + $format = self::getResultFormat($params); | |
| 281 | 281 | } | 
| 282 | 282 | |
| 283 | - $printer = self::getResultPrinter( $format, $context ); | |
| 284 | - $result = $printer->getResult( $res, $params, $outputmode ); | |
| 283 | + $printer = self::getResultPrinter($format, $context); | |
| 284 | + $result = $printer->getResult($res, $params, $outputmode); | |
| 285 | 285 | |
| 286 | 286 | return $result; | 
| 287 | 287 | } | 
| @@ -7,70 +7,70 @@ | ||
| 7 | 7 | |
| 8 | 8 | /** English (English) */ | 
| 9 | 9 | $magicWords['en'] = [ | 
| 10 | - 'compound_query' => [ 0, 'compound_query' ], | |
| 10 | + 'compound_query' => [0, 'compound_query'], | |
| 11 | 11 | ]; | 
| 12 | 12 | |
| 13 | 13 | /** Arabic (العربية) */ | 
| 14 | 14 | $magicWords['ar'] = [ | 
| 15 | - 'compound_query' => [ 0, 'استعلام_مركب' ], | |
| 15 | + 'compound_query' => [0, 'استعلام_مركب'], | |
| 16 | 16 | ]; | 
| 17 | 17 | |
| 18 | 18 | /** Egyptian Arabic (مصرى) */ | 
| 19 | 19 | $magicWords['arz'] = [ | 
| 20 | - 'compound_query' => [ 0, 'استعلام_مركب' ], | |
| 20 | + 'compound_query' => [0, 'استعلام_مركب'], | |
| 21 | 21 | ]; | 
| 22 | 22 | |
| 23 | 23 | /** Chuvash (Чӑвашла) */ | 
| 24 | 24 | $magicWords['cv'] = [ | 
| 25 | - 'compound_query' => [ 0, 'compound_query' ], | |
| 25 | + 'compound_query' => [0, 'compound_query'], | |
| 26 | 26 | ]; | 
| 27 | 27 | |
| 28 | 28 | /** German (Deutsch) */ | 
| 29 | 29 | $magicWords['de'] = [ | 
| 30 | - 'compound_query' => [ 0, 'abfrage_zusammen', 'frage_zusammen' ], | |
| 30 | + 'compound_query' => [0, 'abfrage_zusammen', 'frage_zusammen'], | |
| 31 | 31 | ]; | 
| 32 | 32 | |
| 33 | 33 | /** Japanese (日本語) */ | 
| 34 | 34 | $magicWords['ja'] = [ | 
| 35 | - 'compound_query' => [ 0, '複合クエリ', '複合クエリー' ], | |
| 35 | + 'compound_query' => [0, '複合クエリ', '複合クエリー'], | |
| 36 | 36 | ]; | 
| 37 | 37 | |
| 38 | 38 | /** Korean (한국어) */ | 
| 39 | 39 | $magicWords['ko'] = [ | 
| 40 | - 'compound_query' => [ 0, '복합_쿼리' ], | |
| 40 | + 'compound_query' => [0, '복합_쿼리'], | |
| 41 | 41 | ]; | 
| 42 | 42 | |
| 43 | 43 | /** Macedonian (македонски) */ | 
| 44 | 44 | $magicWords['mk'] = [ | 
| 45 | - 'compound_query' => [ 0, 'мешовито_барање' ], | |
| 45 | + 'compound_query' => [0, 'мешовито_барање'], | |
| 46 | 46 | ]; | 
| 47 | 47 | |
| 48 | 48 | /** Low Saxon (Netherlands) (Nedersaksies) */ | 
| 49 | 49 | $magicWords['nds-nl'] = [ | 
| 50 | - 'compound_query' => [ 0, 'samenestelden_zeukopdrachte', 'samengestelde_zoekopdracht' ], | |
| 50 | + 'compound_query' => [0, 'samenestelden_zeukopdrachte', 'samengestelde_zoekopdracht'], | |
| 51 | 51 | ]; | 
| 52 | 52 | |
| 53 | 53 | /** Dutch (Nederlands) */ | 
| 54 | 54 | $magicWords['nl'] = [ | 
| 55 | - 'compound_query' => [ 0, 'samengestelde_zoekopdracht' ], | |
| 55 | + 'compound_query' => [0, 'samengestelde_zoekopdracht'], | |
| 56 | 56 | ]; | 
| 57 | 57 | |
| 58 | 58 | /** Brazilian Portuguese (português do Brasil) */ | 
| 59 | 59 | $magicWords['pt-br'] = [ | 
| 60 | - 'compound_query' => [ 0, 'consulta_composta' ], | |
| 60 | + 'compound_query' => [0, 'consulta_composta'], | |
| 61 | 61 | ]; | 
| 62 | 62 | |
| 63 | 63 | /** Serbian (Latin script) (srpski (latinica)) */ | 
| 64 | 64 | $magicWords['sr-el'] = [ | 
| 65 | - 'compound_query' => [ 0, 'sastavi_upit' ], | |
| 65 | + 'compound_query' => [0, 'sastavi_upit'], | |
| 66 | 66 | ]; | 
| 67 | 67 | |
| 68 | 68 | /** Simplified Chinese (中文(简体)) */ | 
| 69 | 69 | $magicWords['zh-hans'] = [ | 
| 70 | - 'compound_query' => [ 0, '组合查询' ], | |
| 70 | + 'compound_query' => [0, '组合查询'], | |
| 71 | 71 | ]; | 
| 72 | 72 | |
| 73 | 73 | /** Traditional Chinese (中文(繁體)) */ | 
| 74 | 74 | $magicWords['zh-hant'] = [ | 
| 75 | - 'compound_query' => [ 0, '組合搜尋' ], | |
| 75 | + 'compound_query' => [0, '組合搜尋'], | |
| 76 | 76 | ]; | 
| 77 | 77 | \ No newline at end of file | 
| @@ -23,29 +23,29 @@ | ||
| 23 | 23 | * | 
| 24 | 24 | * @param QueryResult $newResult | 
| 25 | 25 | */ | 
| 26 | -	public function addResult( QueryResult $newResult ) { | |
| 26 | +	public function addResult(QueryResult $newResult) { | |
| 27 | 27 | $existingPageNames = []; | 
| 28 | 28 | |
| 29 | -		while ( $row = $this->getNext() ) { | |
| 30 | -			if ( $row[0] instanceof ResultArray ) { | |
| 29 | +		while ($row = $this->getNext()) { | |
| 30 | +			if ($row[0] instanceof ResultArray) { | |
| 31 | 31 | $content = $row[0]->getContent(); | 
| 32 | - $existingPageNames[] = $content[0]->getLongText( SMW_OUTPUT_WIKI ); | |
| 32 | + $existingPageNames[] = $content[0]->getLongText(SMW_OUTPUT_WIKI); | |
| 33 | 33 | } | 
| 34 | 34 | } | 
| 35 | 35 | |
| 36 | -		while ( ( $row = $newResult->getNext() ) !== false ) { | |
| 37 | -			if ( property_exists( $newResult, 'display_options' ) ) { | |
| 36 | +		while (($row = $newResult->getNext()) !== false) { | |
| 37 | +			if (property_exists($newResult, 'display_options')) { | |
| 38 | 38 | $row[0]->display_options = $newResult->display_options; | 
| 39 | 39 | } | 
| 40 | 40 | $content = $row[0]->getContent(); | 
| 41 | - $pageName = $content[0]->getLongText( SMW_OUTPUT_WIKI ); | |
| 41 | + $pageName = $content[0]->getLongText(SMW_OUTPUT_WIKI); | |
| 42 | 42 | |
| 43 | -			if ( !in_array( $pageName, $existingPageNames ) ) { | |
| 43 | +			if (!in_array($pageName, $existingPageNames)) { | |
| 44 | 44 | $this->m_content[] = $row; | 
| 45 | 45 | } | 
| 46 | 46 | } | 
| 47 | 47 | |
| 48 | - reset( $this->m_content ); | |
| 48 | + reset($this->m_content); | |
| 49 | 49 | } | 
| 50 | 50 | |
| 51 | 51 | } | 
| @@ -21,18 +21,18 @@ discard block | ||
| 21 | 21 | * @see ApiBase::execute | 
| 22 | 22 | */ | 
| 23 | 23 |  	public function execute() { | 
| 24 | - $parameterFormatter = new ApiRequestParameterFormatter( $this->extractRequestParams() ); | |
| 24 | + $parameterFormatter = new ApiRequestParameterFormatter($this->extractRequestParams()); | |
| 25 | 25 | $parameters = $parameterFormatter->getAskApiParameters(); | 
| 26 | 26 | |
| 27 | - list( $queryParams, $otherParams ) = CompoundQueryProcessor::separateParams( $parameters ); | |
| 28 | - list( $queryResult ) = CompoundQueryProcessor::queryAndMergeResults( $queryParams, $otherParams ); | |
| 27 | + list($queryParams, $otherParams) = CompoundQueryProcessor::separateParams($parameters); | |
| 28 | + list($queryResult) = CompoundQueryProcessor::queryAndMergeResults($queryParams, $otherParams); | |
| 29 | 29 | |
| 30 | 30 | $outputFormat = 'json'; | 
| 31 | -		if ( $this->getMain()->getPrinter() instanceof \ApiFormatXml ) { | |
| 31 | +		if ($this->getMain()->getPrinter() instanceof \ApiFormatXml) { | |
| 32 | 32 | $outputFormat = 'xml'; | 
| 33 | 33 | } | 
| 34 | 34 | |
| 35 | - $this->addQueryResult( $queryResult, $outputFormat ); | |
| 35 | + $this->addQueryResult($queryResult, $outputFormat); | |
| 36 | 36 | } | 
| 37 | 37 | |
| 38 | 38 | /** | 
| @@ -82,8 +82,8 @@ discard block | ||
| 82 | 82 | */ | 
| 83 | 83 |  	protected function getExamples() { | 
| 84 | 84 | return [ | 
| 85 | - 'api.php?action=compoundquery&query=' . urlencode( '[[Has city::Vienna]]; ?Has coordinates|[[Has city::Graz]]; ?Has coordinates' ), | |
| 86 | - 'api.php?action=compoundquery&query=' . urlencode( '|[[Has city::Vienna]]; ?Has coordinates|[[Has city::Graz]]; ?Has coordinates' ), | |
| 85 | +			'api.php?action=compoundquery&query=' . urlencode('[[Has city::Vienna]]; ?Has coordinates|[[Has city::Graz]]; ?Has coordinates'), | |
| 86 | +			'api.php?action=compoundquery&query=' . urlencode('|[[Has city::Vienna]]; ?Has coordinates|[[Has city::Graz]]; ?Has coordinates'), | |
| 87 | 87 | ]; | 
| 88 | 88 | } | 
| 89 | 89 | |
| @@ -1,16 +1,16 @@ | ||
| 1 | 1 | <?php | 
| 2 | 2 | |
| 3 | -if ( PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg' ) { | |
| 4 | - die( 'Not an entry point' ); | |
| 3 | +if (PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg') { | |
| 4 | +	die('Not an entry point'); | |
| 5 | 5 | } | 
| 6 | 6 | |
| 7 | -if ( !is_readable( $autoloaderClassPath = __DIR__ . '/../../SemanticMediaWiki/tests/autoloader.php' ) ) { | |
| 8 | - die( 'The SemanticMediaWiki test autoloader is not available' ); | |
| 7 | +if (!is_readable($autoloaderClassPath = __DIR__ . '/../../SemanticMediaWiki/tests/autoloader.php')) { | |
| 8 | +	die('The SemanticMediaWiki test autoloader is not available'); | |
| 9 | 9 | } | 
| 10 | 10 | |
| 11 | -print sprintf( "\n%-20s%s\n", "Semantic Compound Queries: ", SCQ_VERSION ); | |
| 11 | +print sprintf("\n%-20s%s\n", "Semantic Compound Queries: ", SCQ_VERSION); | |
| 12 | 12 | |
| 13 | 13 | $autoloader = require $autoloaderClassPath; | 
| 14 | -$autoloader->addPsr4( 'SCQ\\Tests\\', __DIR__ . '/phpunit/Unit' ); | |
| 15 | -$autoloader->addPsr4( 'SCQ\\Tests\\Integration\\', __DIR__ . '/phpunit/Integration' ); | |
| 16 | -unset( $autoloader ); | |
| 14 | +$autoloader->addPsr4('SCQ\\Tests\\', __DIR__ . '/phpunit/Unit'); | |
| 15 | +$autoloader->addPsr4('SCQ\\Tests\\Integration\\', __DIR__ . '/phpunit/Integration'); | |
| 16 | +unset($autoloader); | |
| @@ -24,13 +24,13 @@ discard block | ||
| 24 | 24 | * | 
| 25 | 25 | * @return mixed Method return. | 
| 26 | 26 | */ | 
| 27 | -	public function invokeMethod( &$object, $methodName, array $parameters = [] ) { | |
| 27 | +	public function invokeMethod(&$object, $methodName, array $parameters = []) { | |
| 28 | 28 | |
| 29 | - $reflection = new \ReflectionClass( get_class( $object ) ); | |
| 30 | - $method = $reflection->getMethod( $methodName ); | |
| 31 | - $method->setAccessible( true ); | |
| 29 | + $reflection = new \ReflectionClass(get_class($object)); | |
| 30 | + $method = $reflection->getMethod($methodName); | |
| 31 | + $method->setAccessible(true); | |
| 32 | 32 | |
| 33 | - return $method->invokeArgs( $object, $parameters ); | |
| 33 | + return $method->invokeArgs($object, $parameters); | |
| 34 | 34 | } | 
| 35 | 35 | |
| 36 | 36 |  	public function testSeparateParams() { | 
| @@ -57,7 +57,7 @@ discard block | ||
| 57 | 57 | ] | 
| 58 | 58 | ]; | 
| 59 | 59 | |
| 60 | - $this->assertEquals( $expected, CompoundQueryProcessor::separateParams( $params ) ); | |
| 60 | + $this->assertEquals($expected, CompoundQueryProcessor::separateParams($params)); | |
| 61 | 61 | } | 
| 62 | 62 | |
| 63 | 63 |  	public function testGetSubParams() { | 
| @@ -74,8 +74,8 @@ discard block | ||
| 74 | 74 | ]; | 
| 75 | 75 | |
| 76 | 76 | $processor = new CompoundQueryProcessor(); | 
| 77 | - $actual = $this->invokeMethod( $processor, 'getSubParams', [ $param ] ); | |
| 78 | - $this->assertEquals( $expected, $actual ); | |
| 77 | + $actual = $this->invokeMethod($processor, 'getSubParams', [$param]); | |
| 78 | + $this->assertEquals($expected, $actual); | |
| 79 | 79 | } | 
| 80 | 80 | |
| 81 | 81 | } | 
| @@ -29,7 +29,7 @@ discard block | ||
| 29 | 29 |  	public function testCanConstruct() { | 
| 30 | 30 | |
| 31 | 31 | $instance = new CompoundQuery( | 
| 32 | - $this->apiFactory->newApiMain( [ 'query' => 'Foo' ] ), | |
| 32 | + $this->apiFactory->newApiMain(['query' => 'Foo']), | |
| 33 | 33 | 'compoundquery' | 
| 34 | 34 | ); | 
| 35 | 35 | |
| @@ -42,12 +42,12 @@ discard block | ||
| 42 | 42 | /** | 
| 43 | 43 | * @dataProvider sampleQueryProvider | 
| 44 | 44 | */ | 
| 45 | -	public function testExecute( array $query, array $expected ) { | |
| 45 | +	public function testExecute(array $query, array $expected) { | |
| 46 | 46 | |
| 47 | - $results = $this->apiFactory->doApiRequest( [ | |
| 47 | + $results = $this->apiFactory->doApiRequest([ | |
| 48 | 48 | 'action' => 'compoundquery', | 
| 49 | - 'query' => implode( '|', $query ) | |
| 50 | - ] ); | |
| 49 | +			'query' => implode('|', $query) | |
| 50 | + ]); | |
| 51 | 51 | |
| 52 | 52 | $this->assertInternalType( | 
| 53 | 53 | 'array', | 
| @@ -55,10 +55,10 @@ discard block | ||
| 55 | 55 | ); | 
| 56 | 56 | |
| 57 | 57 | // If their is no printrequests array we expect an error array | 
| 58 | -		if ( isset( $results['query']['printrequests'] ) ) { | |
| 59 | - $this->assertEquals( $expected, $results['query']['printrequests'] ); | |
| 58 | +		if (isset($results['query']['printrequests'])) { | |
| 59 | + $this->assertEquals($expected, $results['query']['printrequests']); | |
| 60 | 60 |  		} else { | 
| 61 | - $this->assertArrayHasKey( 'error', $results ); | |
| 61 | +			$this->assertArrayHasKey('error', $results); | |
| 62 | 62 | } | 
| 63 | 63 | } | 
| 64 | 64 | |
| @@ -17,9 +17,9 @@ discard block | ||
| 17 | 17 | /** | 
| 18 | 18 | * @dataProvider i18nFileProvider | 
| 19 | 19 | */ | 
| 20 | -	public function testI18NJsonDecodeEncode( $file ) { | |
| 20 | +	public function testI18NJsonDecodeEncode($file) { | |
| 21 | 21 | |
| 22 | - $jsonFileReader = UtilityFactory::getInstance()->newJsonFileReader( $file ); | |
| 22 | + $jsonFileReader = UtilityFactory::getInstance()->newJsonFileReader($file); | |
| 23 | 23 | |
| 24 | 24 | $this->assertInternalType( | 
| 25 | 25 | 'integer', | 
| @@ -37,11 +37,11 @@ discard block | ||
| 37 | 37 | $provider = []; | 
| 38 | 38 | $location = $GLOBALS['wgMessagesDirs']['SemanticCompoundQueries']; | 
| 39 | 39 | |
| 40 | - $bulkFileProvider = UtilityFactory::getInstance()->newBulkFileProvider( $location ); | |
| 41 | - $bulkFileProvider->searchByFileExtension( 'json' ); | |
| 40 | + $bulkFileProvider = UtilityFactory::getInstance()->newBulkFileProvider($location); | |
| 41 | +		$bulkFileProvider->searchByFileExtension('json'); | |
| 42 | 42 | |
| 43 | -		foreach ( $bulkFileProvider->getFiles() as $file ) { | |
| 44 | - $provider[] = [ $file ]; | |
| 43 | +		foreach ($bulkFileProvider->getFiles() as $file) { | |
| 44 | + $provider[] = [$file]; | |
| 45 | 45 | } | 
| 46 | 46 | |
| 47 | 47 | return $provider; | 
| @@ -21,11 +21,11 @@ discard block | ||
| 21 | 21 |  	protected function setUp() : void { | 
| 22 | 22 | parent::setUp(); | 
| 23 | 23 | |
| 24 | - $this->store = $this->getMockBuilder( '\SMW\Store' ) | |
| 24 | +		$this->store = $this->getMockBuilder('\SMW\Store') | |
| 25 | 25 | ->disableOriginalConstructor() | 
| 26 | 26 | ->getMockForAbstractClass(); | 
| 27 | 27 | |
| 28 | - $this->query = $this->getMockBuilder( '\SMWQuery' ) | |
| 28 | +		$this->query = $this->getMockBuilder('\SMWQuery') | |
| 29 | 29 | ->disableOriginalConstructor() | 
| 30 | 30 | ->getMock(); | 
| 31 | 31 | } | 
| @@ -34,7 +34,7 @@ discard block | ||
| 34 | 34 | |
| 35 | 35 | $this->assertInstanceOf( | 
| 36 | 36 | CompoundQueryResult::class, | 
| 37 | - new CompoundQueryResult( [], $this->query, [], $this->store ) | |
| 37 | + new CompoundQueryResult([], $this->query, [], $this->store) | |
| 38 | 38 | ); | 
| 39 | 39 | } | 
| 40 | 40 | |