Conditions | 3 |
Paths | 4 |
Total Lines | 10 |
Code Lines | 7 |
Lines | 10 |
Ratio | 100 % |
Changes | 0 |
1 | <?php |
||
34 | View Code Duplication | protected static function assureApi(TwitterAds $instance = null) |
|
|
|||
35 | { |
||
36 | $instance = $instance ?: TwitterAds::instance(); |
||
37 | if (!$instance) { |
||
38 | throw new \InvalidArgumentException( |
||
39 | 'An Api instance must be provided as argument or ' . |
||
40 | 'set as instance in the \TwitterAds\Api'); |
||
41 | } |
||
42 | return $instance; |
||
43 | } |
||
44 | |||
67 | } |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.