From fa1663a2b185b5f96a2314581cc9bbbf7b3fa75d Mon Sep 17 00:00:00 2001 From: Ivan Lanin Date: Sun, 9 Mar 2014 21:59:23 +0700 Subject: [PATCH] PHP method IS NOT case sensitive :) --- Classes/PHPWord/Style/Font.php | 2 +- Classes/PHPWord/Style/Paragraph.php | 2 +- Tests/PHPWord/Style/FontTest.php | 10 +++++----- Tests/PHPWord/Style/ParagraphTest.php | 10 +++++----- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Classes/PHPWord/Style/Font.php b/Classes/PHPWord/Style/Font.php index 062fe839..43495cdc 100755 --- a/Classes/PHPWord/Style/Font.php +++ b/Classes/PHPWord/Style/Font.php @@ -192,7 +192,7 @@ class PHPWord_Style_Font */ public function setStyleValue($key, $value) { - $method = 'set' . ucwords(substr($key, 1)); + $method = 'set' . substr($key, 1); if (method_exists($this, $method)) { $this->$method($value); } diff --git a/Classes/PHPWord/Style/Paragraph.php b/Classes/PHPWord/Style/Paragraph.php index 5942ec34..c7104e8e 100755 --- a/Classes/PHPWord/Style/Paragraph.php +++ b/Classes/PHPWord/Style/Paragraph.php @@ -156,7 +156,7 @@ class PHPWord_Style_Paragraph if ($key == '_spacing') { $value += 240; // because line height of 1 matches 240 twips } - $method = 'set' . ucwords(substr($key, 1)); + $method = 'set' . substr($key, 1); if (method_exists($this, $method)) { $this->$method($value); } diff --git a/Tests/PHPWord/Style/FontTest.php b/Tests/PHPWord/Style/FontTest.php index 1238f34b..a3fa2086 100644 --- a/Tests/PHPWord/Style/FontTest.php +++ b/Tests/PHPWord/Style/FontTest.php @@ -45,11 +45,11 @@ class PHPWord_Style_FontTest extends \PHPUnit_Framework_TestCase 'fgColor' => null, ); foreach ($attributes as $key => $default) { - $method = 'get' . ucwords($key); + $get = "get{$key}"; $object->setStyleValue("_$key", null); - $this->assertEquals($default, $object->$method()); + $this->assertEquals($default, $object->$get()); $object->setStyleValue("_$key", ''); - $this->assertEquals($default, $object->$method()); + $this->assertEquals($default, $object->$get()); } } @@ -73,9 +73,9 @@ class PHPWord_Style_FontTest extends \PHPUnit_Framework_TestCase 'fgColor' => '999999', ); foreach ($attributes as $key => $value) { - $method = 'get' . ucwords($key); + $get = "get{$key}"; $object->setStyleValue("_$key", $value); - $this->assertEquals($value, $object->$method()); + $this->assertEquals($value, $object->$get()); } } diff --git a/Tests/PHPWord/Style/ParagraphTest.php b/Tests/PHPWord/Style/ParagraphTest.php index c0850cde..23d0b713 100644 --- a/Tests/PHPWord/Style/ParagraphTest.php +++ b/Tests/PHPWord/Style/ParagraphTest.php @@ -29,11 +29,11 @@ class PHPWord_Style_ParagraphTest extends \PHPUnit_Framework_TestCase 'pageBreakBefore' => false, ); foreach ($attributes as $key => $default) { - $method = 'get' . ucwords($key); + $get = "get{$key}"; $object->setStyleValue("_$key", null); - $this->assertEquals($default, $object->$method()); + $this->assertEquals($default, $object->$get()); $object->setStyleValue("_$key", ''); - $this->assertEquals($default, $object->$method()); + $this->assertEquals($default, $object->$get()); } } @@ -59,7 +59,7 @@ class PHPWord_Style_ParagraphTest extends \PHPUnit_Framework_TestCase 'pageBreakBefore' => true, ); foreach ($attributes as $key => $value) { - $method = 'get' . ucwords($key); + $get = "get{$key}"; $object->setStyleValue("_$key", $value); if ($key == 'align') { if ($value == 'justify') { @@ -70,7 +70,7 @@ class PHPWord_Style_ParagraphTest extends \PHPUnit_Framework_TestCase } elseif ($key == 'spacing') { $value += 240; } - $this->assertEquals($value, $object->$method()); + $this->assertEquals($value, $object->$get()); } }