Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F1431895
Operation.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
Operation.php
View Options
<?php
/**
* @private
* @see less-3.13.1.js#Operation.prototype
*/
class
Less_Tree_Operation
extends
Less_Tree
{
public
$op
;
public
$operands
;
public
$isSpaced
;
/**
* @param string $op
*/
public
function
__construct
(
$op
,
$operands
,
$isSpaced
=
false
)
{
$this
->
op
=
trim
(
$op
);
$this
->
operands
=
$operands
;
$this
->
isSpaced
=
$isSpaced
;
}
public
function
accept
(
$visitor
)
{
$this
->
operands
=
$visitor
->
visitArray
(
$this
->
operands
);
}
public
function
compile
(
$env
)
{
$a
=
$this
->
operands
[
0
]->
compile
(
$env
);
$b
=
$this
->
operands
[
1
]->
compile
(
$env
);
// Skip operation if argument was not compiled down to a non-operable value.
// For example, if one argument is a Less_Tree_Call like 'var(--foo)' then we
// preserve it as literal for native CSS.
// https://phabricator.wikimedia.org/T331688
if
(
$env
->
isMathOn
(
$this
->
op
)
)
{
$op
=
$this
->
op
===
'./'
?
'/'
:
$this
->
op
;
if
(
$a
instanceof
Less_Tree_Dimension
&&
$b
instanceof
Less_Tree_Color
)
{
$a
=
$a
->
toColor
();
}
elseif
(
$b
instanceof
Less_Tree_Dimension
&&
$a
instanceof
Less_Tree_Color
)
{
$b
=
$b
->
toColor
();
}
if
(
!(
$a
instanceof
Less_Tree_Dimension
||
$a
instanceof
Less_Tree_Color
)
)
{
if
(
$a
instanceof
Less_Tree_Operation
&&
$a
->
op
===
'/'
&&
$env
->
math
===
Less_Environment
::
MATH_PARENS_DIVISION
)
{
return
new
self
(
$this
->
op
,
[
$a
,
$b
],
$this
->
isSpaced
);
}
throw
new
Less_Exception_Compiler
(
"Operation on an invalid type"
);
}
return
$a
->
operate
(
$op
,
$b
);
}
else
{
return
new
self
(
$this
->
op
,
[
$a
,
$b
],
$this
->
isSpaced
);
}
}
/**
* @see Less_Tree::genCSS
*/
public
function
genCSS
(
$output
)
{
$this
->
operands
[
0
]->
genCSS
(
$output
);
if
(
$this
->
isSpaced
)
{
$output
->
add
(
" "
);
}
$output
->
add
(
$this
->
op
);
if
(
$this
->
isSpaced
)
{
$output
->
add
(
' '
);
}
$this
->
operands
[
1
]->
genCSS
(
$output
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, May 16, 21:11 (1 d, 13 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
bc/d7/4339fcbf4006eefbac3164053322
Default Alt Text
Operation.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment