/** * Test remove underscore prefix */ public function testRemoveUnderscorePrefix() { $this->assertEquals('item', Text::removeUnderscorePrefix('_item')); }
/** * Set Style value * * @param string $key * @param mixed $value * @return self */ public function setStyleValue($key, $value) { $key = Text::removeUnderscorePrefix($key); if ('indent' == $key || 'hanging' == $key) { $value = $value * 720; } elseif ('spacing' == $key) { $value += 240; // because line height of 1 matches 240 twips } return parent::setStyleValue($key, $value); }
/** * Set style value template method * * Some child classes have their own specific overrides. * Backward compability check for versions < 0.10.0 which use underscore * prefix for their private properties. * Check if the set method is exists. Throws an exception? * * @param string $key * @param string $value * @return self */ public function setStyleValue($key, $value) { if (isset($this->aliases[$key])) { $key = $this->aliases[$key]; } $method = 'set' . Text::removeUnderscorePrefix($key); if (method_exists($this, $method)) { $this->{$method}($value); } return $this; }