@param bool $checkCode

@throws ExecutionException

@return CliResult
494064
public function getResult($checkCode = true)
    {
        if (null === $this->result) {
            $tmpFileName = 'tmp-'.self::$tmpCounter++.'.sh';
            $tmpFileLines = array_merge($this->scriptInit, $this->scriptParts);
            $this->tmpFilePath = $this->cwd.'/'.$tmpFileName;
            file_put_contents($this->tmpFilePath, implode("\n", $tmpFileLines));
            chmod($this->tmpFilePath, 0777);
            $command = './'.$tmpFileName;

            // for symfony/process:^4.2
            if (method_exists(Process::class, 'fromShellCommandline')) {
                $process = Process::fromShellCommandline($command, $this->cwd);
            } else {
                $process = new Process($command, $this->cwd);
            }
            $process->run();

            $this->result = new CliResult(
                $process->getExitCode(),
                $process->getOutput(),
                $process->getErrorOutput()
            );
        }

        if ($checkCode && 0 !== $this->result->getCode()) {
            throw new ExecutionException(
                $this->result,
                sprintf(
                    "Cannot execute `%s`:\n%s\nCode: %s\nExit text: %s\nError output: %s\nDetails:\n%s",
                    $command,
                    implode("\n", array_map(function ($line) { return "$ ${line}"; }, $tmpFileLines)),
                    $this->result->getCode(),
                    isset(Process::$exitCodes[$this->result->getCode()]) ? Process::$exitCodes[$this->result->getCode()] : 'Unknown exit code',
                    $this->result->getError(),
                    $this->result->getOutput()
                ),
                $process->getExitCode()
            );
        }

        return $this->result;
    }
193401
public function flushCode()
    {
        if ($this->hasValidCode()) {
            $this->addCodeBufferToHistory();
            $code = $this->code;
            $this->popCodeStack();

            return $code;
        }
    }
1251006
public function evaluate($code) {
		$code = $this->applyHandlersToCode($code);
		$code = $this->adaptCodeToEval($code);

		$this->backupGlobals();
		$this->applyOpenBaseDirSetting();

		$startTime = microtime(true);
		static::executeCode('', $this->sharedVars);
		$selfTime = microtime(true) - $startTime;

		ob_start();
		$result = new EvalResult();
		$startTime = microtime(true);
		try {
			$result->return = static::executeCode($code, $this->sharedVars);
		}
		catch(\Throwable $exception) {
			$result->exception = $exception;
		}
		catch(\Exception $exception) {
			$result->exception = $exception;
		}
		$result->time = abs(microtime(true) - $startTime - $selfTime);
		$result->output = ob_get_clean();

		$this->restoreGlobals();

		return $result;
	}
156089
protected function _getInstallmentsHelperFromPaymentMethod($methodCode)
    {
        $helperClassName = $this->_scopeConfig->getValue('installments/payment_methods/'
            . $methodCode . '/installments_helper');
        $helper = $this->_helperFactory->get($helperClassName);
        if (false === $helper instanceof \Magento\Framework\App\Helper\AbstractHelper) {
            throw new \LogicException($helperClassName .
                ' doesn\'t extend Magento\Framework\App\Helper\AbstractHelper');
        }

        return $helper;
    }
1037474
public function postManage($code = null)
    {
        if ($code === null) {
            throw new NotFoundHttpException();
        }

        $subscriber = Subscriber::where('verify_code', '=', $code)->first();

        if (!$subscriber) {
            throw new BadRequestHttpException();
        }

        try {
            execute(new UpdateSubscriberSubscriptionCommand($subscriber, Binput::get('subscriptions')));
        } catch (ValidationException $e) {
            return cachet_redirect('subscribe.manage', $subscriber->verify_code)
                ->withInput(Binput::all())
                ->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('cachet.subscriber.email.failure')))
                ->withErrors($e->getMessageBag());
        }

        return cachet_redirect('subscribe.manage', $subscriber->verify_code)
            ->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('cachet.subscriber.email.updated-subscribe')));
    }
1092505
protected function setAuthCode($oauthCode, $accountId, $redirectUri, $expires = null, $scope = null)
    {
        if (null === $account = $this->app['repo.api-accounts']->find($accountId)) {
            throw new RuntimeException(sprintf('Account with id %s is not valid', $accountId));
        }
        $code = $this->app['manipulator.api-oauth-code']->create($account, $redirectUri, $expires, $scope);
        $this->app['manipulator.api-oauth-code']->setCode($code, $oauthCode);

        return $this;
    }
1048474
public function get(string $code, string $cardId = '', bool $checkConsume = true)
    {
        $params = [
            'code' => $code,
            'check_consume' => $checkConsume,
            'card_id' => $cardId,
        ];

        return $this->httpPostJson('card/code/get', $params);
    }
1045574
public function setSecretCode($secretCode)
    {
        if (!Icepay_Parameter_Validation::secretCode($secretCode))
            throw new Exception('Secretcode not valid');

        $this->_secretCode = (string) $secretCode;
        return $this;
    }
535897
public function code ( $code = NULL ) {
      if ( $code === NULL )
        return $this->code;
      if ( ResponseCode::find( $code ) === NULL )
        throw new \InvalidArgumentException( "Response: no code $code" );
      $this->code = intval( $code );
      return $this;
    }
963741
public function execute($code = null) {

		if(null !== $code && false === ('-' . intval($code) == '-' . $code)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type integer, "%s" given', __METHOD__, gettype($code)), E_USER_ERROR);
		}

		$this -> setUrl();

		if(null !== $this -> seconds) {
			return Response :: addHeader('refresh', sprintf('%d;url=%s', $this -> seconds, $this -> url), $code);
		}

		Response :: addHeader('Location', $this -> url, $code);
	}
303106
public final function withStatus(
       $code,
       $reasonPhrase = ""): ResponseInterface
   {
       try {
           $response = $this->with("statusCode", $code);
           $response->setStatus((int) $code, $reasonPhrase);
       } catch (InvalidArgumentException $e) {
           throw new InvalidArgumentException(
               "Can't get instance for status: " . $e->getMessage());
       }
       return $response;
   }
1020548
function responseCode($code = null) {
		if ($code === null) {
			return $this->http_response_code;
		}
		else { // $code !== null, act as setter
			$this->http_response_code = $code;
			return $this;
		}
	}
268412
public function withStatusCode(int $code)
    {
        if ($this->statusCode == $code) {
            return $this;
        }

        $that = clone($this);
        $that->statusCode = $code;
        return $that;
    }
642325
public function generateChecksum($obj = null, $secretCode = null,$isautocheckout = false)
    {
        $arr = array();
        if ($secretCode)
            array_push($arr, $secretCode);

        foreach ($obj as $val) {
            $insert = $val;

            if (is_bool($val)) {
                if ($isautocheckout) {
					$insert = ($val) ? 'True' : 'False';	// autocheckout function computes boolean checksum differently (first character uppercase)
				} else {
					$insert = ($val) ? 'true' : 'false';
				}
            }

            array_push($arr, $insert);
        }

        return sha1(implode("|", $arr));
    }
253160
public function getFilter(string $code): FilterInterface
    {
        if (empty($this->filters[$code])) {
            throw new UnexpectedValueException("No filter with code : {$code} for query handler {$this->code}");
        }

        return $this->filters[$code];
    }
1288533
public function withStatus($code, $reasonPhrase = '')
    {
        $this->getStateObject()->setStatusCode($code);
        $this->getStateObject()->setReasonPhrase($reasonPhrase);

        return $this;
    }
1279713
public function check($code)
    {
        $promocode = Promocode::byCode($code)->first();

        if ($promocode === null) {
            throw new InvalidPromocodeException;
        }

        if ($promocode->isExpired() || ($promocode->isDisposable() && $promocode->users()->exists())) {
            return false;
        }

        return $promocode;
    }