public static function registerClass(
    /*int*/ $customType,
    /*string*/ $customClassName
  ) {
    $customType = @intval($customType);
    if(0x1000 > $customType) {
      self::raise([
        'message' => 'Unique id for a custom error starts from 0x1000',
        'type' => Exceptions\Error::TYPE_ARGUMENT,
        'magic' => 0xf181
      ]);
    }

    // One custom class for each unique id.
    if(isset(self::$customErrors[$customType])) {
      self::raise([
        'message' => sprintf(
          'Unique id (%d) has already been assigned a custom error',
          $customType
        ),
        'type' => Exceptions\Error::TYPE_ARGUMENT,
        'magic' => 0xf182
      ]);
    }

    // Remove any white spaces from the class name.
    $customClassName = @trim($customClassName);

    // Allow forward slash to be specified as the namespace separator.
    $customClassName = @str_replace('/', '\\', $customClassName);

    // Adding a leading back-slash to it, if not present.
    if('\\' !== $customClassName{0}) {
      $customClassName = '\\' . $customClassName;
    }

    // Make sure this class exists and extends our own Error class.
    if(!class_exists($customClassName)) {
      self::raise([
        'message' => sprintf(
          'Custom error class is erroneous: %s',
          $customClassName
        ),
        'type' => Exceptions\Error::TYPE_ARGUMENT,
        'magic' => 0xf183
      ]);
    }

    // Make sure this custom error class is a descendant of our own Error class.
    if(!is_subclass_of($customClassName, '\\Fine47\\Exceptions\\Error')) {
      self::raise([
        'message' => 'Custom error class is not sub class of Error.',
        'type' => Exceptions\Error::TYPE_ARGUMENT,
        'magic' => 0xf184
      ]);
    }

    // Register the error class.
    self::$customErrors[$customType] = $customClassName;
  }
public static function registerClass(
    /*int*/ $customType,
    /*string*/ $customClassName
  ) {
    $customType = @intval($customType);
    if(0x1000 > $customType) {
      self::raise([
        'message' => 'Unique id for a custom error starts from 0x1000',
        'type' => Exceptions\Error::TYPE_ARGUMENT,
        'magic' => 0xf181
      ]);
    }

    // One custom class for each unique id.
    if(isset(self::$customErrors[$customType])) {
      self::raise([
        'message' => sprintf(
          'Unique id (%d) has already been assigned a custom error',
          $customType
        ),
        'type' => Exceptions\Error::TYPE_ARGUMENT,
        'magic' => 0xf182
      ]);
    }

    // Remove any white spaces from the class name.
    $customClassName = @trim($customClassName);

    // Allow forward slash to be specified as the namespace separator.
    $customClassName = @str_replace('/', '\\', $customClassName);

    // Adding a leading back-slash to it, if not present.
    if('\\' !== $customClassName{0}) {
      $customClassName = '\\' . $customClassName;
    }

    // Make sure this class exists and extends our own Error class.
    if(!class_exists($customClassName)) {
      self::raise([
        'message' => sprintf(
          'Custom error class is erroneous: %s',
          $customClassName
        ),
        'type' => Exceptions\Error::TYPE_ARGUMENT,
        'magic' => 0xf183
      ]);
    }

    // Make sure this custom error class is a descendant of our own Error class.
    if(!is_subclass_of($customClassName, '\\Fine47\\Exceptions\\Error')) {
      self::raise([
        'message' => 'Custom error class is not sub class of Error.',
        'type' => Exceptions\Error::TYPE_ARGUMENT,
        'magic' => 0xf184
      ]);
    }

    // Register the error class.
    self::$customErrors[$customType] = $customClassName;
  }
public static function registerClass ( /*int*/ $ customType , /*string*/ $ customClassName ) { $ customType = @ intval ( $ customType ) ; if ( 0x1000 > $ customType ) { self :: raise ( [ 'message' => 'Unique id for a custom error starts from 0x1000' , 'type' => Exceptions \ Error :: TYPE_ARGUMENT , 'magic' => 0xf181 ] ) ; } // One custom class for each unique id. if ( isset ( self :: $ customErrors [ $ customType ] ) ) { self :: raise ( [ 'message' => sprintf ( 'Unique id (%d) has already been assigned a custom error' , $ customType ) , 'type' => Exceptions \ Error :: TYPE_ARGUMENT , 'magic' => 0xf182 ] ) ; } // Remove any white spaces from the class name. $ customClassName = @ trim ( $ customClassName ) ; // Allow forward slash to be specified as the namespace separator. $ customClassName = @ str_replace ( '/' , '\\' , $ customClassName ) ; // Adding a leading back-slash to it, if not present. if ( '\\' !== $ customClassName { 0 } ) { $ customClassName = '\\' . $ customClassName ; } // Make sure this class exists and extends our own Error class. if ( ! class_exists ( $ customClassName ) ) { self :: raise ( [ 'message' => sprintf ( 'Custom error class is erroneous: %s' , $ customClassName ) , 'type' => Exceptions \ Error :: TYPE_ARGUMENT , 'magic' => 0xf183 ] ) ; } // Make sure this custom error class is a descendant of our own Error class. if ( ! is_subclass_of ( $ customClassName , '\\Fine47\\Exceptions\\Error' ) ) { self :: raise ( [ 'message' => 'Custom error class is not sub class of Error.' , 'type' => Exceptions \ Error :: TYPE_ARGUMENT , 'magic' => 0xf184 ] ) ; } // Register the error class. self :: $ customErrors [ $ customType ] = $ customClassName ; }
Registers a custom error class in addition to the internal ones. Note that
custom errors' unique id starts from 0x1000.

@param int $customType unique identifier of this error class
@param string $customClassName error class name, including namespace
Registers a custom error class in addition to the internal ones . Note that custom errors unique id starts from 0x1000 .