示例#1
0
 public function denormalize($data, $class, $format = null, array $context = array())
 {
     $profile = new Model\Entity\Profile();
     foreach ($data as $uri => $content) {
         $profile->set($this->serializer->denormalize($content, 'Depot\\Core\\Model\\Entity\\ProfileInfoInterface', $format, array_merge($context, array('depot.profile_type.uri' => $uri))));
     }
     return $profile;
 }
示例#2
0
 public static function createProfileFromJson($json)
 {
     if (!isset($json['https://tent.io/types/info/core/v0.1.0']['entity'])) {
         return null;
     }
     if (!isset($json['https://tent.io/types/info/core/v0.1.0']['servers'])) {
         return null;
     }
     $profile = new Model\Entity\Profile();
     foreach ($json as $type => $content) {
         $profile->set(new Model\Entity\ProfileInfo($type, $content));
     }
     return $profile;
 }