| Conditions | 6 | 
| Paths | 4 | 
| Total Lines | 32 | 
| Code Lines | 19 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 2 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php  | 
            ||
| 19 | public function setUp()  | 
            ||
| 20 |     { | 
            ||
| 21 |         $key    = getenv('AWS_KEY'); | 
            ||
| 22 |         $secret = getenv('AWS_SECRET'); | 
            ||
| 23 |         $region = getenv('AWS_REGION'); | 
            ||
| 24 | |||
| 25 |         if (empty($key) || empty($secret)) { | 
            ||
| 26 |             $this->markTestSkipped('Missing AWS_KEY and/or AWS_SECRET env vars.'); | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 27 | }  | 
            ||
| 28 | |||
| 29 |         $this->bucket = uniqid(getenv('AWS_BUCKET')); | 
            ||
| 30 | |||
| 31 | // For AWS SDK v2  | 
            ||
| 32 |         if (class_exists('Aws\Common\Client\AbstractClient')) { | 
            ||
| 33 | return $this->client = S3Client::factory([  | 
            ||
| 34 | 'region' => $region ? $region : 'eu-west-1',  | 
            ||
| 35 | 'version' => '2006-03-01',  | 
            ||
| 36 | 'key' => $key,  | 
            ||
| 37 | 'secret' => $secret,  | 
            ||
| 38 | ]);  | 
            ||
| 39 | }  | 
            ||
| 40 | |||
| 41 | // For AWS SDK v3  | 
            ||
| 42 | $this->client = new S3Client([  | 
            ||
| 43 | 'region' => $region ? $region : 'eu-west-1',  | 
            ||
| 44 | 'version' => 'latest',  | 
            ||
| 45 | 'credentials' => [  | 
            ||
| 46 | 'key' => $key,  | 
            ||
| 47 | 'secret' => $secret,  | 
            ||
| 48 | ],  | 
            ||
| 49 | ]);  | 
            ||
| 50 | }  | 
            ||
| 51 | |||
| 68 | 
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.