Skip to content

Change properties and methods name to follow PSR standards #128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Classes/PHPWord/HashTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@

/**
* PHPWord_HashTable
*
* @codeCoverageIgnore Legacy from PHPExcel
*/
class PHPWord_HashTable
{
Expand Down
10 changes: 5 additions & 5 deletions Classes/PHPWord/Section.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public function getSettings()
*/
public function addText($text, $styleFont = null, $styleParagraph = null)
{
if (!PHPWord_Shared_String::IsUTF8($text)) {
if (!PHPWord_Shared_String::isUTF8($text)) {
$text = utf8_encode($text);
}
$text = new PHPWord_Section_Text($text, $styleFont, $styleParagraph);
Expand All @@ -136,11 +136,11 @@ public function addText($text, $styleFont = null, $styleParagraph = null)
*/
public function addLink($linkSrc, $linkName = null, $styleFont = null, $styleParagraph = null)
{
if (!PHPWord_Shared_String::IsUTF8($linkSrc)) {
if (!PHPWord_Shared_String::isUTF8($linkSrc)) {
$linkSrc = utf8_encode($linkSrc);
}
if (!is_null($linkName)) {
if (!PHPWord_Shared_String::IsUTF8($linkName)) {
if (!PHPWord_Shared_String::isUTF8($linkName)) {
$linkName = utf8_encode($linkName);
}
}
Expand Down Expand Up @@ -198,7 +198,7 @@ public function addTable($style = null)
*/
public function addListItem($text, $depth = 0, $styleFont = null, $styleList = null, $styleParagraph = null)
{
if (!PHPWord_Shared_String::IsUTF8($text)) {
if (!PHPWord_Shared_String::isUTF8($text)) {
$text = utf8_encode($text);
}
$listItem = new PHPWord_Section_ListItem($text, $depth, $styleFont, $styleList, $styleParagraph);
Expand Down Expand Up @@ -319,7 +319,7 @@ public function addTOC($styleFont = null, $styleTOC = null)
*/
public function addTitle($text, $depth = 1)
{
if (!PHPWord_Shared_String::IsUTF8($text)) {
if (!PHPWord_Shared_String::isUTF8($text)) {
$text = utf8_encode($text);
}
$styles = PHPWord_Style::getStyles();
Expand Down
4 changes: 2 additions & 2 deletions Classes/PHPWord/Section/Footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function __construct($sectionCount)
*/
public function addText($text, $styleFont = null, $styleParagraph = null)
{
if (!PHPWord_Shared_String::IsUTF8($text)) {
if (!PHPWord_Shared_String::isUTF8($text)) {
$text = utf8_encode($text);
}
$text = new PHPWord_Section_Text($text, $styleFont, $styleParagraph);
Expand Down Expand Up @@ -168,7 +168,7 @@ public function addMemoryImage($link, $style = null)
*/
public function addPreserveText($text, $styleFont = null, $styleParagraph = null)
{
if (!PHPWord_Shared_String::IsUTF8($text)) {
if (!PHPWord_Shared_String::isUTF8($text)) {
$text = utf8_encode($text);
}
$ptext = new PHPWord_Section_Footer_PreserveText($text, $styleFont, $styleParagraph);
Expand Down
4 changes: 2 additions & 2 deletions Classes/PHPWord/Section/Header.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function __construct($sectionCount)
*/
public function addText($text, $styleFont = null, $styleParagraph = null)
{
if (!PHPWord_Shared_String::IsUTF8($text)) {
if (!PHPWord_Shared_String::isUTF8($text)) {
$text = utf8_encode($text);
}
$text = new PHPWord_Section_Text($text, $styleFont, $styleParagraph);
Expand Down Expand Up @@ -197,7 +197,7 @@ public function addMemoryImage($link, $style = null)
*/
public function addPreserveText($text, $styleFont = null, $styleParagraph = null)
{
if (!PHPWord_Shared_String::IsUTF8($text)) {
if (!PHPWord_Shared_String::isUTF8($text)) {
$text = utf8_encode($text);
}
$ptext = new PHPWord_Section_Footer_PreserveText($text, $styleFont, $styleParagraph);
Expand Down
10 changes: 5 additions & 5 deletions Classes/PHPWord/Section/Table/Cell.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function __construct($insideOf, $pCount, $width = null, $style = null)
*/
public function addText($text, $styleFont = null, $styleParagraph = null)
{
if (!PHPWord_Shared_String::IsUTF8($text)) {
if (!PHPWord_Shared_String::isUTF8($text)) {
$text = utf8_encode($text);
}
$text = new PHPWord_Section_Text($text, $styleFont, $styleParagraph);
Expand All @@ -124,11 +124,11 @@ public function addText($text, $styleFont = null, $styleParagraph = null)
public function addLink($linkSrc, $linkName = null, $style = null)
{
if ($this->_insideOf == 'section') {
if (!PHPWord_Shared_String::IsUTF8($linkSrc)) {
if (!PHPWord_Shared_String::isUTF8($linkSrc)) {
$linkSrc = utf8_encode($linkSrc);
}
if (!is_null($linkName)) {
if (!PHPWord_Shared_String::IsUTF8($linkName)) {
if (!PHPWord_Shared_String::isUTF8($linkName)) {
$linkName = utf8_encode($linkName);
}
}
Expand Down Expand Up @@ -166,7 +166,7 @@ public function addTextBreak()
*/
public function addListItem($text, $depth = 0, $styleText = null, $styleList = null)
{
if (!PHPWord_Shared_String::IsUTF8($text)) {
if (!PHPWord_Shared_String::isUTF8($text)) {
$text = utf8_encode($text);
}
$listItem = new PHPWord_Section_ListItem($text, $depth, $styleText, $styleList);
Expand Down Expand Up @@ -281,7 +281,7 @@ public function addObject($src, $style = null)
public function addPreserveText($text, $styleFont = null, $styleParagraph = null)
{
if ($this->_insideOf == 'footer' || $this->_insideOf == 'header') {
if (!PHPWord_Shared_String::IsUTF8($text)) {
if (!PHPWord_Shared_String::isUTF8($text)) {
$text = utf8_encode($text);
}
$ptext = new PHPWord_Section_Footer_PreserveText($text, $styleFont, $styleParagraph);
Expand Down
2 changes: 1 addition & 1 deletion Classes/PHPWord/Section/Table/Row.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
* @category PHPWord
* @package PHPWord
* @copyright Copyright (c) 2013 PHPWord
* @copyright Copyright (c) 2014 PHPWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.7.0
*/
Expand Down
2 changes: 1 addition & 1 deletion Classes/PHPWord/Section/TextRun.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function __construct($styleParagraph = null)
*/
public function addText($text = null, $styleFont = null)
{
if (!PHPWord_Shared_String::IsUTF8($text)) {
if (!PHPWord_Shared_String::isUTF8($text)) {
$text = utf8_encode($text);
}
$text = new PHPWord_Section_Text($text, $styleFont);
Expand Down
2 changes: 1 addition & 1 deletion Classes/PHPWord/Shared/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class PHPWord_Shared_File
* @param string $pFilename Filename
* @return bool
*/
public static function file_exists($pFilename)
public static function fileExists($pFilename)
{
// Sick construction, but it seems that
// file_exists returns strange values when
Expand Down
20 changes: 10 additions & 10 deletions Classes/PHPWord/Shared/String.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public static function getIsIconvEnabled()
* @param string $value Value to unescape
* @return string
*/
public static function ControlCharacterOOXML2PHP($value = '')
public static function controlCharacterOOXML2PHP($value = '')
{
if (empty(self::$_controlCharacters)) {
self::_buildControlCharacters();
Expand All @@ -136,7 +136,7 @@ public static function ControlCharacterOOXML2PHP($value = '')
* @param string $value Value to escape
* @return string
*/
public static function ControlCharacterPHP2OOXML($value = '')
public static function controlCharacterPHP2OOXML($value = '')
{
if (empty(self::$_controlCharacters)) {
self::_buildControlCharacters();
Expand All @@ -151,7 +151,7 @@ public static function ControlCharacterPHP2OOXML($value = '')
* @param string $value
* @return boolean
*/
public static function IsUTF8($value = '')
public static function isUTF8($value = '')
{
return $value === '' || preg_match('/^./su', $value) === 1;
}
Expand All @@ -162,7 +162,7 @@ public static function IsUTF8($value = '')
* @param mixed $value
* @return string
*/
public static function FormatNumber($value)
public static function formatNumber($value)
{
return number_format($value, 2, '.', '');
}
Expand All @@ -180,14 +180,14 @@ public static function FormatNumber($value)
public static function UTF8toBIFF8UnicodeShort($value)
{
// character count
$ln = self::CountCharacters($value, 'UTF-8');
$ln = self::countCharacters($value, 'UTF-8');

// option flags
$opt = (self::getIsMbstringEnabled() || self::getIsIconvEnabled()) ?
0x0001 : 0x0000;

// characters
$chars = self::ConvertEncoding($value, 'UTF-16LE', 'UTF-8');
$chars = self::convertEncoding($value, 'UTF-16LE', 'UTF-8');

$data = pack('CC', $ln, $opt) . $chars;
return $data;
Expand All @@ -206,14 +206,14 @@ public static function UTF8toBIFF8UnicodeShort($value)
public static function UTF8toBIFF8UnicodeLong($value)
{
// character count
$ln = self::CountCharacters($value, 'UTF-8');
$ln = self::countCharacters($value, 'UTF-8');

// option flags
$opt = (self::getIsMbstringEnabled() || self::getIsIconvEnabled()) ?
0x0001 : 0x0000;

// characters
$chars = self::ConvertEncoding($value, 'UTF-16LE', 'UTF-8');
$chars = self::convertEncoding($value, 'UTF-16LE', 'UTF-8');

$data = pack('vC', $ln, $opt) . $chars;
return $data;
Expand All @@ -227,7 +227,7 @@ public static function UTF8toBIFF8UnicodeLong($value)
* @param string $from Encoding to convert from, e.g. 'UTF-16LE'
* @return string
*/
public static function ConvertEncoding($value, $to, $from)
public static function convertEncoding($value, $to, $from)
{
if (self::getIsMbstringEnabled()) {
$value = mb_convert_encoding($value, $to, $from);
Expand All @@ -250,7 +250,7 @@ public static function ConvertEncoding($value, $to, $from)
* @param string $enc Encoding
* @return int Character count
*/
public static function CountCharacters($value, $enc = 'UTF-8')
public static function countCharacters($value, $enc = 'UTF-8')
{
if (self::getIsMbstringEnabled()) {
$count = mb_strlen($value, $enc);
Expand Down
14 changes: 8 additions & 6 deletions Classes/PHPWord/Shared/ZipStreamWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@

/**
* Class PHPWord_Shared_ZipStreamWrapper
*
* @codeCoverageIgnore Legacy from PHPExcel
*/
class PHPWord_Shared_ZipStreamWrapper
{
Expand Down Expand Up @@ -73,7 +75,7 @@ public static function register()
/**
* Open stream
*/
public function stream_open($path, $mode, $options, &$opened_path)
public function streamOpen($path, $mode, $options, &$opened_path)
{
// Check for mode
if ($mode{0} != 'r') {
Expand Down Expand Up @@ -113,15 +115,15 @@ public function stream_open($path, $mode, $options, &$opened_path)
/**
* Stat stream
*/
public function stream_stat()
public function streamStat()
{
return $this->_archive->statName($this->_fileNameInArchive);
}

/**
* Read stream
*/
public function stream_read($count)
public function streamRead($count)
{
$ret = substr($this->_data, $this->_position, $count);
$this->_position += strlen($ret);
Expand All @@ -131,23 +133,23 @@ public function stream_read($count)
/**
* Tell stream
*/
public function stream_tell()
public function streamTell()
{
return $this->_position;
}

/**
* EOF stream
*/
public function stream_eof()
public function streamEOF()
{
return $this->_position >= strlen($this->_data);
}

/**
* Seek stream
*/
public function stream_seek($offset, $whence)
public function streamSeek($offset, $whence)
{
switch ($whence) {
case SEEK_SET:
Expand Down
2 changes: 1 addition & 1 deletion Classes/PHPWord/Style/Row.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
* @category PHPWord
* @package PHPWord
* @copyright Copyright (c) 2013 PHPWord
* @copyright Copyright (c) 2014 PHPWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.7.0
*/
Expand Down
Loading