File tree Expand file tree Collapse file tree 4 files changed +19
-106
lines changed Expand file tree Collapse file tree 4 files changed +19
-106
lines changed Original file line number Diff line number Diff line change @@ -35,14 +35,14 @@ class CheckBox extends Text
35
35
private $ name ;
36
36
37
37
/**
38
- * Default value
38
+ * Default value.
39
39
*
40
40
* @var bool
41
41
*/
42
42
private $ default = false ;
43
43
44
44
/**
45
- * Create new instance
45
+ * Create new instance.
46
46
*
47
47
* @param string $name
48
48
* @param string $text
@@ -80,19 +80,19 @@ public function getName()
80
80
}
81
81
82
82
/**
83
- * set default checked status
84
- * @param bool $default
83
+ * set default checked status.
84
+ *
85
85
* @return CheckBox
86
86
*/
87
87
public function setDefault (bool $ default = false )
88
88
{
89
89
$ this ->default = $ default ;
90
+
90
91
return $ this ;
91
92
}
92
93
93
94
/**
94
- * get default checked status
95
- * @return bool
95
+ * get default checked status.
96
96
*/
97
97
public function isDefault (): bool
98
98
{
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ public function write(): void
52
52
$ xmlWriter ->startElement ('w:checkBox ' );
53
53
$ xmlWriter ->writeAttribute ('w:sizeAuto ' , '' );
54
54
$ xmlWriter ->startElement ('w:default ' );
55
- $ xmlWriter ->writeAttribute ('w:val ' , $ element ->getDefault () ? 1 : 0 );
55
+ $ xmlWriter ->writeAttribute ('w:val ' , $ element ->isDefault () ? 1 : 0 );
56
56
$ xmlWriter ->endElement (); //w:default
57
57
$ xmlWriter ->endElement (); //w:checkBox
58
58
$ xmlWriter ->endElement (); // w:ffData
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -85,4 +85,16 @@ public function testParagraph(): void
85
85
$ oCheckBox ->setParagraphStyle (['alignment ' => Jc::CENTER , 'spaceAfter ' => 100 ]);
86
86
self ::assertInstanceOf ('PhpOffice \\PhpWord \\Style \\Paragraph ' , $ oCheckBox ->getParagraphStyle ());
87
87
}
88
+
89
+ /**
90
+ * Get default value.
91
+ */
92
+ public function testDefault (): void
93
+ {
94
+ $ oCheckBox = new CheckBox ('chkBox ' , 'CheckBox ' );
95
+ self ::assertFalse ($ oCheckBox ->isDefault ());
96
+
97
+ $ oCheckBox ->setDefault (true );
98
+ self ::assertTrue ($ oCheckBox ->isDefault ());
99
+ }
88
100
}
You can’t perform that action at this time.
0 commit comments