original_string: public function applyCookie($req)
      {
          // fetch cookies
          $host = $req->getHeader('host');
          $path = $req->getUrlParam('path');
          $cookies = $this->fetchCookieToSend($host, $path);
          if ($this !== $req) {
              $cookies = array_merge($cookies, $req->fetchCookieToSend($host, $path));
          }
          // add to header
          $req->setHeader('cookie', null);
          foreach (array_chunk(array_values($cookies), 3) as $chunk) {
              $req->addHeader('cookie', implode('; ', $chunk));
          }
      }
code: public function applyCookie($req)
      {
          // fetch cookies
          $host = $req->getHeader('host');
          $path = $req->getUrlParam('path');
          $cookies = $this->fetchCookieToSend($host, $path);
          if ($this !== $req) {
              $cookies = array_merge($cookies, $req->fetchCookieToSend($host, $path));
          }
          // add to header
          $req->setHeader('cookie', null);
          foreach (array_chunk(array_values($cookies), 3) as $chunk) {
              $req->addHeader('cookie', implode('; ', $chunk));
          }
      }
code_tokens: public function applyCookie ( $ req ) { // fetch cookies $ host = $ req -> getHeader ( 'host' ) ; $ path = $ req -> getUrlParam ( 'path' ) ; $ cookies = $ this -> fetchCookieToSend ( $ host , $ path ) ; if ( $ this !== $ req ) { $ cookies = array_merge ( $ cookies , $ req -> fetchCookieToSend ( $ host , $ path ) ) ; } // add to header $ req -> setHeader ( 'cookie' , null ) ; foreach ( array_chunk ( array_values ( $ cookies ) , 3 ) as $ chunk ) { $ req -> addHeader ( 'cookie' , implode ( '; ' , $ chunk ) ) ; } }
docstring: Apply cookies for request
  @param Request $req
docstring_tokens: Apply cookies for request