PHP_HTTP_END_ARGS;
PHP_HTTP_EMPTY_ARGS(flushCookies);
-PHP_HTTP_EMPTY_ARGS(getMessageClass);
-PHP_HTTP_BEGIN_ARGS(setMessageClass, 1)
+PHP_HTTP_EMPTY_ARGS(getResponseMessageClass);
+PHP_HTTP_BEGIN_ARGS(setResponseMessageClass, 1)
PHP_HTTP_ARG_VAL(message_class_name, 0)
PHP_HTTP_END_ARGS;
PHP_HTTP_EMPTY_ARGS(getRequestMessage);
PHP_HTTP_EMPTY_ARGS(getHistory);
PHP_HTTP_EMPTY_ARGS(clearHistory);
+
+PHP_HTTP_BEGIN_ARGS(setRequest, 1)
+ PHP_HTTP_ARG_OBJ(http\\Client\\Request, request, 1)
+PHP_HTTP_END_ARGS;
+PHP_HTTP_EMPTY_ARGS(getRequest);
+
PHP_HTTP_BEGIN_ARGS(send, 1)
PHP_HTTP_ARG_VAL(request, 0)
PHP_HTTP_END_ARGS;
PHP_HTTP_CLIENT_ME(resetCookies, ZEND_ACC_PUBLIC)
PHP_HTTP_CLIENT_ME(flushCookies, ZEND_ACC_PUBLIC)
+ PHP_HTTP_CLIENT_ME(setRequest, ZEND_ACC_PUBLIC)
+ PHP_HTTP_CLIENT_ME(getRequest, ZEND_ACC_PUBLIC)
PHP_HTTP_CLIENT_ME(send, ZEND_ACC_PUBLIC)
PHP_HTTP_CLIENT_ME(getResponseMessage, ZEND_ACC_PUBLIC)
PHP_HTTP_CLIENT_ME(getHistory, ZEND_ACC_PUBLIC)
PHP_HTTP_CLIENT_ME(clearHistory, ZEND_ACC_PUBLIC)
- PHP_HTTP_CLIENT_ME(getMessageClass, ZEND_ACC_PUBLIC)
- PHP_HTTP_CLIENT_ME(setMessageClass, ZEND_ACC_PUBLIC)
+ PHP_HTTP_CLIENT_ME(getResponseMessageClass, ZEND_ACC_PUBLIC)
+ PHP_HTTP_CLIENT_ME(setResponseMessageClass, ZEND_ACC_PUBLIC)
EMPTY_FUNCTION_ENTRY
};
static inline zend_object_value php_http_client_object_message(zval *this_ptr, php_http_message_t *msg TSRMLS_DC)
{
zend_object_value ov;
- zval *zcn = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("messageClass"), 0 TSRMLS_CC);
+ zval *zcn = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("responseMessageClass"), 0 TSRMLS_CC);
zend_class_entry *class_entry;
if (Z_STRLEN_P(zcn)
}
}
-STATUS php_http_client_object_handle_request(zval *zclient, zval *zreq TSRMLS_DC)
+STATUS php_http_client_object_handle_request(zval *zclient, zval **zreq TSRMLS_DC)
{
php_http_client_object_t *obj = zend_object_store_get_object(zclient TSRMLS_CC);
php_http_client_progress_t *progress;
zval *zoptions;
+ /* do we have a valid request? */
+ if (*zreq) {
+ /* remember the request */
+ zend_update_property(php_http_client_class_entry, zclient, ZEND_STRL("request"), *zreq TSRMLS_CC);
+ } else {
+ /* maybe a request is already set */
+ *zreq = zend_read_property(php_http_client_class_entry, zclient, ZEND_STRL("request"), 0 TSRMLS_CC);
+
+ if (Z_TYPE_PP(zreq) != IS_OBJECT || !instanceof_function(Z_OBJCE_PP(zreq), php_http_client_request_class_entry TSRMLS_CC)) {
+ php_http_error(HE_WARNING, PHP_HTTP_E_CLIENT, "The client does not have a valid request set");
+ return FAILURE;
+ }
+ }
+
/* reset request handle */
php_http_client_reset(obj->client);
- /* remember the request */
- zend_update_property(php_http_client_class_entry, zclient, ZEND_STRL("request"), zreq TSRMLS_CC);
-
/* reset transfer info */
zend_update_property_null(php_http_client_class_entry, zclient, ZEND_STRL("info") TSRMLS_CC);
zend_call_method_with_1_params(&getThis(), Z_OBJCE_P(getThis()), NULL, "addcookies", NULL, *opt);
} else if (KEYMATCH(key, "recordHistory")) {
zend_update_property(php_http_client_class_entry, getThis(), ZEND_STRL("recordHistory"), *opt TSRMLS_CC);
- } else if (KEYMATCH(key, "messageClass")) {
+ } else if (KEYMATCH(key, "responseMessageClass")) {
zend_call_method_with_1_params(&getThis(), Z_OBJCE_P(getThis()), NULL, "setmessageclass", NULL, *opt);
} else if (Z_TYPE_PP(opt) == IS_NULL) {
old_opts = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("options"), 0 TSRMLS_CC);
RETVAL_ZVAL(getThis(), 1, 0);
}
-PHP_METHOD(HttpClient, getMessageClass)
+PHP_METHOD(HttpClient, getResponseMessageClass)
{
if (SUCCESS == zend_parse_parameters_none()) {
- RETURN_PROP(php_http_client_class_entry, "messageClass");
+ RETURN_PROP(php_http_client_class_entry, "responseMessageClass");
}
RETURN_FALSE;
}
-PHP_METHOD(HttpClient, setMessageClass)
+PHP_METHOD(HttpClient, setResponseMessageClass)
{
char *cn;
int cl;
if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &cn, &cl)) {
- zend_update_property_stringl(php_http_client_class_entry, getThis(), ZEND_STRL("messageClass"), cn, cl TSRMLS_CC);
+ zend_update_property_stringl(php_http_client_class_entry, getThis(), ZEND_STRL("responseMessageClass"), cn, cl TSRMLS_CC);
}
RETVAL_ZVAL(getThis(), 1, 0);
}
+PHP_METHOD(HttpClient, setRequest)
+{
+ zval *zreq = NULL;
+
+ if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &zreq, php_http_client_request_class_entry)) {
+ zend_update_property(php_http_client_class_entry, getThis(), ZEND_STRL("request"), zreq TSRMLS_CC);
+ }
+ RETURN_ZVAL(getThis(), 1, 0);
+}
+
+PHP_METHOD(HttpClient, getRequest)
+{
+ if (SUCCESS == zend_parse_parameters_none()) {
+ RETURN_PROP(php_http_client_class_entry, "request");
+ }
+}
+
PHP_METHOD(HttpClient, send)
{
- zval *zreq;
+ zval *zreq = NULL;
RETVAL_FALSE;
with_error_handling(EH_THROW, php_http_exception_class_entry) {
- if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &zreq, php_http_client_request_class_entry)) {
- if (SUCCESS == php_http_client_object_handle_request(getThis(), zreq TSRMLS_CC)) {
+ if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O!", &zreq, php_http_client_request_class_entry)) {
+ if (SUCCESS == php_http_client_object_handle_request(getThis(), &zreq TSRMLS_CC)) {
php_http_client_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
php_http_message_object_t *req = zend_object_store_get_object(zreq TSRMLS_CC);
zend_class_implements(php_http_client_class_entry TSRMLS_CC, 2, spl_ce_SplSubject, php_http_client_interface_class_entry);
- zend_declare_property_string(php_http_client_class_entry, ZEND_STRL("messageClass"), "", ZEND_ACC_PRIVATE TSRMLS_CC);
+ zend_declare_property_string(php_http_client_class_entry, ZEND_STRL("responseMessageClass"), "", ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(php_http_client_class_entry, ZEND_STRL("observers"), ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(php_http_client_class_entry, ZEND_STRL("options"), ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(php_http_client_class_entry, ZEND_STRL("transferInfo"), ZEND_ACC_PRIVATE TSRMLS_CC);
extern zend_object_handlers *php_http_client_get_object_handlers(void);
+extern STATUS php_http_client_object_handle_request(zval *zclient, zval **zreq TSRMLS_DC);
+extern STATUS php_http_client_object_handle_response(zval *zclient TSRMLS_DC);
+
extern STATUS php_http_client_object_requesthandler(php_http_client_object_t *obj, zval *this_ptr, char **meth, char **url, php_http_message_body_t **body TSRMLS_DC);
extern STATUS php_http_client_object_responsehandler(php_http_client_object_t *obj, zval *this_ptr TSRMLS_DC);
PHP_METHOD(HttpClient, enableCookies);
PHP_METHOD(HttpClient, resetCookies);
PHP_METHOD(HttpClient, flushCookies);
+PHP_METHOD(HttpClient, setRequest);
+PHP_METHOD(HttpClient, getRequest);
PHP_METHOD(HttpClient, send);
PHP_METHOD(HttpClient, getResponseMessage);
-PHP_METHOD(HttpClient, getRawResponseMessage);
PHP_METHOD(HttpClient, getRequestMessage);
-PHP_METHOD(HttpClient, getRawRequestMessage);
PHP_METHOD(HttpClient, getHistory);
PHP_METHOD(HttpClient, clearHistory);
-PHP_METHOD(HttpClient, getMessageClass);
-PHP_METHOD(HttpClient, setMessageClass);
+PHP_METHOD(HttpClient, getResponseMessageClass);
+PHP_METHOD(HttpClient, setResponseMessageClass);
extern PHP_MINIT_FUNCTION(http_client);
return SUCCESS;
}
-static STATUS php_http_client_curl_exec(php_http_client_t *h, php_http_message_t *msg)
+STATUS php_http_client_curl_prepare(php_http_client_t *h, php_http_message_t *msg)
{
- uint tries = 0;
- CURLcode result;
php_http_client_curl_t *curl = h->ctx;
php_http_client_curl_storage_t *storage = get_storage(curl->handle);
TSRMLS_FETCH_FROM_CTX(h->ts);
/* request url */
if (!PHP_HTTP_INFO(msg).request.url) {
php_http_error(HE_WARNING, PHP_HTTP_E_CLIENT, "Cannot request empty URL");
+ return FAILURE;
}
storage->errorbuffer[0] = '\0';
if (storage->url) {
curl_easy_setopt(curl->handle, CURLOPT_POSTFIELDSIZE, body_size);
}
+ return SUCCESS;
+}
+
+static STATUS php_http_client_curl_exec(php_http_client_t *h, php_http_message_t *msg)
+{
+ uint tries = 0;
+ CURLcode result;
+ php_http_client_curl_t *curl = h->ctx;
+ php_http_client_curl_storage_t *storage = get_storage(curl->handle);
+ TSRMLS_FETCH_FROM_CTX(h->ts);
+
+ if (SUCCESS != php_http_client_curl_prepare(h, msg)) {
+ return FAILURE;
+ }
+
retry:
if (CURLE_OK != (result = curl_easy_perform(curl->handle))) {
php_http_error(HE_WARNING, PHP_HTTP_E_CLIENT, "%s; %s (%s)", curl_easy_strerror(result), storage->errorbuffer, storage->url);
return st;
}
+extern STATUS php_http_client_curl_prepare(php_http_client_t *h, php_http_message_t *msg);
+
extern zend_class_entry *php_http_client_curl_class_entry;
extern zend_function_entry php_http_client_curl_method_entry[];
-zend_object_value php_http_client_curl_object_new(zend_class_entry *ce TSRMLS_DC);
-zend_object_value php_http_client_curl_object_new_ex(zend_class_entry *ce, php_http_client_t *r, php_http_client_object_t **ptr TSRMLS_DC);
+extern zend_object_value php_http_client_curl_object_new(zend_class_entry *ce TSRMLS_DC);
+extern zend_object_value php_http_client_curl_object_new_ex(zend_class_entry *ce, php_http_client_t *r, php_http_client_object_t **ptr TSRMLS_DC);
+PHP_MINIT_FUNCTION(http_client_curl);
#endif /* PHP_HTTP_HAVE_CURL */
#endif /* PHP_HTTP_CLIENT_CURL_H */
TSRMLS_FETCH_FROM_CTX(h->ts);
if (h->ops->attach) {
- char *url = NULL;
- char *m = NULL;
- php_http_message_body_t *body = NULL;
- php_http_client_object_t *obj = zend_object_store_get_object(client TSRMLS_CC);
+ zval *zreq = NULL;
+ php_http_client_object_t *obj;
+ php_http_message_object_t *msg_obj;
- if (SUCCESS != php_http_client_object_requesthandler(obj, client, &m, &url, &body TSRMLS_CC)) {
+ if (SUCCESS != php_http_client_object_handle_request(client, &zreq TSRMLS_CC)) {
return FAILURE;
}
- if (SUCCESS == h->ops->attach(h, obj->client, m, url, body)) {
- STR_FREE(url);
+
+ obj = zend_object_store_get_object(client TSRMLS_CC);
+ msg_obj = zend_object_store_get_object(zreq TSRMLS_CC);
+
+ if (SUCCESS == h->ops->attach(h, obj->client, msg_obj->message)) {
Z_ADDREF_P(client);
zend_llist_add_element(&h->clients.attached, &client);
return SUCCESS;
}
- STR_FREE(url);
}
return FAILURE;
#define PHP_HTTP_BEGIN_ARGS(method, req_args) PHP_HTTP_BEGIN_ARGS_EX(HttpClientPool, method, 0, req_args)
#define PHP_HTTP_EMPTY_ARGS(method) PHP_HTTP_EMPTY_ARGS_EX(HttpClientPool, method, 0)
-#define PHP_HTTP_REQPOOL_ME(method, visibility) PHP_ME(HttpClientPool, method, PHP_HTTP_ARGS(HttpClientPool, method), visibility)
+#define PHP_HTTP_CLIENT_POOL_ME(method, visibility) PHP_ME(HttpClientPool, method, PHP_HTTP_ARGS(HttpClientPool, method), visibility)
PHP_HTTP_EMPTY_ARGS(__destruct);
PHP_HTTP_EMPTY_ARGS(reset);
PHP_HTTP_BEGIN_ARGS(attach, 1)
- PHP_HTTP_ARG_OBJ(http\\Client, client, 0)
+ PHP_HTTP_ARG_OBJ(http\\Client\\AbstractClient, request, 0)
PHP_HTTP_END_ARGS;
PHP_HTTP_BEGIN_ARGS(detach, 1)
- PHP_HTTP_ARG_OBJ(http\\Client, client, 0)
+ PHP_HTTP_ARG_OBJ(http\\Client\\AbstractClient, request, 0)
PHP_HTTP_END_ARGS;
PHP_HTTP_EMPTY_ARGS(send);
PHP_HTTP_EMPTY_ARGS(count);
-PHP_HTTP_EMPTY_ARGS(getAttachedRequests);
-PHP_HTTP_EMPTY_ARGS(getFinishedRequests);
+PHP_HTTP_EMPTY_ARGS(getAttached);
+PHP_HTTP_EMPTY_ARGS(getFinished);
PHP_HTTP_BEGIN_ARGS(enablePipelining, 0)
PHP_HTTP_ARG_VAL(enable, 0)
zend_class_entry *php_http_client_pool_class_entry;
zend_function_entry php_http_client_pool_method_entry[] = {
- PHP_HTTP_REQPOOL_ME(__destruct, ZEND_ACC_PUBLIC|ZEND_ACC_DTOR)
- PHP_HTTP_REQPOOL_ME(attach, ZEND_ACC_PUBLIC)
- PHP_HTTP_REQPOOL_ME(detach, ZEND_ACC_PUBLIC)
- PHP_HTTP_REQPOOL_ME(send, ZEND_ACC_PUBLIC)
- PHP_HTTP_REQPOOL_ME(reset, ZEND_ACC_PUBLIC)
+ PHP_HTTP_CLIENT_POOL_ME(__destruct, ZEND_ACC_PUBLIC|ZEND_ACC_DTOR)
+ PHP_HTTP_CLIENT_POOL_ME(attach, ZEND_ACC_PUBLIC)
+ PHP_HTTP_CLIENT_POOL_ME(detach, ZEND_ACC_PUBLIC)
+ PHP_HTTP_CLIENT_POOL_ME(send, ZEND_ACC_PUBLIC)
+ PHP_HTTP_CLIENT_POOL_ME(reset, ZEND_ACC_PUBLIC)
- PHP_HTTP_REQPOOL_ME(once, ZEND_ACC_PROTECTED)
- PHP_HTTP_REQPOOL_ME(wait, ZEND_ACC_PROTECTED)
+ PHP_HTTP_CLIENT_POOL_ME(once, ZEND_ACC_PROTECTED)
+ PHP_HTTP_CLIENT_POOL_ME(wait, ZEND_ACC_PROTECTED)
/* implements Iterator */
- PHP_HTTP_REQPOOL_ME(valid, ZEND_ACC_PUBLIC)
- PHP_HTTP_REQPOOL_ME(current, ZEND_ACC_PUBLIC)
- PHP_HTTP_REQPOOL_ME(key, ZEND_ACC_PUBLIC)
- PHP_HTTP_REQPOOL_ME(next, ZEND_ACC_PUBLIC)
- PHP_HTTP_REQPOOL_ME(rewind, ZEND_ACC_PUBLIC)
+ PHP_HTTP_CLIENT_POOL_ME(valid, ZEND_ACC_PUBLIC)
+ PHP_HTTP_CLIENT_POOL_ME(current, ZEND_ACC_PUBLIC)
+ PHP_HTTP_CLIENT_POOL_ME(key, ZEND_ACC_PUBLIC)
+ PHP_HTTP_CLIENT_POOL_ME(next, ZEND_ACC_PUBLIC)
+ PHP_HTTP_CLIENT_POOL_ME(rewind, ZEND_ACC_PUBLIC)
/* implmenents Countable */
- PHP_HTTP_REQPOOL_ME(count, ZEND_ACC_PUBLIC)
+ PHP_HTTP_CLIENT_POOL_ME(count, ZEND_ACC_PUBLIC)
- PHP_HTTP_REQPOOL_ME(getAttachedRequests, ZEND_ACC_PUBLIC)
- PHP_HTTP_REQPOOL_ME(getFinishedRequests, ZEND_ACC_PUBLIC)
+ PHP_HTTP_CLIENT_POOL_ME(getAttached, ZEND_ACC_PUBLIC)
+ PHP_HTTP_CLIENT_POOL_ME(getFinished, ZEND_ACC_PUBLIC)
- PHP_HTTP_REQPOOL_ME(enablePipelining, ZEND_ACC_PUBLIC)
- PHP_HTTP_REQPOOL_ME(enableEvents, ZEND_ACC_PUBLIC)
+ PHP_HTTP_CLIENT_POOL_ME(enablePipelining, ZEND_ACC_PUBLIC)
+ PHP_HTTP_CLIENT_POOL_ME(enableEvents, ZEND_ACC_PUBLIC)
EMPTY_FUNCTION_ENTRY
};
}
}
-PHP_METHOD(HttpClientPool, getAttachedRequests)
+PHP_METHOD(HttpClientPool, getAttached)
{
if (SUCCESS == zend_parse_parameters_none()) {
php_http_client_pool_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
RETURN_FALSE;
}
-PHP_METHOD(HttpClientPool, getFinishedRequests)
+PHP_METHOD(HttpClientPool, getFinished)
{
if (SUCCESS == zend_parse_parameters_none()) {
php_http_client_pool_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
memcpy(&php_http_client_pool_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
php_http_client_pool_object_handlers.clone_obj = NULL;
+ zend_declare_property_null(php_http_client_pool_class_entry, ZEND_STRL("client"), ZEND_ACC_PRIVATE TSRMLS_CC);
zend_class_implements(php_http_client_pool_class_entry TSRMLS_CC, 2, spl_ce_Countable, zend_ce_iterator);
return SUCCESS;
typedef STATUS (*php_http_client_pool_exec_func_t)(struct php_http_client_pool *p);
typedef STATUS (*php_http_client_pool_wait_func_t)(struct php_http_client_pool *p, struct timeval *custom_timeout);
typedef int (*php_http_client_pool_once_func_t)(struct php_http_client_pool *p);
-typedef STATUS (*php_http_client_pool_attach_func_t)(struct php_http_client_pool *p, php_http_client_t *r, const char *m, const char *url, php_http_message_body_t *body);
+typedef STATUS (*php_http_client_pool_attach_func_t)(struct php_http_client_pool *p, php_http_client_t *r, php_http_message_t *msg);
typedef STATUS (*php_http_client_pool_detach_func_t)(struct php_http_client_pool *p, php_http_client_t *r);
typedef STATUS (*php_http_client_pool_setopt_func_t)(struct php_http_client_pool *p, php_http_client_pool_setopt_opt_t opt, void *arg);
php_http_client_pool_ops_t *ops;
struct {
+ php_http_client_t *master;
zend_llist attached;
zend_llist finished;
} clients;
typedef struct php_http_client_pool_object {
zend_object zo;
php_http_client_pool_t *pool;
- zend_object_value factory;
+ zend_object_value client;
struct {
long pos;
} iterator;
PHP_METHOD(HttpClientPool, next);
PHP_METHOD(HttpClientPool, rewind);
PHP_METHOD(HttpClientPool, count);
-PHP_METHOD(HttpClientPool, getAttachedRequests);
-PHP_METHOD(HttpClientPool, getFinishedRequests);
+PHP_METHOD(HttpClientPool, getAttached);
+PHP_METHOD(HttpClientPool, getFinished);
PHP_METHOD(HttpClientPool, enablePipelining);
PHP_METHOD(HttpClientPool, enableEvents);
if (msg->easy_handle == ((php_http_client_curl_t *) (obj->client->ctx))->handle) {
Z_ADDREF_PP(request);
zend_llist_add_element(&pool->clients.finished, request);
- php_http_client_object_responsehandler(obj, *request TSRMLS_CC);
+ php_http_client_object_handle_response(*request TSRMLS_CC);
}
zval_ptr_dtor(request);
h->ctx = NULL;
}
-static STATUS php_http_client_pool_curl_attach(php_http_client_pool_t *h, php_http_client_t *r, const char *m, const char *url, php_http_message_body_t *body)
+static STATUS php_http_client_pool_curl_attach(php_http_client_pool_t *h, php_http_client_t *r, php_http_message_t *m)
{
php_http_client_pool_curl_t *curl = h->ctx;
php_http_client_curl_t *recurl = r->ctx;
CURLMcode rs;
TSRMLS_FETCH_FROM_CTX(h->ts);
- if (SUCCESS != php_http_curl_request_prepare(r, m, url, body)) {
+ if (SUCCESS != php_http_client_curl_prepare(r, m)) {
return FAILURE;
}
}
printf("\n");
-foreach ($ext->getClasses() as $class) {
+$classes = $ext->getClasses();
+usort($classes, function($a,$b) {
+ $cmp = strcmp($a->getNamespaceName(), $b->getNamespaceName());
+ if (!$cmp) {
+ $cmp = strcmp($a->getShortName(), $b->getShortName());
+ }
+ return $cmp;
+ }
+);
+
+foreach ($classes as $class) {
if ($class->inNamespace()) {
- printf("namespace %s {\n", $class->getNamespaceName());
+ printf("namespace %s\n{\n", $class->getNamespaceName());
}
- printf("%s%s %s ", m($class->getModifiers()), $class->isInterface() ? "interface":"class" ,$class->getShortName());
+ printf("\t%s%s %s ", m($class->getModifiers()), $class->isInterface() ? "interface":"class" ,$class->getShortName());
if ($p = $class->getParentClass()) {
printf("extends \\%s ", $p->getName());
}
if ($i = $class->getInterfaceNames()) {
printf("implements \\%s ", implode(", \\", array_filter($i,function($v){return$v!="Traversable";})));
}
- printf("\n{\n");
+ printf("\n\t{\n");
$_=0;
foreach ($class->getConstants() as $n => $v) {
- c($n, $class) and $_+=printf("\tconst %s = %s;\n", $n, var_export($v, true));
+ c($n, $class) and $_+=printf("\t\tconst %s = %s;\n", $n, var_export($v, true));
}
$_ and printf("\n");
$_=0;
foreach ($class->getProperties() as $p) {
if ($p->getDeclaringClass()->getName() == $class->getName()) {
- $_+=printf("\t%s\$%s;\n", m($p->getModifiers()), $p->getName());
+ $_+=printf("\t\t%s\$%s;\n", m($p->getModifiers()), $p->getName());
}
}
$_ and printf("\n");
foreach ($class->getMethods() as $m) {
if ($m->getDeclaringClass()->getName() == $class->getName()) {
- printf("\t%sfunction %s(", m($m->getModifiers()), $m->getName());
+ printf("\t\t%sfunction %s(", m($m->getModifiers()), $m->getName());
$ps = array();
foreach ($m->getParameters() as $p) {
$p1 = sprintf("%s%s\$%s", t($p), $p->isPassedByReference()?"&":"", $p->getName());
}
$ps[] = $p1;
}
- printf("%s) {\n\t}\n", implode(", ", $ps));
+ printf("%s) {\n\t\t}\n", implode(", ", $ps));
}
}
- printf("}\n");
+ printf("\t}\n");
if ($class->inNamespace()) {
printf("}\n");
}