Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4108167
DataMwAttrib.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
DataMwAttrib.php
View Options
<?php
declare
(
strict_types
=
1
);
namespace
Wikimedia\Parsoid\NodeData
;
use
Wikimedia\Assert\Assert
;
use
Wikimedia\JsonCodec\JsonCodecable
;
use
Wikimedia\JsonCodec\JsonCodecableTrait
;
/**
* Rich attribute data for a DOM Element. Both the key and the value
* can be strings or more complex values.
*/
class
DataMwAttrib
implements
JsonCodecable
{
use
JsonCodecableTrait
;
/**
* The attribute name.
* @var array{txt?:string,html?:string}|string
*/
public
$key
;
/**
* The attribute value.
* @var array|string
*/
public
$value
;
/**
* @param array{txt?:string,html?:string}|string $key Attribute name
* @param array|string $value Attribute value
*/
public
function
__construct
(
$key
,
$value
)
{
$this
->
key
=
$key
;
$this
->
value
=
$value
;
}
/** @inheritDoc */
public
static
function
jsonClassHintFor
(
string
$keyname
)
{
// No hints necessary, both $key and $value are arrays
return
null
;
}
/** @inheritDoc */
public
function
toJsonArray
():
array
{
return
[
$this
->
key
,
$this
->
value
];
}
/** @inheritDoc */
public
static
function
newFromJsonArray
(
array
$json
):
DataMwAttrib
{
Assert
::
invariant
(
array_is_list
(
$json
)
&&
count
(
$json
)
===
2
,
"bad data-mw.attrib"
);
return
new
DataMwAttrib
(
$json
[
0
],
$json
[
1
]
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Aug 18, 20:26 (2 w, 2 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
aa/e9/d20d4f7b34df628929d61dfe4c47
Default Alt Text
DataMwAttrib.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment