| Conditions | 1 |
| Paths | 1 |
| Total Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 1 |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | 1 | public function registerUrlGenerator() |
|
| 22 | { |
||
| 23 | $this->getContainer()->singleton('url', function () { |
||
|
|
|||
| 24 | 1 | $routes = $this->getContainer()->get('routes'); |
|
| 25 | 1 | $request = $this->getRequest(); |
|
| 26 | |||
| 27 | 1 | $url = new UrlGenerator( |
|
| 28 | 1 | $routes, |
|
| 29 | 1 | (new RequestContext())->fromRequest($request) |
|
| 30 | ); |
||
| 31 | 1 | return $url; |
|
| 32 | 1 | }); |
|
| 33 | 1 | } |
|
| 34 | |||
| 45 | } |
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
Idableprovides a methodequalsIdthat 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.