/** * Create a new Table-of-Contents Element * * @param mixed $fontStyle * @param array $tocStyle * @param integer $minDepth * @param integer $maxDepth */ public function __construct($fontStyle = null, $tocStyle = null, $minDepth = 1, $maxDepth = 9) { $this->TOCStyle = new TOCStyle(); if (!is_null($tocStyle) && is_array($tocStyle)) { $this->TOCStyle->setStyleByArray($tocStyle); } if (!is_null($fontStyle) && is_array($fontStyle)) { $this->fontStyle = new Font(); $this->fontStyle->setStyleByArray($fontStyle); } else { $this->fontStyle = $fontStyle; } $this->minDepth = $minDepth; $this->maxDepth = $maxDepth; }
/** * Create a new Table-of-Contents Element * * @param mixed $fontStyle * @param array $tocStyle * @param integer $minDepth * @param integer $maxDepth */ public function __construct($fontStyle = null, $tocStyle = null, $minDepth = 1, $maxDepth = 9) { $this->TOCStyle = new TOCStyle(); if (!is_null($tocStyle) && is_array($tocStyle)) { foreach ($tocStyle as $key => $value) { $this->TOCStyle->setStyleValue($key, $value); } } if (!is_null($fontStyle)) { if (is_array($fontStyle)) { $this->fontStyle = new Font(); foreach ($fontStyle as $key => $value) { $this->fontStyle->setStyleValue($key, $value); } } else { $this->fontStyle = $fontStyle; } } $this->minDepth = $minDepth; $this->maxDepth = $maxDepth; }
/** * Test properties with normal value */ public function testProperties() { $object = new TOC(); $properties = array('tabPos' => 9062, 'tabLeader' => TOC::TABLEADER_DOT, 'indent' => 200); foreach ($properties as $key => $value) { // set/get $set = "set{$key}"; $get = "get{$key}"; $object->{$set}($value); $this->assertEquals($value, $object->{$get}()); // setStyleValue $object->setStyleValue("{$key}", null); $this->assertEquals(null, $object->{$get}()); } }