DocBlock and use fixes

This commit is contained in:
Ivan Lanin 2014-04-03 10:13:13 +07:00
parent 1ebd26ddc6
commit 7c549f5802
26 changed files with 110 additions and 157 deletions

View File

@ -16,6 +16,7 @@ use PhpOffice\PhpWord\Style;
use PhpOffice\PhpWord\TOC;
use PhpOffice\PhpWord\Footnote as FootnoteCollection;
use PhpOffice\PhpWord\Shared\String;
use PhpOffice\PhpWord\Element\Element;
use PhpOffice\PhpWord\Element\Text;
use PhpOffice\PhpWord\Element\TextRun;
use PhpOffice\PhpWord\Element\Link;
@ -34,7 +35,7 @@ use PhpOffice\PhpWord\Element\CheckBox;
*
* @since 0.9.2
*/
abstract class Container
abstract class Container extends Element
{
/**
* Container type section|header|footer|cell|textrun|footnote
@ -53,7 +54,7 @@ abstract class Container
/**
* Elements collection
*
* @var int
* @var array
*/
protected $elements = array();
@ -487,37 +488,10 @@ abstract class Container
return $this->addFootnote($paragraphStyle);
}
/**
* Set style value
*
* Used by Footnote
*
* @param mixed $styleObject Style object, could be Font, Paragraph, Cell, Image
* @param mixed $styleValue
* @param boolean $returnObject Always return object
* @todo Remove duplicate with ..\Element\Element
*/
protected function setStyle($styleObject, $styleValue = null, $returnObject = false)
{
if (!is_null($styleValue) && is_array($styleValue)) {
foreach ($styleValue as $key => $value) {
if (substr($key, 0, 1) != '_') {
$key = '_' . $key;
}
$styleObject->setStyleValue($key, $value);
}
$style = $styleObject;
} else {
$style = $returnObject ? $styleObject : $styleValue;
}
return $style;
}
/**
* Check if a method is allowed for the current container
*
* @param string $element
* @param string $method
* @return boolean
*/
private function checkValidity($method)

View File

@ -36,7 +36,7 @@ class Header extends Container
/**
* Create new instance
*
* @param int $sectionCount
* @param int $sectionId
*/
public function __construct($sectionId)
{

View File

@ -46,7 +46,7 @@ class Section extends Container
* Create new instance
*
* @param int $sectionCount
* @param mixed $settings
* @param array $settings
*/
public function __construct($sectionCount, $settings = null)
{
@ -132,7 +132,7 @@ class Section extends Container
/**
* Get Headers
*
* @return array
* @return Header[]
*/
public function getHeaders()
{

View File

@ -27,101 +27,101 @@ class DocumentProperties
*
* @var string
*/
private $_creator;
private $creator;
/**
* LastModifiedBy
*
* @var string
*/
private $_lastModifiedBy;
private $lastModifiedBy;
/**
* Created
*
* @var int
*/
private $_created;
private $created;
/**
* Modified
*
* @var int
*/
private $_modified;
private $modified;
/**
* Title
*
* @var string
*/
private $_title;
private $title;
/**
* Description
*
* @var string
*/
private $_description;
private $description;
/**
* Subject
*
* @var string
*/
private $_subject;
private $subject;
/**
* Keywords
*
* @var string
*/
private $_keywords;
private $keywords;
/**
* Category
*
* @var string
*/
private $_category;
private $category;
/**
* Company
*
* @var string
*/
private $_company;
private $company;
/**
* Manager
*
* @var string
*/
private $_manager;
private $manager;
/**
* Custom Properties
*
* @var array
*/
private $_customProperties = array();
private $customProperties = array();
/**
* Create new DocumentProperties
*/
public function __construct()
{
$this->_creator = '';
$this->_lastModifiedBy = $this->_creator;
$this->_created = time();
$this->_modified = time();
$this->_title = '';
$this->_subject = '';
$this->_description = '';
$this->_keywords = '';
$this->_category = '';
$this->_company = '';
$this->_manager = '';
$this->creator = '';
$this->lastModifiedBy = $this->creator;
$this->created = time();
$this->modified = time();
$this->title = '';
$this->subject = '';
$this->description = '';
$this->keywords = '';
$this->category = '';
$this->company = '';
$this->manager = '';
}
/**
@ -131,7 +131,7 @@ class DocumentProperties
*/
public function getCreator()
{
return $this->_creator;
return $this->creator;
}
/**
@ -142,7 +142,7 @@ class DocumentProperties
*/
public function setCreator($pValue = '')
{
$this->_creator = $pValue;
$this->creator = $pValue;
return $this;
}
@ -153,7 +153,7 @@ class DocumentProperties
*/
public function getLastModifiedBy()
{
return $this->_lastModifiedBy;
return $this->lastModifiedBy;
}
/**
@ -164,7 +164,7 @@ class DocumentProperties
*/
public function setLastModifiedBy($pValue = '')
{
$this->_lastModifiedBy = $pValue;
$this->lastModifiedBy = $pValue;
return $this;
}
@ -175,7 +175,7 @@ class DocumentProperties
*/
public function getCreated()
{
return $this->_created;
return $this->created;
}
/**
@ -189,7 +189,7 @@ class DocumentProperties
if (is_null($pValue)) {
$pValue = time();
}
$this->_created = $pValue;
$this->created = $pValue;
return $this;
}
@ -200,7 +200,7 @@ class DocumentProperties
*/
public function getModified()
{
return $this->_modified;
return $this->modified;
}
/**
@ -214,7 +214,7 @@ class DocumentProperties
if (is_null($pValue)) {
$pValue = time();
}
$this->_modified = $pValue;
$this->modified = $pValue;
return $this;
}
@ -225,7 +225,7 @@ class DocumentProperties
*/
public function getTitle()
{
return $this->_title;
return $this->title;
}
/**
@ -236,7 +236,7 @@ class DocumentProperties
*/
public function setTitle($pValue = '')
{
$this->_title = $pValue;
$this->title = $pValue;
return $this;
}
@ -247,7 +247,7 @@ class DocumentProperties
*/
public function getDescription()
{
return $this->_description;
return $this->description;
}
/**
@ -258,7 +258,7 @@ class DocumentProperties
*/
public function setDescription($pValue = '')
{
$this->_description = $pValue;
$this->description = $pValue;
return $this;
}
@ -269,7 +269,7 @@ class DocumentProperties
*/
public function getSubject()
{
return $this->_subject;
return $this->subject;
}
/**
@ -280,7 +280,7 @@ class DocumentProperties
*/
public function setSubject($pValue = '')
{
$this->_subject = $pValue;
$this->subject = $pValue;
return $this;
}
@ -291,7 +291,7 @@ class DocumentProperties
*/
public function getKeywords()
{
return $this->_keywords;
return $this->keywords;
}
/**
@ -302,7 +302,7 @@ class DocumentProperties
*/
public function setKeywords($pValue = '')
{
$this->_keywords = $pValue;
$this->keywords = $pValue;
return $this;
}
@ -313,7 +313,7 @@ class DocumentProperties
*/
public function getCategory()
{
return $this->_category;
return $this->category;
}
/**
@ -324,7 +324,7 @@ class DocumentProperties
*/
public function setCategory($pValue = '')
{
$this->_category = $pValue;
$this->category = $pValue;
return $this;
}
@ -335,7 +335,7 @@ class DocumentProperties
*/
public function getCompany()
{
return $this->_company;
return $this->company;
}
/**
@ -346,7 +346,7 @@ class DocumentProperties
*/
public function setCompany($pValue = '')
{
$this->_company = $pValue;
$this->company = $pValue;
return $this;
}
@ -357,7 +357,7 @@ class DocumentProperties
*/
public function getManager()
{
return $this->_manager;
return $this->manager;
}
/**
@ -368,7 +368,7 @@ class DocumentProperties
*/
public function setManager($pValue = '')
{
$this->_manager = $pValue;
$this->manager = $pValue;
return $this;
}
@ -379,7 +379,7 @@ class DocumentProperties
*/
public function getCustomProperties()
{
return array_keys($this->_customProperties);
return array_keys($this->customProperties);
}
/**
@ -390,7 +390,7 @@ class DocumentProperties
*/
public function isCustomPropertySet($propertyName)
{
return isset($this->_customProperties[$propertyName]);
return isset($this->customProperties[$propertyName]);
}
/**
@ -401,8 +401,8 @@ class DocumentProperties
*/
public function getCustomPropertyValue($propertyName)
{
if (isset($this->_customProperties[$propertyName])) {
return $this->_customProperties[$propertyName]['value'];
if (isset($this->customProperties[$propertyName])) {
return $this->customProperties[$propertyName]['value'];
}
}
@ -415,8 +415,8 @@ class DocumentProperties
*/
public function getCustomPropertyType($propertyName)
{
if (isset($this->_customProperties[$propertyName])) {
return $this->_customProperties[$propertyName]['type'];
if (isset($this->customProperties[$propertyName])) {
return $this->customProperties[$propertyName]['type'];
}
}
@ -457,7 +457,7 @@ class DocumentProperties
}
}
$this->_customProperties[$propertyName] = array(
$this->customProperties[$propertyName] = array(
'value' => $propertyValue,
'type' => $propertyType
);
@ -465,11 +465,11 @@ class DocumentProperties
}
/**
* Convert document propery based on type
* Convert document property based on type
*
* @param mixed $propertyValue
* @param string $propertyType
* @return mixed
* @param string $propertyValue
* @param string $propertyType
* @return mixed
*/
public static function convertProperty($propertyValue, $propertyType)
{
@ -525,8 +525,8 @@ class DocumentProperties
/**
* Convert document property type
*
* @param string $propertyType
* @return mixed
* @param string $propertyType
* @return string
*/
public static function convertPropertyType($propertyType)
{

View File

@ -42,7 +42,7 @@ class Image extends Element
/**
* Is watermark
*
* @var bool
* @var boolean
*/
private $isWatermark;
@ -77,7 +77,7 @@ class Image extends Element
/**
* Is memory image
*
* @var string
* @var boolean
*/
private $isMemImage;
@ -86,7 +86,7 @@ class Image extends Element
*
* @param string $source
* @param mixed $style
* @param bool $isWatermark
* @param boolean $isWatermark
* @throws \PhpOffice\PhpWord\Exception\InvalidImageException
* @throws \PhpOffice\PhpWord\Exception\UnsupportedImageTypeException
*/
@ -196,7 +196,7 @@ class Image extends Element
/**
* Get is watermark
*
* @return int
* @return boolean
*/
public function getIsWatermark()
{
@ -206,7 +206,7 @@ class Image extends Element
/**
* Set is watermark
*
* @param bool $pValue
* @param boolean $pValue
*/
public function setIsWatermark($pValue)
{

View File

@ -28,7 +28,7 @@ class TextRun extends Container
* Create new instance
*
* @param string|array|Paragraph $paragraphStyle
* @param string $docPartType section|header|footer
* @param string $docPart section|header|footer
* @param int $docPartId
*/
public function __construct($paragraphStyle = null, $docPart = 'section', $docPartId = 1)

View File

@ -55,7 +55,7 @@ class Title extends Element
*
* @param string $text
* @param int $depth
* @param mixed $style
* @param string $style Name of the heading style, e.g. 'Heading1'
*/
public function __construct($text, $depth = 1, $style = null)
{

View File

@ -61,7 +61,7 @@ class Media
* @param string $src
* @param string $type
* @param Image $image
* @return mixed
* @return integer|array
*/
public static function addSectionMediaElement($src, $type, Image $image = null)
{
@ -115,7 +115,7 @@ class Media
* Add new Section Link Element
*
* @param string $linkSrc
* @return mixed
* @return integer
*/
public static function addSectionLinkElement($linkSrc)
{
@ -340,6 +340,7 @@ class Media
* Get media elements
*
* @param string $container
* @param string $mediaType
* @return int
*/
public static function getMediaElements($container, $mediaType = null)

View File

@ -37,36 +37,36 @@ class PhpWord
*
* @var DocumentProperties
*/
private $_documentProperties;
private $documentProperties;
/**
* Default font name
*
* @var string
*/
private $_defaultFontName;
private $defaultFontName;
/**
* Default font size
* @var int
*/
private $_defaultFontSize;
private $defaultFontSize;
/**
* Collection of sections
*
* @var Section[]
*/
private $_sections = array();
private $sections = array();
/**
* Create new
*/
public function __construct()
{
$this->_documentProperties = new DocumentProperties();
$this->_defaultFontName = self::DEFAULT_FONT_NAME;
$this->_defaultFontSize = self::DEFAULT_FONT_SIZE;
$this->documentProperties = new DocumentProperties();
$this->defaultFontName = self::DEFAULT_FONT_NAME;
$this->defaultFontSize = self::DEFAULT_FONT_SIZE;
}
/**
@ -76,7 +76,7 @@ class PhpWord
*/
public function getDocumentProperties()
{
return $this->_documentProperties;
return $this->documentProperties;
}
/**
@ -87,7 +87,7 @@ class PhpWord
*/
public function setDocumentProperties(DocumentProperties $documentProperties)
{
$this->_documentProperties = $documentProperties;
$this->documentProperties = $documentProperties;
return $this;
}
@ -100,8 +100,8 @@ class PhpWord
*/
public function addSection($settings = null)
{
$section = new Section(\count($this->_sections) + 1, $settings);
$this->_sections[] = $section;
$section = new Section(\count($this->sections) + 1, $settings);
$this->sections[] = $section;
return $section;
}
@ -113,7 +113,7 @@ class PhpWord
*/
public function getDefaultFontName()
{
return $this->_defaultFontName;
return $this->defaultFontName;
}
/**
@ -123,17 +123,17 @@ class PhpWord
*/
public function setDefaultFontName($fontName)
{
$this->_defaultFontName = $fontName;
$this->defaultFontName = $fontName;
}
/**
* Get default font size
*
* @return string
* @return integer
*/
public function getDefaultFontSize()
{
return $this->_defaultFontSize;
return $this->defaultFontSize;
}
/**
@ -143,7 +143,7 @@ class PhpWord
*/
public function setDefaultFontSize($fontSize)
{
$this->_defaultFontSize = $fontSize;
$this->defaultFontSize = $fontSize;
}
/**
@ -159,8 +159,8 @@ class PhpWord
/**
* Adds a paragraph style definition to styles.xml
*
* @param $styleName string
* @param $styles array
* @param string $styleName
* @param array $styles
*/
public function addParagraphStyle($styleName, $styles)
{
@ -170,7 +170,7 @@ class PhpWord
/**
* Adds a font style definition to styles.xml
*
* @param $styleName string
* @param string $styleName
* @param mixed $styleFont
* @param mixed $styleParagraph
*/
@ -221,7 +221,7 @@ class PhpWord
*/
public function getSections()
{
return $this->_sections;
return $this->sections;
}
/**

View File

@ -64,7 +64,7 @@ class Word2007 extends Reader implements IReader
* @param mixed $archive
* @param string $fileName
* @param bool $removeNamespace
* @return mixed
* @return string
*/
public function getFromZipArchive($archive, $fileName = '', $removeNamespace = false)
{

View File

@ -17,8 +17,8 @@ class Font
/**
* Calculate an (approximate) pixel size, based on a font points size
*
* @param int $fontSizeInPoints Font size (in points)
* @return int Font size (in pixels)
* @param int $fontSizeInPoints Font size (in points)
* @return int Font size (in pixels)
*/
public static function fontSizeToPixels($fontSizeInPoints = 12)
{
@ -40,7 +40,7 @@ class Font
* Calculate an (approximate) pixel size, based on centimeter size
*
* @param int $sizeInCm Font size (in centimeters)
* @return int Size (in pixels)
* @return double Size (in pixels)
*/
public static function centimeterSizeToPixels($sizeInCm = 1)
{
@ -51,7 +51,7 @@ class Font
* Convert centimeter to twip
*
* @param int $sizeInCm
* @return int
* @return double
*/
public static function centimeterSizeToTwips($sizeInCm = 1)
{
@ -62,7 +62,7 @@ class Font
* Convert inch to twip
*
* @param int $sizeInInch
* @return int
* @return double
*/
public static function inchSizeToTwips($sizeInInch = 1)
{
@ -73,7 +73,7 @@ class Font
* Convert pixel to twip
*
* @param int $sizeInPixel
* @return int
* @return double
*/
public static function pixelSizeToTwips($sizeInPixel = 1)
{
@ -83,8 +83,8 @@ class Font
/**
* Calculate twip based on point size, used mainly for paragraph spacing
*
* @param int|float $sizeInPoint Size in point
* @return int|float Size (in twips)
* @param integer $sizeInPoint Size in point
* @return integer Size (in twips)
*/
public static function pointSizeToTwips($sizeInPoint = 1)
{

View File

@ -447,7 +447,7 @@ class Font
/**
* Get foreground/highlight color
*
* @return bool
* @return string
*/
public function getFgColor()
{
@ -543,7 +543,7 @@ class Font
/**
* Get Font Content Type
*
* @return bool
* @return string
*/
public function getHint()
{

View File

@ -188,7 +188,7 @@ class Paragraph
/**
* Get Space before Paragraph
*
* @return string
* @return integer
*/
public function getSpaceBefore()
{
@ -210,7 +210,7 @@ class Paragraph
/**
* Get Space after Paragraph
*
* @return string
* @return integer
*/
public function getSpaceAfter()
{

View File

@ -211,7 +211,7 @@ class Table
/**
* Get background
*
* @return \PhpOffice\PhpWord\Style\Table
* @return string
*/
public function getBgColor()
{

View File

@ -11,7 +11,6 @@ namespace PhpOffice\PhpWord\Writer\ODText;
use PhpOffice\PhpWord\Exception\Exception;
use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\Shared\XMLWriter;
/**
* ODText manifest part writer

View File

@ -10,7 +10,6 @@
namespace PhpOffice\PhpWord\Writer\ODText;
use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\Shared\XMLWriter;
/**
* ODText meta part writer

View File

@ -10,7 +10,6 @@
namespace PhpOffice\PhpWord\Writer\ODText;
use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\Shared\XMLWriter;
use PhpOffice\PhpWord\Style;
use PhpOffice\PhpWord\Style\Font;
use PhpOffice\PhpWord\Style\Paragraph;

View File

@ -1169,7 +1169,6 @@ class Base extends WriterPart
*
* @param XMLWriter $xmlWriter
* @param Container $container
* @param Container $textBreak Add text break when no element found
*/
protected function writeContainerElements(XMLWriter $xmlWriter, Container $container)
{
@ -1224,9 +1223,9 @@ class Base extends WriterPart
* Write margin or border
*
* @param XMLWriter $xmlWriter
* @param boolean $isBorder
* @param array $sizes
* @param array $colors
* @param array $attributes
*/
protected function writeMarginBorder(XMLWriter $xmlWriter, $sizes, $colors = array(), $attributes = array())
{

View File

@ -10,7 +10,6 @@
namespace PhpOffice\PhpWord\Writer\Word2007;
use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\Shared\XMLWriter;
/**
* Word2007 contenttypes part writer

View File

@ -15,7 +15,6 @@ use PhpOffice\PhpWord\Container\Section;
use PhpOffice\PhpWord\Element\PageBreak;
use PhpOffice\PhpWord\Shared\XMLWriter;
use PhpOffice\PhpWord\Style\Font;
use PhpOffice\PhpWord\Style\Paragraph;
/**
* Word2007 document part writer

View File

@ -9,9 +9,6 @@
namespace PhpOffice\PhpWord\Writer\Word2007;
use PhpOffice\PhpWord\Exception\Exception;
use PhpOffice\PhpWord\Shared\XMLWriter;
/**
* Word2007 document rels part writer
*/

View File

@ -10,7 +10,6 @@
namespace PhpOffice\PhpWord\Writer\Word2007;
use PhpOffice\PhpWord\Container\Footer as FooterElement;
use PhpOffice\PhpWord\Shared\XMLWriter;
/**
* Word2007 footer part writer

View File

@ -10,12 +10,6 @@
namespace PhpOffice\PhpWord\Writer\Word2007;
use PhpOffice\PhpWord\Element\Footnote;
use PhpOffice\PhpWord\Element\Text;
use PhpOffice\PhpWord\Element\Link;
use PhpOffice\PhpWord\Element\Image;
use PhpOffice\PhpWord\Element\Object;
use PhpOffice\PhpWord\Element\TextBreak;
use PhpOffice\PhpWord\Style\Paragraph;
use PhpOffice\PhpWord\Shared\XMLWriter;
/**

View File

@ -9,9 +9,6 @@
namespace PhpOffice\PhpWord\Writer\Word2007;
use PhpOffice\PhpWord\Exception\Exception;
use PhpOffice\PhpWord\Shared\XMLWriter;
/**
* Word2007 footnotes rel part writer
*/

View File

@ -10,7 +10,6 @@
namespace PhpOffice\PhpWord\Writer\Word2007;
use PhpOffice\PhpWord\Container\Header as HeaderElement;
use PhpOffice\PhpWord\Shared\XMLWriter;
/**
* Word2007 header part writer

View File

@ -9,9 +9,7 @@
namespace PhpOffice\PhpWord\Writer\Word2007;
use PhpOffice\PhpWord\Exception\Exception;
use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\Shared\XMLWriter;
/**
* Word2007 rels part writer