コード例 #1
0
ファイル: UtilTest.php プロジェクト: clever/clever-php
 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
ファイル: ApiResource.php プロジェクト: clever/clever-php
 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
ファイル: School.php プロジェクト: clever/clever-php
 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
ファイル: Object.php プロジェクト: clever/clever-php
 public function __toArray($recursive = false)
 {
     if ($recursive) {
         return CleverUtil::convertCleverObjectToArray($this->_values);
     } else {
         return $this->_values;
     }
 }