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