class Basecamp_Object var _basecamp var account var id public function

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?
class Basecamp_Object {
var $_basecamp;
var $account;
var $id;
public function __construct($id,$basecamp='') {
$this->id = $id;
if ( $basecamp ) {
$this->_basecamp = $basecamp;
}
}
public static function objectFromResponse($object,$basecamp='') {
$newObject = new static('','');
foreach ((array)$object as $key => $val ) {
$newObject->$key = $val;
}
if ( $basecamp ) {
$newObject->setBasecamp($basecamp);
$newObject->account = $basecamp->account;
}
return $newObject;
}
public function setBasecamp(Basecamp $basecamp) {
$this->_basecamp = $basecamp;
}
public function basecampRequired() {
if ( !$this->_basecamp ) {
throw new Exception('There is no Basecamp object associated with this object to make requests');
}
}
}
?>