Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7417860
Function_.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
Function_.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
;
/**
* Abstract class for functions.
*
* @author Marco Marchiò <marco.mm89@gmail.com>
*/
abstract
class
Function_
extends
Node
{
/**
* Map of node properties
*
* @var array
*/
protected
$propertiesMap
=
array
(
"id"
=>
true
,
"params"
=>
true
,
"body"
=>
true
,
"generator"
=>
false
,
"async"
=>
false
);
/**
* Function name
*
* @var Identifier
*/
protected
$id
;
/**
* Function parameters array
*
* @var Pattern[]
*/
protected
$params
=
array
();
/**
* Function body
*
* @var BlockStatement
*/
protected
$body
;
/**
* Generator flag that is true when the function is a generator
*
* @var bool
*/
protected
$generator
=
false
;
/**
* Async flag that is true when it is an async function
*
* @var bool
*/
protected
$async
=
false
;
/**
* Returns function name
*
* @return Identifier
*/
public
function
getId
()
{
return
$this
->
id
;
}
/**
* Sets function name
*
* @param Identifier $id Function name
*
* @return $this
*/
public
function
setId
(
$id
)
{
$this
->
assertType
(
$id
,
"Identifier"
,
true
);
$this
->
id
=
$id
;
return
$this
;
}
/**
* Returns function parameters array
*
* @return Pattern[]
*/
public
function
getParams
()
{
return
$this
->
params
;
}
/**
* Sets function parameters array
*
* @param Pattern[] $params Function parameters array
*
* @return $this
*/
public
function
setParams
(
$params
)
{
$this
->
assertArrayOf
(
$params
,
"Pattern"
);
$this
->
params
=
$params
;
return
$this
;
}
/**
* Returns function body
*
* @return BlockStatement
*/
public
function
getBody
()
{
return
$this
->
body
;
}
/**
* Sets function body
*
* @param BlockStatement $body Function body
*
* @return $this
*/
public
function
setBody
(
$body
)
{
$this
->
assertType
(
$body
,
"BlockStatement"
);
$this
->
body
=
$body
;
return
$this
;
}
/**
* Returns the generator flag that is true when the function is a generator
*
* @return bool
*/
public
function
getGenerator
()
{
return
$this
->
generator
;
}
/**
* Sets the generator flag that is true when the function is a generator
*
* @param bool $generator Generator flag
*
* @return $this
*/
public
function
setGenerator
(
$generator
)
{
$this
->
generator
=
(
bool
)
$generator
;
return
$this
;
}
/**
* Returns the async flag that is true when it is an async function
*
* @return bool
*/
public
function
getAsync
()
{
return
$this
->
async
;
}
/**
* Sets the async flag that is true when it is an async function
*
* @param bool $async Async flag
*
* @return $this
*/
public
function
setAsync
(
$async
)
{
$this
->
async
=
(
bool
)
$async
;
return
$this
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Nov 22, 03:36 (1 d, 8 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
6e/c1/ea7e95beb524f037eb6e78a407ea
Default Alt Text
Function_.php (3 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment