Skip to content

Commit 3277175

Browse files
committed
Feat: borderOfTheFourSides
1 parent c2f6577 commit 3277175

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

kernel/format.c

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,13 @@ ZEND_BEGIN_ARG_INFO_EX(format_border_arginfo, 0, 0, 1)
103103
ZEND_ARG_INFO(0, style)
104104
ZEND_END_ARG_INFO()
105105

106+
ZEND_BEGIN_ARG_INFO_EX(format_border_of_the_four_sides_arginfo, 0, 0, 4)
107+
ZEND_ARG_INFO(0, top)
108+
ZEND_ARG_INFO(0, right)
109+
ZEND_ARG_INFO(0, bottom)
110+
ZEND_ARG_INFO(0, left)
111+
ZEND_END_ARG_INFO()
112+
106113
ZEND_BEGIN_ARG_INFO_EX(format_border_color_arginfo, 0, 0, 1)
107114
ZEND_ARG_INFO(0, color)
108115
ZEND_END_ARG_INFO()
@@ -367,7 +374,7 @@ PHP_METHOD(vtiful_format, wrap)
367374
}
368375
/* }}} */
369376

370-
/** {{{ \Vtiful\Kernel\Format::toResource()
377+
/** {{{ \Vtiful\Kernel\Format::border()
371378
*/
372379
PHP_METHOD(vtiful_format, border)
373380
{
@@ -387,6 +394,33 @@ PHP_METHOD(vtiful_format, border)
387394
}
388395
/* }}} */
389396

397+
/** {{{ \Vtiful\Kernel\Format::borderOfTheFourSides(int $top, int $right, int $bottom, int $left)
398+
*/
399+
PHP_METHOD(vtiful_format, borderOfTheFourSides)
400+
{
401+
zend_long top = LXW_BORDER_NONE, right = LXW_BORDER_NONE, bottom = LXW_BORDER_NONE, left = LXW_BORDER_NONE;
402+
403+
ZEND_PARSE_PARAMETERS_START(0, 4)
404+
Z_PARAM_OPTIONAL
405+
Z_PARAM_LONG_OR_NULL(top, _dummy)
406+
Z_PARAM_LONG_OR_NULL(right, _dummy)
407+
Z_PARAM_LONG_OR_NULL(bottom, _dummy)
408+
Z_PARAM_LONG_OR_NULL(left, _dummy)
409+
ZEND_PARSE_PARAMETERS_END();
410+
411+
ZVAL_COPY(return_value, getThis());
412+
413+
format_object *obj = Z_FORMAT_P(getThis());
414+
415+
if (obj->ptr.format) {
416+
format_set_top(obj->ptr.format, top);
417+
format_set_right(obj->ptr.format, right);
418+
format_set_bottom(obj->ptr.format, bottom);
419+
format_set_left(obj->ptr.format, left);
420+
}
421+
}
422+
/* }}} */
423+
390424
/** {{{ \Vtiful\Kernel\Format::borderColor(int $color)
391425
*/
392426
PHP_METHOD(vtiful_format, borderColor)
@@ -463,6 +497,7 @@ zend_function_entry format_methods[] = {
463497
PHP_ME(vtiful_format, bold, format_bold_arginfo, ZEND_ACC_PUBLIC)
464498
PHP_ME(vtiful_format, italic, format_italic_arginfo, ZEND_ACC_PUBLIC)
465499
PHP_ME(vtiful_format, border, format_border_arginfo, ZEND_ACC_PUBLIC)
500+
PHP_ME(vtiful_format, borderOfTheFourSides, format_border_of_the_four_sides_arginfo, ZEND_ACC_PUBLIC)
466501
PHP_ME(vtiful_format, borderColor, format_border_color_arginfo, ZEND_ACC_PUBLIC)
467502
PHP_ME(vtiful_format, borderColorOfTheFourSides, format_border_color_of_the_four_sides_arginfo, ZEND_ACC_PUBLIC)
468503
PHP_ME(vtiful_format, align, format_align_arginfo, ZEND_ACC_PUBLIC)

0 commit comments

Comments
 (0)