export.php ➔ outputTxt()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
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 = array(
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()));
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()));
41
}
42