protected function createProfileFromData($token, $data, $parent = null) { $profile = new Profile($token); $profile->setIp($data['ip']); $profile->setUrl($data['url']); $profile->setTime($data['time']); $profile->setCollectors(unserialize(base64_decode($data['data']))); if (!$parent && isset($data['parent']) && $data['parent']) { $parent = $this->read($data['parent']); } if ($parent) { $profile->setParent($parent); } $profile->setChildren($this->readChildren($token, $profile)); return $profile; }