A bare bones front-end for knockout designed for maximum compatibility with "obsolete" browsers
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.3KB

  1. <?php
  2. namespace App\Vendor\BBCode;
  3. /**
  4. * This class represents a single BBCode tag.
  5. * It is just a simple class used for storing tag.
  6. *
  7. * @package ChrisKonnertz\BBCode
  8. */
  9. class Tag {
  10. /**
  11. * The name of the tag
  12. *
  13. * @var string|null
  14. */
  15. public $name = null;
  16. /**
  17. * The value of the property
  18. *
  19. * @var string
  20. */
  21. public $property = null;
  22. /**
  23. * Is this an opening tag (true)?
  24. *
  25. * @var bool
  26. */
  27. public $opening = true;
  28. /**
  29. * Is this tag valid?
  30. *
  31. * @var bool
  32. */
  33. public $valid = true;
  34. /**
  35. * Position of this tag inside the whole BBCode string
  36. *
  37. * @var int
  38. */
  39. public $position = -1;
  40. /**
  41. * Tag constructor.
  42. *
  43. * @param string|null $name The name of the tag
  44. * @param bool $opening Is this an opening tag (true)?
  45. */
  46. public function __construct($name = null, $opening = true)
  47. {
  48. if ($name !== null and ! is_string($name)) {
  49. throw new \InvalidArgumentException('The "name" parameter has to be of type string');
  50. }
  51. if (! is_bool($opening)) {
  52. throw new \InvalidArgumentException('The "opening" parameter has to be of type bool');
  53. }
  54. $this->name = $name;
  55. $this->opening = $opening;
  56. }
  57. }