src/Assert.php
public static function that(array $config) {
    // If assertion active state is off, bail out prematurely.
    if(
      !self::$active &&
      (!isset($config['force']) || true !== $config['force'])
    ) {
      return;
    }

    // If the condition is either missing or truthful, bail out also.
    if(!isset($config['condition']) || !!$config['condition']) {
      return;
    }

    // Default error type, if missing.
    $type = isset($config['type']) ? $config['type'] : '';

    // Default extra parameters, if missing.
    $params = isset($config['params']) && is_array($config['params'])
      ? $config['params']
      : [];

    // Prepare error message.
    if(empty($config['message'])) {
      // Use default error message.
      $message = 'Assertion condition failed!';
    } else {
      // Use supplied error message, optionally formatted.
      $message = empty($config['args'])
        ? $config['message']
        : self::formatMessage($config['message'], $config['args']);
    }

    // Default error code, if missing.
    $code = isset($config['code']) ? intval($config['code']) : 0;

    // Default error magic code, if missing.
    $magic = isset($config['magic']) ? $config['magic'] : 0x0;

    // Previous error, if exists.
    $previous = isset($config['previous']) ? $config['previous'] : null;

    // If there's a callable to pre-run, run it now.
    if(isset($config['run']) && is_callable($config['run'])) {
      call_user_func($config['run']);
    }

    // Raise an error.
    self::assertImpl($type, $message, $code, $magic, $previous, $params);
  }
public static function that(array $config) {
    // If assertion active state is off, bail out prematurely.
    if(
      !self::$active &&
      (!isset($config['force']) || true !== $config['force'])
    ) {
      return;
    }

    // If the condition is either missing or truthful, bail out also.
    if(!isset($config['condition']) || !!$config['condition']) {
      return;
    }

    // Default error type, if missing.
    $type = isset($config['type']) ? $config['type'] : '';

    // Default extra parameters, if missing.
    $params = isset($config['params']) && is_array($config['params'])
      ? $config['params']
      : [];

    // Prepare error message.
    if(empty($config['message'])) {
      // Use default error message.
      $message = 'Assertion condition failed!';
    } else {
      // Use supplied error message, optionally formatted.
      $message = empty($config['args'])
        ? $config['message']
        : self::formatMessage($config['message'], $config['args']);
    }

    // Default error code, if missing.
    $code = isset($config['code']) ? intval($config['code']) : 0;

    // Default error magic code, if missing.
    $magic = isset($config['magic']) ? $config['magic'] : 0x0;

    // Previous error, if exists.
    $previous = isset($config['previous']) ? $config['previous'] : null;

    // If there's a callable to pre-run, run it now.
    if(isset($config['run']) && is_callable($config['run'])) {
      call_user_func($config['run']);
    }

    // Raise an error.
    self::assertImpl($type, $message, $code, $magic, $previous, $params);
  }
Verifies that the passed condition is truthful (by simply negating it), and
throws an exception if it fails this simple check.

The configuration is an associative array with one or more of the following
keys:

'condition':
condition to test

'type':
One of Error::TYPE_* constants (optional, defaults to general error)

'message':
error message when condition fails

'code':
error code (optional)

'magic':
magic code to easily pinpoint this error (optional)

'previous':
Previous error, if any, which lead to this assertion (optional)

'args':
Extra arguments as input to sprintf() formatting

@throws \Fine47\Exceptions\Error