设置执行代码
@param callable $code callable(InputInterface $input, OutputInterface $output)
@return Command
@throws \InvalidArgumentException
@see execute()
500171
public function setCode(callable $code) {
        if (!is_callable($code)) {
            throw new \InvalidArgumentException('Invalid callable provided to Command::setCode.');
        }

        if (PHP_VERSION_ID >= 50400 && $code instanceof \Closure) {
            $r = new \ReflectionFunction($code);
            if (null === $r->getClosureThis()) {
                $code = \Closure::bind($code, $this);
            }
        }

        $this->code = $code;

        return $this;
    }
1177449
protected function execute(InputInterface $input, OutputInterface $output)
  {
    $this->_input = $input;
    $this->_output = $output;

    $params = array_values($input->getArguments());
    //Strip off the command name
    array_shift($params);

    //Call the execute command with $input and $output as the first args
    if(method_exists($this, 'executeCommand'))
    {
      array_unshift($params, $input, $output);
      return $this->executeCommand(...$params);
    }

    //Call the process method, without $input and $output
    if(method_exists($this, 'process'))
    {
      return $this->process(...$params);
    }

    throw new \RuntimeException(
      "Your command must contain one of the following methods:\n" .
      "process()\n" .
      'executeCommand(InputInterface $input, OutputInterface $output)' . "\n",
      500
    );
  }
1162996
protected function filtreCode($code)
    {
        if (is_numeric($code)) {
            $code = (int) $code;
        }
        if (!isset($this->reasonPhraseDefault[ $code ])) {
            throw new \InvalidArgumentException('Status code is invalid.');
        }

        return $code;
    }
363430
public function scriptBlock($code, array $options = [])
    {
        $options = optionsParser($options, ['block' => true]);

        return parent::scriptBlock($code, $options->toArray());
    }
252443
public function findByActivationCode($code)
	{
		if ( ! $code)
		{
			throw new \InvalidArgumentException("No activation code passed.");
		}

		$model = $this->createModel();

		$result = $model->where('activation_code', '=', $code)->get();

		if (($count = $result->count()) > 1)
		{
			throw new \RuntimeException("Found [$count] users with the same activation code.");
		}

		 $user = $result->find();

		if ( !$user->loaded() )
		{
			throw new UserNotFoundException("A user was not found with the given activation code.");
		}

		return $user;
	}
1351575
public function getName(string $code): string
    {
        $result = $code;

        if (empty($code)) {
            throw new InvalidArgumentException("Code must be a non-empty string.");
        }

        $languages = $this->getSupported();
        if (!empty($languages[$code])) {
            $result = $languages[$code];
        }

        return $result;
    }
1056239
public static function Create($code, $args = null, $_ = null)
  {
    if (!is_null($args)) {
      if (!is_array($args)) {
        $args = array_slice(func_get_args(), 1);
      }
    }

    $str = static::GetNameForCode($code, $args);

    return new static($str, $code);
  }
96036
public function execute($code, $throwExceptions = false)
    {
        $this->setCode($code, true);
        $closure = new ExecutionClosure($this);

        if ($throwExceptions) {
            return $closure->execute();
        }

        try {
            return $closure->execute();
        } catch (\TypeError $_e) {
            $this->writeException(TypeErrorException::fromTypeError($_e));
        } catch (\Error $_e) {
            $this->writeException(ErrorException::fromError($_e));
        } catch (\Exception $_e) {
            $this->writeException($_e);
        }
    }
18337
public static function invoke(
        array $options,
        string $code
    ): string {
        $codes = Property::getArray(
            $options,
            self::OPTION_CODES,
            null
        );

        if (empty($codes)) {
            return $code;
        }

        return Property::getString(
            $codes,
            $code,
            $code
        );
    }
1174778
public function compile($code, $path = null) {
        global $CFG;

        $pathtosassc = trim($CFG->pathtosassc ?? '');

        if (!empty($pathtosassc) && is_executable($pathtosassc) && !is_dir($pathtosassc)) {
            $process = proc_open(
                $pathtosassc . ' -I' . implode(':', $this->importPaths) . ' -s',
                [
                    ['pipe', 'r'], // Set the process stdin pipe to read mode.
                    ['pipe', 'w'], // Set the process stdout pipe to write mode.
                    ['pipe', 'w'] // Set the process stderr pipe to write mode.
                ],
                $pipes // Pipes become available in $pipes (pass by reference).
            );
            if (is_resource($process)) {
                fwrite($pipes[0], $code); // Write the raw scss to the sassc process stdin.
                fclose($pipes[0]);

                $stdout = stream_get_contents($pipes[1]);
                $stderr = stream_get_contents($pipes[2]);

                fclose($pipes[1]);
                fclose($pipes[2]);

                // The proc_close function returns the process exit status. Anything other than 0 is bad.
                if (proc_close($process) !== 0) {
                    throw new coding_exception($stderr);
                }

                // Compiled CSS code will be available from stdout.
                return $stdout;
            }
        }

        return parent::compile($code, $path);
    }
1371718
public function setCode($code)
    {
        if (!is_scalar($code)) {
            throw new InvalidArgumentException(
                sprintf(
                    'Wrong parameters for %s([int|string $code]); %s given.',
                    __METHOD__,
                    is_object($code) ? get_class($code) : gettype($code)
                ),
                E_ERROR
            );
        }

        $this->code = $code;

        return $this;
    }
1022475
function execute(code, { filename = path.cwd('./__temp.js'), babelOptions } = {}) {

    // 生成模块
    if (!(filename in locals) || locals.code !== code) {
        let script = new vm.Script(transform(code, babelOptions).code, { filename }),
            dirname = path.dirname(filename),
            loader = createLoader(dirname, babelOptions),
            local = { exports: {} };

        // 执行代码
        script.runInNewContext({
            process,
            module: local,
            exports: local.exports,
            require: loader,
            __dirname: dirname,
            __filename: filename
        });

        // 缓存模块
        locals[filename] = { code, exports: local.exports };
    }

    // 返回模块
    return locals[filename].exports;
}
969737
public function execute($callable, array $args = [], $context = null)
    {
        if ($callable instanceof \Closure) {
            $ref = new \ReflectionObject($callable);

            $args = $this->getMethodArgs($ref->getMethod('__invoke'), $args);
        } else {
            if (is_string($callable)) {
                $callable = explode('::', $callable);
            }

            list($object, $method) = $callable;

            $ref = new \ReflectionClass($object);

            $args = $this->getMethodArgs($ref->getMethod($method), $args);
        }

        $closure = function () use ($args, $callable) {
            switch (count($args)) {
                case 0:
                    return $callable();
                case 1:
                    return $callable($args[0]);
                case 2:
                    return $callable($args[0], $args[1]);
                case 3:
                    return $callable($args[0], $args[1], $args[2]);
                case 4:
                    return $callable($args[0], $args[1], $args[2], $args[3]);
                default:
                    return call_user_func_array($callable, $args);
            }
        };

        if ($context) {
            $closure = $closure->bindTo($context, $context);
        }

        return $closure();
    }
905230
public static function voice($code = null)
    {
        $sms = new self();
        $sms->type(self::TYPE_VOICE);
        $sms->code($code);

        return $sms;
    }
635310
public function show($code)
    {
        $lang = $this->langRepo->getByCode($code);
        if (empty($lang)) {
            return $this->respondNotFound();
        }
        return $this->respondWithSuccess($lang, new LangTransformer);
    }
704048
public function withStatus($code, $reason = '')
    {
        $code = Validator::checkCode($code);

        if (!is_string($reason) && !method_exists($reason, '__toString')) {
            throw new InvalidArgumentException('ReasonPhrase must be a string');
        }

        $clone = clone $this;
        $clone->code = $code;
        if ($reason === '') {
            $reason = Validator::getCodeMessage($code);
        }

        if ($reason === '') {
            throw new InvalidArgumentException('ReasonPhrase must be supplied for this code');
        }

        $clone->phrase = $reason;

        return $clone;
    }
703385
public function executeCode($code, array $arguments = [])
    {
        if (! ($code instanceof MongoCode)) {
            $code = new MongoCode($code);
        }

        return $this->database->execute($code, $arguments);
    }