| Conditions | 3 |
| Paths | 2 |
| Total Lines | 22 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 32 | 11 | public function deleteTemplate($templateName) |
|
| 33 | { |
||
| 34 | 11 | $ret = false; |
|
| 35 | |||
| 36 | 11 | StaticValidator::execute($templateName, 'TemplateName'); |
|
| 37 | |||
| 38 | $query = [ |
||
| 39 | 10 | 'templateName' => $templateName, |
|
| 40 | 10 | ]; |
|
| 41 | |||
| 42 | $options = [ |
||
| 43 | 10 | RequestOptions::QUERY => $query, |
|
| 44 | 10 | ]; |
|
| 45 | |||
| 46 | 10 | $response = $this->request('DELETE', $this->uri('/templates/delete'), $options); |
|
| 47 | |||
| 48 | 9 | if ($response instanceof Response && 204 === $response->getStatusCode()) { |
|
| 49 | 9 | $ret = true; |
|
| 50 | 9 | } |
|
| 51 | |||
| 52 | 10 | return $ret; |
|
| 53 | } |
||
| 54 | } |
||
| 55 |
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.