| 1 | <?php |
||
| 5 | trait PayPalTransactions |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * Perform a GetTransactionDetails API call on PayPal. |
||
| 9 | * |
||
| 10 | * @param string $transaction |
||
| 11 | * |
||
| 12 | * @return array |
||
| 13 | */ |
||
| 14 | public function getTransactionDetails($transaction) |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Perform a DoReferenceTransaction API operation on PayPal. |
||
| 25 | * |
||
| 26 | * @param string $transaction |
||
| 27 | * @param string $action |
||
| 28 | * |
||
| 29 | * @return array |
||
| 30 | */ |
||
| 31 | public function doReferenceTransaction($transaction, $action) |
||
| 40 | |||
| 41 | /** |
||
| 42 | * Refund PayPal Transaction. |
||
| 43 | * |
||
| 44 | * @param string $transaction |
||
| 45 | * @param float $amount |
||
| 46 | * |
||
| 47 | * @return array |
||
| 48 | */ |
||
| 49 | public function refundTransaction($transaction, $amount = 0.00) |
||
| 64 | |||
| 65 | /** |
||
| 66 | * Search Transactions On PayPal. |
||
| 67 | * |
||
| 68 | * @param array $post |
||
| 69 | * |
||
| 70 | * @return array |
||
| 71 | */ |
||
| 72 | public function searchTransactions($post) |
||
| 78 | } |
||
| 79 |
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.