/** * Phalcon\Config\Adapter\Json constructor */ PHP_METHOD(Phalcon_Config_Adapter_Json, __construct) { int ZEPHIR_LAST_CALL_STATUS; zephir_fcall_cache_entry *_0 = NULL; zval *filePath_param = NULL, *_1, *_2; zval *filePath = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &filePath_param); if (unlikely(Z_TYPE_P(filePath_param) != IS_STRING && Z_TYPE_P(filePath_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'filePath' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(filePath_param) == IS_STRING)) { zephir_get_strval(filePath, filePath_param); } else { ZEPHIR_INIT_VAR(filePath); ZVAL_EMPTY_STRING(filePath); } ZEPHIR_INIT_VAR(_1); ZEPHIR_INIT_VAR(_2); zephir_file_get_contents(_2, filePath TSRMLS_CC); zephir_json_decode(_1, &(_1), _2, zephir_get_intval(ZEPHIR_GLOBAL(global_true)) TSRMLS_CC); ZEPHIR_CALL_PARENT(NULL, phalcon_config_adapter_json_ce, this_ptr, "__construct", &_0, 19, _1); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); }
/** * Returns the content of the resource as an string * Optionally a base path where the resource is located can be set */ PHP_METHOD(Phalcon_Assets_Resource, getContent) { zend_long ZEPHIR_LAST_CALL_STATUS; zval *basePath_param = NULL, *sourcePath = NULL, *completePath = NULL, *content = NULL, *_0, *_1$$5, *_2$$5, *_3$$6, *_4$$6; zval *basePath = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, &basePath_param); if (!basePath_param) { ZEPHIR_INIT_VAR(basePath); ZVAL_EMPTY_STRING(basePath); } else { zephir_get_strval(basePath, basePath_param); } ZEPHIR_OBS_VAR(sourcePath); zephir_read_property_this(&sourcePath, this_ptr, SL("_sourcePath"), PH_NOISY_CC); if (ZEPHIR_IS_EMPTY(sourcePath)) { ZEPHIR_OBS_NVAR(sourcePath); zephir_read_property_this(&sourcePath, this_ptr, SL("_path"), PH_NOISY_CC); } ZEPHIR_INIT_VAR(completePath); ZEPHIR_CONCAT_VV(completePath, basePath, sourcePath); _0 = zephir_fetch_nproperty_this(this_ptr, SL("_local"), PH_NOISY_CC); if (zephir_is_true(_0)) { if (!((zephir_file_exists(completePath TSRMLS_CC) == SUCCESS))) { ZEPHIR_INIT_VAR(_1$$5); object_init_ex(_1$$5, phalcon_assets_exception_ce); ZEPHIR_INIT_VAR(_2$$5); ZEPHIR_CONCAT_SVS(_2$$5, "Resource's content for '", completePath, "' cannot be read"); ZEPHIR_CALL_METHOD(NULL, _1$$5, "__construct", NULL, 9, _2$$5); zephir_check_call_status(); zephir_throw_exception_debug(_1$$5, "phalcon/assets/resource.zep", 183 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } } ZEPHIR_INIT_VAR(content); zephir_file_get_contents(content, completePath TSRMLS_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(content)) { ZEPHIR_INIT_VAR(_3$$6); object_init_ex(_3$$6, phalcon_assets_exception_ce); ZEPHIR_INIT_VAR(_4$$6); ZEPHIR_CONCAT_SVS(_4$$6, "Resource's content for '", completePath, "' cannot be read"); ZEPHIR_CALL_METHOD(NULL, _3$$6, "__construct", NULL, 9, _4$$6); zephir_check_call_status(); zephir_throw_exception_debug(_3$$6, "phalcon/assets/resource.zep", 192 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } RETURN_CCTOR(content); }
/** * Phalcon\Config\Adapter\Json constructor */ PHP_METHOD(Phalcon_Config_Adapter_Json, __construct) { zend_long ZEPHIR_LAST_CALL_STATUS; zephir_fcall_cache_entry *_0 = NULL; zval *filePath_param = NULL, __$true, _1, _2; zval filePath; zval *this_ptr = getThis(); ZVAL_UNDEF(&filePath); ZVAL_BOOL(&__$true, 1); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &filePath_param); if (UNEXPECTED(Z_TYPE_P(filePath_param) != IS_STRING && Z_TYPE_P(filePath_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'filePath' must be of the type string") TSRMLS_CC); RETURN_MM_NULL(); } if (EXPECTED(Z_TYPE_P(filePath_param) == IS_STRING)) { zephir_get_strval(&filePath, filePath_param); } else { ZEPHIR_INIT_VAR(&filePath); ZVAL_EMPTY_STRING(&filePath); } ZEPHIR_INIT_VAR(&_1); ZEPHIR_INIT_VAR(&_2); zephir_file_get_contents(&_2, &filePath TSRMLS_CC); zephir_json_decode(&_1, &_2, zephir_get_intval(&__$true) ); ZEPHIR_CALL_PARENT(NULL, phalcon_config_adapter_json_ce, getThis(), "__construct", &_0, 0, &_1); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); }
/** * Returns a cached content * * @param int|string keyName * @param int lifetime * @return mixed */ PHP_METHOD(Phalcon_Cache_Backend_File, get) { zephir_nts_static zephir_fcall_cache_entry *_8 = NULL; int ttl, modifiedTime, ZEPHIR_LAST_CALL_STATUS; zval *keyName, *lifetime = NULL, *prefixedKey, *cacheDir, *cacheFile, *frontend, *lastLifetime, *cachedContent, *ret = NULL, *_0, *_1 = NULL, *_2, *_3 = NULL, *_4, *_5, *_6, *_7; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &keyName, &lifetime); if (!lifetime) { lifetime = ZEPHIR_GLOBAL(global_null); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&_1, this_ptr, "getkey", NULL, keyName); zephir_check_call_status(); ZEPHIR_INIT_VAR(prefixedKey); ZEPHIR_CONCAT_VV(prefixedKey, _0, _1); zephir_update_property_this(this_ptr, SL("_lastKey"), prefixedKey TSRMLS_CC); ZEPHIR_OBS_VAR(cacheDir); _2 = zephir_fetch_nproperty_this(this_ptr, SL("_options"), PH_NOISY_CC); if (!(zephir_array_isset_string_fetch(&cacheDir, _2, SS("cacheDir"), 0 TSRMLS_CC))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Unexpected inconsistency in options", "phalcon/cache/backend/file.zep", 115); return; } ZEPHIR_INIT_VAR(cacheFile); ZEPHIR_CONCAT_VV(cacheFile, cacheDir, prefixedKey); if ((zephir_file_exists(cacheFile TSRMLS_CC) == SUCCESS) == 1) { ZEPHIR_OBS_VAR(frontend); zephir_read_property_this(&frontend, this_ptr, SL("_frontend"), PH_NOISY_CC); if (!(zephir_is_true(lifetime))) { ZEPHIR_OBS_VAR(lastLifetime); zephir_read_property_this(&lastLifetime, this_ptr, SL("_lastLifetime"), PH_NOISY_CC); if (!(zephir_is_true(lastLifetime))) { ZEPHIR_CALL_METHOD(&_3, frontend, "getlifetime", NULL); zephir_check_call_status(); ttl = zephir_get_intval(_3); } else { ttl = zephir_get_intval(lastLifetime); } } else { ttl = zephir_get_intval(lifetime); } ZEPHIR_INIT_VAR(_4); zephir_filemtime(_4, cacheFile TSRMLS_CC); modifiedTime = zephir_get_intval(_4); ZEPHIR_INIT_VAR(_5); zephir_time(_5); if (!((zephir_get_numberval(_5) - ttl) > modifiedTime)) { ZEPHIR_INIT_VAR(cachedContent); zephir_file_get_contents(cachedContent, cacheFile TSRMLS_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(cachedContent)) { ZEPHIR_INIT_VAR(_6); object_init_ex(_6, phalcon_cache_exception_ce); ZEPHIR_INIT_VAR(_7); ZEPHIR_CONCAT_SVS(_7, "Cache file ", cacheFile, " could not be opened"); ZEPHIR_CALL_METHOD(NULL, _6, "__construct", &_8, _7); zephir_check_call_status(); zephir_throw_exception_debug(_6, "phalcon/cache/backend/file.zep", 151 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } if (zephir_is_numeric(cachedContent)) { RETURN_CCTOR(cachedContent); } else { ZEPHIR_CALL_METHOD(&ret, frontend, "afterretrieve", NULL, cachedContent); zephir_check_call_status(); RETURN_CCTOR(ret); } } } ZEPHIR_MM_RESTORE(); }
PHP_METHOD(Test_RegexDNA, process) { HashTable *_5; HashPosition _4; int ZEPHIR_LAST_CALL_STATUS; zephir_fcall_cache_entry *_3 = NULL; zval *path, *variants, *vIUB, *vIUBnew, *stuffToRemove, *contents = NULL, *initialLength, *regex = NULL, *codeLength, *discard = NULL, *_0 = NULL, *_1, *_2 = NULL, **_6, *_7 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &path); ZEPHIR_INIT_VAR(discard); ZVAL_NULL(discard); ZEPHIR_INIT_VAR(variants); zephir_create_array(variants, 9, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(_0); ZVAL_STRING(_0, "agggtaaa|tttaccct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "[cgt]gggtaaa|tttaccc[acg]", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "a[act]ggtaaa|tttacc[agt]t", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "ag[act]gtaaa|tttac[agt]ct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "agg[act]taaa|ttta[agt]cct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "aggg[acg]aaa|ttt[cgt]ccct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "agggt[cgt]aa|tt[acg]accct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "agggta[cgt]a|t[acg]taccct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "agggtaa[cgt]|[acg]ttaccct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_VAR(vIUB); array_init(vIUB); ZEPHIR_INIT_VAR(vIUBnew); array_init(vIUBnew); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "/B/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE, "test/regexdna.zep", 30); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "(c|g|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE, "test/regexdna.zep", 30); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "/D/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE, "test/regexdna.zep", 31); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "(a|g|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE, "test/regexdna.zep", 31); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "/H/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE, "test/regexdna.zep", 32); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "(a|c|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE, "test/regexdna.zep", 32); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "/K/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE, "test/regexdna.zep", 33); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "(g|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE, "test/regexdna.zep", 33); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "/M/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE, "test/regexdna.zep", 34); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "(a|c)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE, "test/regexdna.zep", 34); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "/N/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE, "test/regexdna.zep", 35); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "(a|c|g|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE, "test/regexdna.zep", 35); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "/R/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE, "test/regexdna.zep", 36); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "(a|g)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE, "test/regexdna.zep", 36); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "/S/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE, "test/regexdna.zep", 37); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "(c|g)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE, "test/regexdna.zep", 37); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "/V/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE, "test/regexdna.zep", 38); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "(a|c|g)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE, "test/regexdna.zep", 38); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "/W/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE, "test/regexdna.zep", 39); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "(a|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE, "test/regexdna.zep", 39); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "/Y/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE, "test/regexdna.zep", 40); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "(c|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE, "test/regexdna.zep", 40); ZEPHIR_INIT_VAR(stuffToRemove); ZVAL_STRING(stuffToRemove, "^>.*$|\n", 1); ZEPHIR_INIT_NVAR(discard); ZVAL_NULL(discard); ZEPHIR_INIT_VAR(contents); zephir_file_get_contents(contents, path TSRMLS_CC); ZEPHIR_INIT_VAR(initialLength); ZVAL_LONG(initialLength, zephir_fast_strlen_ev(contents)); ZEPHIR_INIT_VAR(_1); ZEPHIR_CONCAT_SVS(_1, "/", stuffToRemove, "/mS"); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_FUNCTION(&_2, "preg_replace", &_3, 53, _1, _0, contents); zephir_check_temp_parameter(_0); zephir_check_call_status(); ZEPHIR_CPY_WRT(contents, _2); ZEPHIR_INIT_VAR(codeLength); ZVAL_LONG(codeLength, zephir_fast_strlen_ev(contents)); zephir_is_iterable(variants, &_5, &_4, 0, 0, "test/regexdna.zep", 59); for ( ; zephir_hash_get_current_data_ex(_5, (void**) &_6, &_4) == SUCCESS ; zephir_hash_move_forward_ex(_5, &_4) ) { ZEPHIR_GET_HVALUE(regex, _6); zend_print_zval(regex, 0); php_printf("%s", " "); ZEPHIR_INIT_NVAR(_0); ZEPHIR_INIT_LNVAR(_7); ZEPHIR_CONCAT_SVS(_7, "/", regex, "/iS"); zephir_preg_match(_0, _7, contents, discard, 1, 0 , 0 TSRMLS_CC); zend_print_zval(_0, 0); php_printf("%c", '\n'); } ZEPHIR_CALL_FUNCTION(&_2, "preg_replace", &_3, 53, vIUB, vIUBnew, contents); zephir_check_call_status(); ZEPHIR_CPY_WRT(contents, _2); php_printf("%c", '\n'); zend_print_zval(initialLength, 0); php_printf("%c", '\n'); zend_print_zval(codeLength, 0); php_printf("%c", '\n'); php_printf("%d", zephir_fast_strlen_ev(contents)); php_printf("%c", '\n'); ZEPHIR_MM_RESTORE(); }
PHP_METHOD(Test_RegexDNA, process) { HashTable *_6; HashPosition _5; int ZEPHIR_LAST_CALL_STATUS; zephir_nts_static zephir_fcall_cache_entry *_4 = NULL, *_9 = NULL; zval *path, *variants, *vIUB, *vIUBnew, *stuffToRemove, *contents = NULL, *initialLength, *regex = NULL, *codeLength, *discard = NULL, *_0, *_1, _2, *_3 = NULL, **_7, *_8 = NULL, *_10 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &path); ZEPHIR_INIT_VAR(discard); ZVAL_NULL(discard); ZEPHIR_INIT_VAR(variants); array_init_size(variants, 13); ZEPHIR_INIT_VAR(_0); ZVAL_STRING(_0, "agggtaaa|tttaccct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "[cgt]gggtaaa|tttaccc[acg]", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "a[act]ggtaaa|tttacc[agt]t", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "ag[act]gtaaa|tttac[agt]ct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "agg[act]taaa|ttta[agt]cct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "aggg[acg]aaa|ttt[cgt]ccct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "agggt[cgt]aa|tt[acg]accct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "agggta[cgt]a|t[acg]taccct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "agggtaa[cgt]|[acg]ttaccct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_VAR(vIUB); array_init(vIUB); ZEPHIR_INIT_VAR(vIUBnew); array_init(vIUBnew); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "/B/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "(c|g|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "/D/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "(a|g|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "/H/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "(a|c|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "/K/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "(g|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "/M/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "(a|c)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "/N/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "(a|c|g|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "/R/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "(a|g)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "/S/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "(c|g)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "/V/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "(a|c|g)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "/W/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "(a|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "/Y/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "(c|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE); ZEPHIR_INIT_VAR(stuffToRemove); ZVAL_STRING(stuffToRemove, "^>.*$|\n", 1); ZEPHIR_INIT_VAR(discard); ZVAL_NULL(discard); ZEPHIR_INIT_VAR(contents); zephir_file_get_contents(contents, path TSRMLS_CC); ZEPHIR_INIT_VAR(initialLength); ZVAL_LONG(initialLength, zephir_fast_strlen_ev(contents)); ZEPHIR_INIT_VAR(_1); ZEPHIR_CONCAT_SVS(_1, "/", stuffToRemove, "/mS"); ZEPHIR_SINIT_VAR(_2); ZVAL_STRING(&_2, "", 0); ZEPHIR_CALL_FUNCTION(&_3, "preg_replace", &_4, _1, &_2, contents); zephir_check_call_status(); ZEPHIR_CPY_WRT(contents, _3); ZEPHIR_INIT_VAR(codeLength); ZVAL_LONG(codeLength, zephir_fast_strlen_ev(contents)); zephir_is_iterable(variants, &_6, &_5, 0, 0); for ( ; zephir_hash_get_current_data_ex(_6, (void**) &_7, &_5) == SUCCESS ; zephir_hash_move_forward_ex(_6, &_5) ) { ZEPHIR_GET_HVALUE(regex, _7); zend_print_zval(regex, 0); php_printf(" "); ZEPHIR_INIT_LNVAR(_8); ZEPHIR_CONCAT_SVS(_8, "/", regex, "/iS"); Z_SET_ISREF_P(discard); ZEPHIR_CALL_FUNCTION(&_3, "preg_match_all", &_9, _8, contents, discard); Z_UNSET_ISREF_P(discard); zephir_check_call_status(); zend_print_zval(_3, 0); php_printf("%c", '\n'); } ZEPHIR_CALL_FUNCTION(&_10, "preg_replace", &_4, vIUB, vIUBnew, contents); zephir_check_call_status(); ZEPHIR_CPY_WRT(contents, _10); php_printf("%c", '\n'); zend_print_zval(initialLength, 0); php_printf("%c", '\n'); zend_print_zval(codeLength, 0); php_printf("%c", '\n'); php_printf("%d", zephir_fast_strlen_ev(contents)); php_printf("%c", '\n'); ZEPHIR_MM_RESTORE(); }
PHP_METHOD(Test_RegexDNA, process) { int ZEPHIR_LAST_CALL_STATUS; zephir_fcall_cache_entry *_3 = NULL; zval *path, path_sub, variants, vIUB, vIUBnew, stuffToRemove, contents, initialLength, regex, codeLength, discard, _0, _1, _2, *_4, _5$$3, _6$$3; ZEPHIR_INIT_THIS(); ZVAL_UNDEF(&path_sub); ZVAL_UNDEF(&variants); ZVAL_UNDEF(&vIUB); ZVAL_UNDEF(&vIUBnew); ZVAL_UNDEF(&stuffToRemove); ZVAL_UNDEF(&contents); ZVAL_UNDEF(&initialLength); ZVAL_UNDEF(®ex); ZVAL_UNDEF(&codeLength); ZVAL_UNDEF(&discard); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_5$$3); ZVAL_UNDEF(&_6$$3); ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &path); ZEPHIR_INIT_VAR(&discard); ZVAL_NULL(&discard); ZEPHIR_INIT_VAR(&variants); zephir_create_array(&variants, 9, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "agggtaaa|tttaccct"); zephir_array_fast_append(&variants, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "[cgt]gggtaaa|tttaccc[acg]"); zephir_array_fast_append(&variants, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "a[act]ggtaaa|tttacc[agt]t"); zephir_array_fast_append(&variants, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "ag[act]gtaaa|tttac[agt]ct"); zephir_array_fast_append(&variants, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "agg[act]taaa|ttta[agt]cct"); zephir_array_fast_append(&variants, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "aggg[acg]aaa|ttt[cgt]ccct"); zephir_array_fast_append(&variants, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "agggt[cgt]aa|tt[acg]accct"); zephir_array_fast_append(&variants, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "agggta[cgt]a|t[acg]taccct"); zephir_array_fast_append(&variants, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "agggtaa[cgt]|[acg]ttaccct"); zephir_array_fast_append(&variants, &_0); ZEPHIR_INIT_VAR(&vIUB); array_init(&vIUB); ZEPHIR_INIT_VAR(&vIUBnew); array_init(&vIUBnew); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "/B/S"); zephir_array_append(&vIUB, &_0, PH_SEPARATE, "test/regexdna.zep", 30); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "(c|g|t)"); zephir_array_append(&vIUBnew, &_0, PH_SEPARATE, "test/regexdna.zep", 30); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "/D/S"); zephir_array_append(&vIUB, &_0, PH_SEPARATE, "test/regexdna.zep", 31); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "(a|g|t)"); zephir_array_append(&vIUBnew, &_0, PH_SEPARATE, "test/regexdna.zep", 31); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "/H/S"); zephir_array_append(&vIUB, &_0, PH_SEPARATE, "test/regexdna.zep", 32); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "(a|c|t)"); zephir_array_append(&vIUBnew, &_0, PH_SEPARATE, "test/regexdna.zep", 32); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "/K/S"); zephir_array_append(&vIUB, &_0, PH_SEPARATE, "test/regexdna.zep", 33); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "(g|t)"); zephir_array_append(&vIUBnew, &_0, PH_SEPARATE, "test/regexdna.zep", 33); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "/M/S"); zephir_array_append(&vIUB, &_0, PH_SEPARATE, "test/regexdna.zep", 34); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "(a|c)"); zephir_array_append(&vIUBnew, &_0, PH_SEPARATE, "test/regexdna.zep", 34); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "/N/S"); zephir_array_append(&vIUB, &_0, PH_SEPARATE, "test/regexdna.zep", 35); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "(a|c|g|t)"); zephir_array_append(&vIUBnew, &_0, PH_SEPARATE, "test/regexdna.zep", 35); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "/R/S"); zephir_array_append(&vIUB, &_0, PH_SEPARATE, "test/regexdna.zep", 36); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "(a|g)"); zephir_array_append(&vIUBnew, &_0, PH_SEPARATE, "test/regexdna.zep", 36); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "/S/S"); zephir_array_append(&vIUB, &_0, PH_SEPARATE, "test/regexdna.zep", 37); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "(c|g)"); zephir_array_append(&vIUBnew, &_0, PH_SEPARATE, "test/regexdna.zep", 37); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "/V/S"); zephir_array_append(&vIUB, &_0, PH_SEPARATE, "test/regexdna.zep", 38); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "(a|c|g)"); zephir_array_append(&vIUBnew, &_0, PH_SEPARATE, "test/regexdna.zep", 38); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "/W/S"); zephir_array_append(&vIUB, &_0, PH_SEPARATE, "test/regexdna.zep", 39); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "(a|t)"); zephir_array_append(&vIUBnew, &_0, PH_SEPARATE, "test/regexdna.zep", 39); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "/Y/S"); zephir_array_append(&vIUB, &_0, PH_SEPARATE, "test/regexdna.zep", 40); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "(c|t)"); zephir_array_append(&vIUBnew, &_0, PH_SEPARATE, "test/regexdna.zep", 40); ZEPHIR_INIT_VAR(&stuffToRemove); ZVAL_STRING(&stuffToRemove, "^>.*$|\n"); ZEPHIR_INIT_NVAR(&discard); ZVAL_NULL(&discard); ZEPHIR_INIT_VAR(&contents); zephir_file_get_contents(&contents, path TSRMLS_CC); ZEPHIR_INIT_VAR(&initialLength); ZVAL_LONG(&initialLength, zephir_fast_strlen_ev(&contents)); ZEPHIR_INIT_VAR(&_1); ZEPHIR_CONCAT_SVS(&_1, "/", &stuffToRemove, "/mS"); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, ""); ZEPHIR_CALL_FUNCTION(&_2, "preg_replace", &_3, 51, &_1, &_0, &contents); zephir_check_call_status(); ZEPHIR_CPY_WRT(&contents, &_2); ZEPHIR_INIT_VAR(&codeLength); ZVAL_LONG(&codeLength, zephir_fast_strlen_ev(&contents)); zephir_is_iterable(&variants, 0, "test/regexdna.zep", 59); ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&variants), _4) { ZEPHIR_INIT_NVAR(®ex); ZVAL_COPY(®ex, _4); zend_print_zval(®ex, 0); php_printf("%s", " "); ZEPHIR_INIT_NVAR(&_5$$3); ZEPHIR_INIT_LNVAR(_6$$3); ZEPHIR_CONCAT_SVS(&_6$$3, "/", ®ex, "/iS"); zephir_preg_match(&_5$$3, &_6$$3, &contents, &discard, 1, 0 , 0 TSRMLS_CC); zend_print_zval(&_5$$3, 0); php_printf("%c", '\n'); } ZEND_HASH_FOREACH_END();
/** * Returns a cached content */ PHP_METHOD(Phalcon_Cache_Backend_File, get) { int lifetime, ZEPHIR_LAST_CALL_STATUS, ttl = 0, modifiedTime = 0; zval *keyName_param = NULL, *lifetime_param = NULL, *prefixedKey = NULL, *cacheDir = NULL, *cacheFile = NULL, *frontend = NULL, *lastLifetime = NULL, *cachedContent = NULL, *ret = NULL, *_0, *_1 = NULL, *_2, *_3$$6 = NULL, *_4$$4, *_5$$4, *_6$$10, *_7$$10; zval *keyName = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &keyName_param, &lifetime_param); zephir_get_strval(keyName, keyName_param); if (!lifetime_param) { lifetime = 0; } else { lifetime = zephir_get_intval(lifetime_param); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&_1, this_ptr, "getkey", NULL, 0, keyName); zephir_check_call_status(); ZEPHIR_INIT_VAR(prefixedKey); ZEPHIR_CONCAT_VV(prefixedKey, _0, _1); zephir_update_property_this(this_ptr, SL("_lastKey"), prefixedKey TSRMLS_CC); ZEPHIR_OBS_VAR(cacheDir); _2 = zephir_fetch_nproperty_this(this_ptr, SL("_options"), PH_NOISY_CC); if (!(zephir_array_isset_string_fetch(&cacheDir, _2, SS("cacheDir"), 0 TSRMLS_CC))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Unexpected inconsistency in options", "phalcon/cache/backend/file.zep", 111); return; } ZEPHIR_INIT_VAR(cacheFile); ZEPHIR_CONCAT_VV(cacheFile, cacheDir, prefixedKey); if ((zephir_file_exists(cacheFile TSRMLS_CC) == SUCCESS) == 1) { ZEPHIR_OBS_VAR(frontend); zephir_read_property_this(&frontend, this_ptr, SL("_frontend"), PH_NOISY_CC); if (!(lifetime)) { ZEPHIR_OBS_VAR(lastLifetime); zephir_read_property_this(&lastLifetime, this_ptr, SL("_lastLifetime"), PH_NOISY_CC); if (!(zephir_is_true(lastLifetime))) { ZEPHIR_CALL_METHOD(&_3$$6, frontend, "getlifetime", NULL, 0); zephir_check_call_status(); ttl = zephir_get_intval(_3$$6); } else { ttl = zephir_get_intval(lastLifetime); } } else { ttl = lifetime; } ZEPHIR_CALL_FUNCTION(NULL, "clearstatcache", NULL, 114, ZEPHIR_GLOBAL(global_true), cacheFile); zephir_check_call_status(); ZEPHIR_INIT_VAR(_4$$4); zephir_filemtime(_4$$4, cacheFile TSRMLS_CC); modifiedTime = zephir_get_intval(_4$$4); ZEPHIR_INIT_VAR(_5$$4); zephir_time(_5$$4); if (ZEPHIR_LT_LONG(_5$$4, (modifiedTime + ttl))) { ZEPHIR_INIT_VAR(cachedContent); zephir_file_get_contents(cachedContent, cacheFile TSRMLS_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(cachedContent)) { ZEPHIR_INIT_VAR(_6$$10); object_init_ex(_6$$10, phalcon_cache_exception_ce); ZEPHIR_INIT_VAR(_7$$10); ZEPHIR_CONCAT_SVS(_7$$10, "Cache file ", cacheFile, " could not be opened"); ZEPHIR_CALL_METHOD(NULL, _6$$10, "__construct", NULL, 9, _7$$10); zephir_check_call_status(); zephir_throw_exception_debug(_6$$10, "phalcon/cache/backend/file.zep", 148 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } if (zephir_is_numeric(cachedContent)) { RETURN_CCTOR(cachedContent); } else { ZEPHIR_CALL_METHOD(&ret, frontend, "afterretrieve", NULL, 0, cachedContent); zephir_check_call_status(); RETURN_CCTOR(ret); } } } RETURN_MM_NULL(); }
PHP_METHOD(Test_RegexDNA, process) { HashTable *_4; HashPosition _3; zval *path, *variants, *vIUB, *vIUBnew, *stuffToRemove, *contents = NULL, *initialLength, *regex = NULL, *codeLength, *discard, *_0 = NULL, *_1, _2, **_5, *_6 = NULL, *_7; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &path); ZEPHIR_INIT_VAR(variants); array_init_size(variants, 13); ZEPHIR_INIT_VAR(_0); ZVAL_STRING(_0, "agggtaaa|tttaccct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "[cgt]gggtaaa|tttaccc[acg]", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "a[act]ggtaaa|tttacc[agt]t", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "ag[act]gtaaa|tttac[agt]ct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "agg[act]taaa|ttta[agt]cct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "aggg[acg]aaa|ttt[cgt]ccct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "agggt[cgt]aa|tt[acg]accct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "agggta[cgt]a|t[acg]taccct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "agggtaa[cgt]|[acg]ttaccct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_VAR(vIUB); array_init(vIUB); ZEPHIR_INIT_VAR(vIUBnew); array_init(vIUBnew); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "/B/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "(c|g|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "/D/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "(a|g|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "/H/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "(a|c|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "/K/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "(g|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "/M/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "(a|c)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "/N/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "(a|c|g|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "/R/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "(a|g)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "/S/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "(c|g)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "/V/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "(a|c|g)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "/W/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "(a|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "/Y/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "(c|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE); ZEPHIR_INIT_VAR(stuffToRemove); ZVAL_STRING(stuffToRemove, "^>.*$|\n", 1); ZEPHIR_INIT_VAR(discard); ZVAL_NULL(discard); ZEPHIR_INIT_VAR(contents); zephir_file_get_contents(contents, path TSRMLS_CC); ZEPHIR_INIT_VAR(initialLength); ZVAL_LONG(initialLength, zephir_fast_strlen_ev(contents)); ZEPHIR_INIT_VAR(_1); ZEPHIR_CONCAT_SVS(_1, "/", stuffToRemove, "/mS"); ZEPHIR_SINIT_VAR(_2); ZVAL_STRING(&_2, "", 0); ZEPHIR_INIT_BNVAR(_0); zephir_call_func_p3(_0, "preg_replace", _1, &_2, contents); ZEPHIR_CPY_WRT(contents, _0); ZEPHIR_INIT_VAR(codeLength); ZVAL_LONG(codeLength, zephir_fast_strlen_ev(contents)); zephir_is_iterable(variants, &_4, &_3, 0, 0); for ( ; zend_hash_get_current_data_ex(_4, (void**) &_5, &_3) == SUCCESS ; zephir_hash_move_forward_ex(_4, &_3) ) { ZEPHIR_GET_HVALUE(regex, _5); zend_print_zval(regex, 0); php_printf(" "); ZEPHIR_INIT_NVAR(_0); ZEPHIR_INIT_LNVAR(_6); ZEPHIR_CONCAT_SVS(_6, "/", regex, "/iS"); zephir_preg_match(_0, &(_0), _6, contents, discard, 1, 0 , 0 TSRMLS_CC); zend_print_zval(_0, 0); php_printf("%c", '\n'); } ZEPHIR_INIT_VAR(_7); zephir_call_func_p3(_7, "preg_replace", vIUB, vIUBnew, contents); ZEPHIR_CPY_WRT(contents, _7); php_printf("%c", '\n'); zend_print_zval(initialLength, 0); php_printf("%c", '\n'); zend_print_zval(codeLength, 0); php_printf("%c", '\n'); php_printf("%d", zephir_fast_strlen_ev(contents)); php_printf("%c", '\n'); ZEPHIR_MM_RESTORE(); }
/** * Reads and decodes a JSON-encoded file into an object or array * * @param string $file A readable JSON file. * @param boolean $assoc [Optional] Whether to decode to an associative array. Default false. * @param int $depth [Optional] Depth to decode to. Default 512 * @param int $flags [Optional] Bitwise flags for use in json_decode(). Default is 0 * @return object|array|null JSON data decoded to object(s) or array(s). */ PHP_METHOD(Xpl_Json, decodeFile) { int depth, flags, ZEPHIR_LAST_CALL_STATUS; zend_bool assoc; zval *file_param = NULL, *assoc_param = NULL, *depth_param = NULL, *flags_param = NULL, *json = NULL, *_2, *_3, *_4, *_0$$3; zval *file = NULL, *_1$$3; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 3, &file_param, &assoc_param, &depth_param, &flags_param); if (unlikely(Z_TYPE_P(file_param) != IS_STRING && Z_TYPE_P(file_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'file' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(file_param) == IS_STRING)) { zephir_get_strval(file, file_param); } else { ZEPHIR_INIT_VAR(file); ZVAL_EMPTY_STRING(file); } if (!assoc_param) { assoc = 0; } else { assoc = zephir_get_boolval(assoc_param); } if (!depth_param) { depth = 512; } else { depth = zephir_get_intval(depth_param); } if (!flags_param) { flags = 0; } else { flags = zephir_get_intval(flags_param); } if (!((zephir_file_exists(file TSRMLS_CC) == SUCCESS))) { ZEPHIR_INIT_VAR(_0$$3); object_init_ex(_0$$3, spl_ce_RuntimeException); ZEPHIR_INIT_VAR(_1$$3); ZEPHIR_CONCAT_SV(_1$$3, "Unreadable file: ", file); ZEPHIR_CALL_METHOD(NULL, _0$$3, "__construct", NULL, 111, _1$$3); zephir_check_call_status(); zephir_throw_exception_debug(_0$$3, "xpl/json.zep", 62 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } ZEPHIR_INIT_VAR(json); zephir_file_get_contents(json, file TSRMLS_CC); ZEPHIR_INIT_VAR(_2); if (assoc) { ZVAL_BOOL(_2, 1); } else { ZVAL_BOOL(_2, 0); } ZEPHIR_INIT_VAR(_3); ZVAL_LONG(_3, depth); ZEPHIR_INIT_VAR(_4); ZVAL_LONG(_4, flags); ZEPHIR_RETURN_CALL_SELF("decode", NULL, 0, json, _2, _3, _4); zephir_check_call_status(); RETURN_MM(); }