class-invalid-indexable-exception.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * WPSEO plugin file.
  4. *
  5. * @package WPSEO\Internals
  6. */
  7. /**
  8. * Class WPSEO_Invalid_Indexable_Exception.
  9. */
  10. class WPSEO_Invalid_Indexable_Exception extends InvalidArgumentException {
  11. /**
  12. * Creates an invalid indexable exception.
  13. *
  14. * @param int $id The ID that was passed.
  15. *
  16. * @return WPSEO_Invalid_Indexable_Exception The exception.
  17. */
  18. public static function non_existing_indexable( $id ) {
  19. return new self(
  20. sprintf(
  21. /* translators: %1$s expands to the indexable's ID. */
  22. __( 'Indexable with ID `%1$s` does not exist', 'wordpress-seo' ),
  23. $id
  24. )
  25. );
  26. }
  27. /**
  28. * Creates an invalid POST request exception.
  29. *
  30. * @param int $id The ID that was passed.
  31. *
  32. * @return WPSEO_Invalid_Indexable_Exception The exception.
  33. */
  34. public static function invalid_post_request( $id ) {
  35. return new self(
  36. sprintf(
  37. /* translators: %1$s expands to the indexable's ID. */
  38. __( 'Invalid POST request. Meta values already exist for object with ID %1$s.', 'wordpress-seo' ),
  39. $id
  40. )
  41. );
  42. }
  43. }