private function extractChainedMethodsBefore($methods, $currentMethod)
    {
        $chainedMethodsBefore = [];
        $currentMethodName = key($currentMethod);

        foreach ($methods as $method)
        {
            $methodName = key($method);

            if ($methodName == $currentMethodName) {
                break;
            }

            $chainedMethodsBefore[] = $method;
        }

        return $chainedMethodsBefore;
    }