/**
  * Constructor accepts message string and any number of parameters, which will be used as string replacements for
  * message string (unless an instance of \Throwable is found, in which case it is passed to parent as previous).
  *
  * @param null|string $message
  * @param mixed       ...$params
  */
 public function __construct(string $message = null, ...$params)
 {
     parent::__construct($this->compileMessage($message ?: $this->defaultMessage(), $params), null, $this->compileThrown($params));
 }
Пример #2
0
 /**
  * Validate the requested object instance or class name exists.
  *
  * @param string        $method The method name
  * @param string|object $object The object instance or class name
  * @param bool          $static Whether this is a static call or not
  *
  * @internal
  *
  * @throws BadFunctionCallException
  *
  * @return string|array
  */
 private static function validateMethod($method, $object, $static)
 {
     $callable = $static ? $object . '::' . $method : [$object, $method];
     if (method_exists($object, $method) && is_callable($callable)) {
         return $callable;
     }
     throw BadFunctionCallException::create('Could not validate call method.');
 }