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)); }
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); }
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."); }
public function __toArray($recursive = false) { if ($recursive) { return CleverUtil::convertCleverObjectToArray($this->_values); } else { return $this->_values; } }