コード例 #1
0
 /**
  * Buy constructor.
  *
  * @param $itemid
  *
  * @param $expected_price
  *
  * @param Login $login
  */
 public function __construct($itemid, $expected_price, Login $login)
 {
     $this->itemid = $itemid;
     $this->expected_price = $expected_price;
     $this->login = $login;
     if ($this->post == null) {
         $data = $this->PrepareHeaders();
         if ($data == null) {
             throw new TradeException();
         }
         $this->post = new Post(DEADFRONTIER_BACKPACK_ADDRESS, $data, $login->GetSessionCookie());
         if ($this->post == false) {
             throw new TradeException();
         }
     }
 }
コード例 #2
0
 /**
  * Bank constructor.
  *
  * @param $amount
  *
  * @param $action
  *
  * @param \DeadFrontier\User\Login $login
  */
 public function __construct($amount, $action = BANK_WIDTHDRAW, Login $login)
 {
     if ($login instanceof Login == false) {
         throw new UserException("Takes instance of login, given unidentified");
     }
     $this->login = $login;
     $this->action = $action;
     $this->amount = $amount;
     if ($this->post == null) {
         $data = $this->PrepareHeaders();
         if (empty($data)) {
             throw new UserException("Unexpected Result");
         }
         $this->post = new Post(DEADFRONTIER_BANK_ADDRESS, $data, $login->GetSessionCookie());
         if ($this->post === false) {
             throw new UserException("Unexpected Result");
         }
     } else {
         throw new UserException("Unexpected Result");
     }
 }