Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401]

   1  <?php
   2  /*
   3   * Copyright 2015-present MongoDB, Inc.
   4   *
   5   * Licensed under the Apache License, Version 2.0 (the "License");
   6   * you may not use this file except in compliance with the License.
   7   * You may obtain a copy of the License at
   8   *
   9   *   https://www.apache.org/licenses/LICENSE-2.0
  10   *
  11   * Unless required by applicable law or agreed to in writing, software
  12   * distributed under the License is distributed on an "AS IS" BASIS,
  13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14   * See the License for the specific language governing permissions and
  15   * limitations under the License.
  16   */
  17  
  18  namespace MongoDB\Exception;
  19  
  20  class UnsupportedException extends RuntimeException
  21  {
  22      /**
  23       * Thrown when a command's allowDiskUse option is not supported by a server.
  24       *
  25       * @return self
  26       */
  27      public static function allowDiskUseNotSupported()
  28      {
  29          return new static('The "allowDiskUse" option is not supported by the server executing this operation');
  30      }
  31  
  32      /**
  33       * Thrown when array filters are not supported by a server.
  34       *
  35       * @deprecated 1.12
  36       * @todo Remove this in 2.0 (see: PHPLIB-797)
  37       *
  38       * @return self
  39       */
  40      public static function arrayFiltersNotSupported()
  41      {
  42          return new static('Array filters are not supported by the server executing this operation');
  43      }
  44  
  45      /**
  46       * Thrown when collations are not supported by a server.
  47       *
  48       * @deprecated 1.12
  49       * @todo Remove this in 2.0 (see: PHPLIB-797)
  50       *
  51       * @return self
  52       */
  53      public static function collationNotSupported()
  54      {
  55          return new static('Collations are not supported by the server executing this operation');
  56      }
  57  
  58      /**
  59       * Thrown when the commitQuorum option for createIndexes is not supported
  60       * by a server.
  61       *
  62       * @return self
  63       */
  64      public static function commitQuorumNotSupported()
  65      {
  66          return new static('The "commitQuorum" option is not supported by the server executing this operation');
  67      }
  68  
  69      /**
  70       * Thrown when explain is not supported by a server.
  71       *
  72       * @return self
  73       */
  74      public static function explainNotSupported()
  75      {
  76          return new static('Explain is not supported by the server executing this operation');
  77      }
  78  
  79      /**
  80       * Thrown when a command's hint option is not supported by a server.
  81       *
  82       * @return self
  83       */
  84      public static function hintNotSupported()
  85      {
  86          return new static('Hint is not supported by the server executing this operation');
  87      }
  88  
  89      /**
  90       * Thrown when a command's readConcern option is not supported by a server.
  91       *
  92       * @return self
  93       */
  94      public static function readConcernNotSupported()
  95      {
  96          return new static('Read concern is not supported by the server executing this command');
  97      }
  98  
  99      /**
 100       * Thrown when a readConcern is used with a read operation in a transaction.
 101       *
 102       * @return self
 103       */
 104      public static function readConcernNotSupportedInTransaction()
 105      {
 106          return new static('The "readConcern" option cannot be specified within a transaction. Instead, specify it when starting the transaction.');
 107      }
 108  
 109      /**
 110       * Thrown when a command's writeConcern option is not supported by a server.
 111       *
 112       * @return self
 113       */
 114      public static function writeConcernNotSupported()
 115      {
 116          return new static('Write concern is not supported by the server executing this command');
 117      }
 118  
 119      /**
 120       * Thrown when a writeConcern is used with a write operation in a transaction.
 121       *
 122       * @return self
 123       */
 124      public static function writeConcernNotSupportedInTransaction()
 125      {
 126          return new static('The "writeConcern" option cannot be specified within a transaction. Instead, specify it when starting the transaction.');
 127      }
 128  }