Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7428916
Property.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
Property.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 a property in an object literal.
* For example "b" in: a = {b: 1}
*
* @author Marco Marchiò <marco.mm89@gmail.com>
*/
class
Property
extends
Node
{
/**
* Map of node properties
*
* @var array
*/
protected
$propertiesMap
=
array
(
"key"
=>
true
,
"value"
=>
true
,
"kind"
=>
false
,
"method"
=>
false
,
"shorthand"
=>
false
,
"computed"
=>
false
);
//Kind constants
/**
* The default kind for properties
*/
const
KIND_INIT
=
"init"
;
/**
* Getter property
*/
const
KIND_GET
=
"get"
;
/**
* Setter property
*/
const
KIND_SET
=
"set"
;
/**
* Property key
*
* @var Expression
*/
protected
$key
;
/**
* Property value
*
* @var Expression
*/
protected
$value
;
/**
* Property kind that is one of the kind constants
*
* @var string
*/
protected
$kind
=
self
::
KIND_INIT
;
/**
* Property method flag that is true when the property is a method
*
* @var bool
*/
protected
$method
=
false
;
/**
* Property shorthand flag that is true when the property is declared
* using an identifier and without a value
*
* @var bool
*/
protected
$shorthand
=
false
;
/**
* Property computed flag that is true when the property is declared using
* the square brackets syntax
*
* @var bool
*/
protected
$computed
=
false
;
/**
* Returns the property key
*
* @return Expression
*/
public
function
getKey
()
{
return
$this
->
key
;
}
/**
* Sets the property key
*
* @param Expression $key Property key
*
* @return $this
*/
public
function
setKey
(
Expression
$key
)
{
$this
->
key
=
$key
;
return
$this
;
}
/**
* Returns the property value
*
* @return Expression
*/
public
function
getValue
()
{
return
$this
->
value
;
}
/**
* Sets the property value
*
* @param Expression $value Property value
*
* @return $this
*/
public
function
setValue
(
$value
)
{
$this
->
assertType
(
$value
,
"Expression"
);
$this
->
value
=
$value
;
return
$this
;
}
/**
* Returns the property kind that is one of the kind constants
*
* @return string
*/
public
function
getKind
()
{
return
$this
->
kind
;
}
/**
* Sets the property kind that is one of the kind constants
*
* @param string $kind Property kind
*
* @return $this
*/
public
function
setKind
(
$kind
)
{
$this
->
kind
=
$kind
;
return
$this
;
}
/**
* Returns the property method flag that is true when the property is a
* method
*
* @return bool
*/
public
function
getMethod
()
{
return
$this
->
method
;
}
/**
* Sets the property method flag that is true when the property is a method
*
* @param bool $method Method flag
*
* @return $this
*/
public
function
setMethod
(
$method
)
{
$this
->
method
=
(
bool
)
$method
;
return
$this
;
}
/**
* Returns the property shorthand flag that is true when the property
* is declared using an identifier and without a value
*
* @return bool
*/
public
function
getShorthand
()
{
return
$this
->
shorthand
;
}
/**
* Sets the property shorthand flag that is true when the property
* is declared using an identifier and without a value
*
* @param bool $shorthand Property shorthand flag
*
* @return $this
*/
public
function
setShorthand
(
$shorthand
)
{
$this
->
shorthand
=
(
bool
)
$shorthand
;
return
$this
;
}
/**
* Returns the property computed flag that is true when the property is
* declared using the square brackets syntax
*
* @return bool
*/
public
function
getComputed
()
{
return
$this
->
computed
;
}
/**
* Sets the property computed flag that is true when the property is
* declared using the square brackets syntax
*
* @param bool $computed Property computed flag
*
* @return $this
*/
public
function
setComputed
(
$computed
)
{
$this
->
computed
=
(
bool
)
$computed
;
return
$this
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Nov 22, 09:43 (12 h, 33 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
6c/ec/0effe220f5541e004ebd23e39cac
Default Alt Text
Property.php (4 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment