original_string: protected static function parseCookies(array $cookieHeader)
      {
          $cookies = [];
          foreach ($cookieHeader as $cookie) {
              if (strpos($cookie, '";"') !== false) {
                  $cookie = str_replace('";"', '{__cookie_replace__}', $cookie);
                  $parts = preg_split('/\;[ \t]*/', $cookie);
                  $parts = str_replace('{__cookie_replace__}', '";"', $parts);
              } else {
                  $parts = preg_split('/\;[ \t]*/', $cookie);
              }
  
              list($name, $value) = explode('=', array_shift($parts), 2);
              $parsed = ['name' => $name, 'value' => urldecode($value)];
  
              foreach ($parts as $part) {
                  if (strpos($part, '=') !== false) {
                      list($key, $value) = explode('=', $part);
                  } else {
                      $key = $part;
                      $value = true;
                  }
  
                  $key = strtolower($key);
                  if ($key === 'httponly') {
                      $key = 'httpOnly';
                  }
                  if ($key === 'expires') {
                      $key = 'expire';
                      $value = strtotime($value);
                  }
                  if (!isset($parsed[$key])) {
                      $parsed[$key] = $value;
                  }
              }
              $cookies[] = $parsed;
          }
  
          return $cookies;
      }
code: protected static function parseCookies(array $cookieHeader)
      {
          $cookies = [];
          foreach ($cookieHeader as $cookie) {
              if (strpos($cookie, '";"') !== false) {
                  $cookie = str_replace('";"', '{__cookie_replace__}', $cookie);
                  $parts = preg_split('/\;[ \t]*/', $cookie);
                  $parts = str_replace('{__cookie_replace__}', '";"', $parts);
              } else {
                  $parts = preg_split('/\;[ \t]*/', $cookie);
              }
  
              list($name, $value) = explode('=', array_shift($parts), 2);
              $parsed = ['name' => $name, 'value' => urldecode($value)];
  
              foreach ($parts as $part) {
                  if (strpos($part, '=') !== false) {
                      list($key, $value) = explode('=', $part);
                  } else {
                      $key = $part;
                      $value = true;
                  }
  
                  $key = strtolower($key);
                  if ($key === 'httponly') {
                      $key = 'httpOnly';
                  }
                  if ($key === 'expires') {
                      $key = 'expire';
                      $value = strtotime($value);
                  }
                  if (!isset($parsed[$key])) {
                      $parsed[$key] = $value;
                  }
              }
              $cookies[] = $parsed;
          }
  
          return $cookies;
      }
code_tokens: protected static function parseCookies ( array $ cookieHeader ) { $ cookies = [ ] ; foreach ( $ cookieHeader as $ cookie ) { if ( strpos ( $ cookie , '";"' ) !== false ) { $ cookie = str_replace ( '";"' , '{__cookie_replace__}' , $ cookie ) ; $ parts = preg_split ( '/\;[ \t]*/' , $ cookie ) ; $ parts = str_replace ( '{__cookie_replace__}' , '";"' , $ parts ) ; } else { $ parts = preg_split ( '/\;[ \t]*/' , $ cookie ) ; } list ( $ name , $ value ) = explode ( '=' , array_shift ( $ parts ) , 2 ) ; $ parsed = [ 'name' => $ name , 'value' => urldecode ( $ value ) ] ; foreach ( $ parts as $ part ) { if ( strpos ( $ part , '=' ) !== false ) { list ( $ key , $ value ) = explode ( '=' , $ part ) ; } else { $ key = $ part ; $ value = true ; } $ key = strtolower ( $ key ) ; if ( $ key === 'httponly' ) { $ key = 'httpOnly' ; } if ( $ key === 'expires' ) { $ key = 'expire' ; $ value = strtotime ( $ value ) ; } if ( ! isset ( $ parsed [ $ key ] ) ) { $ parsed [ $ key ] = $ value ; } } $ cookies [ ] = $ parsed ; } return $ cookies ; }
docstring: Parse the Set-Cookie headers in a PSR7 response
  into the format CakePHP expects.
  
  @param array $cookieHeader A list of Set-Cookie headers.
  @return array Parsed cookie data.
docstring_tokens: Parse the Set - Cookie headers in a PSR7 response into the format CakePHP expects .