MatchWithOffsetsResult.php 990 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /*
  3. * This file is part of composer/pcre.
  4. *
  5. * (c) Composer <https://github.com/composer>
  6. *
  7. * For the full copyright and license information, please view
  8. * the LICENSE file that was distributed with this source code.
  9. */
  10. namespace Composer\Pcre;
  11. final class MatchWithOffsetsResult
  12. {
  13. /**
  14. * An array of match group => pair of string matched + offset in bytes (or -1 if no match)
  15. *
  16. * @readonly
  17. * @var array<int|string, array{string|null, int}>
  18. * @phpstan-var array<int|string, array{string|null, int<-1, max>}>
  19. */
  20. public $matches;
  21. /**
  22. * @readonly
  23. * @var bool
  24. */
  25. public $matched;
  26. /**
  27. * @param 0|positive-int $count
  28. * @param array<array{string|null, int}> $matches
  29. * @phpstan-param array<int|string, array{string|null, int<-1, max>}> $matches
  30. */
  31. public function __construct(int $count, array $matches)
  32. {
  33. $this->matches = $matches;
  34. $this->matched = (bool) $count;
  35. }
  36. }