public static function get($classname) {
        $contexts = self::$environment->getContexts();

        foreach ($contexts as $context) {
            if (is_a($context, $classname)) {
                return $context;
            }
        }

        $suitename = self::$environment->getSuite()->getName();
        // If default suite, then get the default theme name.
        if ($suitename == 'default') {
            $suitename = theme_config::DEFAULT_THEME;
        }
        $overridencontextname = 'behat_theme_'.$suitename.'_'.$classname;

        // If contexts has not been checked before and doesn't exist then just use core one.
        if (!isset(self::$nonexistingcontexts[$overridencontextname])) {
            try {
                $subcontext = self::$environment->getContext($overridencontextname);

                return $subcontext;
            } catch (Behat\Behat\Context\Exception\ContextNotFoundException $e) {
                // If context not found then it's not overridden.
                self::$nonexistingcontexts[$overridencontextname] = 1;
            }
        }

        // Get the actual context.
        return self::$environment->getContext($classname);
    }
public static function get($classname) {
        $contexts = self::$environment->getContexts();

        foreach ($contexts as $context) {
            if (is_a($context, $classname)) {
                return $context;
            }
        }

        $suitename = self::$environment->getSuite()->getName();
        // If default suite, then get the default theme name.
        if ($suitename == 'default') {
            $suitename = theme_config::DEFAULT_THEME;
        }
        $overridencontextname = 'behat_theme_'.$suitename.'_'.$classname;

        // If contexts has not been checked before and doesn't exist then just use core one.
        if (!isset(self::$nonexistingcontexts[$overridencontextname])) {
            try {
                $subcontext = self::$environment->getContext($overridencontextname);

                return $subcontext;
            } catch (Behat\Behat\Context\Exception\ContextNotFoundException $e) {
                // If context not found then it's not overridden.
                self::$nonexistingcontexts[$overridencontextname] = 1;
            }
        }

        // Get the actual context.
        return self::$environment->getContext($classname);
    }
public static function get ( $ classname ) { $ contexts = self :: $ environment -> getContexts ( ) ; foreach ( $ contexts as $ context ) { if ( is_a ( $ context , $ classname ) ) { return $ context ; } } $ suitename = self :: $ environment -> getSuite ( ) -> getName ( ) ; // If default suite, then get the default theme name. if ( $ suitename == 'default' ) { $ suitename = theme_config :: DEFAULT_THEME ; } $ overridencontextname = 'behat_theme_' . $ suitename . '_' . $ classname ; // If contexts has not been checked before and doesn't exist then just use core one. if ( ! isset ( self :: $ nonexistingcontexts [ $ overridencontextname ] ) ) { try { $ subcontext = self :: $ environment -> getContext ( $ overridencontextname ) ; return $ subcontext ; } catch ( Behat \ Behat \ Context \ Exception \ ContextNotFoundException $ e ) { // If context not found then it's not overridden. self :: $ nonexistingcontexts [ $ overridencontextname ] = 1 ; } } // Get the actual context. return self :: $ environment -> getContext ( $ classname ) ; }
Gets the required context.

Getting a context you get access to all the steps
that uses direct API calls; steps returning step chains
can not be executed like this.

@throws Behat\Behat\Context\Exception\ContextNotFoundException
@param string $classname Context identifier (the class name).
@return behat_base
Gets the required context .