public static function getJustificationConstant($value) {

        // if the value coming in, is a integer, ensure it is one of the constants
        if (is_int($value)) {

            // get the justification integer values
            $values = array_values(self::$justificationConstants);

            // if the integer submitted is one of those values, return it
            if (in_array($value, $values)) {

                // return the valid value
                return $value;
            }

        }
        // if the value coming in is a string
        else if (is_string($value)) {

            // trim the string
            $value = trim($value);

            // transform to uppercase
            $value = strtoupper($value);

            // if it is in the array of string values
            if (isset(self::$justificationConstants[$value])) {

                // return the matching integer value
                return self::$justificationConstants[$value];


            } else {

                // not a valid string
                return self::LEFT;
            }

        } else {

            // something went wrong, return left
            return self::LEFT;
        }

        return self::LEFT;
    }
public static function getJustificationConstant($value) {

        // if the value coming in, is a integer, ensure it is one of the constants
        if (is_int($value)) {

            // get the justification integer values
            $values = array_values(self::$justificationConstants);

            // if the integer submitted is one of those values, return it
            if (in_array($value, $values)) {

                // return the valid value
                return $value;
            }

        }
        // if the value coming in is a string
        else if (is_string($value)) {

            // trim the string
            $value = trim($value);

            // transform to uppercase
            $value = strtoupper($value);

            // if it is in the array of string values
            if (isset(self::$justificationConstants[$value])) {

                // return the matching integer value
                return self::$justificationConstants[$value];


            } else {

                // not a valid string
                return self::LEFT;
            }

        } else {

            // something went wrong, return left
            return self::LEFT;
        }

        return self::LEFT;
    }
public static function getJustificationConstant ( $ value ) { // if the value coming in, is a integer, ensure it is one of the constants if ( is_int ( $ value ) ) { // get the justification integer values $ values = array_values ( self :: $ justificationConstants ) ; // if the integer submitted is one of those values, return it if ( in_array ( $ value , $ values ) ) { // return the valid value return $ value ; } } // if the value coming in is a string else if ( is_string ( $ value ) ) { // trim the string $ value = trim ( $ value ) ; // transform to uppercase $ value = strtoupper ( $ value ) ; // if it is in the array of string values if ( isset ( self :: $ justificationConstants [ $ value ] ) ) { // return the matching integer value return self :: $ justificationConstants [ $ value ] ; } else { // not a valid string return self :: LEFT ; } } else { // something went wrong, return left return self :: LEFT ; } return self :: LEFT ; }
Function to take a value and turn it into a justification constant

@param string | int $value - if a string, it can be "left", "RIGHT", etc..., if an int, just needs to be a constant
@return int - the constant it represents or LEFT if it is garbage
Function to take a value and turn it into a justification constant