iaematt /
cafeapi
| 1 | <?php |
||
| 2 | |||
| 3 | /** Require files */ |
||
| 4 | require __DIR__ . '/assets/config.php'; |
||
| 5 | require __DIR__ . '/../vendor/autoload.php'; |
||
| 6 | |||
| 7 | /** Dependencies */ |
||
| 8 | use MatheusBastos\CafeApi\Subscriptions; |
||
| 9 | |||
| 10 | $subscription = new Subscriptions('localhost/fsphp/api/', '[email protected]', 'senhasecreta'); |
||
| 11 | |||
| 12 | /** Index */ |
||
| 13 | echo '<h1>Index</h1>'; |
||
| 14 | $index = $subscription->index(null); |
||
|
0 ignored issues
–
show
|
|||
| 15 | |||
| 16 | if ($index->error()) { |
||
| 17 | var_dump($index->error()); |
||
| 18 | } else { |
||
| 19 | var_dump($index->response()); |
||
| 20 | } |
||
| 21 | |||
| 22 | /** Create */ |
||
| 23 | echo '<h1>Create</h1>'; |
||
| 24 | |||
| 25 | $create = $subscription->create([ |
||
| 26 | 'plan_id' => 1, |
||
| 27 | 'card_number' => '5583983765729729', |
||
| 28 | 'card_holder_name' => 'ROBSON LEITE', |
||
| 29 | 'card_expiration_date' => '12/2020', |
||
| 30 | 'card_cvv' => '654', |
||
| 31 | ]); |
||
| 32 | |||
| 33 | if ($create->error()) { |
||
| 34 | echo "<p class='error'>{$create->error()->message}</p>"; |
||
| 35 | } else { |
||
| 36 | var_dump($create->response()); |
||
| 37 | } |
||
| 38 | |||
| 39 | /** Read */ |
||
| 40 | echo '<h1>Read</h1>'; |
||
| 41 | |||
| 42 | $read = $subscription->read(); |
||
| 43 | |||
| 44 | if ($read->error()) { |
||
| 45 | echo "<p class='error'>{$read->error()->message}</p>"; |
||
| 46 | } else { |
||
| 47 | var_dump($read->response()); |
||
| 48 | } |
||
| 49 | |||
| 50 | /** Update */ |
||
| 51 | echo '<h1>UPDATE</h1>'; |
||
| 52 | |||
| 53 | //$update = $subscription->update(["plan_id" => 2]); |
||
| 54 | $update = $subscription->update([ |
||
| 55 | 'card_number' => '4024007190034479', |
||
| 56 | 'card_holder_name' => 'ROBSON LEITE', |
||
| 57 | 'card_expiration_date' => '12/2020', |
||
| 58 | 'card_cvv' => '654', |
||
| 59 | ]); |
||
| 60 | |||
| 61 | if ($update->error()) { |
||
| 62 | echo "<p class='error'>{$update->error()->message}</p>"; |
||
| 63 | } else { |
||
| 64 | var_dump($update->response()); |
||
| 65 | } |
||
| 66 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.