/** * Phalcon\Cache\Backend\Xcache constructor * * @param Phalcon\Cache\FrontendInterface $frontend * @param array $options */ PHP_METHOD(Phalcon_Cache_Backend_Xcache, __construct){ zval *frontend, *options = NULL; PHALCON_MM_GROW(); phalcon_fetch_params(1, 1, 1, &frontend, &options); if (!options) { PHALCON_INIT_VAR(options); } else { PHALCON_SEPARATE_PARAM(options); } if (Z_TYPE_P(options) != IS_ARRAY) { PHALCON_INIT_NVAR(options); array_init(options); } if (!phalcon_array_isset_string(options, SS("statsKey"))) { phalcon_array_update_string_string(&options, SL("statsKey"), SL("_PHCX"), PH_SEPARATE TSRMLS_CC); } PHALCON_CALL_PARENT_PARAMS_2_NORETURN(this_ptr, "Phalcon\\Cache\\Backend\\Xcache", "__construct", frontend, options); PHALCON_MM_RESTORE(); }
/** * Phalcon\Cache\Backend\Mongo constructor * * @param Phalcon\Cache\FrontendInterface $frontend * @param array $options */ PHP_METHOD(Phalcon_Cache_Backend_Mongo, __construct){ zval *frontend, *options = NULL; PHALCON_MM_GROW(); phalcon_fetch_params(1, 1, 1, &frontend, &options); if (!options) { PHALCON_INIT_VAR(options); } if (!phalcon_array_isset_string(options, SS("mongo"))) { if (!phalcon_array_isset_string(options, SS("server"))) { PHALCON_THROW_EXCEPTION_STR(phalcon_cache_exception_ce, "The parameter 'server' is required"); return; } } if (!phalcon_array_isset_string(options, SS("db"))) { PHALCON_THROW_EXCEPTION_STR(phalcon_cache_exception_ce, "The parameter 'db' is required"); return; } if (!phalcon_array_isset_string(options, SS("collection"))) { PHALCON_THROW_EXCEPTION_STR(phalcon_cache_exception_ce, "The parameter 'collection' is required"); return; } PHALCON_CALL_PARENT_PARAMS_2_NORETURN(this_ptr, "Phalcon\\Cache\\Backend\\Mongo", "__construct", frontend, options); PHALCON_MM_RESTORE(); }
/** * Phalcon_View_Engine_Php constructor * * @param Phalcon_View $view * @param array $options */ PHP_METHOD(Phalcon_View_Engine_Php, __construct){ zval *view = NULL, *options = NULL; PHALCON_MM_GROW(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &view, &options) == FAILURE) { PHALCON_MM_RESTORE(); RETURN_NULL(); } PHALCON_CALL_PARENT_PARAMS_2_NORETURN(this_ptr, "Phalcon_View_Engine_Php", "__construct", view, options); PHALCON_MM_RESTORE(); }
/** * Phalcon_View_Engine_Mustache constructor * * @param Phalcon_View $view * @param array $options */ PHP_METHOD(Phalcon_View_Engine_Mustache, __construct){ zval *view = NULL, *options = NULL, *mustache = NULL; zval *c0 = NULL; zval *r0 = NULL, *r1 = NULL; zval *i0 = NULL; int eval_int; zend_class_entry *ce0; PHALCON_MM_GROW(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &view, &options) == FAILURE) { PHALCON_MM_RESTORE(); RETURN_NULL(); } PHALCON_INIT_VAR(c0); ZVAL_STRING(c0, "Mustache", 1); PHALCON_ALLOC_ZVAL_MM(r0); PHALCON_CALL_FUNC_PARAMS_1(r0, "class_exists", c0); if (!zend_is_true(r0)) { PHALCON_THROW_EXCEPTION_STR(phalcon_view_exception_ce, "Mustache class must be loaded first"); return; } eval_int = phalcon_array_isset_string(options, SL("mustache")+1); if (eval_int) { PHALCON_ALLOC_ZVAL_MM(r1); phalcon_array_fetch_string(&r1, options, SL("mustache"), PHALCON_NOISY TSRMLS_CC); PHALCON_CPY_WRT(mustache, r1); } else { ce0 = zend_fetch_class("Mustache", strlen("Mustache"), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); PHALCON_ALLOC_ZVAL_MM(i0); object_init_ex(i0, ce0); PHALCON_CALL_METHOD_NORETURN(i0, "__construct", PHALCON_CHECK); PHALCON_CPY_WRT(mustache, i0); } phalcon_update_property_zval(this_ptr, SL("_mustache"), mustache TSRMLS_CC); PHALCON_CALL_PARENT_PARAMS_2_NORETURN(this_ptr, "Phalcon_View_Engine_Mustache", "__construct", view, options); PHALCON_MM_RESTORE(); }
/** * Phalcon\Cache\Backend\File constructor * * @param Phalcon\Cache\FrontendInterface $frontend * @param array $options */ PHP_METHOD(Phalcon_Cache_Backend_File, __construct){ zval *frontend, *options = NULL, *cache_dir, *is_writable; int eval_int; PHALCON_MM_GROW(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|z", &frontend, &options) == FAILURE) { PHALCON_MM_RESTORE(); RETURN_NULL(); } if (!options) { PHALCON_INIT_NVAR(options); array_init(options); } eval_int = phalcon_array_isset_string(options, SS("cacheDir")); if (eval_int) { PHALCON_INIT_VAR(cache_dir); phalcon_array_fetch_string(&cache_dir, options, SL("cacheDir"), PH_NOISY_CC); /** * Prod mode? */ PHALCON_INIT_VAR(is_writable); PHALCON_CALL_FUNC_PARAMS_1(is_writable, "is_writable", cache_dir); if (PHALCON_IS_FALSE(is_writable)) { PHALCON_THROW_EXCEPTION_STR(phalcon_cache_exception_ce, "The cache directory does not exist or is not writable"); return; } PHALCON_CALL_PARENT_PARAMS_2_NORETURN(this_ptr, "Phalcon\\Cache\\Backend\\File", "__construct", frontend, options); } else { PHALCON_THROW_EXCEPTION_STR(phalcon_cache_exception_ce, "You must specify the cache directory with the option cacheDir"); return; } PHALCON_MM_RESTORE(); }
/** * Phalcon\Cache\Backend\Memcache constructor * * @param Phalcon\Cache\FrontendInterface $frontend * @param array $options */ PHP_METHOD(Phalcon_Cache_Backend_Memcache, __construct){ zval *frontend, *options = NULL; PHALCON_MM_GROW(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|z", &frontend, &options) == FAILURE) { RETURN_MM_NULL(); } if (!options) { PHALCON_INIT_VAR(options); } else { PHALCON_SEPARATE_PARAM(options); } if (Z_TYPE_P(options) != IS_ARRAY) { PHALCON_INIT_NVAR(options); array_init(options); } if (!phalcon_array_isset_string(options, SS("host"))) { phalcon_array_update_string_string(&options, SL("host"), SL("127.0.0.1"), PH_SEPARATE TSRMLS_CC); } if (!phalcon_array_isset_string(options, SS("port"))) { phalcon_array_update_string_string(&options, SL("port"), SL("11211"), PH_SEPARATE TSRMLS_CC); } if (!phalcon_array_isset_string(options, SS("persistent"))) { phalcon_array_update_string_bool(&options, SL("persistent"), 0, PH_SEPARATE TSRMLS_CC); } if (!phalcon_array_isset_string(options, SS("statsKey"))) { phalcon_array_update_string_string(&options, SL("statsKey"), SL("_PHCM"), PH_SEPARATE TSRMLS_CC); } PHALCON_CALL_PARENT_PARAMS_2_NORETURN(this_ptr, "Phalcon\\Cache\\Backend\\Memcache", "__construct", frontend, options); PHALCON_MM_RESTORE(); }
/** * Phalcon\Forms\Element constructor * * @param string $name * @param object|array $options * @param array $attributes */ PHP_METHOD(Phalcon_Forms_Element_Select, __construct){ zval *name, *options = NULL, *attributes = NULL; PHALCON_MM_GROW(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|zz", &name, &options, &attributes) == FAILURE) { RETURN_MM_NULL(); } if (!options) { PHALCON_INIT_VAR(options); } if (!attributes) { PHALCON_INIT_VAR(attributes); } phalcon_update_property_zval(this_ptr, SL("_options"), options TSRMLS_CC); PHALCON_CALL_PARENT_PARAMS_2_NORETURN(this_ptr, "Phalcon\\Forms\\Element\\Select", "__construct", name, attributes); PHALCON_MM_RESTORE(); }
/** * Phalcon\Cache\Backend\File constructor * * @param Phalcon\Cache\FrontendInterface $frontend * @param array $options */ PHP_METHOD(Phalcon_Cache_Backend_File, __construct){ zval *frontend, *options = NULL, *cache_dir; PHALCON_MM_GROW(); phalcon_fetch_params(1, 1, 1, &frontend, &options); if (!options) { PHALCON_INIT_VAR(options); } if (!phalcon_array_isset_string(options, SS("cacheDir"))) { PHALCON_THROW_EXCEPTION_STR(phalcon_cache_exception_ce, "Cache directory must be specified with the option cacheDir"); return; } PHALCON_OBS_VAR(cache_dir); phalcon_array_fetch_string(&cache_dir, options, SL("cacheDir"), PH_NOISY); PHALCON_CALL_PARENT_PARAMS_2_NORETURN(this_ptr, "Phalcon\\Cache\\Backend\\File", "__construct", frontend, options); PHALCON_MM_RESTORE(); }