コード例 #1
0
 private static function getInstance()
 {
     if (self::$instance == null) {
         self::$instance = new self();
     }
     return self::$instance;
 }
コード例 #2
0
 public function getList($params)
 {
     OpenpayConsole::trace('OpenpayApiDerivedResource @find');
     $list = parent::_find($this->resourceName, $params, array('parent' => $this));
     foreach ($list as $resource) {
         $this->addResource($resource);
     }
     return $list;
 }
コード例 #3
0
 public static function request($method, $url, $params = null)
 {
     OpenpayConsole::trace('OpenpayApiConnector @request ' . $url);
     if (!$params) {
         $params = array();
     }
     $method = strtolower($method);
     if (!in_array($method, array('get', 'post', 'delete', 'put'))) {
         throw new OpenpayApiError("Invalid request method '" . $method . "'");
     }
     $connector = self::getInstance();
     return $connector->_request($method, $url, $params);
 }
コード例 #4
0
 public function __set($key, $value)
 {
     OpenpayConsole::trace('OpenpayApiResourceBase @__set > ' . $key . ' = ' . $value);
     if ($value === '' || !$value) {
         error_log("[OPENPAY Notice] The property '" . $key . "' will be set to en empty string which will be intepreted ad a NULL in request");
     }
     if (isset($this->{$key}) && is_array($value)) {
         // TODO: handle this properly, eg: interpret the array as an object and replace value as
         // $this->$key->replaceWith($value);
         throw new OpenpayApiError("The property '" . $key . "' cannot be assigned directly with an array");
         //} else if (property_exists($this, $key)) {
         //	$this->$key = $value;
     } else {
         if (isset($this->serializableData[$key])) {
             $this->serializableData[$key] = $value;
         } elseif (isset($this->derivedResources[$key])) {
             $this->derivedResources[$key] = $value;
         }
     }
 }