コード例 #1
0
 /**
  * @test
  */
 public function itShouldConvertToArray()
 {
     $array = ['payment_method' => 'credit-card', 'payment_method_details' => [], 'id' => '5ac3eb32-384d-4d61-a797-9f44b1cd70e5', 'created' => '2015-03-07T20:58:35+0100', 'modified' => '2015-03-07T21:58:35+0100', 'completed' => '2015-03-07T22:58:35+0100', 'status' => 'new', 'reason' => 'A great reason', 'currency' => 'EUR', 'amount' => 3400, 'expiration_period' => 'P0Y0M0DT1H0M0S', 'description' => 'A transaction', 'balance' => 'internal', 'payment_url' => 'http://www.example.com'];
     $this->assertEquals($array, Transaction::fromArray($array)->toArray());
 }
コード例 #2
0
 /**
  * @param array $transactions
  * @return Transactions
  */
 public static function fromArray(array $transactions)
 {
     return new static(array_map(function ($transaction) {
         return Transaction::fromArray($transaction);
     }, $transactions));
 }