export.php 986 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /*
  3. * This file is part of Crawler Detect - the web crawler detection library.
  4. *
  5. * (c) Mark Beech <m@rkbee.ch>
  6. *
  7. * This source file is subject to the MIT license that is bundled
  8. * with this source code in the file LICENSE.
  9. */
  10. require 'src/Fixtures/AbstractProvider.php';
  11. require 'src/Fixtures/Crawlers.php';
  12. require 'src/Fixtures/Exclusions.php';
  13. require 'src/Fixtures/Headers.php';
  14. $src = array(
  15. 'Crawlers',
  16. 'Exclusions',
  17. 'Headers',
  18. );
  19. foreach ($src as $class) {
  20. $class = "Jaybizzle\\CrawlerDetect\\Fixtures\\$class";
  21. $object = new $class;
  22. outputJson($object);
  23. outputTxt($object);
  24. }
  25. function outputJson($object)
  26. {
  27. $className = (new ReflectionClass($object))->getShortName();
  28. file_put_contents("raw/$className.json", json_encode($object->getAll()));
  29. }
  30. function outputTxt($object)
  31. {
  32. $className = (new ReflectionClass($object))->getShortName();
  33. file_put_contents("raw/$className.txt", implode($object->getAll(), PHP_EOL));
  34. }