style = $style; } /** * Set parent writer. * * @param \PhpOffice\PhpWord\Writer\AbstractWriter $writer */ public function setParentWriter($writer) { $this->parentWriter = $writer; } /** * Get parent writer * * @return \PhpOffice\PhpWord\Writer\AbstractWriter */ public function getParentWriter() { return $this->parentWriter; } /** * Get style * * @return array|\PhpOffice\PhpWord\Style\AbstractStyle $style */ public function getStyle() { if (!$this->style instanceof Style && !is_array($this->style)) { return ''; } return $this->style; } /** * Takes array where of CSS properties / values and converts to CSS string * * @param array $css * @return string */ protected function assembleCss($css) { $pairs = array(); $string = ''; foreach ($css as $key => $value) { if ($value != '') { $pairs[] = $key . ': ' . $value; } } if (!empty($pairs)) { $string = implode('; ', $pairs) . ';'; } return $string; } /** * Get value if ... * * @param bool|null $condition * @param string $value * @return string */ protected function getValueIf($condition, $value) { return $condition == true ? $value : ''; } }