Skip to content

Commit fa1663a

Browse files
committed
PHP method IS NOT case sensitive :)
1 parent c364490 commit fa1663a

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

Classes/PHPWord/Style/Font.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public function __construct($type = 'text', $styleParagraph = null)
192192
*/
193193
public function setStyleValue($key, $value)
194194
{
195-
$method = 'set' . ucwords(substr($key, 1));
195+
$method = 'set' . substr($key, 1);
196196
if (method_exists($this, $method)) {
197197
$this->$method($value);
198198
}

Classes/PHPWord/Style/Paragraph.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public function setStyleValue($key, $value)
156156
if ($key == '_spacing') {
157157
$value += 240; // because line height of 1 matches 240 twips
158158
}
159-
$method = 'set' . ucwords(substr($key, 1));
159+
$method = 'set' . substr($key, 1);
160160
if (method_exists($this, $method)) {
161161
$this->$method($value);
162162
}

Tests/PHPWord/Style/FontTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ public function testSetStyleValueWithNullOrEmpty()
4545
'fgColor' => null,
4646
);
4747
foreach ($attributes as $key => $default) {
48-
$method = 'get' . ucwords($key);
48+
$get = "get{$key}";
4949
$object->setStyleValue("_$key", null);
50-
$this->assertEquals($default, $object->$method());
50+
$this->assertEquals($default, $object->$get());
5151
$object->setStyleValue("_$key", '');
52-
$this->assertEquals($default, $object->$method());
52+
$this->assertEquals($default, $object->$get());
5353
}
5454
}
5555

@@ -73,9 +73,9 @@ public function testSetStyleValueNormal()
7373
'fgColor' => '999999',
7474
);
7575
foreach ($attributes as $key => $value) {
76-
$method = 'get' . ucwords($key);
76+
$get = "get{$key}";
7777
$object->setStyleValue("_$key", $value);
78-
$this->assertEquals($value, $object->$method());
78+
$this->assertEquals($value, $object->$get());
7979
}
8080
}
8181

Tests/PHPWord/Style/ParagraphTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ public function testSetStyleValueWithNullOrEmpty()
2929
'pageBreakBefore' => false,
3030
);
3131
foreach ($attributes as $key => $default) {
32-
$method = 'get' . ucwords($key);
32+
$get = "get{$key}";
3333
$object->setStyleValue("_$key", null);
34-
$this->assertEquals($default, $object->$method());
34+
$this->assertEquals($default, $object->$get());
3535
$object->setStyleValue("_$key", '');
36-
$this->assertEquals($default, $object->$method());
36+
$this->assertEquals($default, $object->$get());
3737
}
3838
}
3939

@@ -59,7 +59,7 @@ public function testSetStyleValueNormal()
5959
'pageBreakBefore' => true,
6060
);
6161
foreach ($attributes as $key => $value) {
62-
$method = 'get' . ucwords($key);
62+
$get = "get{$key}";
6363
$object->setStyleValue("_$key", $value);
6464
if ($key == 'align') {
6565
if ($value == 'justify') {
@@ -70,7 +70,7 @@ public function testSetStyleValueNormal()
7070
} elseif ($key == 'spacing') {
7171
$value += 240;
7272
}
73-
$this->assertEquals($value, $object->$method());
73+
$this->assertEquals($value, $object->$get());
7474
}
7575
}
7676

0 commit comments

Comments
 (0)