Completed
Pull Request — master (#109)
by Patrick
10:35
created

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
2
/**
3
 * Cron script
4
 *
5
 * This file describes runs actions needed by the system occasionally that take a long time
6
 *
7
 * PHP version 5 and 7
8
 *
9
 * @author Patrick Boyd / [email protected]
10
 * @copyright Copyright (c) 2015, Austin Artistic Reconstruction
11
 * @license http://www.apache.org/licenses/ Apache 2.0 License
12
 */
13
14
/**
15
 * This cron script recompiles the Browscap cache
16
 */
17
ini_set('memory_limit','-1');      // turn off memory limit for this script
18
set_time_limit(120);               // change to 2 minutes for this script
19
20
require('vendor/autoload.php');
21
22
use BrowscapPHP\Browscap;
23
24
date_default_timezone_set('America/Chicago');
25
26
$bc = new \BrowscapPHP\BrowscapUpdater('/var/php_cache/browser');
0 ignored issues
show
The call to BrowscapUpdater::__construct() misses a required argument $logger.

This check looks for function calls that miss required arguments.

Loading history...
'/var/php_cache/browser' is of type string, but the function expects a object<Psr\SimpleCache\CacheInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
27
$adapter = new \WurflCache\Adapter\File([\WurflCache\Adapter\File::DIR => '/var/php_cache/browser']);
28
$bc->setCache($adapter);
0 ignored issues
show
The method setCache() does not seem to exist on object<BrowscapPHP\BrowscapUpdater>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
29
//$browscap = new Browscap('/var/php_cache/browser');
30
//$browscap->updateCache();
31
$bc->update();
32