public function test_getter_and_setter()
 {
     $obj = new Transaction();
     $this->assertNull($obj->getAccountNumber());
     $this->assertNull($obj->getAmount());
     $this->assertNull($obj->getBankCode());
     $this->assertNull($obj->getBookingDate());
     $this->assertNull($obj->getBookingText());
     $this->assertNull($obj->getCreditDebit());
     $this->assertNull($obj->getDescription1());
     $this->assertNull($obj->getDescription2());
     $this->assertNull($obj->getName());
     $this->assertNull($obj->getValutaDate());
     $date = new \DateTime();
     $this->assertSame('123456789', $obj->setAccountNumber('123456789')->getAccountNumber());
     $this->assertSame(20.0, $obj->setAmount(20.0)->getAmount());
     $this->assertSame('123456789', $obj->setBankCode('123456789')->getBankCode());
     $this->assertSame($date, $obj->setBookingDate($date)->getBookingDate());
     $this->assertSame($date, $obj->setValutaDate($date)->getValutaDate());
     $this->assertSame('text', $obj->setBookingText('text')->getBookingText());
     $this->assertSame(Transaction::CD_DEBIT, $obj->setCreditDebit(Transaction::CD_DEBIT)->getCreditDebit());
     $this->assertSame(Transaction::CD_CREDIT, $obj->setCreditDebit(Transaction::CD_CREDIT)->getCreditDebit());
     $this->assertSame('desc1', $obj->setDescription1('desc1')->getDescription1());
     $this->assertSame('desc2', $obj->setDescription2('desc2')->getDescription2());
     $this->assertSame('name', $obj->setName('name')->getName());
 }
 /**
  * Creates a StatementOfAccount model from array.
  *
  * @param array $array
  * @return StatementOfAccount|null
  */
 public static function createModelFromArray(array $array)
 {
     if (empty($array)) {
         return null;
     }
     $soa = new StatementOfAccount();
     foreach ($array as $date => $statement) {
         $statementModel = new Statement();
         $statementModel->setDate(new \DateTime($date));
         $statementModel->setStartBalance((double) $statement['start_balance']['amount']);
         $statementModel->setCreditDebit($statement['start_balance']['credit_debit']);
         if (isset($statement['transactions'])) {
             foreach ($statement['transactions'] as $trx) {
                 $transaction = new Transaction();
                 $transaction->setBookingDate(new \DateTime($trx['booking_date']));
                 $transaction->setValutaDate(new \DateTime($trx['valuta_date']));
                 $transaction->setCreditDebit($trx['credit_debit']);
                 $transaction->setAmount($trx['amount']);
                 $transaction->setBookingText($trx['description']['booking_text']);
                 $transaction->setDescription1($trx['description']['description_1']);
                 $transaction->setDescription2($trx['description']['description_2']);
                 $transaction->setBankCode($trx['description']['bank_code']);
                 $transaction->setAccountNumber($trx['description']['account_number']);
                 $transaction->setName($trx['description']['name']);
                 $statementModel->addTransaction($transaction);
             }
         }
         $soa->addStatement($statementModel);
     }
     return $soa;
 }