Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F1430393
TranslationQuery.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
TranslationQuery.php
View Options
<?php
declare
(
strict_types
=
1
);
namespace
MediaWiki\Extension\Translate\WebService
;
/**
* Mutable objects that represents an HTTP(S) query.
* NB: Too lazy to make TranslationQueryFactory to make this class immutable.
* @author Niklas Laxström
* @license GPL-2.0-or-later
* @since 2015.02
*/
class
TranslationQuery
{
private
string
$url
;
private
float
$timeout
=
0
;
private
string
$method
=
'GET'
;
private
array
$params
=
[];
private
?
string
$body
=
null
;
private
array
$headers
=
[];
/** @var mixed Arbitrary data that is returned with TranslationQueryResponse */
private
$instructions
;
public
static
function
factory
(
string
$url
):
TranslationQuery
{
$obj
=
new
self
();
$obj
->
url
=
$url
;
return
$obj
;
}
/** Make this a POST request with given data. */
public
function
postWithData
(
string
$data
):
TranslationQuery
{
$this
->
method
=
'POST'
;
$this
->
body
=
$data
;
return
$this
;
}
public
function
queryParameters
(
array
$params
):
TranslationQuery
{
$this
->
params
=
$params
;
return
$this
;
}
public
function
queryHeaders
(
array
$headers
):
TranslationQuery
{
$this
->
headers
=
$headers
;
return
$this
;
}
public
function
timeout
(
float
$timeout
):
TranslationQuery
{
$this
->
timeout
=
$timeout
;
return
$this
;
}
/**
* Attach arbitrary data that is necessary to process the results.
* @param mixed $data
* @since 2017.04
*/
public
function
attachProcessingInstructions
(
$data
):
TranslationQuery
{
$this
->
instructions
=
$data
;
return
$this
;
}
public
function
getTimeout
():
float
{
return
$this
->
timeout
;
}
public
function
getUrl
():
string
{
return
$this
->
url
;
}
public
function
getMethod
():
string
{
return
$this
->
method
;
}
public
function
getQueryParameters
():
array
{
return
$this
->
params
;
}
public
function
getBody
():
?
string
{
return
$this
->
body
;
}
public
function
getHeaders
():
array
{
return
$this
->
headers
;
}
/**
* Get previously attached result processing instructions.
* @return mixed
* @since 2017.04
*/
public
function
getProcessingInstructions
()
{
return
$this
->
instructions
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, May 16, 18:42 (5 h, 49 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
9f/d4/48eeabc29d3aa90af9f14530a198
Default Alt Text
TranslationQuery.php (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment