/** * Checks if a form is registered in the forms manager */ PHP_METHOD(Phalcon_Forms_Manager, has) { zval *name_param = NULL, _0; zval name; zval *this_ptr = getThis(); ZVAL_UNDEF(&name); ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &name_param); zephir_get_strval(&name, name_param); zephir_read_property(&_0, this_ptr, SL("_forms"), PH_NOISY_CC | PH_READONLY); RETURN_MM_BOOL(zephir_array_isset(&_0, &name)); }
/** * Checks whether the file has been uploaded via Post. */ PHP_METHOD(Phalcon_Http_Request_File, isUploadedFile) { zend_bool _0; int ZEPHIR_LAST_CALL_STATUS; zval *tmp = NULL, *_1 = NULL; ZEPHIR_MM_GROW(); ZEPHIR_CALL_METHOD(&tmp, this_ptr, "gettempname", NULL, 0); zephir_check_call_status(); _0 = Z_TYPE_P(tmp) == IS_STRING; if (_0) { ZEPHIR_CALL_FUNCTION(&_1, "is_uploaded_file", NULL, 209, tmp); zephir_check_call_status(); _0 = zephir_is_true(_1); } RETURN_MM_BOOL(_0); }
/** * Check on empty */ PHP_METHOD(Phalcon_Validation_Validator_File, isAllowEmpty) { zend_bool _0, _1; zend_long ZEPHIR_LAST_CALL_STATUS; zval field; zval *validation, validation_sub, *field_param = NULL, value, _2; zval *this_ptr = getThis(); ZVAL_UNDEF(&validation_sub); ZVAL_UNDEF(&value); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&field); ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 0, &validation, &field_param); if (UNEXPECTED(Z_TYPE_P(field_param) != IS_STRING && Z_TYPE_P(field_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'field' must be of the type string") TSRMLS_CC); RETURN_MM_NULL(); } if (EXPECTED(Z_TYPE_P(field_param) == IS_STRING)) { zephir_get_strval(&field, field_param); } else { ZEPHIR_INIT_VAR(&field); ZVAL_EMPTY_STRING(&field); } ZEPHIR_CALL_METHOD(&value, validation, "getvalue", NULL, 0, &field); zephir_check_call_status(); _0 = ZEPHIR_IS_EMPTY(&value); if (!(_0)) { _1 = zephir_array_isset_string(&value, SL("error")); if (_1) { zephir_array_fetch_string(&_2, &value, SL("error"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 299 TSRMLS_CC); _1 = ZEPHIR_IS_LONG_IDENTICAL(&_2, 4); } _0 = _1; } RETURN_MM_BOOL(_0); }
/** * Starts a transaction in the connection * * @param boolean nesting * @return boolean */ PHP_METHOD(Pdm_Db_Adapter_AbstractPdo, begin) { int ZEPHIR_LAST_CALL_STATUS; zval *nesting_param = NULL, *transactionLevel = NULL, *savepointName = NULL, *_0, *_1 = NULL; zend_bool nesting; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, &nesting_param); if (!nesting_param) { nesting = 1; } else { nesting = zephir_get_boolval(nesting_param); } RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("transactionLevel") TSRMLS_CC)); _0 = zephir_fetch_nproperty_this(this_ptr, SL("transactionLevel"), PH_NOISY_CC); ZEPHIR_CPY_WRT(transactionLevel, _0); if (ZEPHIR_IS_LONG(transactionLevel, 1)) { _0 = zephir_fetch_nproperty_this(this_ptr, SL("pdo"), PH_NOISY_CC); ZEPHIR_RETURN_CALL_METHOD(_0, "begintransaction", NULL); zephir_check_call_status(); RETURN_MM(); } else { if (zephir_is_true(transactionLevel)) { if (nesting) { ZEPHIR_CALL_METHOD(&_1, this_ptr, "isnestedtransactionswithsavepoints", NULL); zephir_check_call_status(); if (zephir_is_true(_1)) { ZEPHIR_CALL_METHOD(&savepointName, this_ptr, "getnestedtransactionsavepointname", NULL); zephir_check_call_status(); ZEPHIR_RETURN_CALL_METHOD(this_ptr, "createsavepoint", NULL, savepointName); zephir_check_call_status(); RETURN_MM(); } } } } RETURN_MM_BOOL(0); }
/** * Decrement of a given key, by number $value * * @param string keyName */ PHP_METHOD(Phalcon_Cache_Backend_Apc, decrement) { zend_long value, ZEPHIR_LAST_CALL_STATUS; zval *keyName = NULL, *value_param = NULL, *lastKey = NULL, *cachedContent = NULL, *result = NULL, *_0, *_1$$3; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 2, &keyName, &value_param); if (!keyName) { keyName = ZEPHIR_GLOBAL(global_null); } if (!value_param) { value = 1; } else { value = zephir_get_intval(value_param); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY_CC); ZEPHIR_INIT_VAR(lastKey); ZEPHIR_CONCAT_SVV(lastKey, "_PHCA", _0, keyName); zephir_update_property_this(getThis(), SL("_lastKey"), lastKey TSRMLS_CC); if ((zephir_function_exists_ex(SS("apc_dec") TSRMLS_CC) == SUCCESS)) { ZEPHIR_INIT_VAR(_1$$3); ZVAL_LONG(_1$$3, value); ZEPHIR_RETURN_CALL_FUNCTION("apc_dec", NULL, 114, lastKey, _1$$3); zephir_check_call_status(); RETURN_MM(); } else { ZEPHIR_CALL_FUNCTION(&cachedContent, "apc_fetch", NULL, 90, lastKey); zephir_check_call_status(); if (zephir_is_numeric(cachedContent)) { ZEPHIR_INIT_VAR(result); ZVAL_LONG(result, (zephir_get_numberval(cachedContent) - value)); ZEPHIR_CALL_METHOD(NULL, this_ptr, "save", NULL, 0, keyName, result); zephir_check_call_status(); RETURN_CCTOR(result); } } RETURN_MM_BOOL(0); }
/** * Returns the annotations found in the properties' docblocks */ PHP_METHOD(Phalcon_Annotations_Reflection, getPropertiesAnnotations) { zephir_fcall_cache_entry *_5 = NULL; int ZEPHIR_LAST_CALL_STATUS; HashTable *_2; HashPosition _1; zval *annotations, *reflectionProperties, *collections, *property = NULL, *reflectionProperty = NULL, *_0, **_3, *_4 = NULL; ZEPHIR_MM_GROW(); ZEPHIR_OBS_VAR(annotations); zephir_read_property_this(&annotations, this_ptr, SL("_propertyAnnotations"), PH_NOISY_CC); if (Z_TYPE_P(annotations) != IS_OBJECT) { ZEPHIR_OBS_VAR(reflectionProperties); _0 = zephir_fetch_nproperty_this(this_ptr, SL("_reflectionData"), PH_NOISY_CC); if (zephir_array_isset_string_fetch(&reflectionProperties, _0, SS("properties"), 0 TSRMLS_CC)) { if (zephir_fast_count_int(reflectionProperties TSRMLS_CC)) { ZEPHIR_INIT_VAR(collections); array_init(collections); zephir_is_iterable(reflectionProperties, &_2, &_1, 0, 0, "phalcon/annotations/reflection.zep", 131); for ( ; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS ; zephir_hash_move_forward_ex(_2, &_1) ) { ZEPHIR_GET_HMKEY(property, _2, _1); ZEPHIR_GET_HVALUE(reflectionProperty, _3); ZEPHIR_INIT_NVAR(_4); object_init_ex(_4, phalcon_annotations_collection_ce); ZEPHIR_CALL_METHOD(NULL, _4, "__construct", &_5, 19, reflectionProperty); zephir_check_call_status(); zephir_array_update_zval(&collections, property, &_4, PH_COPY | PH_SEPARATE); } zephir_update_property_this(this_ptr, SL("_propertyAnnotations"), collections TSRMLS_CC); RETURN_CCTOR(collections); } } zephir_update_property_this(this_ptr, SL("_propertyAnnotations"), (0) ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false) TSRMLS_CC); RETURN_MM_BOOL(0); } RETURN_CCTOR(annotations); }
/** * Get first row in the resultset */ PHP_METHOD(Phalcon_Mvc_Model_Resultset, getFirst) { zval *_0, *_1; int ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); _0 = zephir_fetch_nproperty_this(this_ptr, SL("_count"), PH_NOISY_CC); if (ZEPHIR_IS_LONG(_0, 0)) { RETURN_MM_BOOL(0); } ZEPHIR_INIT_VAR(_1); ZVAL_LONG(_1, 0); ZEPHIR_CALL_METHOD(NULL, this_ptr, "seek", NULL, 70, _1); zephir_check_call_status(); ZEPHIR_RETURN_CALL_METHOD(this_ptr, "current", NULL, 0); zephir_check_call_status(); RETURN_MM(); }
/** * Attempts to register a service in the services container * Only is successful if a service hasn"t been registered previously * with the same name * * @param string name * @param mixed definition * @param boolean shared * @return Phalcon\Di\ServiceInterface|false */ PHP_METHOD(Phalcon_Di, attempt) { zephir_nts_static zephir_fcall_cache_entry *_1 = NULL; int ZEPHIR_LAST_CALL_STATUS; zend_bool shared; zval *name_param = NULL, *definition, *shared_param = NULL, *service, *_0; zval *name = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 1, &name_param, &definition, &shared_param); if (unlikely(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(name_param) == IS_STRING)) { zephir_get_strval(name, name_param); } else { ZEPHIR_INIT_VAR(name); ZVAL_EMPTY_STRING(name); } if (!shared_param) { shared = 0; } else { shared = zephir_get_boolval(shared_param); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_services"), PH_NOISY_CC); if (!(zephir_array_isset(_0, name))) { ZEPHIR_INIT_VAR(service); object_init_ex(service, phalcon_di_service_ce); ZEPHIR_CALL_METHOD(NULL, service, "__construct", &_1, name, definition, (shared ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false))); zephir_check_call_status(); zephir_update_property_array(this_ptr, SL("_services"), name, service TSRMLS_CC); RETURN_CCTOR(service); } RETURN_MM_BOOL(0); }
/** * Rewind array position * * @see Iterator * @return boolean */ PHP_METHOD(Prr_RouteCollection, valid) { zend_bool _2; int ZEPHIR_LAST_CALL_STATUS; zephir_nts_static zephir_fcall_cache_entry *_1 = NULL; zval *key = NULL, *_0; ZEPHIR_MM_GROW(); _0 = zephir_fetch_nproperty_this(this_ptr, SL("storage"), PH_NOISY_CC); Z_SET_ISREF_P(_0); ZEPHIR_CALL_FUNCTION(&key, "key", &_1, _0); Z_UNSET_ISREF_P(_0); zephir_check_call_status(); _2 = Z_TYPE_P(key) != IS_NULL; if (_2) { _2 = !ZEPHIR_IS_FALSE_IDENTICAL(key); } RETURN_MM_BOOL(_2); }
/** * Get last row in the resultset */ PHP_METHOD(Phalcon_Mvc_Model_Resultset, getLast) { zval *count = NULL, *_0; int ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); ZEPHIR_OBS_VAR(count); zephir_read_property_this(&count, this_ptr, SL("_count"), PH_NOISY_CC); if (ZEPHIR_IS_LONG(count, 0)) { RETURN_MM_BOOL(0); } ZEPHIR_INIT_VAR(_0); ZVAL_LONG(_0, (zephir_get_numberval(count) - 1)); ZEPHIR_CALL_METHOD(NULL, this_ptr, "seek", NULL, 70, _0); zephir_check_call_status(); ZEPHIR_RETURN_CALL_METHOD(this_ptr, "current", NULL, 0); zephir_check_call_status(); RETURN_MM(); }
/** * @param \Ouchbase\Entity entity * @return bool */ PHP_METHOD(Ouchbase_IdentityMap, contains) { int ZEPHIR_LAST_CALL_STATUS; zephir_nts_static zephir_fcall_cache_entry *_2 = NULL; zval *entity, *_0, *_1 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &entity); if (!(zephir_instance_of_ev(entity, ouchbase_entity_ce TSRMLS_CC))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(spl_ce_InvalidArgumentException, "Parameter 'entity' must be an instance of 'Ouchbase\\Entity'", "", 0); return; } _0 = zephir_fetch_nproperty_this(this_ptr, SL("entities"), PH_NOISY_CC); ZEPHIR_CALL_CE_STATIC(&_1, ouchbase__etc_ce, "getentityhash", &_2, entity); zephir_check_call_status(); RETURN_MM_BOOL(zephir_array_isset(_0, _1)); }
/** * Check if a string ends with a given string * * <code> * echo Phalcon\Text::endsWith("Hello", "llo"); // true * echo Phalcon\Text::endsWith("Hello", "LLO", false); // false * echo Phalcon\Text::endsWith("Hello", "LLO"); // true * </code> */ PHP_METHOD(Phalcon_Text, endsWith) { zend_bool ignoreCase; zval *str_param = NULL, *end_param = NULL, *ignoreCase_param = NULL; zval *str = NULL, *end = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 1, &str_param, &end_param, &ignoreCase_param); zephir_get_strval(str, str_param); zephir_get_strval(end, end_param); if (!ignoreCase_param) { ignoreCase = 1; } else { ignoreCase = zephir_get_boolval(ignoreCase_param); } RETURN_MM_BOOL(zephir_end_with(str, end, (ignoreCase ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false)))); }
/** * Reserves a job in the queue */ PHP_METHOD(Phalcon_Queue_Beanstalk, reserve) { zephir_nts_static zephir_fcall_cache_entry *_0 = NULL, *_6 = NULL, *_7 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *timeout = NULL, *command, *response = NULL, *_1, *_2, *_3 = NULL, *_4, *_5 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, &timeout); if (!timeout) { timeout = ZEPHIR_GLOBAL(global_null); } ZEPHIR_INIT_VAR(command); if (Z_TYPE_P(timeout) != IS_NULL) { ZEPHIR_CONCAT_SV(command, "reserve-with-timeout ", timeout); } else { ZVAL_STRING(command, "reserve", 1); } ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, command); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", &_0); zephir_check_call_status(); zephir_array_fetch_long(&_1, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 153 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_1, "RESERVED")) { RETURN_MM_BOOL(0); } object_init_ex(return_value, phalcon_queue_beanstalk_job_ce); zephir_array_fetch_long(&_2, response, 1, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 163 TSRMLS_CC); zephir_array_fetch_long(&_4, response, 2, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 163 TSRMLS_CC); ZEPHIR_CALL_METHOD(&_3, this_ptr, "read", NULL, _4); zephir_check_call_status(); ZEPHIR_CALL_FUNCTION(&_5, "unserialize", &_6, _3); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_7, this_ptr, _2, _5); zephir_check_call_status(); RETURN_MM(); }
/** * Returns a route object by its name */ PHP_METHOD(Phalcon_Cli_Router, getRouteByName) { int ZEPHIR_LAST_CALL_STATUS; HashTable *_2; HashPosition _1; zval *name_param = NULL, *route = NULL, *_0, **_3, *_4 = NULL; zval *name = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &name_param); if (unlikely(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(name_param) == IS_STRING)) { zephir_get_strval(name, name_param); } else { ZEPHIR_INIT_VAR(name); ZVAL_EMPTY_STRING(name); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_routes"), PH_NOISY_CC); zephir_is_iterable(_0, &_2, &_1, 0, 0, "phalcon/cli/router.zep", 501); for ( ; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS ; zephir_hash_move_forward_ex(_2, &_1) ) { ZEPHIR_GET_HVALUE(route, _3); ZEPHIR_CALL_METHOD(&_4, route, "getname", NULL, 0); zephir_check_call_status(); if (ZEPHIR_IS_EQUAL(_4, name)) { RETURN_CCTOR(route); } } RETURN_MM_BOOL(0); }
/** * Compare strings */ PHP_METHOD(Phalcon_Validation_Validator_Confirmation, compare) { zephir_fcall_cache_entry *_5 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *a_param = NULL, *b_param = NULL, *_0 = NULL, *_1, *_2, _3$$3 = zval_used_for_init, *_4$$3 = NULL, *_6$$3 = NULL; zval *a = NULL, *b = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 0, &a_param, &b_param); zephir_get_strval(a, a_param); zephir_get_strval(b, b_param); ZEPHIR_INIT_VAR(_1); ZVAL_STRING(_1, "ignoreCase", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_VAR(_2); ZVAL_BOOL(_2, 0); ZEPHIR_CALL_METHOD(&_0, this_ptr, "getoption", NULL, 0, _1, _2); zephir_check_temp_parameter(_1); zephir_check_call_status(); if (zephir_is_true(_0)) { if (!((zephir_function_exists_ex(SS("mb_strtolower") TSRMLS_CC) == SUCCESS))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_validation_exception_ce, "Extension 'mbstring' is required", "phalcon/validation/validator/confirmation.zep", 122); return; } ZEPHIR_SINIT_VAR(_3$$3); ZVAL_STRING(&_3$$3, "utf-8", 0); ZEPHIR_CALL_FUNCTION(&_4$$3, "mb_strtolower", &_5, 200, a, &_3$$3); zephir_check_call_status(); zephir_get_strval(a, _4$$3); ZEPHIR_SINIT_NVAR(_3$$3); ZVAL_STRING(&_3$$3, "utf-8", 0); ZEPHIR_CALL_FUNCTION(&_6$$3, "mb_strtolower", &_5, 200, b, &_3$$3); zephir_check_call_status(); zephir_get_strval(b, _6$$3); } RETURN_MM_BOOL(ZEPHIR_IS_EQUAL(a, b)); }
/** * Get list of a tubes. */ PHP_METHOD(Phalcon_Queue_Beanstalk, listTubes) { zval *response = NULL, *_0, *_1, *_2; int ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(_0); ZVAL_STRING(_0, "list-tubes", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _0); zephir_check_temp_parameter(_0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&response, this_ptr, "readyaml", NULL, 384); zephir_check_call_status(); zephir_array_fetch_long(&_1, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 266 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_1, "OK")) { RETURN_MM_BOOL(0); } zephir_array_fetch_long(&_2, response, 2, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 270 TSRMLS_CC); RETURN_CTOR(_2); }
/** * Determine if data is associative array * * @param mixed data * @return boolean */ PHP_METHOD(Phal_Format_Reader_Hal_JsonReader, isAssocArray) { int ZEPHIR_LAST_CALL_STATUS; zephir_nts_static zephir_fcall_cache_entry *_4 = NULL; zval *data, *_0, _1, _2, *_3 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &data); ZEPHIR_INIT_VAR(_0); zephir_array_keys(_0, data TSRMLS_CC); ZEPHIR_SINIT_VAR(_1); ZVAL_LONG(&_1, 0); ZEPHIR_SINIT_VAR(_2); ZVAL_LONG(&_2, (zephir_fast_count_int(data TSRMLS_CC) - 1)); ZEPHIR_CALL_FUNCTION(&_3, "range", &_4, &_1, &_2); zephir_check_call_status(); RETURN_MM_BOOL(!ZEPHIR_IS_IDENTICAL(_0, _3)); }
PHP_METHOD(Yb_Factory_Shared, __isset) { int ZEPHIR_LAST_CALL_STATUS; zval *name_param = NULL, *_0, *_1; zval *name = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &name_param); zephir_get_strval(name, name_param); _0 = zephir_fetch_nproperty_this(this_ptr, SL("productions"), PH_NOISY_CC); if (zephir_array_isset(_0, name)) { RETURN_MM_BOOL(1); } _1 = zephir_fetch_nproperty_this(this_ptr, SL("factory"), PH_NOISY_CC); ZEPHIR_RETURN_CALL_METHOD(_1, "__isset", NULL, 0, name); zephir_check_call_status(); RETURN_MM(); }
PHP_METHOD(Cake_Core_Configure, load) { zephir_fcall_cache_entry *_1 = NULL; int ZEPHIR_LAST_CALL_STATUS; zend_bool merge; zval *key, *config = NULL, *merge_param = NULL, *engine = NULL, *values = NULL, *_0 = NULL, *_2; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 2, &key, &config, &merge_param); if (!config) { ZEPHIR_INIT_VAR(config); ZVAL_STRING(config, "default", 1); } if (!merge_param) { merge = 1; } else { merge = zephir_get_boolval(merge_param); } ZEPHIR_CALL_SELF(&engine, "_getengine", NULL, 0, config); zephir_check_call_status(); if (!(zephir_is_true(engine))) { RETURN_MM_BOOL(0); } ZEPHIR_CALL_METHOD(&values, engine, "read", NULL, 0, key); zephir_check_call_status(); if (merge) { _2 = zephir_fetch_static_property_ce(cake_core_configure_ce, SL("_values") TSRMLS_CC); ZEPHIR_CALL_CE_STATIC(&_0, cake_utility_hash_ce, "merge", &_1, 6, _2, values); zephir_check_call_status(); ZEPHIR_CPY_WRT(values, _0); } ZEPHIR_RETURN_CALL_SELF("write", NULL, 0, values); zephir_check_call_status(); RETURN_MM(); }
PHP_METHOD(Test_EmptyTest, testString) { zval *a_param = NULL; zval a; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&a); ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &a_param); zephir_get_strval(&a, a_param); RETURN_MM_BOOL(ZEPHIR_IS_EMPTY(&a)); }
/** * 判断字母是否在某个区域内。用于判断某个字符只能介于[a-h](包含)之间的类似情况。 * @param string alpha 原值。 * @param string start_alpha 起始值。 * @param string end_alpha 截止值。 * @return boolean */ PHP_METHOD(Winer_Validator, alpha_between) { int ZEPHIR_LAST_CALL_STATUS; zval *alpha_param = NULL, *start_alpha_param = NULL, *end_alpha_param = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL; zval *alpha = NULL, *start_alpha = NULL, *end_alpha = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 3, 0, &alpha_param, &start_alpha_param, &end_alpha_param); zephir_get_strval(alpha, alpha_param); zephir_get_strval(start_alpha, start_alpha_param); zephir_get_strval(end_alpha, end_alpha_param); ZEPHIR_CALL_SELF(&_0, "is_alpha", NULL, alpha); zephir_check_call_status(); if (ZEPHIR_IS_FALSE(_0)) { RETURN_MM_BOOL(0); } ZEPHIR_CALL_SELF(&_1, "is_alpha", NULL, start_alpha); zephir_check_call_status(); if (ZEPHIR_IS_FALSE(_1)) { RETURN_MM_BOOL(0); } ZEPHIR_CALL_SELF(&_2, "is_alpha", NULL, end_alpha); zephir_check_call_status(); if (ZEPHIR_IS_FALSE(_2)) { RETURN_MM_BOOL(0); } if (ZEPHIR_GE(start_alpha, end_alpha)) { RETURN_MM_BOOL(0); } if (ZEPHIR_LT(alpha, start_alpha)) { RETURN_MM_BOOL(0); } if (ZEPHIR_GT(alpha, end_alpha)) { RETURN_MM_BOOL(0); } RETURN_MM_BOOL(1); }
/** * Reads parsed annotations from XCache * * @param string key * @return Phalcon\Annotations\Reflection */ PHP_METHOD(Phalcon_Annotations_Adapter_Xcache, read) { int ZEPHIR_LAST_CALL_STATUS; zval *key_param = NULL, *serialized = NULL, *data = NULL, *_0; zval *key = NULL, *_1; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &key_param); if (unlikely(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(key_param) == IS_STRING)) { zephir_get_strval(key, key_param); } else { ZEPHIR_INIT_VAR(key); ZVAL_EMPTY_STRING(key); } ZEPHIR_INIT_VAR(_0); ZEPHIR_INIT_VAR(_1); ZEPHIR_CONCAT_SV(_1, "_PHAN", key); zephir_fast_strtolower(_0, _1); ZEPHIR_CALL_FUNCTION(&serialized, "xcache_get", NULL, 9, _0); zephir_check_call_status(); if (Z_TYPE_P(serialized) == IS_STRING) { ZEPHIR_CALL_FUNCTION(&data, "unserialize", NULL, 10, serialized); zephir_check_call_status(); if (Z_TYPE_P(data) == IS_OBJECT) { RETURN_CCTOR(data); } } RETURN_MM_BOOL(0); }
/** * Check if a string ends with a given string * * <code> * echo Phalcon\Text::endsWith("Hello", "llo"); // true * echo Phalcon\Text::endsWith("Hello", "LLO", false); // false * echo Phalcon\Text::endsWith("Hello", "LLO"); // true * </code> */ PHP_METHOD(Phalcon_Text, endsWith) { zend_bool ignoreCase; zval *str_param = NULL, *end_param = NULL, *ignoreCase_param = NULL, _0; zval *str = NULL, *end = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 1, &str_param, &end_param, &ignoreCase_param); zephir_get_strval(str, str_param); zephir_get_strval(end, end_param); if (!ignoreCase_param) { ignoreCase = 1; } else { ignoreCase = zephir_get_boolval(ignoreCase_param); } ZEPHIR_SINIT_VAR(_0); ZVAL_BOOL(&_0, (ignoreCase ? 1 : 0)); RETURN_MM_BOOL(zephir_end_with(str, end, &_0)); }
/** * Returns the insert id for the auto_increment/serial column inserted in the lastest executed SQL statement * *<code> * //Inserting a new robot * $success = $connection->insert( * "robots", * array("Astro Boy", 1952), * array("name", "year") * ); * * //Getting the generated id * $id = $connection->lastInsertId(); *</code> * * @param string sequenceName * @return int|boolean */ PHP_METHOD(Phalcon_Db_Adapter_Pdo, lastInsertId) { int ZEPHIR_LAST_CALL_STATUS; zval *sequenceName = NULL, *pdo; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, &sequenceName); if (!sequenceName) { sequenceName = ZEPHIR_GLOBAL(global_null); } ZEPHIR_OBS_VAR(pdo); zephir_read_property_this(&pdo, this_ptr, SL("_pdo"), PH_NOISY_CC); if (Z_TYPE_P(pdo) != IS_OBJECT) { RETURN_MM_BOOL(0); } ZEPHIR_RETURN_CALL_METHOD(pdo, "lastinsertid", NULL, 0, sequenceName); zephir_check_call_status(); RETURN_MM(); }
/** * Checks whether an offset exists in the document * * @param int index * @return boolean */ PHP_METHOD(Phalcon_Mvc_Collection_Document, offsetExists) { zval *index_param = NULL; zval *index = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &index_param); if (unlikely(Z_TYPE_P(index_param) != IS_STRING && Z_TYPE_P(index_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'index' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(index_param) == IS_STRING)) { zephir_get_strval(index, index_param); } else { ZEPHIR_INIT_VAR(index); ZVAL_EMPTY_STRING(index); } RETURN_MM_BOOL(zephir_isset_property_zval(this_ptr, index TSRMLS_CC)); }
/** * Starts the session */ PHP_METHOD(Yaf_Session, start) { int ZEPHIR_LAST_CALL_STATUS; zval *session = NULL, *_0, *_SESSION; ZEPHIR_MM_GROW(); ZEPHIR_CALL_SELF(&session, "getinstance", NULL); zephir_check_call_status(); ZEPHIR_OBS_VAR(_0); zephir_read_property(&_0, session, SL("started"), PH_NOISY_CC); if (ZEPHIR_IS_TRUE(_0)) { RETURN_MM_BOOL(1); } else { ZEPHIR_CALL_FUNCTION(NULL, "session_start", NULL); zephir_check_call_status(); zephir_update_property_zval(session, SL("started"), (1) ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false) TSRMLS_CC); zephir_get_global(&_SESSION, SS("_SESSION") TSRMLS_CC); zephir_update_property_zval(session, SL("session"), _SESSION TSRMLS_CC); } ZEPHIR_MM_RESTORE(); }
PHP_METHOD(Test_EmptyTest, testDynamicVarArrayNotEmpty) { zval *a, *_0; ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(a); array_init_size(a, 7); ZEPHIR_INIT_VAR(_0); ZVAL_LONG(_0, 1); zephir_array_fast_append(a, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_LONG(_0, 2); zephir_array_fast_append(a, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_LONG(_0, 3); zephir_array_fast_append(a, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_LONG(_0, 4); zephir_array_fast_append(a, _0); RETURN_MM_BOOL(ZEPHIR_IS_EMPTY(a)); }
/** * Removes a service from the services container using the array syntax */ PHP_METHOD(Phalcon_Di, offsetUnset) { zval *name_param = NULL; zval *name = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &name_param); if (unlikely(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(name_param) == IS_STRING)) { zephir_get_strval(name, name_param); } else { ZEPHIR_INIT_VAR(name); ZVAL_EMPTY_STRING(name); } RETURN_MM_BOOL(0); }
/** * Change the active tube. By default the tube is "default" */ PHP_METHOD(Phalcon_Queue_Beanstalk, watch) { zephir_nts_static zephir_fcall_cache_entry *_1 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *tube_param = NULL, *response = NULL, *_2, *_3; zval *tube = NULL, *_0; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &tube_param); if (unlikely(Z_TYPE_P(tube_param) != IS_STRING && Z_TYPE_P(tube_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tube' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(tube_param) == IS_STRING)) { zephir_get_strval(tube, tube_param); } else { ZEPHIR_INIT_VAR(tube); ZVAL_EMPTY_STRING(tube); } ZEPHIR_INIT_VAR(_0); ZEPHIR_CONCAT_SV(_0, "watch ", tube); ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, _0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", &_1); zephir_check_call_status(); zephir_array_fetch_long(&_2, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 193 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_2, "WATCHING")) { RETURN_MM_BOOL(0); } zephir_array_fetch_long(&_3, response, 1, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 197 TSRMLS_CC); RETURN_CTOR(_3); }
/** * Check whether is defined a translation key in the internal array */ PHP_METHOD(Phalcon_Translate_Adapter_NativeArray, exists) { zval *index_param = NULL, *_0; zval *index = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &index_param); if (unlikely(Z_TYPE_P(index_param) != IS_STRING && Z_TYPE_P(index_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'index' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(index_param) == IS_STRING)) { zephir_get_strval(index, index_param); } else { ZEPHIR_INIT_VAR(index); ZVAL_EMPTY_STRING(index); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_translate"), PH_NOISY_CC); RETURN_MM_BOOL(zephir_array_isset(_0, index)); }