5 * @author Galen Grover <galenjr@gmail.com>
6 * @license http://opensource.org/licenses/mit-license.php The MIT License
9 namespace Instagram\Core;
12 * Base object that all objects extend from
14 * Provides core functionality
16 abstract class BaseObjectAbstract {
27 * Proxy object that does all the API heavy lifting
29 * @var \Instagram\Core\Proxy
32 protected $proxy = null;
35 * Get the ID returned from the API
40 public function getId() {
41 return $this->data->id;
47 * Some API objects don't have IDs (tags, some locations )
48 * Those objects define their own getId() methods to return a psuedo ID
49 * Tags = tag name, ID-less locations return null
51 * @return string Returns the ID
54 public function getApiId() {
55 return $this->getId();
61 * @param StdClass $data Object's data
62 * @param \Instagram\Core\Proxy $proxy Object's proxy
65 public function __construct( $data, \Instagram\Core\Proxy $proxy = null ) {
66 $this->setData( $data );
67 $this->proxy = $proxy;
71 * Set the object's data
73 * @param StdClass $data Object data
76 public function setData( $data ) {
81 * Get the object's data
83 * @return Stdclass Returns the object's data
86 public function getData() {
91 * Magic method to get data
93 * This may be removed in future versions
95 * @param string $var Variable ot get from the data
96 * @return mixed Returns the variable or null
99 public function __get( $var ) {
100 return isset( $this->data->$var ) ? $this->data->$var : null;
104 * Set the object's proxy
106 * @param \Instagram\Core\Proxy $proxy Proxy object
109 public function setProxy( \Instagram\Core\Proxy $proxy ) {
110 $this->proxy = $proxy;