本文整理汇总了C++中PHALCON_THROW_EXCEPTION_STRW函数的典型用法代码示例。如果您正苦于以下问题:C++ PHALCON_THROW_EXCEPTION_STRW函数的具体用法?C++ PHALCON_THROW_EXCEPTION_STRW怎么用?C++ PHALCON_THROW_EXCEPTION_STRW使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PHALCON_THROW_EXCEPTION_STRW函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: PHP_METHOD
/**
* Adds a resource to the annotations handler
* A resource is a class that contains routing annotations
* The class is located in a module
*
* @param string $module
* @param string $handler
* @param string $prefix
* @return Phalcon\Mvc\Router\Annotations
*/
PHP_METHOD(Phalcon_Mvc_Router_Annotations, addModuleResource){
zval *module, *handler, *prefix = NULL, *scope;
phalcon_fetch_params(0, 2, 1, &module, &handler, &prefix);
if (!prefix) {
prefix = PHALCON_GLOBAL(z_null);
}
if (Z_TYPE_P(module) != IS_STRING) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_mvc_router_exception_ce, "The module is not a valid string");
return;
}
if (Z_TYPE_P(handler) != IS_STRING) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_mvc_router_exception_ce, "The handler must be a class name");
return;
}
MAKE_STD_ZVAL(scope);
array_init_size(scope, 3);
phalcon_array_append(&scope, prefix, 0);
phalcon_array_append(&scope, handler, 0);
phalcon_array_append(&scope, module, 0);
phalcon_update_property_array_append(this_ptr, SL("_handlers"), scope TSRMLS_CC);
zval_ptr_dtor(&scope);
phalcon_update_property_this(this_ptr, SL("_processed"), PHALCON_GLOBAL(z_false) TSRMLS_CC);
RETURN_THISW();
}
开发者ID:9466,项目名称:cphalcon,代码行数:41,代码来源:annotations.c
示例2: PHP_METHOD
/**
* Changes a parameter in the definition without resolve the service
*
* @param long $position
* @param array $parameter
* @return Phalcon\DI\Service
*/
PHP_METHOD(Phalcon_DI_Service, setParameter){
zval *position, *parameter, definition = {}, arguments = {};
phalcon_fetch_params(0, 2, 0, &position, ¶meter);
PHALCON_ENSURE_IS_LONG(position);
phalcon_return_property(&definition, getThis(), SL("_definition"));
if (unlikely(Z_TYPE(definition) != IS_ARRAY)) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_di_exception_ce, "Definition must be an array to update its parameters");
return;
}
if (unlikely(Z_TYPE_P(parameter) != IS_ARRAY)) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_di_exception_ce, "The parameter must be an array");
return;
}
/* Update the parameter */
if (phalcon_array_isset_fetch_str(&arguments, &definition, SL("arguments"))) {
phalcon_array_update_zval(&arguments, position, parameter, PH_COPY);
} else {
array_init_size(&arguments, 1);
phalcon_array_update_zval(&arguments, position, parameter, PH_COPY);
}
phalcon_array_update_str(&definition, SL("arguments"), &arguments, PH_COPY);
phalcon_update_property_zval(getThis(), SL("_definition"), &definition);
RETURN_THISW();
}
开发者ID:dreamsxin,项目名称:cphalcon7,代码行数:40,代码来源:service.c
示例3: PHP_METHOD
/**
* Phalcon\Translate\Adapter\Gettext constructor
*
* @param array $options
* @throws \Phalcon\Translate\Exception
*/
PHP_METHOD(Phalcon_Translate_Adapter_Gettext, __construct){
zval *options, *locale, *default_domain, *directory, *setting, *key = NULL, *value = NULL;
HashTable *ah0;
HashPosition hp0;
zval **hd;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 0, &options);
if (Z_TYPE_P(options) != IS_ARRAY) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_translate_exception_ce, "Invalid options");
return;
}
if (!phalcon_array_isset_string_fetch(&locale, options, SS("locale"))) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_translate_exception_ce, "Parameter \"locale\" is required");
return;
}
if (!phalcon_array_isset_string_fetch(&default_domain, options, SS("defaultDomain"))) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_translate_exception_ce, "Parameter \"defaultDomain\" is required");
return;
}
if (!phalcon_array_isset_string_fetch(&directory, options, SS("directory"))) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_translate_exception_ce, "Parameter \"directory\" is required");
return;
}
phalcon_update_property_this(this_ptr, SL("_locale"), locale TSRMLS_CC);
phalcon_update_property_this(this_ptr, SL("_defaultDomain"), default_domain TSRMLS_CC);
phalcon_update_property_this(this_ptr, SL("_directory"), directory TSRMLS_CC);
PHALCON_INIT_VAR(setting);
PHALCON_CONCAT_SV(setting, "LC_ALL=", locale);
PHALCON_CALL_FUNCTION(NULL, "putenv", setting);
setlocale(LC_ALL, Z_STRVAL_P(locale));
if (Z_TYPE_P(directory) == IS_ARRAY) {
phalcon_is_iterable(directory, &ah0, &hp0, 0, 0);
while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) {
PHALCON_GET_HKEY(key, ah0, hp0);
PHALCON_GET_HVALUE(value);
bindtextdomain(Z_STRVAL_P(key), Z_STRVAL_P(value));
zend_hash_move_forward_ex(ah0, &hp0);
}
} else {
bindtextdomain(Z_STRVAL_P(default_domain), Z_STRVAL_P(directory));
}
textdomain(Z_STRVAL_P(default_domain));
PHALCON_MM_RESTORE();
}
开发者ID:9466,项目名称:cphalcon,代码行数:66,代码来源:gettext.c
示例4: PHP_METHOD
/**
* Phalcon\Paginator\Adapter\Sql
*
* @param array $config
*/
PHP_METHOD(Phalcon_Paginator_Adapter_Sql, __construct){
zval *config, db = {}, sql = {}, total_sql = {}, bind = {}, limit = {}, page = {};
long int i_limit;
phalcon_fetch_params(0, 1, 0, &config);
if (!phalcon_array_isset_fetch_str(&db, config, SL("db"))) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_paginator_exception_ce, "Parameter 'db' is required");
return;
}
if (!phalcon_array_isset_fetch_str(&sql, config, SL("sql"))) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_paginator_exception_ce, "Parameter 'sql' is required");
return;
}
if (!phalcon_array_isset_fetch_str(&total_sql, config, SL("total_sql"))) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_paginator_exception_ce, "Parameter 'sql' is required");
return;
}
if (phalcon_array_isset_fetch_str(&bind, config, SL("bind"))) {
if (Z_TYPE_P(&bind) != IS_ARRAY) {
phalcon_update_property_empty_array(getThis(), SL("_bind"));
} else {
phalcon_update_property_this(getThis(), SL("_bind"), &bind);
}
} else {
phalcon_update_property_empty_array(getThis(), SL("_bind"));
}
PHALCON_VERIFY_INTERFACE_EX(&db, phalcon_db_adapterinterface_ce, phalcon_paginator_exception_ce, 0);
phalcon_update_property_this(getThis(), SL("_db"), &db);
phalcon_update_property_this(getThis(), SL("_sql"), &sql);
phalcon_update_property_this(getThis(), SL("_total_sql"), &total_sql);
if (!phalcon_array_isset_fetch_str(&limit, config, SL("limit"))) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_paginator_exception_ce, "Parameter 'limit' is required");
return;
}
i_limit = phalcon_get_intval(&limit);
if (i_limit < 1) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_paginator_exception_ce, "'limit' should be positive");
return;
}
phalcon_update_property_this(getThis(), SL("_limitRows"), &limit);
if (phalcon_array_isset_fetch_str(&page, config, SL("page"))) {
phalcon_update_property_this(getThis(), SL("_page"), &page);
}
}
开发者ID:googlle,项目名称:cphalcon7,代码行数:60,代码来源:sql.c
示例5: PHP_METHOD
/**
* Phalcon\Logger\Adapter\Stream constructor
*
* @param string $name
* @param array $options
*/
PHP_METHOD(Phalcon_Logger_Adapter_Stream, __construct){
zval *name, *options = NULL, mode = {}, stream = {};
phalcon_fetch_params(0, 1, 1, &name, &options);
PHALCON_ENSURE_IS_STRING(name);
if (!options) {
options = &PHALCON_GLOBAL(z_null);
}
if (phalcon_array_isset_fetch_str(&mode, options, SL("mode"))) {
if (phalcon_memnstr_str(&mode, SL("r"))) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_logger_exception_ce, "Stream must be opened in append or write mode");
return;
}
} else {
ZVAL_STRING(&mode, "ab");
}
/**
* We use 'fopen' to respect to open-basedir directive
*/
PHALCON_CALL_FUNCTIONW(&stream, "fopen", name, &mode);
if (Z_TYPE(stream) != IS_RESOURCE) {
zend_throw_exception_ex(phalcon_logger_exception_ce, 0, "Cannot open stream '%s'", Z_STRVAL_P(name));
} else {
phalcon_update_property_this(getThis(), SL("_stream"), &stream);
}
}
开发者ID:googlle,项目名称:cphalcon7,代码行数:36,代码来源:stream.c
示例6: PHP_METHOD
/**
* Writes parsed annotations to files
*
* @param string $key
* @param Phalcon\Annotations\Reflection $data
*/
PHP_METHOD(Phalcon_Annotations_Adapter_Files, write){
zval *key, *data, annotations_dir = {}, virtual_key = {}, path = {}, php_export = {}, status = {};
smart_str exp = { 0 };
phalcon_fetch_params(0, 2, 0, &key, &data);
PHALCON_ENSURE_IS_STRING(key);
phalcon_return_property(&annotations_dir, getThis(), SL("_annotationsDir"));
/**
* Paths must be normalized before be used as keys
*/
phalcon_prepare_virtual_path_ex(&virtual_key, Z_STRVAL_P(key), Z_STRLEN_P(key), '_');
PHALCON_CONCAT_VVS(&path, &annotations_dir, &virtual_key, ".php");
smart_str_appends(&exp, "<?php return ");
php_var_export_ex(data, 0, &exp);
smart_str_appendc(&exp, ';');
smart_str_0(&exp);
ZVAL_STR(&php_export, exp.s);
phalcon_file_put_contents(&status, &path, &php_export);
if (PHALCON_IS_FALSE(&status)) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_annotations_exception_ce, "Annotations directory cannot be written");
return;
}
}
开发者ID:dreamsxin,项目名称:cphalcon7,代码行数:36,代码来源:files.c
示例7: PHP_METHOD
/**
* Gets a param by its name or numeric index
*
* @param mixed $param
* @param string|array $filters
* @param mixed $defaultValue
* @return mixed
*/
PHP_METHOD(Phalcon_Http_Request, getParam){
zval *param, *filters = NULL, *default_value = NULL, dependency_injector = {}, service = {}, dispatcher = {};
phalcon_fetch_params(0, 1, 2, ¶m, &filters, &default_value);
if (!filters) {
filters = &PHALCON_GLOBAL(z_null);
}
if (!default_value) {
default_value = &PHALCON_GLOBAL(z_null);
}
PHALCON_CALL_METHODW(&dependency_injector, getThis(), "getdi");
if (Z_TYPE(dependency_injector) != IS_OBJECT) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_http_request_exception_ce, "A dependency injection object is required to access the 'filter' service");
return;
}
PHALCON_STR(&service, ISV(dispatcher));
PHALCON_CALL_METHODW(&dispatcher, &dependency_injector, "getshared", &service);
PHALCON_CALL_METHODW(NULL, &dispatcher, "getparam", param, filters, default_value);
}
开发者ID:dreamsxin,项目名称:cphalcon7,代码行数:34,代码来源:request.c
示例8: PHP_METHOD
/**
* Phalcon\Mvc\Model\Transaction constructor
*
* @param Phalcon\DIInterface $dependencyInjector
* @param boolean $autoBegin
* @param string $service
*/
PHP_METHOD(Phalcon_Mvc_Model_Transaction, __construct){
zval *dependency_injector, *auto_begin = NULL, *s = NULL, service = {}, connection = {};
phalcon_fetch_params(0, 1, 2, &dependency_injector, &auto_begin, &service);
if (!auto_begin) {
auto_begin = &PHALCON_GLOBAL(z_false);
}
if (!s || Z_TYPE_P(s) != IS_STRING) {
ZVAL_STRING(&service, "db");
} else {
PHALCON_CPY_WRT(&service, s);
}
if (Z_TYPE_P(dependency_injector) != IS_OBJECT) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_mvc_model_transaction_exception_ce, "A dependency injector container is required to obtain the services related to the ORM");
return;
}
PHALCON_CALL_METHODW(&connection, dependency_injector, "get", &service);
phalcon_update_property_zval(getThis(), SL("_connection"), &connection);
if (zend_is_true(auto_begin)) {
PHALCON_CALL_METHODW(NULL, &connection, "begin");
}
}
开发者ID:dreamsxin,项目名称:cphalcon7,代码行数:35,代码来源:transaction.c
示例9: PHP_METHOD
/**
* Sets values
*
* @param array $arrayConfig
*/
PHP_METHOD(Phalcon_Config, val){
zval *array_config, *value;
zend_string *str_key;
ulong idx;
phalcon_fetch_params(0, 1, 0, &array_config);
/**
* Throw exceptions if bad parameters are passed
*/
if (Z_TYPE_P(array_config) != IS_ARRAY) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_config_exception_ce, "The configuration must be an Array");
return;
}
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(array_config), idx, str_key, value) {
zval key;
if (str_key) {
ZVAL_STR(&key, str_key);
} else {
ZVAL_LONG(&key, idx);
}
PHALCON_CALL_SELFW(NULL, "offsetset", &key, value);
} ZEND_HASH_FOREACH_END();
开发者ID:Myleft,项目名称:cphalcon7,代码行数:30,代码来源:config.c
示例10: PHP_METHOD
/**
* Creates a form registering it in the forms manager
*
* @param string $name
* @param object $entity
* @return Phalcon\Forms\Form
*/
PHP_METHOD(Phalcon_Forms_Manager, create){
zval *name = NULL, *entity = NULL, form = {};
phalcon_fetch_params(0, 0, 2, &name, &entity);
if (!name) {
name = &PHALCON_GLOBAL(z_null);
}
if (!entity) {
entity = &PHALCON_GLOBAL(z_null);
}
if (Z_TYPE_P(name) != IS_STRING) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_forms_exception_ce, "The form name must be string");
return;
}
object_init_ex(&form, phalcon_forms_form_ce);
PHALCON_CALL_METHODW(NULL, &form, "__construct", entity);
phalcon_update_property_array(getThis(), SL("_forms"), name, &form);
RETURN_CTORW(&form);
}
开发者ID:googlle,项目名称:cphalcon7,代码行数:33,代码来源:manager.c
示例11: PHP_METHOD
/**
* Draws a polygon
*
*<code>
* $coordinates = array( array( 'x' => 4, 'y' => 6 ), array( 'x' => 8, 'y' => 10 ) );
* $image->polygon($coordinates);
*</code>
*
* @param array $coordinates array of x and y
* @param string $color
* @return Phalcon\Image\Adapter\GD
*/
PHP_METHOD(Phalcon_Image_Adapter_GD, polygon){
zval *coordinates, *color = NULL, image = {}, rgb = {}, r = {}, g = {}, b = {}, imagecolor = {}, *point, points = {}, num_points = {};
phalcon_fetch_params(0, 1, 1, &coordinates, &color);
if (!color) {
color = &PHALCON_GLOBAL(z_null);
}
if (!phalcon_fast_count_ev(coordinates)) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_image_exception_ce, "Coordinates must be not empty");
return;
}
phalcon_return_property(&image, getThis(), SL("_image"));
if (Z_TYPE(image) == IS_RESOURCE) {
PHALCON_CALL_METHODW(&rgb, getThis(), "getcolorrbg", color);
phalcon_array_fetch_long(&r, &rgb, 0, PH_NOISY);
phalcon_array_fetch_long(&g, &rgb, 1, PH_NOISY);
phalcon_array_fetch_long(&b, &rgb, 2, PH_NOISY);
PHALCON_CALL_FUNCTIONW(&imagecolor, "imagecolorallocate", &image, &r, &g, &b);
array_init(&points);
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(coordinates), point) {
zval x = {}, y = {};
if (Z_TYPE_P(point) == IS_ARRAY) {
if (phalcon_fast_count_int(point) != 2) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_image_exception_ce, "Coordinates point error");
return;
}
if (!phalcon_array_isset_fetch_long(&x, point, 0)) {
phalcon_array_fetch_str(&x, point, SL("x"), PH_NOISY);
}
if (!phalcon_array_isset_fetch_long(&y, point, 0)) {
phalcon_array_fetch_str(&y, point, SL("y"), PH_NOISY);
}
phalcon_array_append(&points, &x, PH_COPY);
phalcon_array_append(&points, &y, PH_COPY);
} else {
phalcon_array_append(&points, &_p->val, PH_COPY);
_p++;
phalcon_array_append(&points, &_p->val, PH_COPY);
}
phalcon_increment(&num_points);
} ZEND_HASH_FOREACH_END();
开发者ID:dreamsxin,项目名称:cphalcon7,代码行数:59,代码来源:gd.c
示例12: PHP_METHOD
/**
* Rows cannot be changed. It has only been implemented to meet the definition of the ArrayAccess interface
*
* @param int $offset
*/
PHP_METHOD(Phalcon_Mvc_Model_Row, offsetUnset) {
zval *offset;
phalcon_fetch_params(0, 1, 0, &offset);
PHALCON_THROW_EXCEPTION_STRW(phalcon_mvc_model_exception_ce, "The index does not exist in the row");
}
开发者ID:dreamsxin,项目名称:cphalcon7,代码行数:13,代码来源:row.c
示例13: PHP_METHOD
/**
* Generates SQL to create a table in PostgreSQL
*
* @param string $tableName
* @param string $schemaName
* @param array $definition
* @return string
*/
PHP_METHOD(Phalcon_Db_Dialect_Oracle, createTable){
zval *table_name, *schema_name, *definition;
phalcon_fetch_params(0, 3, 0, &table_name, &schema_name, &definition);
PHALCON_THROW_EXCEPTION_STRW(phalcon_db_exception_ce, "Not implemented yet");
return;
}
开发者ID:100851766,项目名称:cphalcon,代码行数:17,代码来源:oracle.c
示例14: PHP_METHOD
/**
* Resulsets cannot be changed. It has only been implemented to meet the definition of the ArrayAccess interface
*
* @param int $offset
*/
PHP_METHOD(Phalcon_Mvc_Model_Resultset, offsetUnset){
zval *offset;
phalcon_fetch_params(0, 1, 0, &offset);
PHALCON_THROW_EXCEPTION_STRW(phalcon_mvc_model_exception_ce, "Cursor is an immutable ArrayAccess object");
return;
}
开发者ID:RSivakov,项目名称:cphalcon,代码行数:14,代码来源:resultset.c
示例15: PHP_METHOD
/**
* Rows cannot be changed. It has only been implemented to meet the definition of the ArrayAccess interface
*
* @param string $offset
*/
PHP_METHOD(Phalcon_Mvc_Collection_Document, offsetUnset){
zval *offset;
phalcon_fetch_params(0, 1, 0, &offset);
PHALCON_THROW_EXCEPTION_STRW(phalcon_mvc_collection_exception_ce, "The index does not exist in the row");
return;
}
开发者ID:Myleft,项目名称:cphalcon7,代码行数:14,代码来源:document.c
示例16: PHP_METHOD
/**
* Registers a form in the Forms Manager
*
* @param string $name
* @param Phalcon\Forms\Form $form
* @return Phalcon\Forms\Form
*/
PHP_METHOD(Phalcon_Forms_Manager, set){
zval *name, *form;
phalcon_fetch_params(0, 2, 0, &name, &form);
if (Z_TYPE_P(name) != IS_STRING) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_forms_exception_ce, "The form name must be string");
return;
}
if (Z_TYPE_P(form) != IS_OBJECT) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_forms_exception_ce, "The form is not valid");
return;
}
phalcon_update_property_array(this_ptr, SL("_forms"), name, form TSRMLS_CC);
RETURN_THISW();
}
开发者ID:RSivakov,项目名称:cphalcon,代码行数:26,代码来源:manager.c
示例17: PHP_METHOD
/**
* Returns a collection by its id
*
*<code>
* $scripts = $assets->get('js');
*</code>
*
* @param string $id
* @return Phalcon\Assets\Collection
*/
PHP_METHOD(Phalcon_Assets_Manager, get){
zval *id, *collections, *collection;
phalcon_fetch_params(0, 1, 0, &id);
if (unlikely(Z_TYPE_P(id) != IS_STRING)) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_assets_exception_ce, "Collection-Id must be a string");
return;
}
collections = phalcon_fetch_nproperty_this(this_ptr, SL("_collections"), PH_NOISY TSRMLS_CC);
if (!phalcon_array_isset_fetch(&collection, collections, id)) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_assets_exception_ce, "The collection does not exist in the manager");
return;
}
RETURN_ZVAL(collection, 1, 0);
}
开发者ID:Myleft,项目名称:cphalcon,代码行数:29,代码来源:manager.c
示例18: PHP_METHOD
/**
* Sets a service using a raw Phalcon\DI\Service definition
*
* @param string $name
* @param Phalcon\DI\ServiceInterface $rawDefinition
* @return Phalcon\DI\ServiceInterface
*/
PHP_METHOD(Phalcon_DI, setRaw){
zval *name, *raw_definition;
phalcon_fetch_params(0, 2, 0, &name, &raw_definition);
if (Z_TYPE_P(name) != IS_STRING) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_di_exception_ce, "The service name must be a string");
return;
}
if (Z_TYPE_P(raw_definition) != IS_OBJECT) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_di_exception_ce, "The service definition must be an object");
return;
}
phalcon_update_property_array(this_ptr, SL("_services"), name, raw_definition TSRMLS_CC);
RETURN_CCTORW(raw_definition);
}
开发者ID:11mariom,项目名称:cphalcon,代码行数:26,代码来源:di.c
示例19: PHP_METHOD
/**
* Stops the event preventing propagation
*/
PHP_METHOD(Phalcon_Events_Event, stop){
zval *cancelable;
cancelable = phalcon_fetch_nproperty_this(this_ptr, SL("_cancelable"), PH_NOISY TSRMLS_CC);
if (zend_is_true(cancelable)) {
phalcon_update_property_bool(this_ptr, SL("_stopped"), 1 TSRMLS_CC);
} else {
PHALCON_THROW_EXCEPTION_STRW(phalcon_events_exception_ce, "Trying to cancel a non-cancelable event");
return;
}
}
开发者ID:100851766,项目名称:cphalcon,代码行数:15,代码来源:event.c
示例20: PHP_METHOD
/**
* Phalcon\Binary\Writer constructor
*
* @param string|resource $data
* @param int $endian
* @throws \InvalidArgumentException
*/
PHP_METHOD(Phalcon_Binary_Writer, __construct){
zval *data = NULL, *endian = NULL, filename = {}, mode = {}, handler = {}, fstat = {}, size = {};
phalcon_fetch_params(0, 0, 2, &data, &endian);
if (!data) {
data = &PHALCON_GLOBAL(z_null);
}
if (Z_TYPE_P(data) == IS_STRING || Z_TYPE_P(data) == IS_NULL) {
ZVAL_STRING(&filename, "php://memory");
ZVAL_STRING(&mode, "br+");
PHALCON_CALL_FUNCTIONW(&handler, "fopen", &filename, &mode);
PHALCON_CALL_FUNCTIONW(NULL, "fwrite", &handler, data);
PHALCON_CALL_FUNCTIONW(&fstat, "fstat", &handler);
if (phalcon_array_isset_fetch_str(&size, &fstat, SL("size"))) {
phalcon_update_property_zval(getThis(), SL("_position"), &size);
}
phalcon_update_property_zval(getThis(), SL("_output"), &handler);
} else if (Z_TYPE_P(data) == IS_RESOURCE) {
phalcon_update_property_zval(getThis(), SL("_output"), data);
PHALCON_CALL_FUNCTIONW(&fstat, "fstat", data);
if (phalcon_array_isset_fetch_str(&size, &fstat, SL("size"))) {
phalcon_update_property_zval(getThis(), SL("_position"), &size);
}
} else {
PHALCON_THROW_EXCEPTION_STRW(phalcon_binary_exception_ce, "Data must be set as string or resource");
return;
}
if (endian && Z_TYPE_P(endian) != IS_NULL) {
if (Z_TYPE_P(endian) != IS_LONG || Z_LVAL_P(endian) < 0 || Z_LVAL_P(endian) > 2) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_binary_exception_ce, "Endian must be set as big or little");
}
phalcon_update_property_zval(getThis(), SL("_endian"), endian);
}
}
开发者ID:dreamsxin,项目名称:cphalcon7,代码行数:47,代码来源:writer.c
注:本文中的PHALCON_THROW_EXCEPTION_STRW函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论