[FIXED] Wrong use of passing by reference.

This commit is contained in:
Roman Syroeshko 2014-07-04 16:35:13 +04:00
parent fd209fc999
commit c4638df0d6
15 changed files with 30 additions and 32 deletions

View File

@ -128,10 +128,10 @@ abstract class AbstractElement
/**
* Set PhpWord as reference.
*
* @param \PhpOffice\PhpWord\PhpWord &$phpWord
* @param \PhpOffice\PhpWord\PhpWord $phpWord
* @return void
*/
public function setPhpWord(PhpWord &$phpWord = null)
public function setPhpWord(PhpWord $phpWord)
{
$this->phpWord = $phpWord;
}
@ -285,8 +285,7 @@ abstract class AbstractElement
}
// Set phpword
$phpWord = $container->getPhpWord();
$this->setPhpWord($phpWord);
$this->setPhpWord($container->getPhpWord());
// Set doc part
if (!$this instanceof Footnote) {

View File

@ -38,13 +38,13 @@ class Media
* @param string $container section|headerx|footerx|footnote|endnote
* @param string $mediaType image|object|link
* @param string $source
* @param \PhpOffice\PhpWord\Element\Image &$image
* @param \PhpOffice\PhpWord\Element\Image $image
* @return integer
* @throws \PhpOffice\PhpWord\Exception\Exception
* @since 0.9.2
* @since 0.10.0
*/
public static function addElement($container, $mediaType, $source, Image &$image = null)
public static function addElement($container, $mediaType, $source, Image $image = null)
{
// Assign unique media Id and initiate media container if none exists
$mediaId = md5($container . $source);

View File

@ -53,14 +53,14 @@ class ODText extends AbstractReader implements ReaderInterface
/**
* Read document part.
*
* @param \PhpOffice\PhpWord\PhpWord &$phpWord
* @param \PhpOffice\PhpWord\PhpWord $phpWord
* @param array $relationships
* @param string $partName
* @param string $docFile
* @param string $xmlFile
* @return void
*/
private function readPart(PhpWord &$phpWord, $relationships, $partName, $docFile, $xmlFile)
private function readPart(PhpWord $phpWord, $relationships, $partName, $docFile, $xmlFile)
{
$partClass = "PhpOffice\\PhpWord\\Reader\\ODText\\{$partName}";
if (class_exists($partClass)) {
@ -69,7 +69,6 @@ class ODText extends AbstractReader implements ReaderInterface
$part->setRels($relationships);
$part->read($phpWord);
}
}
/**

View File

@ -30,10 +30,10 @@ class Content extends AbstractPart
/**
* Read content.xml.
*
* @param \PhpOffice\PhpWord\PhpWord &$phpWord
* @param \PhpOffice\PhpWord\PhpWord $phpWord
* @return void
*/
public function read(PhpWord &$phpWord)
public function read(PhpWord $phpWord)
{
$xmlReader = new XMLReader();
$xmlReader->getDomFromZip($this->docFile, $this->xmlFile);

View File

@ -30,11 +30,11 @@ class Meta extends AbstractPart
/**
* Read meta.xml.
*
* @param \PhpOffice\PhpWord\PhpWord &$phpWord
* @param \PhpOffice\PhpWord\PhpWord $phpWord
* @return void
* @todo Process property type
*/
public function read(PhpWord &$phpWord)
public function read(PhpWord $phpWord)
{
$xmlReader = new XMLReader();
$xmlReader->getDomFromZip($this->docFile, $this->xmlFile);

View File

@ -129,11 +129,11 @@ class Document
* - Builds control words and control symbols
* - Pushes every other character into the text queue
*
* @param \PhpOffice\PhpWord\PhpWord &$phpWord
* @param \PhpOffice\PhpWord\PhpWord $phpWord
* @return void
* @todo Use `fread` stream for scalability
*/
public function read(PhpWord &$phpWord)
public function read(PhpWord $phpWord)
{
$markers = array(
123 => 'markOpening', // {

View File

@ -77,14 +77,14 @@ class Word2007 extends AbstractReader implements ReaderInterface
/**
* Read document part.
*
* @param \PhpOffice\PhpWord\PhpWord &$phpWord
* @param \PhpOffice\PhpWord\PhpWord $phpWord
* @param array $relationships
* @param string $partName
* @param string $docFile
* @param string $xmlFile
* @return void
*/
private function readPart(PhpWord &$phpWord, $relationships, $partName, $docFile, $xmlFile)
private function readPart(PhpWord $phpWord, $relationships, $partName, $docFile, $xmlFile)
{
$partClass = "PhpOffice\\PhpWord\\Reader\\Word2007\\{$partName}";
if (class_exists($partClass)) {

View File

@ -64,7 +64,7 @@ abstract class AbstractPart
/**
* Read part.
*/
abstract public function read(PhpWord &$phpWord);
abstract public function read(PhpWord $phpWord);
/**
* Create new instance

View File

@ -54,10 +54,10 @@ class DocPropsCore extends AbstractPart
/**
* Read core/extended document properties.
*
* @param \PhpOffice\PhpWord\PhpWord &$phpWord
* @param \PhpOffice\PhpWord\PhpWord $phpWord
* @return void
*/
public function read(PhpWord &$phpWord)
public function read(PhpWord $phpWord)
{
$xmlReader = new XMLReader();
$xmlReader->getDomFromZip($this->docFile, $this->xmlFile);

View File

@ -31,10 +31,10 @@ class DocPropsCustom extends AbstractPart
/**
* Read custom document properties.
*
* @param \PhpOffice\PhpWord\PhpWord &$phpWord
* @param \PhpOffice\PhpWord\PhpWord $phpWord
* @return void
*/
public function read(PhpWord &$phpWord)
public function read(PhpWord $phpWord)
{
$xmlReader = new XMLReader();
$xmlReader->getDomFromZip($this->docFile, $this->xmlFile);

View File

@ -39,10 +39,10 @@ class Document extends AbstractPart
/**
* Read document.xml.
*
* @param \PhpOffice\PhpWord\PhpWord &$phpWord
* @param \PhpOffice\PhpWord\PhpWord $phpWord
* @return void
*/
public function read(PhpWord &$phpWord)
public function read(PhpWord $phpWord)
{
$this->phpWord = $phpWord;
$xmlReader = new XMLReader();

View File

@ -44,10 +44,10 @@ class Footnotes extends AbstractPart
/**
* Read (footnotes|endnotes).xml.
*
* @param \PhpOffice\PhpWord\PhpWord &$phpWord
* @param \PhpOffice\PhpWord\PhpWord $phpWord
* @return void
*/
public function read(PhpWord &$phpWord)
public function read(PhpWord $phpWord)
{
$getMethod = "get{$this->collection}";
$collection = $phpWord->$getMethod()->getItems();

View File

@ -30,10 +30,10 @@ class Numbering extends AbstractPart
/**
* Read numbering.xml.
*
* @param \PhpOffice\PhpWord\PhpWord &$phpWord
* @param \PhpOffice\PhpWord\PhpWord $phpWord
* @return void
*/
public function read(PhpWord &$phpWord)
public function read(PhpWord $phpWord)
{
$abstracts = array();
$numberings = array();

View File

@ -30,10 +30,10 @@ class Styles extends AbstractPart
/**
* Read styles.xml.
*
* @param \PhpOffice\PhpWord\PhpWord &$phpWord
* @param \PhpOffice\PhpWord\PhpWord $phpWord
* @return void
*/
public function read(PhpWord &$phpWord)
public function read(PhpWord $phpWord)
{
$xmlReader = new XMLReader();
$xmlReader->getDomFromZip($this->docFile, $this->xmlFile);

View File

@ -106,13 +106,13 @@ class Template
/**
* Applies XSL style sheet to template's parts.
*
* @param \DOMDocument &$xslDOMDocument
* @param \DOMDocument $xslDOMDocument
* @param array $xslOptions
* @param string $xslOptionsURI
* @return void
* @throws \PhpOffice\PhpWord\Exception\Exception
*/
public function applyXslStyleSheet(&$xslDOMDocument, $xslOptions = array(), $xslOptionsURI = '')
public function applyXslStyleSheet($xslDOMDocument, $xslOptions = array(), $xslOptionsURI = '')
{
$processor = new \XSLTProcessor();