Passed
Push — master ( c0a3a7...3b84a4 )
by Jeroen
58:51
created

views/default/admin/server/memcache.php (2 issues)

1
<?php
2
/**
3
 * Memcache info
4
 */
5
$servers = elgg_get_config('memcache_servers');
6
$has_class = class_exists('Memcached') || class_exists('Memcache');
7
if (!elgg_get_config('memcache') || empty($servers) || !$has_class) {
8
	echo '<p>' . elgg_echo('admin:server:memcache:inactive') . '</p>';
9
	return;
10
}
11
12
if (class_exists('Memcached')) {
13
	$memcache = new Memcached();
14
} else {
15
	$memcache = new Memcache();
16
}
17
foreach ($servers as $server) {
18
	$title = "{$server[0]}:{$server[1]}";
19
20
	$memcache->connect($server[0], $server[1]);
0 ignored issues
show
The method connect() does not exist on Memcached. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

20
	$memcache->/** @scrutinizer ignore-call */ 
21
            connect($server[0], $server[1]);

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...
21
	$stats = $memcache->getStats();
22
	$memcache->close();
0 ignored issues
show
The method close() does not exist on Memcached. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

22
	$memcache->/** @scrutinizer ignore-call */ 
23
            close();

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...
23
24
	ob_start();
25
	?>
26
	<table class="elgg-table-alt">
27
		<?php
28
		foreach ($stats as $key => $value) {
29
			?>
30
			<tr>
31
				<td><b><?= $key ?></b></td>
32
				<td><?= $value ?></td>
33
			</tr>
34
			<?php
35
		}
36
		?>
37
	</table>
38
39
	<?php
40
	$table = ob_get_clean();
41
42
	echo elgg_view_module('info', $title, $table);
43
}
44