1 | <?php |
||
11 | trait ProviderRedirectTrait |
||
12 | { |
||
13 | /** |
||
14 | * Maximum number of times to follow provider initiated redirects |
||
15 | * |
||
16 | * @var integer |
||
17 | */ |
||
18 | protected $redirectLimit = 2; |
||
19 | |||
20 | /** |
||
21 | * Retrieves current redirect limit. |
||
22 | * |
||
23 | * @return integer |
||
24 | */ |
||
25 | 4 | public function getRedirectLimit() |
|
29 | |||
30 | /** |
||
31 | * Sends a request instance and returns a response instance. |
||
32 | * |
||
33 | * @param RequestInterface $request |
||
34 | * @return ResponseInterface |
||
35 | */ |
||
36 | 8 | protected function sendRequest(RequestInterface $request) |
|
69 | |||
70 | /** |
||
71 | * Updates the redirect limit. |
||
72 | * |
||
73 | * @param integer $limit |
||
74 | * @return League\OAuth2\Client\Provider\AbstractProvider |
||
75 | * @throws InvalidArgumentException |
||
76 | */ |
||
77 | 10 | public function setRedirectLimit($limit) |
|
87 | } |
||
88 |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idable
provides a methodequalsId
that in turn relies on the methodgetId()
. If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()
as an abstract method to the trait will make sure it is available.