Qa\SoftMocks::getConst PHP Method

getConst() public static method

public static getConst ( $namespace, $const )
    public static function getConst($namespace, $const)
    {
        if ($namespace !== '') {
            $ns_const = $namespace . '\\' . $const;
            if (array_key_exists($ns_const, self::$constant_mocks)) {
                if (self::$debug) {
                    self::debug("Mocked {$ns_const}");
                }
                return self::$constant_mocks[$ns_const];
            }
            if (defined($ns_const)) {
                return constant($ns_const);
            }
        }
        if (array_key_exists($const, self::$constant_mocks)) {
            if (self::$debug) {
                self::debug("Mocked {$const}");
            }
            return self::$constant_mocks[$const];
        }
        if (array_key_exists($const, self::$removed_constants)) {
            trigger_error('Trying to access removed constant ' . $const . ', assuming "' . $const . '"');
            return $const;
        }
        return constant($const);
    }