/** * Destroys the active session * *<code> * var_dump($session->destroy()); * var_dump($session->destroy(true)); *</code> */ PHP_METHOD(Phalcon_Session_Adapter, destroy) { HashTable *_2$$4; HashPosition _1$$4; int ZEPHIR_LAST_CALL_STATUS; zval *removeData_param = NULL, *_SESSION = NULL, *uniqueId = NULL, *key = NULL, *_0$$4 = NULL, **_3$$4, *_4$$5 = NULL; zend_bool removeData; ZEPHIR_MM_GROW(); zephir_get_global(&_SESSION, SS("_SESSION") TSRMLS_CC); zephir_fetch_params(1, 0, 1, &removeData_param); if (!removeData_param) { removeData = 0; } else { removeData = zephir_get_boolval(removeData_param); } if (removeData) { ZEPHIR_OBS_VAR(uniqueId); zephir_read_property_this(&uniqueId, this_ptr, SL("_uniqueId"), PH_NOISY_CC); if (!(ZEPHIR_IS_EMPTY(uniqueId))) { ZEPHIR_INIT_VAR(_0$$4); zephir_is_iterable(_SESSION, &_2$$4, &_1$$4, 1, 0, "phalcon/session/adapter.zep", 262); for ( ; zephir_hash_get_current_data_ex(_2$$4, (void**) &_3$$4, &_1$$4) == SUCCESS ; zephir_hash_move_forward_ex(_2$$4, &_1$$4) ) { ZEPHIR_GET_HMKEY(key, _2$$4, _1$$4); ZEPHIR_GET_HVALUE(_0$$4, _3$$4); ZEPHIR_INIT_LNVAR(_4$$5); ZEPHIR_CONCAT_VS(_4$$5, uniqueId, "#"); if (zephir_start_with(key, _4$$5, NULL)) { zephir_array_unset(&_SESSION, key, PH_SEPARATE); } } zend_hash_destroy(_2$$4); FREE_HASHTABLE(_2$$4); } else { ZEPHIR_INIT_NVAR(_SESSION); array_init(_SESSION); } } if (0) { zephir_update_property_this(this_ptr, SL("_started"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); } else { zephir_update_property_this(this_ptr, SL("_started"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); } ZEPHIR_RETURN_CALL_FUNCTION("session_destroy", NULL, 32); zephir_check_call_status(); RETURN_MM(); }
/** * Check if a string starts with a given string * * <code> * echo Phalcon\Text::startsWith("Hello", "He"); // true * echo Phalcon\Text::startsWith("Hello", "he", false); // false * echo Phalcon\Text::startsWith("Hello", "he"); // true * </code> */ PHP_METHOD(Phalcon_Text, startsWith) { zend_bool ignoreCase; zval *str_param = NULL, *start_param = NULL, *ignoreCase_param = NULL; zval *str = NULL, *start = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 1, &str_param, &start_param, &ignoreCase_param); zephir_get_strval(str, str_param); zephir_get_strval(start, start_param); if (!ignoreCase_param) { ignoreCase = 1; } else { ignoreCase = zephir_get_boolval(ignoreCase_param); } RETURN_MM_BOOL(zephir_start_with(str, start, (ignoreCase ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false)))); }
/** * Check if a string starts with a given string * * <code> * echo Phalcon\Text::startsWith("Hello", "He"); // true * echo Phalcon\Text::startsWith("Hello", "he", false); // false * echo Phalcon\Text::startsWith("Hello", "he"); // true * </code> */ PHP_METHOD(Phalcon_Text, startsWith) { zend_bool ignoreCase; zval *str_param = NULL, *start_param = NULL, *ignoreCase_param = NULL, _0; zval *str = NULL, *start = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 1, &str_param, &start_param, &ignoreCase_param); zephir_get_strval(str, str_param); zephir_get_strval(start, start_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_start_with(str, start, &_0)); }
/** * Produce the routing parameters from the rewrite information */ PHP_METHOD(Phalcon_Mvc_Router_Annotations, handle) { zephir_fcall_cache_entry *_9 = NULL, *_17 = NULL, *_18 = NULL; HashTable *_2, *_7, *_11, *_15; HashPosition _1, _6, _10, _14; int ZEPHIR_LAST_CALL_STATUS; zval *uri_param = NULL, *realUri = NULL, *annotationsService = NULL, *handlers, *controllerSuffix, *scope = NULL, *prefix = NULL, *dependencyInjector = NULL, *handler = NULL, *controllerName = NULL, *lowerControllerName = NULL, *namespaceName = NULL, *moduleName = NULL, *sufixed = NULL, *handlerAnnotations = NULL, *classAnnotations = NULL, *annotations = NULL, *annotation = NULL, *methodAnnotations = NULL, *lowercased = NULL, *method = NULL, *collection = NULL, *_0, **_3, *_4, *_5 = NULL, **_8, **_12, *_13 = NULL, **_16; zval *uri = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, &uri_param); if (!uri_param) { ZEPHIR_INIT_VAR(uri); ZVAL_EMPTY_STRING(uri); } else { if (unlikely(Z_TYPE_P(uri_param) != IS_STRING && Z_TYPE_P(uri_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'uri' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(uri_param) == IS_STRING)) { zephir_get_strval(uri, uri_param); } else { ZEPHIR_INIT_VAR(uri); ZVAL_EMPTY_STRING(uri); } } if (!(!(!uri) && Z_STRLEN_P(uri))) { ZEPHIR_CALL_METHOD(&realUri, this_ptr, "getrewriteuri", NULL, 0); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(realUri, uri); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_processed"), PH_NOISY_CC); if (!(zephir_is_true(_0))) { ZEPHIR_INIT_VAR(annotationsService); ZVAL_NULL(annotationsService); ZEPHIR_OBS_VAR(handlers); zephir_read_property_this(&handlers, this_ptr, SL("_handlers"), PH_NOISY_CC); if (Z_TYPE_P(handlers) == IS_ARRAY) { ZEPHIR_OBS_VAR(controllerSuffix); zephir_read_property_this(&controllerSuffix, this_ptr, SL("_controllerSuffix"), PH_NOISY_CC); zephir_is_iterable(handlers, &_2, &_1, 0, 0, "phalcon/mvc/router/annotations.zep", 208); for ( ; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS ; zephir_hash_move_forward_ex(_2, &_1) ) { ZEPHIR_GET_HVALUE(scope, _3); if (Z_TYPE_P(scope) == IS_ARRAY) { ZEPHIR_OBS_NVAR(prefix); zephir_array_fetch_long(&prefix, scope, 0, PH_NOISY, "phalcon/mvc/router/annotations.zep", 117 TSRMLS_CC); if (!(ZEPHIR_IS_EMPTY(prefix))) { if (!(zephir_start_with(realUri, prefix, NULL))) { continue; } } if (Z_TYPE_P(annotationsService) != IS_OBJECT) { _4 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); ZEPHIR_CPY_WRT(dependencyInjector, _4); if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_router_exception_ce, "A dependency injection container is required to access the 'annotations' service", "phalcon/mvc/router/annotations.zep", 129); return; } ZEPHIR_INIT_NVAR(_5); ZVAL_STRING(_5, "annotations", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&annotationsService, dependencyInjector, "getshared", NULL, 0, _5); zephir_check_temp_parameter(_5); zephir_check_call_status(); } ZEPHIR_OBS_NVAR(handler); zephir_array_fetch_long(&handler, scope, 1, PH_NOISY, "phalcon/mvc/router/annotations.zep", 138 TSRMLS_CC); if (zephir_memnstr_str(handler, SL("\\"), "phalcon/mvc/router/annotations.zep", 140)) { ZEPHIR_INIT_NVAR(controllerName); zephir_get_class_ns(controllerName, handler, 0 TSRMLS_CC); ZEPHIR_INIT_NVAR(lowerControllerName); zephir_uncamelize(lowerControllerName, controllerName); ZEPHIR_INIT_NVAR(namespaceName); zephir_get_ns_class(namespaceName, handler, 0 TSRMLS_CC); } else { ZEPHIR_CPY_WRT(controllerName, handler); ZEPHIR_INIT_NVAR(lowerControllerName); zephir_uncamelize(lowerControllerName, controllerName); ZEPHIR_INIT_NVAR(namespaceName); ZVAL_NULL(namespaceName); } zephir_update_property_this(this_ptr, SL("_routePrefix"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC); ZEPHIR_OBS_NVAR(moduleName); zephir_array_isset_long_fetch(&moduleName, scope, 2, 0 TSRMLS_CC); ZEPHIR_INIT_NVAR(sufixed); ZEPHIR_CONCAT_VV(sufixed, handler, controllerSuffix); ZEPHIR_CALL_METHOD(&handlerAnnotations, annotationsService, "get", NULL, 0, sufixed); zephir_check_call_status(); if (Z_TYPE_P(handlerAnnotations) == IS_OBJECT) { ZEPHIR_CALL_METHOD(&classAnnotations, handlerAnnotations, "getclassannotations", NULL, 0); zephir_check_call_status(); if (Z_TYPE_P(classAnnotations) == IS_OBJECT) { ZEPHIR_CALL_METHOD(&annotations, classAnnotations, "getannotations", NULL, 0); zephir_check_call_status(); if (Z_TYPE_P(annotations) == IS_ARRAY) { zephir_is_iterable(annotations, &_7, &_6, 0, 0, "phalcon/mvc/router/annotations.zep", 187); for ( ; zephir_hash_get_current_data_ex(_7, (void**) &_8, &_6) == SUCCESS ; zephir_hash_move_forward_ex(_7, &_6) ) { ZEPHIR_GET_HVALUE(annotation, _8); ZEPHIR_CALL_METHOD(NULL, this_ptr, "processcontrollerannotation", &_9, 0, controllerName, annotation); zephir_check_call_status(); } } } ZEPHIR_CALL_METHOD(&methodAnnotations, handlerAnnotations, "getmethodsannotations", NULL, 0); zephir_check_call_status(); if (Z_TYPE_P(methodAnnotations) == IS_ARRAY) { ZEPHIR_INIT_NVAR(lowercased); zephir_uncamelize(lowercased, handler); zephir_is_iterable(methodAnnotations, &_11, &_10, 0, 0, "phalcon/mvc/router/annotations.zep", 203); for ( ; zephir_hash_get_current_data_ex(_11, (void**) &_12, &_10) == SUCCESS ; zephir_hash_move_forward_ex(_11, &_10) ) { ZEPHIR_GET_HMKEY(method, _11, _10); ZEPHIR_GET_HVALUE(collection, _12); if (Z_TYPE_P(collection) == IS_OBJECT) { ZEPHIR_CALL_METHOD(&_13, collection, "getannotations", NULL, 0); zephir_check_call_status(); zephir_is_iterable(_13, &_15, &_14, 0, 0, "phalcon/mvc/router/annotations.zep", 201); for ( ; zephir_hash_get_current_data_ex(_15, (void**) &_16, &_14) == SUCCESS ; zephir_hash_move_forward_ex(_15, &_14) ) { ZEPHIR_GET_HVALUE(annotation, _16); ZEPHIR_CALL_METHOD(NULL, this_ptr, "processactionannotation", &_17, 0, moduleName, namespaceName, lowerControllerName, method, annotation); zephir_check_call_status(); } } } } } } } } if (1) { zephir_update_property_this(this_ptr, SL("_processed"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); } else { zephir_update_property_this(this_ptr, SL("_processed"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); } } ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_router_annotations_ce, this_ptr, "handle", &_18, 361, realUri); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); }
/** * Produce the routing parameters from the rewrite information */ PHP_METHOD(Phalcon_Mvc_Router_Annotations, handle) { zend_bool _5$$6; HashTable *_3, *_9$$14, *_13$$16, *_17$$18; HashPosition _2, _8$$14, _12$$16, _16$$18; zephir_fcall_cache_entry *_7 = NULL, *_11 = NULL, *_19 = NULL, *_20 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *uri_param = NULL, *realUri = NULL, *annotationsService = NULL, *handlers = NULL, *controllerSuffix = NULL, *scope = NULL, *prefix = NULL, *dependencyInjector = NULL, *handler = NULL, *controllerName = NULL, *lowerControllerName = NULL, *namespaceName = NULL, *moduleName = NULL, *sufixed = NULL, *handlerAnnotations = NULL, *classAnnotations = NULL, *annotations = NULL, *annotation = NULL, *methodAnnotations = NULL, *method = NULL, *collection = NULL, *_0, *_1, **_4, *_6$$11 = NULL, **_10$$14, **_14$$16, *_15$$18 = NULL, **_18$$18; zval *uri = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, &uri_param); if (!uri_param) { ZEPHIR_INIT_VAR(uri); ZVAL_EMPTY_STRING(uri); } else { if (UNEXPECTED(Z_TYPE_P(uri_param) != IS_STRING && Z_TYPE_P(uri_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'uri' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (EXPECTED(Z_TYPE_P(uri_param) == IS_STRING)) { zephir_get_strval(uri, uri_param); } else { ZEPHIR_INIT_VAR(uri); ZVAL_EMPTY_STRING(uri); } } if (!(!(!uri) && Z_STRLEN_P(uri))) { ZEPHIR_CALL_METHOD(&realUri, this_ptr, "getrewriteuri", NULL, 0); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(realUri, uri); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); ZEPHIR_CPY_WRT(dependencyInjector, _0); if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_router_exception_ce, "A dependency injection container is required to access the 'annotations' service", "phalcon/mvc/router/annotations.zep", 104); return; } ZEPHIR_INIT_VAR(_1); ZVAL_STRING(_1, "annotations", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&annotationsService, dependencyInjector, "getshared", NULL, 0, _1); zephir_check_temp_parameter(_1); zephir_check_call_status(); ZEPHIR_OBS_VAR(handlers); zephir_read_property_this(&handlers, this_ptr, SL("_handlers"), PH_NOISY_CC); ZEPHIR_OBS_VAR(controllerSuffix); zephir_read_property_this(&controllerSuffix, this_ptr, SL("_controllerSuffix"), PH_NOISY_CC); zephir_is_iterable(handlers, &_3, &_2, 0, 0, "phalcon/mvc/router/annotations.zep", 205); for ( ; zend_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS ; zend_hash_move_forward_ex(_3, &_2) ) { ZEPHIR_GET_HVALUE(scope, _4); if (Z_TYPE_P(scope) != IS_ARRAY) { continue; } ZEPHIR_OBS_NVAR(prefix); zephir_array_fetch_long(&prefix, scope, 0, PH_NOISY, "phalcon/mvc/router/annotations.zep", 122 TSRMLS_CC); _5$$6 = !(ZEPHIR_IS_EMPTY(prefix)); if (_5$$6) { _5$$6 = !(zephir_start_with(realUri, prefix, NULL)); } if (_5$$6) { continue; } ZEPHIR_OBS_NVAR(handler); zephir_array_fetch_long(&handler, scope, 1, PH_NOISY, "phalcon/mvc/router/annotations.zep", 131 TSRMLS_CC); if (zephir_memnstr_str(handler, SL("\\"), "phalcon/mvc/router/annotations.zep", 133)) { ZEPHIR_INIT_NVAR(controllerName); zephir_get_class_ns(controllerName, handler, 0 TSRMLS_CC); ZEPHIR_INIT_NVAR(namespaceName); zephir_get_ns_class(namespaceName, handler, 0 TSRMLS_CC); } else { ZEPHIR_CPY_WRT(controllerName, handler); ZEPHIR_OBS_NVAR(namespaceName); zephir_fetch_property(&namespaceName, this_ptr, SL("_defaultNamespace"), PH_SILENT_CC); } zephir_update_property_this(getThis(), SL("_routePrefix"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC); ZEPHIR_OBS_NVAR(moduleName); zephir_array_isset_long_fetch(&moduleName, scope, 2, 0 TSRMLS_CC); ZEPHIR_INIT_NVAR(sufixed); ZEPHIR_CONCAT_VV(sufixed, controllerName, controllerSuffix); if (Z_TYPE_P(namespaceName) != IS_NULL) { ZEPHIR_INIT_LNVAR(_6$$11); ZEPHIR_CONCAT_VSV(_6$$11, namespaceName, "\\", sufixed); ZEPHIR_CPY_WRT(sufixed, _6$$11); } ZEPHIR_CALL_METHOD(&handlerAnnotations, annotationsService, "get", &_7, 0, sufixed); zephir_check_call_status(); if (Z_TYPE_P(handlerAnnotations) != IS_OBJECT) { continue; } ZEPHIR_CALL_METHOD(&classAnnotations, handlerAnnotations, "getclassannotations", NULL, 0); zephir_check_call_status(); if (Z_TYPE_P(classAnnotations) == IS_OBJECT) { ZEPHIR_CALL_METHOD(&annotations, classAnnotations, "getannotations", NULL, 0); zephir_check_call_status(); if (Z_TYPE_P(annotations) == IS_ARRAY) { zephir_is_iterable(annotations, &_9$$14, &_8$$14, 0, 0, "phalcon/mvc/router/annotations.zep", 182); for ( ; zend_hash_get_current_data_ex(_9$$14, (void**) &_10$$14, &_8$$14) == SUCCESS ; zend_hash_move_forward_ex(_9$$14, &_8$$14) ) { ZEPHIR_GET_HVALUE(annotation, _10$$14); ZEPHIR_CALL_METHOD(NULL, this_ptr, "processcontrollerannotation", &_11, 0, controllerName, annotation); zephir_check_call_status(); } } } ZEPHIR_CALL_METHOD(&methodAnnotations, handlerAnnotations, "getmethodsannotations", NULL, 0); zephir_check_call_status(); if (Z_TYPE_P(methodAnnotations) == IS_ARRAY) { ZEPHIR_INIT_NVAR(lowerControllerName); zephir_uncamelize(lowerControllerName, controllerName, NULL ); zephir_is_iterable(methodAnnotations, &_13$$16, &_12$$16, 0, 0, "phalcon/mvc/router/annotations.zep", 199); for ( ; zend_hash_get_current_data_ex(_13$$16, (void**) &_14$$16, &_12$$16) == SUCCESS ; zend_hash_move_forward_ex(_13$$16, &_12$$16) ) { ZEPHIR_GET_HMKEY(method, _13$$16, _12$$16); ZEPHIR_GET_HVALUE(collection, _14$$16); if (Z_TYPE_P(collection) == IS_OBJECT) { ZEPHIR_CALL_METHOD(&_15$$18, collection, "getannotations", NULL, 0); zephir_check_call_status(); zephir_is_iterable(_15$$18, &_17$$18, &_16$$18, 0, 0, "phalcon/mvc/router/annotations.zep", 197); for ( ; zend_hash_get_current_data_ex(_17$$18, (void**) &_18$$18, &_16$$18) == SUCCESS ; zend_hash_move_forward_ex(_17$$18, &_16$$18) ) { ZEPHIR_GET_HVALUE(annotation, _18$$18); ZEPHIR_CALL_METHOD(NULL, this_ptr, "processactionannotation", &_19, 0, moduleName, namespaceName, lowerControllerName, method, annotation); zephir_check_call_status(); } } } } } ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_router_annotations_ce, getThis(), "handle", &_20, 392, realUri); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); }
/** * Autoloads the registered classes */ PHP_METHOD(Phalcon_Loader, autoLoad) { zephir_fcall_cache_entry *_10 = NULL, *_12 = NULL, *_13 = NULL, *_23 = NULL, *_24 = NULL, *_31 = NULL, *_32 = NULL; HashTable *_2, *_7, *_15, *_21, *_26, *_29; HashPosition _1, _6, _14, _20, _25, _28; int ZEPHIR_LAST_CALL_STATUS; zval *className_param = NULL, *eventsManager, *classes, *extensions, *filePath = NULL, *ds, *fixedDirectory = NULL, *prefixes, *directories, *namespaceSeparator, *namespaces, *nsPrefix = NULL, *directory = NULL, *fileName = NULL, *extension = NULL, *prefix = NULL, *dsClassName, *nsClassName, *_0 = NULL, **_3, *_4 = NULL, _5 = zval_used_for_init, **_8, *_9 = NULL, *_11 = NULL, **_16, *_17 = NULL, _18 = zval_used_for_init, _19 = zval_used_for_init, **_22, **_27, **_30; zval *className = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &className_param); if (unlikely(Z_TYPE_P(className_param) != IS_STRING && Z_TYPE_P(className_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'className' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(className_param) == IS_STRING)) { zephir_get_strval(className, className_param); } else { ZEPHIR_INIT_VAR(className); ZVAL_EMPTY_STRING(className); } ZEPHIR_OBS_VAR(eventsManager); zephir_read_property_this(&eventsManager, this_ptr, SL("_eventsManager"), PH_NOISY_CC); if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_VAR(_0); ZVAL_STRING(_0, "loader:beforeCheckClass", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", NULL, 0, _0, this_ptr, className); zephir_check_temp_parameter(_0); zephir_check_call_status(); } ZEPHIR_OBS_VAR(classes); zephir_read_property_this(&classes, this_ptr, SL("_classes"), PH_NOISY_CC); if (Z_TYPE_P(classes) == IS_ARRAY) { ZEPHIR_OBS_VAR(filePath); if (zephir_array_isset_fetch(&filePath, classes, className, 0 TSRMLS_CC)) { if (Z_TYPE_P(eventsManager) == IS_OBJECT) { zephir_update_property_this(this_ptr, SL("_foundPath"), filePath TSRMLS_CC); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "loader:pathFound", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", NULL, 0, _0, this_ptr, filePath); zephir_check_temp_parameter(_0); zephir_check_call_status(); } if (zephir_require_zval(filePath TSRMLS_CC) == FAILURE) { RETURN_MM_NULL(); } RETURN_MM_BOOL(1); } } ZEPHIR_OBS_VAR(extensions); zephir_read_property_this(&extensions, this_ptr, SL("_extensions"), PH_NOISY_CC); ZEPHIR_INIT_VAR(ds); ZVAL_STRING(ds, "/", 1); ZEPHIR_INIT_VAR(namespaceSeparator); ZVAL_STRING(namespaceSeparator, "\\", 1); ZEPHIR_OBS_VAR(namespaces); zephir_read_property_this(&namespaces, this_ptr, SL("_namespaces"), PH_NOISY_CC); if (Z_TYPE_P(namespaces) == IS_ARRAY) { zephir_is_iterable(namespaces, &_2, &_1, 0, 0, "phalcon/loader.zep", 347); for ( ; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS ; zephir_hash_move_forward_ex(_2, &_1) ) { ZEPHIR_GET_HMKEY(nsPrefix, _2, _1); ZEPHIR_GET_HVALUE(directory, _3); if (zephir_start_with(className, nsPrefix, NULL)) { ZEPHIR_INIT_LNVAR(_4); ZEPHIR_CONCAT_VV(_4, nsPrefix, namespaceSeparator); ZEPHIR_SINIT_NVAR(_5); ZVAL_LONG(&_5, zephir_fast_strlen_ev(_4)); ZEPHIR_INIT_NVAR(fileName); zephir_substr(fileName, className, zephir_get_intval(&_5), 0, ZEPHIR_SUBSTR_NO_LENGTH); ZEPHIR_INIT_NVAR(_0); zephir_fast_str_replace(&_0, namespaceSeparator, ds, fileName TSRMLS_CC); ZEPHIR_CPY_WRT(fileName, _0); if (zephir_is_true(fileName)) { ZEPHIR_INIT_NVAR(_0); zephir_fast_trim(_0, directory, ds, ZEPHIR_TRIM_RIGHT TSRMLS_CC); ZEPHIR_INIT_NVAR(fixedDirectory); ZEPHIR_CONCAT_VV(fixedDirectory, _0, ds); zephir_is_iterable(extensions, &_7, &_6, 0, 0, "phalcon/loader.zep", 344); for ( ; zephir_hash_get_current_data_ex(_7, (void**) &_8, &_6) == SUCCESS ; zephir_hash_move_forward_ex(_7, &_6) ) { ZEPHIR_GET_HVALUE(extension, _8); ZEPHIR_INIT_NVAR(filePath); ZEPHIR_CONCAT_VVSV(filePath, fixedDirectory, fileName, ".", extension); if (Z_TYPE_P(eventsManager) == IS_OBJECT) { zephir_update_property_this(this_ptr, SL("_checkedPath"), filePath TSRMLS_CC); ZEPHIR_INIT_NVAR(_9); ZVAL_STRING(_9, "loader:beforeCheckPath", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", &_10, 0, _9, this_ptr); zephir_check_temp_parameter(_9); zephir_check_call_status(); } ZEPHIR_CALL_FUNCTION(&_11, "is_file", &_12, 279, filePath); zephir_check_call_status(); if (zephir_is_true(_11)) { if (Z_TYPE_P(eventsManager) == IS_OBJECT) { zephir_update_property_this(this_ptr, SL("_foundPath"), filePath TSRMLS_CC); ZEPHIR_INIT_NVAR(_9); ZVAL_STRING(_9, "loader:pathFound", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", &_13, 0, _9, this_ptr, filePath); zephir_check_temp_parameter(_9); zephir_check_call_status(); } if (zephir_require_zval(filePath TSRMLS_CC) == FAILURE) { RETURN_MM_NULL(); } RETURN_MM_BOOL(1); } } } } } } ZEPHIR_OBS_VAR(prefixes); zephir_read_property_this(&prefixes, this_ptr, SL("_prefixes"), PH_NOISY_CC); if (Z_TYPE_P(prefixes) == IS_ARRAY) { zephir_is_iterable(prefixes, &_15, &_14, 0, 0, "phalcon/loader.zep", 402); for ( ; zephir_hash_get_current_data_ex(_15, (void**) &_16, &_14) == SUCCESS ; zephir_hash_move_forward_ex(_15, &_14) ) { ZEPHIR_GET_HMKEY(prefix, _15, _14); ZEPHIR_GET_HVALUE(directory, _16); if (zephir_start_with(className, prefix, NULL)) { ZEPHIR_INIT_LNVAR(_4); ZEPHIR_CONCAT_VV(_4, prefix, namespaceSeparator); ZEPHIR_SINIT_NVAR(_5); ZVAL_STRING(&_5, "", 0); ZEPHIR_INIT_NVAR(fileName); zephir_fast_str_replace(&fileName, _4, &_5, className TSRMLS_CC); ZEPHIR_INIT_NVAR(_0); ZEPHIR_INIT_LNVAR(_17); ZEPHIR_CONCAT_VS(_17, prefix, "_"); ZEPHIR_SINIT_NVAR(_18); ZVAL_STRING(&_18, "", 0); zephir_fast_str_replace(&_0, _17, &_18, fileName TSRMLS_CC); ZEPHIR_CPY_WRT(fileName, _0); ZEPHIR_INIT_NVAR(_0); ZEPHIR_SINIT_NVAR(_19); ZVAL_STRING(&_19, "_", 0); zephir_fast_str_replace(&_0, &_19, ds, fileName TSRMLS_CC); ZEPHIR_CPY_WRT(fileName, _0); if (zephir_is_true(fileName)) { ZEPHIR_INIT_NVAR(_0); zephir_fast_trim(_0, directory, ds, ZEPHIR_TRIM_RIGHT TSRMLS_CC); ZEPHIR_INIT_NVAR(fixedDirectory); ZEPHIR_CONCAT_VV(fixedDirectory, _0, ds); zephir_is_iterable(extensions, &_21, &_20, 0, 0, "phalcon/loader.zep", 399); for ( ; zephir_hash_get_current_data_ex(_21, (void**) &_22, &_20) == SUCCESS ; zephir_hash_move_forward_ex(_21, &_20) ) { ZEPHIR_GET_HVALUE(extension, _22); ZEPHIR_INIT_NVAR(filePath); ZEPHIR_CONCAT_VVSV(filePath, fixedDirectory, fileName, ".", extension); if (Z_TYPE_P(eventsManager) == IS_OBJECT) { zephir_update_property_this(this_ptr, SL("_checkedPath"), filePath TSRMLS_CC); ZEPHIR_INIT_NVAR(_9); ZVAL_STRING(_9, "loader:beforeCheckPath", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", &_23, 0, _9, this_ptr, filePath); zephir_check_temp_parameter(_9); zephir_check_call_status(); } ZEPHIR_CALL_FUNCTION(&_11, "is_file", &_12, 279, filePath); zephir_check_call_status(); if (zephir_is_true(_11)) { if (Z_TYPE_P(eventsManager) == IS_OBJECT) { zephir_update_property_this(this_ptr, SL("_foundPath"), filePath TSRMLS_CC); ZEPHIR_INIT_NVAR(_9); ZVAL_STRING(_9, "loader:pathFound", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", &_24, 0, _9, this_ptr, filePath); zephir_check_temp_parameter(_9); zephir_check_call_status(); } if (zephir_require_zval(filePath TSRMLS_CC) == FAILURE) { RETURN_MM_NULL(); } RETURN_MM_BOOL(1); } } } } } } ZEPHIR_SINIT_NVAR(_5); ZVAL_STRING(&_5, "_", 0); ZEPHIR_INIT_VAR(dsClassName); zephir_fast_str_replace(&dsClassName, &_5, ds, className TSRMLS_CC); ZEPHIR_SINIT_NVAR(_18); ZVAL_STRING(&_18, "\\", 0); ZEPHIR_INIT_VAR(nsClassName); zephir_fast_str_replace(&nsClassName, &_18, ds, dsClassName TSRMLS_CC); ZEPHIR_OBS_VAR(directories); zephir_read_property_this(&directories, this_ptr, SL("_directories"), PH_NOISY_CC); if (Z_TYPE_P(directories) == IS_ARRAY) { zephir_is_iterable(directories, &_26, &_25, 0, 0, "phalcon/loader.zep", 464); for ( ; zephir_hash_get_current_data_ex(_26, (void**) &_27, &_25) == SUCCESS ; zephir_hash_move_forward_ex(_26, &_25) ) { ZEPHIR_GET_HVALUE(directory, _27); ZEPHIR_INIT_NVAR(_0); zephir_fast_trim(_0, directory, ds, ZEPHIR_TRIM_RIGHT TSRMLS_CC); ZEPHIR_INIT_NVAR(fixedDirectory); ZEPHIR_CONCAT_VV(fixedDirectory, _0, ds); zephir_is_iterable(extensions, &_29, &_28, 0, 0, "phalcon/loader.zep", 463); for ( ; zephir_hash_get_current_data_ex(_29, (void**) &_30, &_28) == SUCCESS ; zephir_hash_move_forward_ex(_29, &_28) ) { ZEPHIR_GET_HVALUE(extension, _30); ZEPHIR_INIT_NVAR(filePath); ZEPHIR_CONCAT_VVSV(filePath, fixedDirectory, nsClassName, ".", extension); if (Z_TYPE_P(eventsManager) == IS_OBJECT) { zephir_update_property_this(this_ptr, SL("_checkedPath"), filePath TSRMLS_CC); ZEPHIR_INIT_NVAR(_9); ZVAL_STRING(_9, "loader:beforeCheckPath", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", &_31, 0, _9, this_ptr, filePath); zephir_check_temp_parameter(_9); zephir_check_call_status(); } ZEPHIR_CALL_FUNCTION(&_11, "is_file", &_12, 279, filePath); zephir_check_call_status(); if (zephir_is_true(_11)) { if (Z_TYPE_P(eventsManager) == IS_OBJECT) { zephir_update_property_this(this_ptr, SL("_foundPath"), filePath TSRMLS_CC); ZEPHIR_INIT_NVAR(_9); ZVAL_STRING(_9, "loader:pathFound", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", &_32, 0, _9, this_ptr, filePath); zephir_check_temp_parameter(_9); zephir_check_call_status(); } if (zephir_require_zval(filePath TSRMLS_CC) == FAILURE) { RETURN_MM_NULL(); } RETURN_MM_BOOL(1); } } } } if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "loader:afterCheckClass", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", NULL, 0, _0, this_ptr, className); zephir_check_temp_parameter(_0); zephir_check_call_status(); } RETURN_MM_BOOL(0); }
PHP_METHOD(Xpl_ClassLoader, findFileWithExtension) { HashTable *_16, *_39, *_6$$3, *_11$$5, *_32$$12, *_35$$14; HashPosition _15, _38, _5$$3, _10$$5, _31$$12, _34$$14; int ZEPHIR_LAST_CALL_STATUS; zephir_fcall_cache_entry *_3 = NULL; zval *className_param = NULL, *ext_param = NULL, *logicalPathPsr4 = NULL, *firstChar = NULL, *prefixLengthsPsr4 = NULL, *prefix = NULL, *length = NULL, *dir = NULL, *file = NULL, *prefixesPsr0 = NULL, *logicalPathPsr0 = NULL, *nsPos = NULL, *dirs = NULL, _0 = zval_used_for_init, _1 = zval_used_for_init, *_2 = NULL, *_4, *_14, **_17, _18, *_30, *_37, **_40, *_41, **_7$$3, *_8$$5, *_9$$5, **_12$$5, *_13$$6 = NULL, _19$$10, _20$$10, *_21$$10, _22$$10, *_23$$10, _24$$10, _25$$10, *_26$$10 = NULL, _27$$11, _28$$11, *_29$$11 = NULL, **_33$$12, **_36$$14; zval *className = NULL, *ext = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 0, &className_param, &ext_param); if (unlikely(Z_TYPE_P(className_param) != IS_STRING && Z_TYPE_P(className_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'className' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(className_param) == IS_STRING)) { zephir_get_strval(className, className_param); } else { ZEPHIR_INIT_VAR(className); ZVAL_EMPTY_STRING(className); } zephir_get_strval(ext, ext_param); ZEPHIR_SINIT_VAR(_0); ZVAL_STRING(&_0, "\\", 0); ZEPHIR_SINIT_VAR(_1); ZVAL_STRING(&_1, "/", 0); ZEPHIR_CALL_FUNCTION(&_2, "strtr", &_3, 56, className, &_0, &_1); zephir_check_call_status(); ZEPHIR_INIT_VAR(logicalPathPsr4); ZEPHIR_CONCAT_VV(logicalPathPsr4, _2, ext); ZEPHIR_SINIT_NVAR(_0); ZVAL_LONG(&_0, 0); ZEPHIR_SINIT_NVAR(_1); ZVAL_LONG(&_1, 1); ZEPHIR_INIT_VAR(firstChar); zephir_substr(firstChar, className, 0 , 1 , 0); ZEPHIR_OBS_VAR(prefixLengthsPsr4); _4 = zephir_fetch_nproperty_this(this_ptr, SL("prefixLengthsPsr4"), PH_NOISY_CC); if (zephir_array_isset_fetch(&prefixLengthsPsr4, _4, firstChar, 0 TSRMLS_CC)) { zephir_is_iterable(prefixLengthsPsr4, &_6$$3, &_5$$3, 0, 0, "xpl/classloader.zep", 505); for ( ; zephir_hash_get_current_data_ex(_6$$3, (void**) &_7$$3, &_5$$3) == SUCCESS ; zephir_hash_move_forward_ex(_6$$3, &_5$$3) ) { ZEPHIR_GET_HMKEY(prefix, _6$$3, _5$$3); ZEPHIR_GET_HVALUE(length, _7$$3); if (zephir_start_with(className, prefix, ZEPHIR_GLOBAL(global_false))) { _8$$5 = zephir_fetch_nproperty_this(this_ptr, SL("prefixDirsPsr4"), PH_NOISY_CC); zephir_array_fetch(&_9$$5, _8$$5, prefix, PH_NOISY | PH_READONLY, "xpl/classloader.zep", 495 TSRMLS_CC); zephir_is_iterable(_9$$5, &_11$$5, &_10$$5, 0, 0, "xpl/classloader.zep", 503); for ( ; zephir_hash_get_current_data_ex(_11$$5, (void**) &_12$$5, &_10$$5) == SUCCESS ; zephir_hash_move_forward_ex(_11$$5, &_10$$5) ) { ZEPHIR_GET_HVALUE(dir, _12$$5); ZEPHIR_INIT_NVAR(_13$$6); zephir_substr(_13$$6, logicalPathPsr4, zephir_get_intval(length), 0, ZEPHIR_SUBSTR_NO_LENGTH); ZEPHIR_INIT_NVAR(file); ZEPHIR_CONCAT_VSV(file, dir, "/", _13$$6); if ((zephir_file_exists(file TSRMLS_CC) == SUCCESS)) { RETURN_CCTOR(file); } } } } } _14 = zephir_fetch_nproperty_this(this_ptr, SL("fallbackDirsPsr4"), PH_NOISY_CC); zephir_is_iterable(_14, &_16, &_15, 0, 0, "xpl/classloader.zep", 517); for ( ; zephir_hash_get_current_data_ex(_16, (void**) &_17, &_15) == SUCCESS ; zephir_hash_move_forward_ex(_16, &_15) ) { ZEPHIR_GET_HVALUE(dir, _17); ZEPHIR_INIT_NVAR(file); ZEPHIR_CONCAT_VSV(file, dir, "/", logicalPathPsr4); if ((zephir_file_exists(file TSRMLS_CC) == SUCCESS)) { RETURN_CCTOR(file); } } ZEPHIR_SINIT_VAR(_18); ZVAL_STRING(&_18, "\\", 0); ZEPHIR_CALL_FUNCTION(&nsPos, "strrpos", NULL, 57, className, &_18); zephir_check_call_status(); ZEPHIR_INIT_VAR(logicalPathPsr0); if (zephir_is_true(nsPos)) { ZEPHIR_SINIT_VAR(_19$$10); ZVAL_LONG(&_19$$10, 0); ZEPHIR_SINIT_VAR(_20$$10); ZVAL_LONG(&_20$$10, (zephir_get_numberval(nsPos) + 1)); ZEPHIR_INIT_VAR(_21$$10); zephir_substr(_21$$10, logicalPathPsr4, 0 , zephir_get_intval(&_20$$10), 0); ZEPHIR_SINIT_VAR(_22$$10); ZVAL_LONG(&_22$$10, (zephir_get_numberval(nsPos) + 1)); ZEPHIR_INIT_VAR(_23$$10); zephir_substr(_23$$10, logicalPathPsr4, zephir_get_intval(&_22$$10), 0, ZEPHIR_SUBSTR_NO_LENGTH); ZEPHIR_SINIT_VAR(_24$$10); ZVAL_STRING(&_24$$10, "_", 0); ZEPHIR_SINIT_VAR(_25$$10); ZVAL_STRING(&_25$$10, "/", 0); ZEPHIR_CALL_FUNCTION(&_26$$10, "strtr", &_3, 56, _23$$10, &_24$$10, &_25$$10); zephir_check_call_status(); ZEPHIR_CONCAT_VV(logicalPathPsr0, _21$$10, _26$$10); } else { ZEPHIR_SINIT_VAR(_27$$11); ZVAL_STRING(&_27$$11, "_", 0); ZEPHIR_SINIT_VAR(_28$$11); ZVAL_STRING(&_28$$11, "/", 0); ZEPHIR_CALL_FUNCTION(&_29$$11, "strtr", &_3, 56, className, &_27$$11, &_28$$11); zephir_check_call_status(); ZEPHIR_CONCAT_VV(logicalPathPsr0, _29$$11, ext); } ZEPHIR_OBS_VAR(prefixesPsr0); _30 = zephir_fetch_nproperty_this(this_ptr, SL("prefixesPsr0"), PH_NOISY_CC); if (zephir_array_isset_fetch(&prefixesPsr0, _30, firstChar, 0 TSRMLS_CC)) { zephir_is_iterable(prefixesPsr0, &_32$$12, &_31$$12, 0, 0, "xpl/classloader.zep", 546); for ( ; zephir_hash_get_current_data_ex(_32$$12, (void**) &_33$$12, &_31$$12) == SUCCESS ; zephir_hash_move_forward_ex(_32$$12, &_31$$12) ) { ZEPHIR_GET_HMKEY(prefix, _32$$12, _31$$12); ZEPHIR_GET_HVALUE(dirs, _33$$12); if (zephir_start_with(className, prefix, NULL)) { zephir_is_iterable(dirs, &_35$$14, &_34$$14, 0, 0, "xpl/classloader.zep", 544); for ( ; zephir_hash_get_current_data_ex(_35$$14, (void**) &_36$$14, &_34$$14) == SUCCESS ; zephir_hash_move_forward_ex(_35$$14, &_34$$14) ) { ZEPHIR_GET_HVALUE(dir, _36$$14); ZEPHIR_INIT_NVAR(file); ZEPHIR_CONCAT_VSV(file, dir, "/", logicalPathPsr0); if ((zephir_file_exists(file TSRMLS_CC) == SUCCESS)) { RETURN_CCTOR(file); } } } } } _37 = zephir_fetch_nproperty_this(this_ptr, SL("fallbackDirsPsr0"), PH_NOISY_CC); zephir_is_iterable(_37, &_39, &_38, 0, 0, "xpl/classloader.zep", 559); for ( ; zephir_hash_get_current_data_ex(_39, (void**) &_40, &_38) == SUCCESS ; zephir_hash_move_forward_ex(_39, &_38) ) { ZEPHIR_GET_HVALUE(dir, _40); ZEPHIR_INIT_NVAR(file); ZEPHIR_CONCAT_VSV(file, dir, "/", logicalPathPsr0); if ((zephir_file_exists(file TSRMLS_CC) == SUCCESS)) { RETURN_CCTOR(file); } } _41 = zephir_fetch_nproperty_this(this_ptr, SL("useIncludePath"), PH_NOISY_CC); if (ZEPHIR_IS_TRUE_IDENTICAL(_41)) { ZEPHIR_CALL_FUNCTION(&file, "stream_resolve_include_path", NULL, 58, logicalPathPsr0); zephir_check_call_status(); if (zephir_is_true(file)) { RETURN_CCTOR(file); } } RETURN_MM_NULL(); }