stringify.php 587 B

123456789101112131415161718192021222324252627
  1. <?php
  2. /*
  3. * This file is part of Respect/Stringifier.
  4. *
  5. * (c) Henrique Moody <henriquemoody@gmail.com>
  6. *
  7. * For the full copyright and license information, please view the "LICENSE.md"
  8. * file that was distributed with this source code.
  9. */
  10. declare(strict_types=1);
  11. namespace Respect\Stringifier;
  12. use Respect\Stringifier\Stringifiers\ClusterStringifier;
  13. function stringify($value): string
  14. {
  15. static $stringifier;
  16. if (null === $stringifier) {
  17. $stringifier = ClusterStringifier::createDefault();
  18. }
  19. return $stringifier->stringify($value, 0) ?? '#ERROR#';
  20. }