Changes to make GHA happy and added usages of the coalescing operator (#121)
This commit is contained in:
parent
40e42a13b8
commit
f551c80176
2 changed files with 21 additions and 20 deletions
|
@ -150,7 +150,7 @@ abstract class element {
|
|||
$this->width = $element->width;
|
||||
$this->refpoint = $element->refpoint;
|
||||
$this->showposxy = isset($showposxy) && $showposxy;
|
||||
$this->set_alignment(isset($element->alignment) ? $element->alignment : element::ALIGN_LEFT);
|
||||
$this->set_alignment($element->alignment ?? self::ALIGN_LEFT);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -258,7 +258,7 @@ abstract class element {
|
|||
* @return string The current alignment value.
|
||||
*/
|
||||
public function get_alignment() {
|
||||
return isset($this->alignment) ? $this->alignment : element::ALIGN_LEFT;
|
||||
return $this->alignment ?? self::ALIGN_LEFT;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -266,12 +266,13 @@ abstract class element {
|
|||
*
|
||||
* @param string $alignment The new alignment.
|
||||
*
|
||||
* @throws InvalidArgumentException if the provided new alignment is not valid.
|
||||
* @throws \InvalidArgumentException if the provided new alignment is not valid.
|
||||
*/
|
||||
protected function set_alignment($alignment) {
|
||||
$valid_values = array(element::ALIGN_LEFT, element::ALIGN_CENTER, element::ALIGN_RIGHT);
|
||||
if (!in_array($alignment, $valid_values)) {
|
||||
throw new \InvalidArgumentException("'$alignment' is not a valid alignment value. It has to be one of " . implode(', ', $valid_values));
|
||||
protected function set_alignment(string $alignment) {
|
||||
$validvalues = array(self::ALIGN_LEFT, self::ALIGN_CENTER, self::ALIGN_RIGHT);
|
||||
if (!in_array($alignment, $validvalues)) {
|
||||
throw new \InvalidArgumentException("'$alignment' is not a valid alignment value. It has to be one of " .
|
||||
implode(', ', $validvalues));
|
||||
}
|
||||
$this->alignment = $alignment;
|
||||
}
|
||||
|
@ -358,16 +359,16 @@ abstract class element {
|
|||
$element = new \stdClass();
|
||||
$element->name = $data->name;
|
||||
$element->data = $this->save_unique_data($data);
|
||||
$element->font = (isset($data->font)) ? $data->font : null;
|
||||
$element->fontsize = (isset($data->fontsize)) ? $data->fontsize : null;
|
||||
$element->colour = (isset($data->colour)) ? $data->colour : null;
|
||||
$element->font = $data->font ?? null;
|
||||
$element->fontsize = $data->fontsize ?? null;
|
||||
$element->colour = $data->colour ?? null;
|
||||
if ($this->showposxy) {
|
||||
$element->posx = (isset($data->posx)) ? $data->posx : null;
|
||||
$element->posy = (isset($data->posy)) ? $data->posy : null;
|
||||
$element->posx = $data->posx ?? null;
|
||||
$element->posy = $data->posy ?? null;
|
||||
}
|
||||
$element->width = (isset($data->width)) ? $data->width : null;
|
||||
$element->refpoint = (isset($data->refpoint)) ? $data->refpoint : null;
|
||||
$element->alignment = (isset($data->alignment)) ? $data->alignment : element::ALIGN_LEFT;
|
||||
$element->width = $data->width ?? null;
|
||||
$element->refpoint = $data->refpoint ?? null;
|
||||
$element->alignment = $data->alignment ?? self::ALIGN_LEFT;
|
||||
$element->timemodified = time();
|
||||
|
||||
// Check if we are updating, or inserting a new element.
|
||||
|
|
Loading…
Reference in a new issue