コード例 #1
0
 public static function createFromXML(CultureFeed_SimpleXMLElement $object)
 {
     $membership = new CultureFeed_Uitpas_Passholder_Membership();
     $membership->id = $object->xpath_str('id');
     $membership->association = CultureFeed_Uitpas_Association::createFromXML($object->xpath('association', false));
     $membership->associationId = $object->xpath_str('association/id');
     $membership->name = $object->xpath_str('association/name');
     $membership->endDate = $object->xpath_time('endDate');
     $membership->renewable = $object->xpath_bool('renewable');
     $membership->newEndDate = $object->xpath_time('newEndDate');
     $membership->renewDate = $object->xpath_time('renewDate');
     $membership->expired = $object->xpath_bool('expired');
     return $membership;
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function getAssociations($consumer_key_counter = NULL, $readPermission = NULL, $registerPermission = NULL)
 {
     $data = array();
     if ($consumer_key_counter) {
         $data['balieConsumerKey'] = $consumer_key_counter;
     }
     // The parameters reflect the existing UiTPAS API.
     // You have to leave out permissions completely if you don't want to
     // filter at all.
     // Filter values should be strings, because booleans would be casted to 0
     // or 1 and the API would not be able to parse those apparently.
     if (!is_null($readPermission)) {
         $data['readPermission'] = $readPermission ? 'true' : 'false';
     }
     if (!is_null($registerPermission)) {
         $data['registerPermission'] = $registerPermission ? 'true' : 'false';
     }
     $result = $this->oauth_client->authenticatedGetAsXML('uitpas/association/list', $data);
     try {
         $xml = new CultureFeed_SimpleXMLElement($result);
     } catch (Exception $e) {
         throw new CultureFeed_ParseException($result);
     }
     $associations = array();
     $objects = $xml->xpath('/response/associations/association');
     $total = count($objects);
     foreach ($objects as $object) {
         $associations[] = CultureFeed_Uitpas_Association::createFromXML($object);
     }
     return new CultureFeed_ResultSet($total, $associations);
 }