From b3674056d6d2b02ac06f22c360c9977115a57ea3 Mon Sep 17 00:00:00 2001 From: Benjamin Wijchers Date: Mon, 5 Oct 2015 14:20:58 +0200 Subject: [PATCH] Renamed PhpOffice\PhpWord\Shared\String to PhpOffice\PhpWord\Shared\SharedString, as String is a special class name as of PHP7 --- src/PhpWord/Element/Bookmark.php | 4 ++-- src/PhpWord/Element/CheckBox.php | 4 ++-- src/PhpWord/Element/Link.php | 6 +++--- src/PhpWord/Element/ListItem.php | 4 ++-- src/PhpWord/Element/PreserveText.php | 4 ++-- src/PhpWord/Element/Text.php | 4 ++-- src/PhpWord/Element/Title.php | 4 ++-- src/PhpWord/Shared/{String.php => SharedString.php} | 2 +- src/PhpWord/Style/AbstractStyle.php | 4 ++-- src/PhpWord/Style/Paragraph.php | 4 ++-- src/PhpWord/TemplateProcessor.php | 4 ++-- src/PhpWord/Writer/RTF/Element/AbstractElement.php | 4 ++-- src/PhpWord/Writer/Word2007/Element/AbstractElement.php | 4 ++-- 13 files changed, 26 insertions(+), 26 deletions(-) rename src/PhpWord/Shared/{String.php => SharedString.php} (99%) diff --git a/src/PhpWord/Element/Bookmark.php b/src/PhpWord/Element/Bookmark.php index d5b8ff6fba..5b751a0481 100644 --- a/src/PhpWord/Element/Bookmark.php +++ b/src/PhpWord/Element/Bookmark.php @@ -17,7 +17,7 @@ namespace PhpOffice\PhpWord\Element; -use PhpOffice\PhpWord\Shared\String; +use PhpOffice\PhpWord\Shared\SharedString; use PhpOffice\PhpWord\Style; /** @@ -47,7 +47,7 @@ class Bookmark extends AbstractElement public function __construct($name) { - $this->name = String::toUTF8($name); + $this->name = SharedString::toUTF8($name); return $this; } diff --git a/src/PhpWord/Element/CheckBox.php b/src/PhpWord/Element/CheckBox.php index d3b2a3c6f4..c4e58b3ed5 100644 --- a/src/PhpWord/Element/CheckBox.php +++ b/src/PhpWord/Element/CheckBox.php @@ -17,7 +17,7 @@ namespace PhpOffice\PhpWord\Element; -use PhpOffice\PhpWord\Shared\String; +use PhpOffice\PhpWord\Shared\SharedString; /** * Check box element @@ -56,7 +56,7 @@ public function __construct($name = null, $text = null, $fontStyle = null, $para */ public function setName($name) { - $this->name = String::toUTF8($name); + $this->name = SharedString::toUTF8($name); return $this; } diff --git a/src/PhpWord/Element/Link.php b/src/PhpWord/Element/Link.php index 9d0eb76662..289a00bd18 100644 --- a/src/PhpWord/Element/Link.php +++ b/src/PhpWord/Element/Link.php @@ -17,7 +17,7 @@ namespace PhpOffice\PhpWord\Element; -use PhpOffice\PhpWord\Shared\String; +use PhpOffice\PhpWord\Shared\SharedString; use PhpOffice\PhpWord\Style\Font; use PhpOffice\PhpWord\Style\Paragraph; @@ -78,8 +78,8 @@ class Link extends AbstractElement */ public function __construct($source, $text = null, $fontStyle = null, $paragraphStyle = null, $internal = false) { - $this->source = String::toUTF8($source); - $this->text = is_null($text) ? $this->source : String::toUTF8($text); + $this->source = SharedString::toUTF8($source); + $this->text = is_null($text) ? $this->source : SharedString::toUTF8($text); $this->fontStyle = $this->setNewStyle(new Font('text'), $fontStyle); $this->paragraphStyle = $this->setNewStyle(new Paragraph(), $paragraphStyle); $this->internal = $internal; diff --git a/src/PhpWord/Element/ListItem.php b/src/PhpWord/Element/ListItem.php index 4cb8d33952..ecb153b56b 100644 --- a/src/PhpWord/Element/ListItem.php +++ b/src/PhpWord/Element/ListItem.php @@ -17,7 +17,7 @@ namespace PhpOffice\PhpWord\Element; -use PhpOffice\PhpWord\Shared\String; +use PhpOffice\PhpWord\Shared\SharedString; use PhpOffice\PhpWord\Style\ListItem as ListItemStyle; /** @@ -57,7 +57,7 @@ class ListItem extends AbstractElement */ public function __construct($text, $depth = 0, $fontStyle = null, $listStyle = null, $paragraphStyle = null) { - $this->textObject = new Text(String::toUTF8($text), $fontStyle, $paragraphStyle); + $this->textObject = new Text(SharedString::toUTF8($text), $fontStyle, $paragraphStyle); $this->depth = $depth; // Version >= 0.10.0 will pass numbering style name. Older version will use old method diff --git a/src/PhpWord/Element/PreserveText.php b/src/PhpWord/Element/PreserveText.php index 44aef3b40e..d41f9f4d74 100644 --- a/src/PhpWord/Element/PreserveText.php +++ b/src/PhpWord/Element/PreserveText.php @@ -17,7 +17,7 @@ namespace PhpOffice\PhpWord\Element; -use PhpOffice\PhpWord\Shared\String; +use PhpOffice\PhpWord\Shared\SharedString; use PhpOffice\PhpWord\Style\Font; use PhpOffice\PhpWord\Style\Paragraph; @@ -61,7 +61,7 @@ public function __construct($text = null, $fontStyle = null, $paragraphStyle = n $this->fontStyle = $this->setNewStyle(new Font('text'), $fontStyle); $this->paragraphStyle = $this->setNewStyle(new Paragraph(), $paragraphStyle); - $this->text = String::toUTF8($text); + $this->text = SharedString::toUTF8($text); $matches = preg_split('/({.*?})/', $this->text, null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); if (isset($matches[0])) { $this->text = $matches; diff --git a/src/PhpWord/Element/Text.php b/src/PhpWord/Element/Text.php index 52fccb3f28..754b92e190 100644 --- a/src/PhpWord/Element/Text.php +++ b/src/PhpWord/Element/Text.php @@ -17,7 +17,7 @@ namespace PhpOffice\PhpWord\Element; -use PhpOffice\PhpWord\Shared\String; +use PhpOffice\PhpWord\Shared\SharedString; use PhpOffice\PhpWord\Style\Font; use PhpOffice\PhpWord\Style\Paragraph; @@ -136,7 +136,7 @@ public function getParagraphStyle() */ public function setText($text) { - $this->text = String::toUTF8($text); + $this->text = SharedString::toUTF8($text); return $this; } diff --git a/src/PhpWord/Element/Title.php b/src/PhpWord/Element/Title.php index cf1d49c81a..909b9578d6 100644 --- a/src/PhpWord/Element/Title.php +++ b/src/PhpWord/Element/Title.php @@ -17,7 +17,7 @@ namespace PhpOffice\PhpWord\Element; -use PhpOffice\PhpWord\Shared\String; +use PhpOffice\PhpWord\Shared\SharedString; use PhpOffice\PhpWord\Style; /** @@ -61,7 +61,7 @@ class Title extends AbstractElement */ public function __construct($text, $depth = 1) { - $this->text = String::toUTF8($text); + $this->text = SharedString::toUTF8($text); $this->depth = $depth; if (array_key_exists("Heading_{$this->depth}", Style::getStyles())) { $this->style = "Heading{$this->depth}"; diff --git a/src/PhpWord/Shared/String.php b/src/PhpWord/Shared/SharedString.php similarity index 99% rename from src/PhpWord/Shared/String.php rename to src/PhpWord/Shared/SharedString.php index be04fd0ec7..4497513f4f 100644 --- a/src/PhpWord/Shared/String.php +++ b/src/PhpWord/Shared/SharedString.php @@ -20,7 +20,7 @@ /** * Common string functions */ -class String +class SharedString { /** * Control characters array diff --git a/src/PhpWord/Style/AbstractStyle.php b/src/PhpWord/Style/AbstractStyle.php index ab1a1ee729..041035cb02 100644 --- a/src/PhpWord/Style/AbstractStyle.php +++ b/src/PhpWord/Style/AbstractStyle.php @@ -17,7 +17,7 @@ namespace PhpOffice\PhpWord\Style; -use PhpOffice\PhpWord\Shared\String; +use PhpOffice\PhpWord\Shared\SharedString; /** * Abstract style class @@ -161,7 +161,7 @@ public function setStyleValue($key, $value) if (isset($this->aliases[$key])) { $key = $this->aliases[$key]; } - $method = 'set' . String::removeUnderscorePrefix($key); + $method = 'set' . SharedString::removeUnderscorePrefix($key); if (method_exists($this, $method)) { $this->$method($value); } diff --git a/src/PhpWord/Style/Paragraph.php b/src/PhpWord/Style/Paragraph.php index ff89b9d5c9..907c4e6bf0 100644 --- a/src/PhpWord/Style/Paragraph.php +++ b/src/PhpWord/Style/Paragraph.php @@ -18,7 +18,7 @@ namespace PhpOffice\PhpWord\Style; use PhpOffice\PhpWord\Exception\InvalidStyleException; -use PhpOffice\PhpWord\Shared\String; +use PhpOffice\PhpWord\Shared\SharedString; /** * Paragraph style @@ -169,7 +169,7 @@ class Paragraph extends Border */ public function setStyleValue($key, $value) { - $key = String::removeUnderscorePrefix($key); + $key = SharedString::removeUnderscorePrefix($key); if ($key == 'indent' || $key == 'hanging') { $value = $value * 720; } elseif ($key == 'spacing') { diff --git a/src/PhpWord/TemplateProcessor.php b/src/PhpWord/TemplateProcessor.php index ce92bacfbe..d822271da9 100644 --- a/src/PhpWord/TemplateProcessor.php +++ b/src/PhpWord/TemplateProcessor.php @@ -20,7 +20,7 @@ use PhpOffice\PhpWord\Exception\CopyFileException; use PhpOffice\PhpWord\Exception\CreateTemporaryFileException; use PhpOffice\PhpWord\Exception\Exception; -use PhpOffice\PhpWord\Shared\String; +use PhpOffice\PhpWord\Shared\SharedString; use PhpOffice\PhpWord\Shared\ZipArchive; class TemplateProcessor @@ -403,7 +403,7 @@ protected function setValueForPart($documentPartXML, $search, $replace, $limit) $search = '${' . $search . '}'; } - if (!String::isUTF8($replace)) { + if (!SharedString::isUTF8($replace)) { $replace = utf8_encode($replace); } diff --git a/src/PhpWord/Writer/RTF/Element/AbstractElement.php b/src/PhpWord/Writer/RTF/Element/AbstractElement.php index 73da5cbddb..3807b5c97f 100644 --- a/src/PhpWord/Writer/RTF/Element/AbstractElement.php +++ b/src/PhpWord/Writer/RTF/Element/AbstractElement.php @@ -17,7 +17,7 @@ namespace PhpOffice\PhpWord\Writer\RTF\Element; -use PhpOffice\PhpWord\Shared\String; +use PhpOffice\PhpWord\Shared\SharedString; use PhpOffice\PhpWord\Style\Font as FontStyle; use PhpOffice\PhpWord\Style; use PhpOffice\PhpWord\Style\Paragraph as ParagraphStyle; @@ -112,7 +112,7 @@ protected function writeOpening() */ protected function writeText($text) { - return String::toUnicode($text); + return SharedString::toUnicode($text); } /** diff --git a/src/PhpWord/Writer/Word2007/Element/AbstractElement.php b/src/PhpWord/Writer/Word2007/Element/AbstractElement.php index 3b6432ed6a..1cca86380a 100644 --- a/src/PhpWord/Writer/Word2007/Element/AbstractElement.php +++ b/src/PhpWord/Writer/Word2007/Element/AbstractElement.php @@ -18,7 +18,7 @@ namespace PhpOffice\PhpWord\Writer\Word2007\Element; use PhpOffice\PhpWord\Element\AbstractElement as Element; -use PhpOffice\PhpWord\Shared\String; +use PhpOffice\PhpWord\Shared\SharedString; use PhpOffice\PhpWord\Shared\XMLWriter; /** @@ -167,6 +167,6 @@ private function writeTextStyle($styleType) */ protected function getText($text) { - return String::controlCharacterPHP2OOXML($text); + return SharedString::controlCharacterPHP2OOXML($text); } }