@param \Predis\Client $redisInstance
@param string         $key
@param string         $method

@throws \Exception
510141
public static function useCurrentRedisEncryptionDriver($redisInstance, string $key, string $method = null): void
    {
        static::throwExceptionIfHasStarted();

        $driver = new RedisEncryption();
        $driver->setCurrentRedis($redisInstance);
        static::setKeyAndMethod($driver, $key, $method);
        $driver->setLifetime(static::getLifetimeForRedis());

        static::$driver = $driver;
    }
968238
private function whenSuccess($response, $method)
    {
        $this->makeSession($response, $method);
        return $this->result->setData([
            'success' => true,
            'payload' => [
                'redirect' => sprintf('%s%s', $this->baseUrl(), 'pagseguro/direct/success')
            ]
        ]);
    }
84801
protected function checkContext(Context $context, string $method) : void
    {
        if ($this->context != $context) { // non-strict equality on purpose
            throw MoneyMismatchException::contextMismatch($method);
        }
    }
725463
public function redirecionar(Atendimento $atendimento, $unidade, $servico, $usuario = null)
    {
        $status = $atendimento->getStatus();
        
        if (!in_array($status, [ self::ATENDIMENTO_INICIADO, self::ATENDIMENTO_ENCERRADO ])) {
            throw new Exception('Não pode redirecionar esse atendimento.');
        }
        
        if (!($unidade instanceof Unidade)) {
            $unidade = $this->storage
                ->getRepository(Unidade::class)
                ->find($unidade);
        }
        
        if (!($servico instanceof Servico)) {
            $servico = $this->storage
                ->getRepository(Servico::class)
                ->find($servico);
        }
        
        if ($usuario !== null && !($usuario instanceof Usuario)) {
            $usuario = $this->storage
                ->getRepository(Usuario::class)
                ->find($usuario);
        }
        
        $this->dispatcher->createAndDispatch('attending.pre-redirect', [$atendimento, $unidade, $servico, $usuario], true);
        
        $atendimento->setStatus(self::ERRO_TRIAGEM);
        $atendimento->setDataFim(new DateTime());
        
        $tempoPermanencia = $atendimento->getDataFim()->diff($atendimento->getDataChegada());
        $tempoAtendimento = new \DateInterval('P0M');
        
        $atendimento->setTempoPermanencia($tempoPermanencia);
        $atendimento->setTempoAtendimento($tempoAtendimento);
        
        $novo = $this->copyToRedirect($atendimento, $unidade, $servico, $usuario);
        
        $om = $this->storage->getManager();
        $om->merge($atendimento);
        $om->persist($novo);
        
        $om->flush();

        $this->dispatcher->createAndDispatch('attending.redirect', [$atendimento, $novo], true);

        return $novo;
    }
1032824
public function setPaymentMethod($method)
    {
        try {
            if ($method instanceof PagSeguroDirectPaymentMethods) {
                $this->paymentMethod = $method;
            } else {
                $this->paymentMethod = new PagSeguroDirectPaymentMethods($method);
            }
        } catch (Exception $e) {
            die($e->getMessage());
        }
    }
1076295
protected function applyNoInstantiationsWithNew(MethodNode $method)
    {
        if (count($method->findChildrenOfType('AllocationExpression')) === 0) {
            return;
        }

        $this->addViolation(
            $method,
            [
                sprintf(
                    'The method %s uses "new" to instantiate an object which violates rule "No instantiations with \'new\'"',
                    $method->getFullQualifiedName()
                ),
            ]
        );
    }
1163071
function Q(redisClient, key) {
  // handle forgetting a 'new'
  if (!(this instanceof Q)) {
    return new Q(redisClient, key);
  }

  this._redis = redisClient;
  this._key = key;
}
1256384
protected function getInfo(
        /*# string */ $key,
        /*# string */ $method = 'server'
    ) {
        if ('server' === $method) {
            $key = strtoupper($key);
        }
        $data = $this->$method;

        if (empty($key)) {
            return $data;
        } elseif (isset($data[$key])) {
            return $data[$key];
        } else {
            return null;
        }
    }
399373
public void addNewInstanceMethod(Method method) {
        final CachedMethod cachedMethod = CachedMethod.find(method);
        NewInstanceMetaMethod newMethod = new NewInstanceMetaMethod(cachedMethod);
        final CachedClass declaringClass = newMethod.getDeclaringClass();
        addNewInstanceMethodToIndex(newMethod, metaMethodIndex.getHeader(declaringClass.getTheClass()));
    }
993319
private function throwException($method)
    {
        if (isset($this->exceptions[$method]) && ! empty($this->exceptions[$method])) {
            $exception = array_shift($this->exceptions[$method]);

            if ($exception != null) {
                throw $exception;
            }
        }
    }
677332
public static function methodCall(string $method, string $message, $_ = null) : InvalidOperationException
    {
        return self::formatArray('Invalid call to %s: ' . $message, array_merge([$method], array_slice(func_get_args(), 2)));
    }
1053846
protected function prefill()
    {
        if (!$this->prefill || $this->prefilled) {
            return;
        }

        try {
            $this->definitions = $this->getReadConnection()->hGetAll($this->hashName);
            $this->prefilled = true;
        } catch (\Exception $exception) {
            throw new RedisException($exception->getMessage(), $exception->getCode(), $exception);
        }
    }
376973
protected function applyEveryInterfaceMethodMustHaveApiTagAndContractText(MethodNode $method)
    {
        $comment = $method->getComment();
        if (preg_match(
            '(
                \*\s+[{}A-Z0-9\-]+.*\s+
                \*?\s*
                \*\s+@api
            )xi',
            $comment
        )) {
            return;
        }

        $this->addViolation(
            $method,
            [
                sprintf(
                    'The interface method %s does not contain an @api tag or contract text ' .
                    'which violates rule: "%s"',
                    $method->getFullQualifiedName(),
                    self::RULE
                ),
            ]
        );
    }
1073772
public function setMethod($method)
    {
        $method = (string) $method;
        if ($method === '') {
            throw new \InvalidArgumentException('$method cannot be empty');
        }

        $this->method = $method;
    }
490314
public function spop($key)
    {
        try {
            return $this->redis->spop($key);
        } catch (\RedisException $e) {
            die("Error!: " . $e->getMessage() . "<br/>");
        }
    }
53003
function call(method, key) {
    if (!exports.results.has(method))
        create(method); // create as needed
    const methodCache = exports.results.get(method);
    let callResults;
    if (methodCache.has(key)) {
        log_1.logger.debug(`[${method}] Calling (cached): ${key}`);
        // return from cache if key has been used on method before
        callResults = methodCache.get(key);
    }
    else {
        // call and cache for next time, returning results
        log_1.logger.debug(`[${method}] Calling (caching): ${key}`);
        callResults = exports.instance.call(method, key).result;
        methodCache.set(key, callResults);
    }
    return Promise.resolve(callResults);
}
87784
private function addMethod($method)
    {
        $tokens = $this->methodParser->parse($method);
        $query = $this->queryBuilder->build($tokens, $this->tableName, $this->namingContention, $this->entityClass);
        if ($query->getResultMode() <= QueryBuilderResult::RESULT_SELECT_MULTIPLE) {
            $this->addSelectionMethod($query, $method);
        } else {
            $this->addIntResultMethod($query, $method);
        }

    }