Passed
Push — master ( abed16...744134 )
by Ax
01:19
created

Leagues::state()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace SchoppAx\Sleeper\Api;
4
5
class Leagues extends Api
6
{
7
8
  /**
9
   * @param string $leagueId
10
   * @return array|[]
0 ignored issues
show
Documentation Bug introduced by
The doc comment array|[] at position 2 could not be parsed: Unknown type name '[' at position 2 in array|[].
Loading history...
11
   * @throws ClientException if status code <> 200
12
   * @throws Exception if response body equals null
13
   */
14 2
  public function find(string $leagueId): array
15
  {
16 2
    return $this->get('league/' . $leagueId);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->get('league/' . $leagueId) returns the type SchoppAx\Sleeper\Api\json which is incompatible with the type-hinted return array.
Loading history...
17
  }
18
19
  /**
20
   * @param string $userId
21
   * @param string $season
22
   * @param string[optional] $sport default is nfl
23
   * @return array|[]
0 ignored issues
show
Documentation Bug introduced by
The doc comment array|[] at position 2 could not be parsed: Unknown type name '[' at position 2 in array|[].
Loading history...
24
   * @throws ClientException if status code <> 200
25
   * @throws Exception if response body equals null
26
   */
27 1
  public function byUser(string $userId, string $season, string $sport = 'nfl'): array
28
  {
29 1
    return $this->get('user/' . $userId . '/leagues/'. $sport .'/' . $season);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->get('user/...$sport . '/' . $season) returns the type SchoppAx\Sleeper\Api\json which is incompatible with the type-hinted return array.
Loading history...
30
  }
31
32
33
  /**
34
   * @param string $leagueId
35
   * @param string $week
36
   * @return array|[]
0 ignored issues
show
Documentation Bug introduced by
The doc comment array|[] at position 2 could not be parsed: Unknown type name '[' at position 2 in array|[].
Loading history...
37
   * @throws ClientException if status code <> 200
38
   * @throws Exception if response body equals null
39
   */
40
  public function matchups(string $userId, string $week): array
0 ignored issues
show
Unused Code introduced by
The parameter $userId is not used and could be removed. ( Ignorable by Annotation )

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

40
  public function matchups(/** @scrutinizer ignore-unused */ string $userId, string $week): array

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
41
  {
42
    return $this->get('league/' . $leagueId . '/matchups/' . $week);
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $leagueId seems to be never defined.
Loading history...
Bug Best Practice introduced by
The expression return $this->get('leagu.... '/matchups/' . $week) returns the type SchoppAx\Sleeper\Api\json which is incompatible with the type-hinted return array.
Loading history...
43
  }
44
45
  /**
46
   * @param string[optional] $sport default is nfl
47
   * @return object
48
   * @throws ClientException if status code <> 200
49
   * @throws Exception if response body equals null
50
   */
51 1
  public function state(string $sport = 'nfl'): array
52
  {
53 1
    return $this->get('state/'. $sport);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->get('state/' . $sport) returns the type SchoppAx\Sleeper\Api\json which is incompatible with the type-hinted return array.
Loading history...
54
  }
55
56
  /**
57
   * @param string $leagueId
58
   * @return array|[]
0 ignored issues
show
Documentation Bug introduced by
The doc comment array|[] at position 2 could not be parsed: Unknown type name '[' at position 2 in array|[].
Loading history...
59
   * @throws ClientException if status code <> 200
60
   * @throws Exception if response body equals null
61
   */
62
  public function users(string $leagueId): array
63
  {
64
    return $this->get('league/' . $leagueId . '/users');
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->get('leagu.... $leagueId . '/users') returns the type SchoppAx\Sleeper\Api\json which is incompatible with the type-hinted return array.
Loading history...
65
  }
66
67
  /**
68
   * @param string $leagueId
69
   * @return array|[]
0 ignored issues
show
Documentation Bug introduced by
The doc comment array|[] at position 2 could not be parsed: Unknown type name '[' at position 2 in array|[].
Loading history...
70
   * @throws ClientException if status code <> 200
71
   * @throws Exception if response body equals null
72
   */
73
  public function rosters(string $leagueId): array
74
  {
75
    return $this->get('league/' . $leagueId . '/rosters');
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->get('leagu...$leagueId . '/rosters') returns the type SchoppAx\Sleeper\Api\json which is incompatible with the type-hinted return array.
Loading history...
76
  }
77
78
}
79