Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F1432005
Alternative.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
Alternative.php
View Options
<?php
/**
* @file
* @license https://opensource.org/licenses/Apache-2.0 Apache-2.0
*/
namespace
Wikimedia\CSS\Grammar
;
use
Wikimedia\CSS\Objects\ComponentValueList
;
use
Wikimedia\CSS\Util
;
/**
* Matcher that matches one out of a set of Matchers ("|" combiner).
* @see https://www.w3.org/TR/2019/CR-css-values-3-20190606/#comb-one
*/
class
Alternative
extends
Matcher
{
/** @var Matcher[] */
protected
$matchers
;
/**
* @param Matcher[] $matchers
*/
public
function
__construct
(
array
$matchers
)
{
Util
::
assertAllInstanceOf
(
$matchers
,
Matcher
::
class
,
'$matchers'
);
$this
->
matchers
=
$matchers
;
}
/** @inheritDoc */
protected
function
generateMatches
(
ComponentValueList
$values
,
$start
,
array
$options
)
{
$used
=
[];
foreach
(
$this
->
matchers
as
$matcher
)
{
foreach
(
$matcher
->
generateMatches
(
$values
,
$start
,
$options
)
as
$match
)
{
$newMatch
=
$this
->
makeMatch
(
$values
,
$start
,
$match
->
getNext
(),
$match
);
$mid
=
$newMatch
->
getUniqueID
();
if
(
!
isset
(
$used
[
$mid
]
)
)
{
$used
[
$mid
]
=
1
;
yield
$newMatch
;
}
}
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, May 16, 21:19 (1 d, 13 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
69/ec/4eebd627ac1dcdaadbc80cb3ad06
Default Alt Text
Alternative.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment