Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5959344
CheckedMatcher.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
CheckedMatcher.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
;
/**
* Wrap another matcher in a callback to verify the matches
*/
class
CheckedMatcher
extends
Matcher
{
/** @var Matcher */
private
$matcher
;
/** @var callable */
protected
$check
;
/**
* @param Matcher $matcher Base matcher
* @param callable $check Function to check the match is really valid.
* Prototype is bool func( ComponentValueList $values, GrammarMatch $match, array $options )
*/
public
function
__construct
(
Matcher
$matcher
,
callable
$check
)
{
$this
->
matcher
=
$matcher
;
$this
->
check
=
$check
;
}
/** @inheritDoc */
protected
function
generateMatches
(
ComponentValueList
$values
,
$start
,
array
$options
)
{
foreach
(
$this
->
matcher
->
generateMatches
(
$values
,
$start
,
$options
)
as
$match
)
{
if
(
call_user_func
(
$this
->
check
,
$values
,
$match
,
$options
)
)
{
yield
$this
->
makeMatch
(
$values
,
$start
,
$match
->
getNext
(),
$match
);
}
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Oct 3, 06:23 (2 w, 3 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
08/d9/a16a0e8051f4edef18d5778f86c4
Default Alt Text
CheckedMatcher.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment