Helper   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 25
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A buildQueryString() 0 17 4
1
<?php
2
3
namespace jofner\SDK\TwitchTV;
4
5
/**
6
 * Helper for TwitchTV API SDK for PHP
7
 *
8
 * PHP SDK for interacting with the TwitchTV API
9
 *
10
 * @author Josef Ohnheiser <[email protected]>
11
 * @license https://github.com/jofner/Twitch-SDK/blob/master/LICENSE.md MIT
12
 * @homepage https://github.com/jofner/Twitch-SDK
13
 */
14
class Helper
15
{
16
    /**
17
     * Build query string
18
     * @param $params
19
     * @return null|string
20
     */
21
    public function buildQueryString($params)
22
    {
23
        $param = array();
24
        $queryString = null;
25
26
        foreach ($params as $key => $value) {
27
            if (!empty($value)) {
28
                $param[$key] = $value;
29
            }
30
        }
31
32
        if (count($param) > 0) {
33
            $queryString = '?' . http_build_query($param);
34
        }
35
36
        return $queryString;
37
    }
38
}
39