Completed
Push — master ( a28997...0d991d )
by Mark
11s
created

export.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 31 and the first side effect is on line 12.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
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($object->getAll(), PHP_EOL));
41
}
42