code: protected function findFirstMatch($cookie)
      {
          for ($i = 0; $i < count($this->cookies); $i++) {
              $is_match = $this->isMatch(
                      $cookie,
                      $this->cookies[$i]->getHost(),
                      $this->cookies[$i]->getPath(),
                      $this->cookies[$i]->getName());
              if ($is_match) {
                  return $i;
              }
          }
  
          return count($this->cookies);
      }
docs: Finds a matching cookie to write over or the first empty slot if none.
  
  @param SimpleCookie $cookie Cookie to write into jar.
  
  @return int Available slot.