protected function createProfileFromData($token, $data, $parent = null)
    {
        $profile = new Profile($token);
        $profile->setIp($data['ip']);
        $profile->setMethod($data['method']);
        $profile->setUrl($data['url']);
        $profile->setTime($data['time']);
        $profile->setCollectors($data['data']);

        if (!$parent && $data['parent']) {
            $parent = $this->read($data['parent']);
        }

        if ($parent) {
            $profile->setParent($parent);
        }

        foreach ($data['children'] as $token) {
            if (!$token) {
                continue;
            }

            if (!$childProfileData = $this->getValue($this->getItemName($token), self::REDIS_SERIALIZER_PHP)) {
                continue;
            }

            $profile->addChild($this->createProfileFromData($token, $childProfileData, $profile));
        }

        return $profile;
    }
protected function createProfileFromData($token, $data, $parent = null)
    {
        $profile = new Profile($token);
        $profile->setIp($data['ip']);
        $profile->setMethod($data['method']);
        $profile->setUrl($data['url']);
        $profile->setTime($data['time']);
        $profile->setCollectors($data['data']);

        if (!$parent && $data['parent']) {
            $parent = $this->read($data['parent']);
        }

        if ($parent) {
            $profile->setParent($parent);
        }

        foreach ($data['children'] as $token) {
            if (!$token) {
                continue;
            }

            if (!$childProfileData = $this->getValue($this->getItemName($token), self::REDIS_SERIALIZER_PHP)) {
                continue;
            }

            $profile->addChild($this->createProfileFromData($token, $childProfileData, $profile));
        }

        return $profile;
    }
protected function createProfileFromData ( $ token , $ data , $ parent = null ) { $ profile = new Profile ( $ token ) ; $ profile -> setIp ( $ data [ 'ip' ] ) ; $ profile -> setMethod ( $ data [ 'method' ] ) ; $ profile -> setUrl ( $ data [ 'url' ] ) ; $ profile -> setTime ( $ data [ 'time' ] ) ; $ profile -> setCollectors ( $ data [ 'data' ] ) ; if ( ! $ parent && $ data [ 'parent' ] ) { $ parent = $ this -> read ( $ data [ 'parent' ] ) ; } if ( $ parent ) { $ profile -> setParent ( $ parent ) ; } foreach ( $ data [ 'children' ] as $ token ) { if ( ! $ token ) { continue ; } if ( ! $ childProfileData = $ this -> getValue ( $ this -> getItemName ( $ token ) , self :: REDIS_SERIALIZER_PHP ) ) { continue ; } $ profile -> addChild ( $ this -> createProfileFromData ( $ token , $ childProfileData , $ profile ) ) ; } return $ profile ; }
Creates a Profile.

@param  string  $token
@param  array   $data
@param  Profile $parent
@return Profile
Creates a Profile .