I have some function (pasted below little piece of function), which I used as separate function and it worked well. 

Now I want to move this functon into some class. As you see, it works with `$_SESSION` and `$_COOKIE`. 

Question is, is it required to send `$_SESSION` and `$_COOKIE` as input data while calling this function (I mean something like that: calling like `protect($_SESSION, $_COOKIE)` and then fetch them from inside function)? or it will work without sending them?

```
...
public function protect() {
    session_start();

    if (isset($_SESSION['HTTP_USER_AGENT'])) {
        if ($_SESSION['HTTP_USER_AGENT'] != md5($_SERVER['HTTP_USER_AGENT'])) {
            $this->logout();
            exit;
        }
    }

    if (!isset($_SESSION['id']) && !isset($_SESSION['login'])) {
        if (isset($_COOKIE['id']) && isset($_COOKIE['key'])) {

 ...

```