Issues (19)

src/Actions/ManagesAccounts.php (2 issues)

Labels
Severity
1
<?php
2
3
namespace TestMonitor\DevOps\Actions;
4
5
use TestMonitor\DevOps\Transforms\TransformsAccounts;
6
7
trait ManagesAccounts
8
{
9
    use TransformsAccounts;
10
11
    /**
12
     * Get a list of of accounts.
13
     *
14
     * @throws \TestMonitor\DevOps\Exceptions\InvalidDataException
15
     *
16
     * @return \TestMonitor\DevOps\Resources\Account[]
17
     */
18 7
    public function accounts()
19
    {
20
        // First, establish your profile ID
21 7
        $user = $this->myself();
22
23
        // Second, retrieve for the accounts for this member
24 1
        $accounts = $this->request(
0 ignored issues
show
It seems like request() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

24
        /** @scrutinizer ignore-call */ 
25
        $accounts = $this->request(
Loading history...
25 1
            'GET',
26 1
            'https://app.vssps.visualstudio.com/_apis/accounts',
27 1
            ['query' => ['memberId' => $user->id]]
28 1
        );
29
30 1
        if ($accounts === '[]') {
31
            return [];
32
        }
33
34
        return $this->fromDevOpsAccounts($accounts);
35
    }
36
37
    /**
38 12
     * Returns the profile of the authenticated user.
39
     *
40 12
     * @return \TestMonitor\DevOps\Resources\Profile
41
     */
42 2
    public function myself()
43
    {
44
        $response = $this->get('https://app.vssps.visualstudio.com/_apis/profile/profiles/me');
0 ignored issues
show
It seems like get() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

44
        /** @scrutinizer ignore-call */ 
45
        $response = $this->get('https://app.vssps.visualstudio.com/_apis/profile/profiles/me');
Loading history...
45
46
        return $this->fromDevOpsProfile($response);
47
    }
48
}
49