function get_vars() { return get_public_vars($this); }
/** * Short notation for the api POST requests * * @param string $path * @param array|GraphObject $data * @return mixed */ static function post($path, $data = array()) { if (is_object($data)) { $data = get_public_vars($data); foreach ($data as $field => $value) { if ($value instanceof Collection) { unset($data[$field]); } } } return self::getInstance()->api($path, 'POST', $data); }
/** * Generate fieldlist based on propeties in the currect class. * * @param array $options Options that will be forwarded to the getFieldPermissions() and getKnownConnections() functions. * @return array */ protected static function getAllowedFields($options = array()) { $permissions = static::getFieldPermissions($options); $relations = static::getKnownConnections($options); $fields = array(); $availablePermissions = Facebook::getInstance()->getPermissions(); $properties = array_keys(get_public_vars(get_called_class())); foreach ($properties as $property) { if (isset($permissions[$property])) { // Does this property require a permission? if (in_array($permissions[$property], $availablePermissions)) { // permission granted? $fields[] = $property; } } elseif (array_key_exists($property, $relations) === false) { // Not a relation? $fields[] = $property; } } return $fields; }