Completed
Push — master ( 7a4c9e...09d75e )
by Gianluca
04:00
created

SingRingApiService::getAllSongs()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 10

Duplication

Lines 13
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 13
loc 13
rs 9.4285
cc 1
eloc 10
nc 1
nop 4
1
<?php
2
namespace App\Service;
3
4
class SingRingApiService
5
{
6 View Code Duplication
    public function getAllSongs($apiKey, $apiId, $start, $limit)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
7
    {
8
        $call = curl_init();
9
        curl_setopt($call, CURLOPT_RETURNTRANSFER, 1);
10
        curl_setopt(
11
            $call,
12
            CURLOPT_URL,
13
            "http://api.singring.it/getAllSongs.php?API_id={$apiId}&API_key={$apiKey}&start={$start}&limit={$limit}"
14
        );
15
        $body = json_decode(curl_exec($call));
16
        curl_close($call);
17
        return $body;
18
    }
19
20 View Code Duplication
    public function getLyricById($apiKey, $apiId, $id)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
21
    {
22
        $call = curl_init();
23
        curl_setopt($call, CURLOPT_RETURNTRANSFER, 1);
24
        curl_setopt(
25
            $call,
26
            CURLOPT_URL,
27
            "http://api.singring.it/getLyricById.php?API_id={$apiId}&API_key={$apiKey}&id={$id}"
28
        );
29
        $body = json_decode(curl_exec($call));
30
        curl_close($call);
31
        return $body[0];
32
    }
33
}
34