Request

Type
Class
Namespace
craft\console
Inherits
craft\console\Request » yii\console\Request (opens new window) » yii\base\Request (opens new window) » yii\base\Component (opens new window) » yii\base\BaseObject (opens new window)
Implements
yii\base\Configurable (opens new window)
Uses traits
craft\base\RequestTrait
Since
3.0.0

View source (opens new window)

# Public Properties

# hadToken

Type
boolean (opens new window)
Default value
null
Access
Read-only
Since
3.6.0

View source (opens new window)

# isActionRequest

Type
boolean (opens new window)
Default value
null
Access
Read-only

View source (opens new window)

# isCpRequest

Type
boolean (opens new window)
Default value
null
Access
Read-only

View source (opens new window)

# isLivePreview

Type
boolean (opens new window)
Default value
null
Access
Read-only

Whether this is a Live Preview request.

View source (opens new window)

# isLoginRequest

Type
boolean (opens new window)
Default value
null
Access
Read-only
Since
3.2.0

View source (opens new window)

# isPreview

Type
boolean (opens new window)
Default value
null
Access
Read-only
Since
3.2.1

View source (opens new window)

# isSingleActionRequest

Type
boolean (opens new window)
Default value
null
Access
Read-only

View source (opens new window)

# isSiteRequest

Type
boolean (opens new window)
Default value
null
Access
Read-only

View source (opens new window)

# siteToken

Type
string (opens new window), null (opens new window)
Default value
null
Access
Read-only
Since
3.6.0

The token, or null if there isn’t one.

View source (opens new window)

# token

Type
string (opens new window), null (opens new window)
Default value
null
Since
3.2.0

The token, or null if there isn’t one.

View source (opens new window)

# Public Methods

Method Description
__call() (opens new window) Calls the named method which is not a class method.
__clone() (opens new window) This method is called after the object is created by cloning an existing one.
__construct() (opens new window) Constructor.
__get() (opens new window) Returns the value of a component property.
__isset() (opens new window) Checks if a property is set, i.e. defined and not null.
__set() (opens new window) Sets the value of a component property.
__unset() (opens new window) Sets a component property to be null.
attachBehavior() (opens new window) Attaches a behavior to this component.
attachBehaviors() (opens new window) Attaches a list of behaviors to the component.
behaviors() (opens new window) Returns a list of behaviors that this component should behave as.
canGetProperty() (opens new window) Returns a value indicating whether a property can be read.
canSetProperty() (opens new window) Returns a value indicating whether a property can be set.
className() (opens new window) Returns the fully qualified name of this class.
detachBehavior() (opens new window) Detaches a behavior from the component.
detachBehaviors() (opens new window) Detaches all behaviors from the component.
ensureBehaviors() (opens new window) Makes sure that the behaviors declared in behaviors() (opens new window) are attached to this component.
getBehavior() (opens new window) Returns the named behavior object.
getBehaviors() (opens new window) Returns all behaviors attached to this component.
getHadToken() Returns whether the request initially had a token.
getIsActionRequest() Returns whether a specific controller action was requested. (Narrator: There wasn't.)
getIsConsoleRequest() (opens new window) Returns a value indicating whether the current request is made via command line.
getIsCpRequest() Returns whether the control panel was requested. (Narrator: It wasn't.)
getIsLivePreview() Returns whether this is a Live Preview request. (Narrator: It isn't.)
getIsLoginRequest() Returns whether this was a Login request.
getIsPreview() Returns whether this is an element preview request.
getIsSingleActionRequest() Returns whether the current request is solely an action request. (Narrator: It isn't.)
getIsSiteRequest() Returns whether the front end site was requested. (Narrator: It wasn't.)
getParams() (opens new window) Returns the command line arguments.
getScriptFile() (opens new window) Returns entry script file path.
getScriptFilename() Returns the requested script name being used to access Craft (e.g. “index.php”).
getSiteToken() Returns the site token submitted with the request, if there is one.
getToken() Returns the token submitted with the request, if there is one.
hasEventHandlers() (opens new window) Returns a value indicating whether there is any handler attached to the named event.
hasMethod() (opens new window) Returns a value indicating whether a method is defined.
hasProperty() (opens new window) Returns a value indicating whether a property is defined for this component.
init() Initializes the object.
off() (opens new window) Detaches an existing event handler from this component.
on() (opens new window) Attaches an event handler to an event.
resolve() (opens new window) Resolves the current request into a route and the associated parameters.
setIsConsoleRequest() (opens new window) Sets the value indicating whether the current request is made via command line.
setParams() (opens new window) Sets the command line arguments.
setScriptFile() (opens new window) Sets the entry script file path.
setToken() Sets the token value.
trigger() (opens new window) Triggers an event.

# getHadToken()

Since
3.6.0

Returns whether the request initially had a token.

View source (opens new window)

Returns

boolean (opens new window)

# getIsActionRequest()

Returns whether a specific controller action was requested. (Narrator: There wasn't.)

View source (opens new window)

Returns

boolean (opens new window)

# getIsCpRequest()

Returns whether the control panel was requested. (Narrator: It wasn't.)

View source (opens new window)

Returns

boolean (opens new window)

# getIsLivePreview()

DEPRECATED

Deprecated in 3.2.0

Returns whether this is a Live Preview request. (Narrator: It isn't.)

View source (opens new window)

Returns

boolean (opens new window) – Whether this is a Live Preview request.

# getIsLoginRequest()

Since
3.2.0

Returns whether this was a Login request.

View source (opens new window)

Returns

boolean (opens new window)

# getIsPreview()

Since
3.2.1

Returns whether this is an element preview request.

View source (opens new window)

Returns

boolean (opens new window)

# getIsSingleActionRequest()

DEPRECATED

Deprecated in 3.2.0

Returns whether the current request is solely an action request. (Narrator: It isn't.)

View source (opens new window)

Returns

boolean (opens new window)

# getIsSiteRequest()

Returns whether the front end site was requested. (Narrator: It wasn't.)

View source (opens new window)

Returns

boolean (opens new window)

# getSiteToken()

Since
3.6.0

Returns the site token submitted with the request, if there is one.

View source (opens new window)

Returns

string (opens new window), null (opens new window) – The token, or null if there isn’t one.

# getToken()

Since
3.2.0

Returns the token submitted with the request, if there is one.

View source (opens new window)

Returns

string (opens new window), null (opens new window) – The token, or null if there isn’t one.

# init()

Initializes the object.

This method is invoked at the end of the constructor after the object is initialized with the given configuration.

View source (opens new window)

# setToken()

Since
3.6.0

Sets the token value.

View source (opens new window)

Arguments

  • $token (?string)