Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
styleName;
}
/**
* Set style name.
*
* @param string $value
*
* @return self
*/
public function setStyleName($value)
{
$this->styleName = $value;
return $this;
}
/**
* Get index number.
*
* @return null|int
*/
public function getIndex()
{
return $this->index;
}
/**
* Set index number.
*
* @param null|int $value
*
* @return self
*/
public function setIndex($value = null)
{
$this->index = $this->setIntVal($value, $this->index);
return $this;
}
/**
* Get is automatic style flag.
*
* @return bool
*/
public function isAuto()
{
return $this->isAuto;
}
/**
* Set is automatic style flag.
*
* @param bool $value
*
* @return self
*/
public function setAuto($value = true)
{
$this->isAuto = $this->setBoolVal($value, $this->isAuto);
return $this;
}
/**
* Return style value of child style object, e.g. `left` from `Indentation` child style of `Paragraph`.
*
* @param \PhpOffice\PhpWord\Style\AbstractStyle $substyleObject
* @param string $substyleProperty
*
* @return mixed
*
* @since 0.12.0
*/
public function getChildStyleValue($substyleObject, $substyleProperty)
{
if ($substyleObject !== null) {
$method = "get{$substyleProperty}";
return $substyleObject->$method();
}
return null;
}
/**
* 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];
}
if ($key === 'align') {
$key = 'alignment';
}
$method = 'set' . Text::removeUnderscorePrefix($key);
if (method_exists($this, $method)) {
$this->$method($value);
}
return $this;
}
/**
* Set style by using associative array.
*
* @param array $values
*
* @return self
*/
public function setStyleByArray($values = [])
{
foreach ($values as $key => $value) {
$this->setStyleValue($key, $value);
}
return $this;
}
/**
* Set default for null and empty value.
*
* @param string $value (was: mixed)
* @param string $default (was: mixed)
*
* @return string (was: mixed)
*/
protected function setNonEmptyVal($value, $default)
{
if ($value === null || $value == '') {
$value = $default;
}
return $value;
}
/**
* Set bool value.
*
* @param bool $value
* @param bool $default
*
* @return bool
*/
protected function setBoolVal($value, $default)
{
if (!is_bool($value)) {
$value = $default;
}
return $value;
}
/**
* Set numeric value.
*
* @param mixed $value
* @param null|float|int $default
*
* @return null|float|int
*/
protected function setNumericVal($value, $default = null)
{
if (!is_numeric($value)) {
$value = $default;
}
return $value;
}
/**
* Set integer value: Convert string that contains only numeric into integer.
*
* @param null|int $value
* @param null|int $default
*
* @return null|int
*/
protected function setIntVal($value, $default = null)
{
if (is_string($value) && (preg_match('/[^\d]/', $value) == 0)) {
$value = (int) $value;
}
if (!is_numeric($value)) {
$value = $default;
} else {
$value = (int) $value;
}
return $value;
}
/**
* Set float value: Convert string that contains only numeric into float.
*
* @param mixed $value
* @param null|float $default
*
* @return null|float
*/
protected function setFloatVal($value, $default = null)
{
if (is_string($value) && (preg_match('/[^\d\.\,]/', $value) == 0)) {
$value = (float) $value;
}
if (!is_numeric($value)) {
$value = $default;
}
return $value;
}
/**
* Set enum value.
*
* @param mixed $value
* @param array $enum
* @param mixed $default
*
* @return mixed
*/
protected function setEnumVal($value = null, $enum = [], $default = null)
{
if ($value != null && trim($value) != '' && !empty($enum) && !in_array($value, $enum)) {
throw new InvalidArgumentException("Invalid style value: {$value} Options:" . implode(',', $enum));
} elseif ($value === null || trim($value) == '') {
$value = $default;
}
return $value;
}
/**
* Set object value.
*
* @param mixed $value
* @param string $styleName
* @param mixed &$style
*
* @return mixed
*/
protected function setObjectVal($value, $styleName, &$style)
{
$styleClass = substr(static::class, 0, strrpos(static::class, '\\')) . '\\' . $styleName;
if (is_array($value)) {
/** @var \PhpOffice\PhpWord\Style\AbstractStyle $style Type hint */
if (!$style instanceof $styleClass) {
$style = new $styleClass();
}
$style->setStyleByArray($value);
} else {
$style = $value;
}
return $style;
}
/**
* Set $property value and set $pairProperty = false when $value = true.
*
* @param bool &$property
* @param bool &$pairProperty
* @param bool $value
*
* @return self
*/
protected function setPairedVal(&$property, &$pairProperty, $value)
{
$property = $this->setBoolVal($value, $property);
if ($value === true) {
$pairProperty = false;
}
return $this;
}
}