Completed
Push — master ( 9ae690...ba1bd4 )
by Stephen
02:32
created

Accounts::findThreads()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 3
1
<?php
2
3
namespace StarCitizen\Accounts;
4
5
use StarCitizen\Base\StarCitizenAbstract;
6
use StarCitizen\Models\Posts;
7
use StarCitizen\Models\Profile;
8
use StarCitizen\Models\Threads;
9
10
/**
11
 * Class Accounts
12
 *
13
 * @package StarCitizen\Accounts;
14
 */
15
class Accounts extends StarCitizenAbstract
16
{
17
18
    /**
19
     * @var string
20
     */
21
    protected static $system = "accounts";
22
23
    /**
24
     * Constants Profile Types
25
     */
26
    const FULL = "full_profile";
27
    const THREADS = "threads";
28
    const POSTS = "posts";
29
30
    /**
31
     * Model Map
32
     */
33
    const MODELS = [
34
        Accounts::FULL => '\Profile',
35
        Accounts::THREADS => '\Threads',
36
        Accounts::POSTS => '\Posts',
37
    ];
38
39
    const BASEPROFILE = Accounts::FULL;
40
41
    /**
42
     * @param $id
43
     * @param bool $cache
44
     * @param bool $raw
45
     *
46
     * @return bool|Profile|string
47
     */
48
    public static function findProfile($id, $cache = false, $raw = false)
49
    {
50
        return parent::find($id, Accounts::FULL, $cache, $raw);
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (find() instead of findProfile()). Are you sure this is correct? If so, you might want to change this to $this->find().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
51
    }
52
53
    /**
54
     * @param $id
55
     * @param bool $cache
56
     * @param bool $raw
57
     *
58
     * @return bool|Threads|string
59
     */
60
    public static function findThreads($id, $cache = false, $raw = false)
61
    {
62
        return parent::find($id, Accounts::THREADS, $cache, $raw);
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (find() instead of findThreads()). Are you sure this is correct? If so, you might want to change this to $this->find().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
63
    }
64
65
    /**
66
     * @param $id
67
     * @param bool $cache
68
     * @param bool $raw
69
     *
70
     * @return bool|Posts|string
71
     */
72
    public static function findPosts($id, $cache = false, $raw = false)
73
    {
74
        return parent::find($id, Accounts::POSTS, $cache, $raw);
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (find() instead of findPosts()). Are you sure this is correct? If so, you might want to change this to $this->find().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
75
    }
76
}