diff --git a/src/Document/Styles/ComponentTextStyle.php b/src/Document/Styles/ComponentTextStyle.php index 3057763..735801f 100644 --- a/src/Document/Styles/ComponentTextStyle.php +++ b/src/Document/Styles/ComponentTextStyle.php @@ -17,6 +17,11 @@ class ComponentTextStyle extends TextStyle { protected $dropCapStyle; protected $hyphenation; protected $linkStyle; + protected $firstLineIndent; + protected $fontScaling; + protected $hangingPunctuation; + protected $paragraphSpacingAfter; + protected $paragraphSpacingBefore; /** * Define optional properties. @@ -28,6 +33,11 @@ protected function optional() { 'dropCapStyle', 'hyphenation', 'linkStyle', + 'firstLineIndent', + 'fontScaling', + 'hangingPunctuation', + 'paragraphSpacingAfter', + 'paragraphSpacingBefore', )); } @@ -103,13 +113,26 @@ public function getLinkStyle() { /** * Setter for linkStyle. * - * @param \ChapterThree\AppleNewsAPI\Document\Styles\TextStyle $value + * @param \ChapterThree\AppleNewsAPI\Document\Styles\TextStyle | array $value * LinkStyle. * * @return $this */ - public function setLinkStyle(TextStyle $value) { - $this->linkStyle = $value; + public function setLinkStyle($value) { + if (is_object($value) && $value instanceof TextStyle) { + $this->linkStyle = $value; + } elseif (is_array($value)) { + $object = new TextStyle(); + foreach ($value as $field => $v) { + $method = 'set' . ucfirst($field); + if ($v && method_exists($object, $method)) { + $object->{$method}($v); + } + } + $this->linkStyle = $object; + } else { + $this->triggerError('linkStyle is not array or object of class TextStyle'); + } return $this; } @@ -133,6 +156,106 @@ public function setHyphenation($value) { return $this; } + /** + * Getter for firstLineIndent. + */ + public function getFirstLineIndent() { + return $this->firstLineIndent; + } + + /** + * Setter for firstLineIndent. + * + * @param int $value + * firstLineIndent. + * + * @return $this + */ + public function setFirstLineIndent($value) { + $this->firstLineIndent = $value; + return $this; + } + + /** + * Getter for fontScaling. + */ + public function getFontScaling() { + return $this->fontScaling; + } + + /** + * Setter for fontScaling. + * + * @param bool $value + * fontScaling. + * + * @return $this + */ + public function setFontScaling($value) { + $this->fontScaling = $value; + return $this; + } + + /** + * Getter for hangingPunctuation. + */ + public function getHangingPunctuation() { + return $this->hangingPunctuation; + } + + /** + * Setter for hangingPunctuation. + * + * @param bool $value + * hangingPunctuation. + * + * @return $this + */ + public function setHangingPunctuation($value) { + $this->hangingPunctuation = $value; + return $this; + } + + /** + * Getter for paragraphSpacingAfter. + */ + public function getParagraphSpacingAfter() { + return $this->paragraphSpacingAfter; + } + + /** + * Setter for paragraphSpacingAfter. + * + * @param int $value + * paragraphSpacingAfter. + * + * @return $this + */ + public function setParagraphSpacingAfter($value) { + $this->paragraphSpacingAfter = $value; + return $this; + } + + /** + * Getter for paragraphSpacingBefore. + */ + public function getParagraphSpacingBefore() { + return $this->paragraphSpacingBefore; + } + + /** + * Setter for paragraphSpacingBefore. + * + * @param int $value + * paragraphSpacingBefore. + * + * @return $this + */ + public function setParagraphSpacingBefore($value) { + $this->paragraphSpacingBefore = $value; + return $this; + } + /** * Implements JsonSerializable::jsonSerialize(). */ diff --git a/src/Document/Styles/TextStyle.php b/src/Document/Styles/TextStyle.php index 2ac6fb9..9b1ca31 100644 --- a/src/Document/Styles/TextStyle.php +++ b/src/Document/Styles/TextStyle.php @@ -15,8 +15,12 @@ */ class TextStyle extends Base { + protected $fontFamily; protected $fontName; protected $fontSize; + protected $fontStyle; + protected $fontWeight; + protected $fontWidth; protected $textColor; protected $textShadow; protected $textTransform; @@ -32,8 +36,12 @@ class TextStyle extends Base { */ protected function optional() { return array_merge(parent::optional(), array( + 'fontFamily', 'fontName', 'fontSize', + 'fontStyle', + 'fontWeight', + 'fontWidth', 'textColor', 'textShadow', 'textTransform', @@ -46,6 +54,26 @@ protected function optional() { )); } + /** + * Getter for fontFamily. + */ + public function getFontFamily() { + return $this->fontFamily; + } + + /** + * Setter for fontFamily. + * + * @param string $value + * FontFamily. + * + * @return $this + */ + public function setFontFamily($value) { + $this->fontFamily = (string) $value; + return $this; + } + /** * Getter for fontName. */ @@ -86,6 +114,67 @@ public function setFontSize($value) { return $this; } + /** + * Getter for fontStyle. + */ + public function getFontStyle() { + return $this->fontStyle; + } + + /** + * Setter for fontStyle. + * + * @param string $value + * fontStyle. + * + * @return $this + */ + public function setFontStyle($value) { + $this->fontStyle = (string) $value; + return $this; + } + + /** + * Getter for fontWeight. + */ + public function getFontWeight() { + return $this->fontWeight; + } + + /** + * Setter for fontWeight. + * + * @param int|string $value + * fontWeight. + * + * @return $this + */ + public function setFontWeight($value) { + $this->fontWeight = $value; + return $this; + } + + + /** + * Getter for fontWidth. + */ + public function getfontWidth() { + return $this->fontWidth; + } + + /** + * Setter for fontWidth. + * + * @param string $value + * fontWidth. + * + * @return $this + */ + public function setfontWidth($value) { + $this->fontWidth = (string) $value; + return $this; + } + /** * Getter for textColor. */