Passed
Push — master ( 1230d1...ab986e )
by Francis
01:11
created

build_url_query()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 6
rs 10
cc 3
nc 3
nop 2
1
<?php
2
declare(strict_types=1);
3
defined('BASEPATH') OR exit('No direct script access allowed');
4
5
if (!function_exists('build_url_query')) {
6
  function build_url_query(array $params, bool $urlEncode=true) {
7
    $queryString = '?';
8
    foreach($params as $key => $val) {
9
      $queryString .= $key."=".($urlEncode ? rawurlencode($val) : $val)."&";
10
    }
11
    return substr($queryString, 0, strlen($queryString) - 1);
12
  }
13
}
14