<?php
namespace shop;

class PaymentMethod implements \ArrayAccess
{
  private static function repo(): \Domain\PaymentMethod\PaymentMethodRepository
  {
    global $mdb;
    return new \Domain\PaymentMethod\PaymentMethodRepository( $mdb );
  }

  // lista dostepnych form platnosci
  static public function method_list()
  {
    return self::repo()->allActive();
  }

  // get_apilo_payment_method_id
  static public function get_apilo_payment_method_id( $payment_method_id )
  {
    return self::repo()->getApiloPaymentTypeId( (int)$payment_method_id );
  }

  public function offsetExists( $offset )
  {
    return isset( $this -> $offset );
  }

  public function offsetGet( $offset )
  {
    return $this -> $offset;
  }

  public function offsetSet( $offset, $value )
  {
    $this -> $offset = $value;
  }

  public function offsetUnset( $offset )
  {
    unset( $this -> $offset );
  }
}
