phpWord; } /** * Set PhpWord as reference * * @param \PhpOffice\PhpWord\PhpWord */ public function setPhpWord(PhpWord &$phpWord = null) { $this->phpWord = &$phpWord; } /** * Get section number * * @return int */ public function getSectionId() { return $this->sectionId; } /** * Set doc part * * @param string $docPart * @param int $docPartId */ public function setDocPart($docPart, $docPartId = 1) { $this->docPart = $docPart; $this->docPartId = $docPartId; } /** * Get doc part * * @return string */ public function getDocPart() { return $this->docPart; } /** * Get doc part Id * * @return int */ public function getDocPartId() { return $this->docPartId; } /** * Get element index * * @return int */ public function getElementIndex() { return $this->elementIndex; } /** * Set element index * * @param int $value */ public function setElementIndex($value) { $this->elementIndex = $value; } /** * Get element unique ID * * @return string */ public function getElementId() { return $this->elementId; } /** * Set element unique ID from 6 first digit of md5 */ public function setElementId() { $this->elementId = substr(md5(rand()), 0, 6); } /** * Get relation Id * * @return int */ public function getRelationId() { return $this->relationId; } /** * Set relation Id * * @param int $value */ public function setRelationId($value) { $this->relationId = $value; } /** * Get nested level * * @return int */ public function getNestedLevel() { return $this->nestedLevel; } /** * Set nested level * * @param int $value */ public function setNestedLevel($value) { $this->nestedLevel = $value; } /** * Check if element is located in Section doc part (as opposed to Header/Footer) * * @return bool */ public function isInSection() { return ($this->docPart == 'Section'); } /** * Set style value * * @param mixed $styleObject Style object * @param mixed $styleValue Style value * @param bool $returnObject Always return object * @return mixed */ protected function setStyle($styleObject, $styleValue = null, $returnObject = false) { if (!is_null($styleValue) && is_array($styleValue)) { $styleObject->setStyleByArray($styleValue); $style = $styleObject; } else { $style = $returnObject ? $styleObject : $styleValue; } return $style; } /** * Set enum value * * @param mixed $value * @param array $enum * @param mixed $default * @return mixed * @throws \InvalidArgumentException * @todo Merge with the same method in AbstractStyle */ protected function setEnumVal($value = null, $enum = array(), $default = null) { if ($value != null && trim($value) != '' && !empty($enum) && !in_array($value, $enum)) { throw new \InvalidArgumentException("Invalid style value: {$value}"); } elseif ($value === null || trim($value) == '') { $value = $default; } return $value; } }