尝试将函数添加到现有的PHP库中

I am trying to add a function to an already existing php lib (which is not maintained anymore).

What I am trying to achieve is to be able to align the text to center/justify/left/right align.

Here is the git link of the library.

https://github.com/armagedan/thaana_text_render_php

Here is where I went so far.

//Creating property
//So by default, this will be centered

private $textAlign = 'center';


public function __construct($fontPath=NULL, $fontName=NULL, $fontSize=NULL, $textColor=NULL, $textAlpha=NULL, $textLineSpacing=NULL, $bgColor=NULL, $bgAlpha=NULL, $shadowOffset=NULL, $shadowColor=NULL, $shadowAlpha=NULL, $textAlign =NULL)
    {
        // Initialize with specified defaults:
        if (!empty($fontPath)) $this->setFontPath($fontPath);
        if (!empty($fontName)) $this->setFont($fontName);
        if (!empty($fontSize)) $this->setFontSize($fontSize);
        if (!empty($textColor)) $this->setTextColor($textColor, $textAlpha);
        if (!empty($textLineSpacing)) $this->setTextLineSpacing($textLineSpacing);
        if (!empty($bgColor)) $this->setBgColor($bgColor, $bgAlpha);
        if (!empty($shadowOffset)) $this->setShadow($shadowOffset, $shadowColor, $shadowAlpha);

        //This one I added
        if (!empty($textAlign )) $this->setAlignment($textAlign);
    }

And here is the function:

public function setAlignment($textAlign=NULL)
    {
        //What to do here?
        //So basically if the $textAlignment is null, then use the default one correct? Else use the user defined one?
    }

So what I am trying to do is add a function called setAlignment which will set the alignment of the text to left/center/right etc... Like microsoft word and so on. But I do not know where to continue from here. I want the last parameter of the Constructor to have the alignment options.