<?php

namespace Hura8\System\Controller;

use Hura8\System\Model\WebUserModel;

class WebUserController
{
    const USER_BROWSER_COOKIE_NAME  = 'uID';

    protected  $objWebUserModel;

    public function __construct()
    {
        $this->objWebUserModel = new WebUserModel(self::getUserId());
    }

    // prefer cookie-id, if set ID in url parameter then use it
    public static function getUserId() {
        $url_user_id    = getRequest("uid", "");
        $cookie_user_id = (isset($_COOKIE[self::USER_BROWSER_COOKIE_NAME])) ? $_COOKIE[self::USER_BROWSER_COOKIE_NAME] : '';

        return ($url_user_id) ?: $cookie_user_id;
    }


}
