Пример #1
0
 /**
  * @param array $data
  * @return $this
  */
 public function import(array $data)
 {
     $this->id = $data['id'];
     $this->name = $data['name'];
     $this->primaryType = $data['primary_type'];
     $this->platformExposure = $data['platform_exposure'];
     $this->email = $data['email'] ?: '';
     $this->dailyImpressionsAnyAuditStatus = $data['daily_imps_any_audit_status'] ?: 0;
     $this->dailyImpressionsAppNexusReviewed = $data['daily_imps_appnexus_reviewed'] ?: 0;
     $this->dailyImpressionsAppNexusSellerReviewed = $data['daily_imps_appnexus_seller_reviewed'] ?: 0;
     $this->IASHCompliant = $data['is_iash_compliant'];
     $this->resold = $data['has_resold'];
     $visibilityRules = new VisibilityRules();
     $this->visibilityRules = $visibilityRules->import($data['visibility_rules']);
     $this->bidder = new Bidder();
     if ($data['bidder']) {
         $this->bidder->import($data['bidder']);
     }
     $this->sellerType = $data['seller_type'] ?: '';
     $this->contactInfo = new ContactInfo();
     $this->active = $data['active'];
     $this->lastModified = \DateTime::createFromFormat("Y-m-d H:i:s", $data['last_modified']);
     $this->defaultDiscrepancyPCT = (double) $data['default_discrepancy_pct'] ?: 0.0;
     if ($data['contact_info'] !== null) {
         $this->contactInfo = $this->contactInfo->import(isset($data['contact_info'][0]) ? $data['contact_info'][0] : $data['contact_info']);
     }
     return $this;
 }
Пример #2
0
 public function testPlatformMemberVisibilityRulesServiceImport()
 {
     foreach ($this->getData('platform-member', 'platform-members') as $data) {
         if ($data['visibility_rules']) {
             $vr = $data['visibility_rules'];
             $obj = new PlatformMember\VisibilityRules();
             $obj->import($vr);
             $this->assertEquals($vr['expose_age'], $obj->canExposeAge());
             $this->assertEquals($vr['expose_custom_categories'], $obj->getExposedCustomCategories());
             $this->assertEquals($vr['expose_gender'], $obj->canExposeGender());
             $this->assertEquals($vr['expose_publishers'], $obj->canExposePublishers());
             $this->assertEquals($vr['expose_tags'], $obj->canExposeTags());
             $this->assertEquals($vr['expose_universal_categories'], $obj->canExposeUniversalCategories());
             $this->assertEquals($vr['url_exposure'], $obj->getUrlExposure());
             $this->assertInternalType('array', $obj->getCustomCategories());
             $this->assertInternalType('bool', $obj->canExposeAge());
             $this->assertInternalType('string', $obj->getExposedCustomCategories());
             $this->assertInternalType('bool', $obj->canExposeGender());
             $this->assertInternalType('bool', $obj->canExposePublishers());
             $this->assertInternalType('bool', $obj->canExposeTags());
             $this->assertInternalType('bool', $obj->canExposeUniversalCategories());
             $this->assertInternalType('string', $obj->getUrlExposure());
         }
     }
 }