예제 #1
0
 public function testIsList()
 {
     $list = array(5, 'nstaoush', array());
     $this->assertTrue(CleverUtil::isList($list));
     $notlist = array(5, 'nstaoush', array(), 'bar' => 'baz');
     $this->assertFalse(CleverUtil::isList($notlist));
 }
예제 #2
0
 protected static function _scopedCreate($class, $params = null, $auth = null)
 {
     self::_validateCall('create', $params, $auth);
     $requestor = new CleverApiRequestor($auth);
     $url = self::classUrl($class);
     list($response, $auth) = $requestor->request('post', $url, $params);
     return CleverUtil::convertToCleverObject($response, $auth);
 }
예제 #3
0
 public function __call($method, $args)
 {
     if (array_key_exists($method, self::$secondLevelEndpoints)) {
         $params = $args && count($args) ? $args[0] : array();
         $requestor = new CleverApiRequestor($this->_auth);
         $url = $this->instanceUrl() . '/' . $method;
         list($response, $auth) = $requestor->request('get', $url, $params);
         return CleverUtil::convertToCleverObject($response, $this->_auth);
     }
     throw new UndefinedEndpointException(__CLASS__ . " endpoint '{$method}' is not defined.");
 }
예제 #4
0
 public function __toArray($recursive = false)
 {
     if ($recursive) {
         return CleverUtil::convertCleverObjectToArray($this->_values);
     } else {
         return $this->_values;
     }
 }