MongoWriteConcernException.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /*
  3. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  4. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  5. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  6. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  7. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  8. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  9. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  10. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  11. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  12. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  13. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14. */
  15. if (class_exists('MongoWriteConcernException', false)) {
  16. return;
  17. }
  18. /**
  19. * <p>(PECL mongo &gt;= 1.5.0)</p>
  20. * @link http://php.net/manual/en/class.mongowriteconcernexception.php#class.mongowriteconcernexception
  21. */
  22. class MongoWriteConcernException extends MongoCursorException
  23. {
  24. private $document;
  25. /**
  26. * MongoWriteConcernException constructor.
  27. *
  28. * @param string $message
  29. * @param int $code
  30. * @param Exception|null $previous
  31. * @param null $document
  32. *
  33. * @internal The $document parameter is not part of the ext-mongo API
  34. */
  35. public function __construct($message = '', $code = 0, Exception $previous = null, $document = null)
  36. {
  37. parent::__construct($message, $code, $previous);
  38. $this->document = $document;
  39. }
  40. /**
  41. * Get the error document
  42. * @link http://php.net/manual/en/mongowriteconcernexception.getdocument.php
  43. * @return array <p>A MongoDB document, if available, as an array.</p>
  44. */
  45. public function getDocument()
  46. {
  47. return $this->document;
  48. }
  49. }