code: protected function balance(BalanceInterface $balance, $text)
      {
          if (!preg_match('/(C|D)(\d{6})([A-Z]{3})([0-9,]{1,15})/', $text, $match)) {
              throw new \RuntimeException(sprintf('Cannot parse balance: "%s"', $text));
          }
  
          $amount = (float) str_replace(',', '.', $match[4]);
          if ($match[1] === 'D') {
              $amount *= -1;
          }
  
          $date = \DateTime::createFromFormat('ymd', $match[2]);
          $date->setTime(0, 0, 0);
  
          $balance->setCurrency($match[3])
                  ->setAmount($amount)
                  ->setDate($date);
  
          return $balance;
      }
docs: Fill a Balance object from an MT940  balance line
  
  @param BalanceInterface $balance
  @param string $text
  @return \Jejik\MT940\Balance