File.php 659 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @package Grav\Framework\File
  5. *
  6. * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved.
  7. * @license MIT License; see LICENSE file for details.
  8. */
  9. namespace Grav\Framework\File;
  10. use RuntimeException;
  11. use function is_string;
  12. /**
  13. * Class File
  14. * @package Grav\Framework\File
  15. */
  16. class File extends AbstractFile
  17. {
  18. /**
  19. * {@inheritdoc}
  20. * @see FileInterface::save()
  21. */
  22. public function save($data): void
  23. {
  24. if (!is_string($data)) {
  25. throw new RuntimeException('Cannot save data, string required');
  26. }
  27. parent::save($data);
  28. }
  29. }