1<?php
2
3use Phalcon\Mvc\View\Engine\Volt\Compiler;
4
5// turn on all errors
6error_reporting(-1);
7
8ini_set('display_errors', 1);
9ini_set('display_startup_errors', 1);
10
11setlocale(LC_ALL, 'en_US.utf-8');
12set_time_limit(-1);
13
14if (!ini_get('date.timezone')) {
15    ini_set('date.timezone', 'UTC');
16}
17
18clearstatcache();
19
20if (extension_loaded('xdebug')) {
21    ini_set('xdebug.cli_color', 1);
22    ini_set('xdebug.collect_params', 0);
23    ini_set('xdebug.dump_globals', 'on');
24    ini_set('xdebug.show_local_vars', 'on');
25    ini_set('xdebug.max_nesting_level', 100);
26    ini_set('xdebug.var_display_max_depth', 4);
27}
28
29
30define('SYNTAX_TESTS_ROOT', __DIR__);
31define('SYNTAX_TESTS_SOURCE', __DIR__ . DIRECTORY_SEPARATOR . 'source');
32
33function syntax_source($path = '') {
34    if (empty($path) === false) {
35        $normalized = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $path);
36        $path = ltrim($normalized, DIRECTORY_SEPARATOR);
37  }
38
39  return SYNTAX_TESTS_SOURCE . DIRECTORY_SEPARATOR . $path;
40}
41
42function parse_string($string) {
43    $compiler = new Compiler();
44
45    return $compiler->parse($string);
46}
47