本文整理汇总了PHP中Expression::parse方法的典型用法代码示例。如果您正苦于以下问题:PHP Expression::parse方法的具体用法?PHP Expression::parse怎么用?PHP Expression::parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Expression
的用法示例。
在下文中一共展示了Expression::parse方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testParse
/**
* @covers Phramework\Testphase\Expression::parse
* @dataProvider parseProvider
*/
public function testParse($input, $expected)
{
$return = Expression::parse($input);
if ($expected !== null) {
$this->assertInternalType('object', $return);
}
$this->assertEquals($expected, $return);
}
示例2: testSimplePlus
function testSimplePlus()
{
$e = new Expression();
$e->parse('x + y');
$this->assertTrue($e->is_operator());
$this->assertTrue($e->is_function());
$this->assertFalse($e->is_number());
$this->assertEqual($e->fun, '+');
$this->assertEqual(sizeof($e->terms), 2);
$this->assertEqual($e->terms[0]->fun, 'x');
$this->assertEqual($e->terms[1]->fun, 'y');
$this->assertEqual($e->terms[0]->op, '');
$this->assertEqual($e->terms[1]->op, '+');
}
示例3: latex
function latex($str)
{
$e1 = new Expression();
$e1->parse($str);
return $e1->latex();
}
示例4: parse_css
/**
* Parse the CSS
*
* @return string - The processes css file as a string
* @author Anthony Short
**/
public static function parse_css()
{
# If the cache is stale or doesn't exist
if (self::config('core.cache.mod_time') <= self::config('core.request.mod_time')) {
# Start the timer
Benchmark::start("parse_css");
# Compress it before parsing
CSS::compress(CSS::$css);
# Import CSS files
Import::parse();
if (self::config('core.auto_include_mixins') === true) {
# Import the mixins in the plugin/module folders
Mixins::import_mixins('framework/mixins');
}
# Parse our css through the plugins
foreach (self::$plugins as $plugin) {
call_user_func(array($plugin, 'import_process'));
}
# Compress it before parsing
CSS::compress(CSS::$css);
# Parse the constants
Constants::parse();
foreach (self::$plugins as $plugin) {
call_user_func(array($plugin, 'pre_process'));
}
# Parse the @grid
Layout::parse_grid();
# Replace the constants
Constants::replace();
# Parse @for loops
Iteration::parse();
foreach (self::$plugins as $plugin) {
call_user_func(array($plugin, 'process'));
}
# Compress it before parsing
CSS::compress(CSS::$css);
# Parse the mixins
Mixins::parse();
# Find missing constants
Constants::replace();
# Compress it before parsing
CSS::compress(CSS::$css);
foreach (self::$plugins as $plugin) {
call_user_func(array($plugin, 'post_process'));
}
# Parse the expressions
Expression::parse();
# Parse the nested selectors
NestedSelectors::parse();
# Convert all url()'s to absolute paths if required
if (self::config('core.absolute_urls') === true) {
CSS::convert_to_absolute_urls();
}
# Replaces url()'s that start with ~ to lead to the CSS directory
CSS::replace_css_urls();
# Add the extra string we've been storing
CSS::$css .= CSS::$append;
# If they want to minify it
if (self::config('core.minify_css') === true) {
Minify::compress();
} else {
CSS::pretty();
}
# Formatting hook
foreach (self::$plugins as $plugin) {
call_user_func(array($plugin, 'formatting_process'));
}
# Validate the CSS
if (self::config('core.validate') === true) {
Validate::check();
}
# Stop the timer...
Benchmark::stop("parse_css");
if (self::config('core.show_header') === TRUE) {
CSS::$css = "/* Processed by CSScaffold on " . gmdate('r') . " in " . Benchmark::get("parse_css", "time") . " seconds */\n\n" . CSS::$css;
}
# Write the css file to the cache
self::cache_write(CSS::$css);
# Output process hook for plugins to display views.
# Doesn't run in production mode.
if (!IN_PRODUCTION) {
foreach (array_merge(self::$plugins, self::$modules) as $plugin) {
call_user_func(array($plugin, 'output'));
}
}
}
}
示例5: array
array_push($x_arr, $x_first);
}
array_push($x_arr, $x);
$empty = false;
}
}
$xvalues = $x_arr;
if (sizeof($xvalues) > 0) {
$yvalues = $spline->calc_array($xvalues);
} else {
$yvalues = array();
}
//exit('{status:"stuff",data:[],x:'.json_encode($xvalues).',y:'.json_encode($yvalues).',pnt:'.json_encode($points).'}');
} else {
$expr = new Expression();
$expr->parse($expr_str);
$yvalues = $expr->eval_double_array(array(), 'x', $xvalues);
}
$m = sizeof($xvalues);
if ($m == 0) {
exit('{status:"OK?",data:[]}');
}
if ($m != sizeof($yvalues)) {
exit('{status:"error",value:"X-Y mismatch"}');
}
for ($i = 0; $i < $m; $i += 1) {
array_push($data, array($xvalues[$i], $yvalues[$i]));
}
if ($intv > 0) {
$fun .= ',';
}