Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7436217
RegExpLiteral.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
RegExpLiteral.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 regular expression literal.
*
* @author Marco Marchiò <marco.mm89@gmail.com>
*/
class
RegExpLiteral
extends
Literal
{
/**
* Map of node properties
*
* @var array
*/
protected
$propertiesMap
=
array
(
"flags"
=>
false
,
"pattern"
=>
false
);
/**
* Regex flags
*
* @var string
*/
protected
$flags
=
""
;
/**
* Regex pattern
*
* @var string
*/
protected
$pattern
=
""
;
/**
* Returns node's type
*
* @return string
*/
public
function
getType
()
{
return
"RegExpLiteral"
;
}
/**
* Returns regex pattern
*
* @return string
*/
public
function
getPattern
()
{
return
$this
->
pattern
;
}
/**
* Sets regex pattern
*
* @param string $pattern Regex pattern
*
* @return $this
*/
public
function
setPattern
(
$pattern
)
{
$this
->
pattern
=
$pattern
;
return
$this
;
}
/**
* Returns regex flags
*
* @return string
*/
public
function
getFlags
()
{
return
$this
->
flags
;
}
/**
* Sets regex flags
*
* @param string $flags Regex flags
*
* @return $this
*/
public
function
setFlags
(
$flags
)
{
$this
->
flags
=
$flags
;
return
$this
;
}
/**
* Returns node's raw value
*
* @return string
*/
public
function
getRaw
()
{
return
"/"
.
$this
->
getPattern
()
.
"/"
.
$this
->
getFlags
();
}
/**
* Sets node's raw value that must include delimiters
*
* @param string $raw Raw value
*
* @return $this
*/
public
function
setRaw
(
$raw
)
{
$parts
=
explode
(
"/"
,
substr
(
$raw
,
1
));
$flags
=
array_pop
(
$parts
);
$this
->
setPattern
(
implode
(
"/"
,
$parts
));
$this
->
setFlags
(
$flags
);
return
$this
;
}
/**
* Returns node's value
*
* @return string
*/
public
function
getValue
()
{
return
$this
->
getRaw
();
}
/**
* Sets node's value
*
* @param mixed $value Value
*
* @return $this
*/
public
function
setValue
(
$value
)
{
return
$this
->
setRaw
(
$value
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Nov 22, 13:20 (3 h, 3 m ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
25/3f/df7c05acc27cd2d32612576d24ca
Default Alt Text
RegExpLiteral.php (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment