public function getLastCurlBracketPositionFromClass($domainClass)
    {
        $matches = [];

        $lastClassCurlBracketPattern = "/\}[ \r\n]*[^{}]\$/";
        preg_match($lastClassCurlBracketPattern, $domainClass . " ", $matches, PREG_OFFSET_CAPTURE);
        $lastClassBracketIdx = $matches[0][1];

        if ($lastClassBracketIdx == 0) {
            throw new \Exception("Can't append function");
        }

        return $lastClassBracketIdx;
    }