Skip to content

Commit b367405

Browse files
committed
Renamed PhpOffice\PhpWord\Shared\String to PhpOffice\PhpWord\Shared\SharedString, as String is a special class name as of PHP7
1 parent 3a58c81 commit b367405

File tree

13 files changed

+26
-26
lines changed

13 files changed

+26
-26
lines changed

src/PhpWord/Element/Bookmark.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
namespace PhpOffice\PhpWord\Element;
1919

20-
use PhpOffice\PhpWord\Shared\String;
20+
use PhpOffice\PhpWord\Shared\SharedString;
2121
use PhpOffice\PhpWord\Style;
2222

2323
/**
@@ -47,7 +47,7 @@ class Bookmark extends AbstractElement
4747
public function __construct($name)
4848
{
4949

50-
$this->name = String::toUTF8($name);
50+
$this->name = SharedString::toUTF8($name);
5151
return $this;
5252
}
5353

src/PhpWord/Element/CheckBox.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
namespace PhpOffice\PhpWord\Element;
1919

20-
use PhpOffice\PhpWord\Shared\String;
20+
use PhpOffice\PhpWord\Shared\SharedString;
2121

2222
/**
2323
* Check box element
@@ -56,7 +56,7 @@ public function __construct($name = null, $text = null, $fontStyle = null, $para
5656
*/
5757
public function setName($name)
5858
{
59-
$this->name = String::toUTF8($name);
59+
$this->name = SharedString::toUTF8($name);
6060

6161
return $this;
6262
}

src/PhpWord/Element/Link.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
namespace PhpOffice\PhpWord\Element;
1919

20-
use PhpOffice\PhpWord\Shared\String;
20+
use PhpOffice\PhpWord\Shared\SharedString;
2121
use PhpOffice\PhpWord\Style\Font;
2222
use PhpOffice\PhpWord\Style\Paragraph;
2323

@@ -78,8 +78,8 @@ class Link extends AbstractElement
7878
*/
7979
public function __construct($source, $text = null, $fontStyle = null, $paragraphStyle = null, $internal = false)
8080
{
81-
$this->source = String::toUTF8($source);
82-
$this->text = is_null($text) ? $this->source : String::toUTF8($text);
81+
$this->source = SharedString::toUTF8($source);
82+
$this->text = is_null($text) ? $this->source : SharedString::toUTF8($text);
8383
$this->fontStyle = $this->setNewStyle(new Font('text'), $fontStyle);
8484
$this->paragraphStyle = $this->setNewStyle(new Paragraph(), $paragraphStyle);
8585
$this->internal = $internal;

src/PhpWord/Element/ListItem.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
namespace PhpOffice\PhpWord\Element;
1919

20-
use PhpOffice\PhpWord\Shared\String;
20+
use PhpOffice\PhpWord\Shared\SharedString;
2121
use PhpOffice\PhpWord\Style\ListItem as ListItemStyle;
2222

2323
/**
@@ -57,7 +57,7 @@ class ListItem extends AbstractElement
5757
*/
5858
public function __construct($text, $depth = 0, $fontStyle = null, $listStyle = null, $paragraphStyle = null)
5959
{
60-
$this->textObject = new Text(String::toUTF8($text), $fontStyle, $paragraphStyle);
60+
$this->textObject = new Text(SharedString::toUTF8($text), $fontStyle, $paragraphStyle);
6161
$this->depth = $depth;
6262

6363
// Version >= 0.10.0 will pass numbering style name. Older version will use old method

src/PhpWord/Element/PreserveText.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
namespace PhpOffice\PhpWord\Element;
1919

20-
use PhpOffice\PhpWord\Shared\String;
20+
use PhpOffice\PhpWord\Shared\SharedString;
2121
use PhpOffice\PhpWord\Style\Font;
2222
use PhpOffice\PhpWord\Style\Paragraph;
2323

@@ -61,7 +61,7 @@ public function __construct($text = null, $fontStyle = null, $paragraphStyle = n
6161
$this->fontStyle = $this->setNewStyle(new Font('text'), $fontStyle);
6262
$this->paragraphStyle = $this->setNewStyle(new Paragraph(), $paragraphStyle);
6363

64-
$this->text = String::toUTF8($text);
64+
$this->text = SharedString::toUTF8($text);
6565
$matches = preg_split('/({.*?})/', $this->text, null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
6666
if (isset($matches[0])) {
6767
$this->text = $matches;

src/PhpWord/Element/Text.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
namespace PhpOffice\PhpWord\Element;
1919

20-
use PhpOffice\PhpWord\Shared\String;
20+
use PhpOffice\PhpWord\Shared\SharedString;
2121
use PhpOffice\PhpWord\Style\Font;
2222
use PhpOffice\PhpWord\Style\Paragraph;
2323

@@ -136,7 +136,7 @@ public function getParagraphStyle()
136136
*/
137137
public function setText($text)
138138
{
139-
$this->text = String::toUTF8($text);
139+
$this->text = SharedString::toUTF8($text);
140140

141141
return $this;
142142
}

src/PhpWord/Element/Title.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
namespace PhpOffice\PhpWord\Element;
1919

20-
use PhpOffice\PhpWord\Shared\String;
20+
use PhpOffice\PhpWord\Shared\SharedString;
2121
use PhpOffice\PhpWord\Style;
2222

2323
/**
@@ -61,7 +61,7 @@ class Title extends AbstractElement
6161
*/
6262
public function __construct($text, $depth = 1)
6363
{
64-
$this->text = String::toUTF8($text);
64+
$this->text = SharedString::toUTF8($text);
6565
$this->depth = $depth;
6666
if (array_key_exists("Heading_{$this->depth}", Style::getStyles())) {
6767
$this->style = "Heading{$this->depth}";

src/PhpWord/Shared/String.php renamed to src/PhpWord/Shared/SharedString.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
/**
2121
* Common string functions
2222
*/
23-
class String
23+
class SharedString
2424
{
2525
/**
2626
* Control characters array

src/PhpWord/Style/AbstractStyle.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
namespace PhpOffice\PhpWord\Style;
1919

20-
use PhpOffice\PhpWord\Shared\String;
20+
use PhpOffice\PhpWord\Shared\SharedString;
2121

2222
/**
2323
* Abstract style class
@@ -161,7 +161,7 @@ public function setStyleValue($key, $value)
161161
if (isset($this->aliases[$key])) {
162162
$key = $this->aliases[$key];
163163
}
164-
$method = 'set' . String::removeUnderscorePrefix($key);
164+
$method = 'set' . SharedString::removeUnderscorePrefix($key);
165165
if (method_exists($this, $method)) {
166166
$this->$method($value);
167167
}

src/PhpWord/Style/Paragraph.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
namespace PhpOffice\PhpWord\Style;
1919

2020
use PhpOffice\PhpWord\Exception\InvalidStyleException;
21-
use PhpOffice\PhpWord\Shared\String;
21+
use PhpOffice\PhpWord\Shared\SharedString;
2222

2323
/**
2424
* Paragraph style
@@ -169,7 +169,7 @@ class Paragraph extends Border
169169
*/
170170
public function setStyleValue($key, $value)
171171
{
172-
$key = String::removeUnderscorePrefix($key);
172+
$key = SharedString::removeUnderscorePrefix($key);
173173
if ($key == 'indent' || $key == 'hanging') {
174174
$value = $value * 720;
175175
} elseif ($key == 'spacing') {

src/PhpWord/TemplateProcessor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
use PhpOffice\PhpWord\Exception\CopyFileException;
2121
use PhpOffice\PhpWord\Exception\CreateTemporaryFileException;
2222
use PhpOffice\PhpWord\Exception\Exception;
23-
use PhpOffice\PhpWord\Shared\String;
23+
use PhpOffice\PhpWord\Shared\SharedString;
2424
use PhpOffice\PhpWord\Shared\ZipArchive;
2525

2626
class TemplateProcessor
@@ -403,7 +403,7 @@ protected function setValueForPart($documentPartXML, $search, $replace, $limit)
403403
$search = '${' . $search . '}';
404404
}
405405

406-
if (!String::isUTF8($replace)) {
406+
if (!SharedString::isUTF8($replace)) {
407407
$replace = utf8_encode($replace);
408408
}
409409

src/PhpWord/Writer/RTF/Element/AbstractElement.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
namespace PhpOffice\PhpWord\Writer\RTF\Element;
1919

20-
use PhpOffice\PhpWord\Shared\String;
20+
use PhpOffice\PhpWord\Shared\SharedString;
2121
use PhpOffice\PhpWord\Style\Font as FontStyle;
2222
use PhpOffice\PhpWord\Style;
2323
use PhpOffice\PhpWord\Style\Paragraph as ParagraphStyle;
@@ -112,7 +112,7 @@ protected function writeOpening()
112112
*/
113113
protected function writeText($text)
114114
{
115-
return String::toUnicode($text);
115+
return SharedString::toUnicode($text);
116116
}
117117

118118
/**

src/PhpWord/Writer/Word2007/Element/AbstractElement.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
namespace PhpOffice\PhpWord\Writer\Word2007\Element;
1919

2020
use PhpOffice\PhpWord\Element\AbstractElement as Element;
21-
use PhpOffice\PhpWord\Shared\String;
21+
use PhpOffice\PhpWord\Shared\SharedString;
2222
use PhpOffice\PhpWord\Shared\XMLWriter;
2323

2424
/**
@@ -167,6 +167,6 @@ private function writeTextStyle($styleType)
167167
*/
168168
protected function getText($text)
169169
{
170-
return String::controlCharacterPHP2OOXML($text);
170+
return SharedString::controlCharacterPHP2OOXML($text);
171171
}
172172
}

0 commit comments

Comments
 (0)