Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7433405
IfStatement.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
IfStatement.php
View Options
<?php
/**
* This file is part of the Peast package
*
* (c) Marco Marchiò <marco.mm89@gmail.com>
*
* For the full copyright and license information refer to the LICENSE file
* distributed with this source code
*/
namespace
Peast\Syntax\Node
;
/**
* A node that represents an if statement.
* For example: if (test) {} else {}
*
* @author Marco Marchiò <marco.mm89@gmail.com>
*/
class
IfStatement
extends
Node
implements
Statement
{
/**
* Map of node properties
*
* @var array
*/
protected
$propertiesMap
=
array
(
"test"
=>
true
,
"consequent"
=>
true
,
"alternate"
=>
true
);
/**
* The test expression
*
* @var Expression
*/
protected
$test
;
/**
* The statement that is activated if the test expression is true
*
* @var Statement|FunctionDeclaration
*/
protected
$consequent
;
/**
* The "else" statement
*
* @var Statement
*/
protected
$alternate
;
/**
* Returns the test expression
*
* @return Expression
*/
public
function
getTest
()
{
return
$this
->
test
;
}
/**
* Sets the test expression
*
* @param Expression $test Test expression
*
* @return $this
*/
public
function
setTest
(
Expression
$test
)
{
$this
->
test
=
$test
;
return
$this
;
}
/**
* Returns the statement that is activated if the test expression is true
*
* @return Statement|FunctionDeclaration
*/
public
function
getConsequent
()
{
return
$this
->
consequent
;
}
/**
* Sets the statement that is activated if the test expression is true
*
* @param Statement|FunctionDeclaration $consequent The consequent expression
*
* @return $this
*/
public
function
setConsequent
(
$consequent
)
{
$this
->
assertType
(
$consequent
,
array
(
"Statement"
,
"FunctionDeclaration"
),
true
);
$this
->
consequent
=
$consequent
;
return
$this
;
}
/**
* Returns the "else" statement
*
* @return Statement
*/
public
function
getAlternate
()
{
return
$this
->
alternate
;
}
/**
* Sets the "else" statement
*
* @param Statement|FunctionDeclaration $alternate The "else" statement
*
* @return $this
*/
public
function
setAlternate
(
$alternate
)
{
$this
->
assertType
(
$alternate
,
array
(
"Statement"
,
"FunctionDeclaration"
),
true
);
$this
->
alternate
=
$alternate
;
return
$this
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Nov 22, 11:53 (1 d, 10 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
2d/8f/b943cae0c52a9531ba5c6e9262af
Default Alt Text
IfStatement.php (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment