Skip to content

Commit

Permalink
Add HttpResponse stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
Sumanai committed Jul 30, 2019
1 parent 5110862 commit 3c47387
Show file tree
Hide file tree
Showing 2 changed files with 176 additions and 0 deletions.
129 changes: 129 additions & 0 deletions bitrix-stubs/bitrix/modules/main/lib/httpresponse.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
<?php

namespace Bitrix\Main;

use Bitrix\Main\Web;

class HttpResponse extends Response
{
const STORE_COOKIE_NAME = "STORE_COOKIES";

/**
* Undocumented function
*
* @param string $text
* @return void
*/
public function flush(string $text = ''): void
{ }

/**
* Adds a HTTP header field to the response.
*
* @param string $name Header field name
* @param string $value Header field value
* @return $this
* @throws ArgumentNullException
*/
public function addHeader(string $name, string $value = ''): self
{
return $this;
}

/**
* Sets a collection of HTTP headers.
*
* @param Web\HttpHeaders $headers Headers collection.
*
* @return $this
*/
public function setHeaders(Web\HttpHeaders $headers): self
{
return $this;
}

/**
* Adds a cookie to the response.
*
* @param Web\Cookie $cookie The cookie.
* @param boolean $replace Replace an existing cookie or not.
* @param boolean $checkExpires Check expires value of the cookie or not.
* @return $this
*/
public function addCookie(Web\Cookie $cookie, bool $replace = true, bool $checkExpires = true): self
{
return $this;
}

/**
* Remembers user's choice about storing persistent cookies.
*
* @param boolean $mode
*/
public function allowPersistentCookies(bool $mode)
{ }

/**
* @return Web\Cookie
*/
public function getCookies(): Web\Cookie
{
return new Web\Cookie('', null);
}

/**
* Undocumented function
*
* @return Web\HttpHeaders
*/
public function getHeaders(): Web\HttpHeaders
{
return new Web\HttpHeaders();
}

/**
* Sets the HTTP status of the response.
*
* @param string $status
* @return $this
* @throws ArgumentNullException
* @throws ArgumentOutOfRangeException
*/
public function setStatus(string $status): self
{
return $this;
}

/**
* Returns the HTTP status of the response.
*
* @return int|string|null
*/
public function getStatus()
{
return null;
}

/**
* Sets the latest time for the Last-Modified header field.
*
* @param Type\DateTime $time
* @return $this
*/
public function setLastModified(Type\DateTime $time): self
{
return $this;
}

/**
* Undocumented function
*
* @param callable $job
* @param array $args
* @return void
*/
public function addBackgroundJob(callable $job, array $args = []): self
{
return $this;
}
}
47 changes: 47 additions & 0 deletions bitrix-stubs/bitrix/modules/main/lib/response.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

namespace Bitrix\Main;

abstract class Response
{
/**
* Undocumented function
*
* @param string $text
* @return void
*/
public function flush(string $text = ''): void
{ }

/**
* Sets content.
* Valid types are strings, numbers, null, and objects that implement a __toString() method.
*
* @param mixed $content Content that can be cast to string.
*
* @return $this
* @throws ArgumentTypeException
*/
public function setContent($content): self
{
return $this;
}

/**
* Returns content of response.
*
* @return string
*/
public function getContent(): string
{
return '';
}

/**
* Sends content to the output.
*
* @return void
*/
public function send(): void
{ }
}

0 comments on commit 3c47387

Please sign in to comment.