public function equals($other, $considerAffix=false)
    {

        if ($other instanceof self) {
            return $considerAffix ? ($other->toString() == $this->toString())
                                  : ($other->getSource() == $this->source);
        }

        $other = "$other";

        if ($considerAffix) {
            return $other == $this->toString();
        }

        $cleaned = $other;

        if ($this->prefix && mb_strpos($other, $this->prefix) === 0) {
            $cleaned = mb_substr($other, mb_strlen($this->prefix));
        }

        if ($this->suffix && mb_strpos($other, $this->suffix)) {
            $cleaned = mb_substr($cleaned, 0, 0-mb_strlen($this->suffix));
        }

        if ($this->hasDifferentAffixes()){
            $cleaned = trim($cleaned, $this->glue);
        }

        $me = implode($this->glue, $this->source);

        return ($me == $other || $me == $cleaned);


    }
public function equals($other, $considerAffix=false)
    {

        if ($other instanceof self) {
            return $considerAffix ? ($other->toString() == $this->toString())
                                  : ($other->getSource() == $this->source);
        }

        $other = "$other";

        if ($considerAffix) {
            return $other == $this->toString();
        }

        $cleaned = $other;

        if ($this->prefix && mb_strpos($other, $this->prefix) === 0) {
            $cleaned = mb_substr($other, mb_strlen($this->prefix));
        }

        if ($this->suffix && mb_strpos($other, $this->suffix)) {
            $cleaned = mb_substr($cleaned, 0, 0-mb_strlen($this->suffix));
        }

        if ($this->hasDifferentAffixes()){
            $cleaned = trim($cleaned, $this->glue);
        }

        $me = implode($this->glue, $this->source);

        return ($me == $other || $me == $cleaned);


    }
public function equals ( $ other , $ considerAffix = false ) { if ( $ other instanceof self ) { return $ considerAffix ? ( $ other -> toString ( ) == $ this -> toString ( ) ) : ( $ other -> getSource ( ) == $ this -> source ) ; } $ other = "$other" ; if ( $ considerAffix ) { return $ other == $ this -> toString ( ) ; } $ cleaned = $ other ; if ( $ this -> prefix && mb_strpos ( $ other , $ this -> prefix ) === 0 ) { $ cleaned = mb_substr ( $ other , mb_strlen ( $ this -> prefix ) ) ; } if ( $ this -> suffix && mb_strpos ( $ other , $ this -> suffix ) ) { $ cleaned = mb_substr ( $ cleaned , 0 , 0 - mb_strlen ( $ this -> suffix ) ) ; } if ( $ this -> hasDifferentAffixes ( ) ) { $ cleaned = trim ( $ cleaned , $ this -> glue ) ; } $ me = implode ( $ this -> glue , $ this -> source ) ; return ( $ me == $ other || $ me == $ cleaned ) ; }
Test if this StringList is equal to a string, another  StringList.

@param string|StringList $other

@param bool $considerAffix (default=false)

@return bool
Test if this StringList is equal to a string another StringList .