-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c4e9338
commit f1d5ff0
Showing
3 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use App\Models\Federation; | ||
use Illuminate\Support\Facades\Cache; | ||
|
||
class EduidczStatisticController extends Controller | ||
{ | ||
public function __invoke() | ||
{ | ||
$cache_time = now('Europe/Prague')->addHour(); | ||
|
||
$CACHE_TIME = Cache::remember('CACHE_TIME', $cache_time, function () use ($cache_time) { | ||
return $cache_time; | ||
}); | ||
|
||
$entities = Cache::remember('entities', $CACHE_TIME, function () { | ||
return Federation::whereXml_name('https://eduid.cz/metadata') | ||
->first() | ||
->entities() | ||
->get() | ||
->filter(fn ($e) => ! $e->hfd); | ||
}); | ||
|
||
// Number of non-HfD entities in eduID.cz | ||
$eduidcz = $entities->count(); | ||
|
||
// Number of eduID.cz entities joined to eduGAIN | ||
$edugain = $entities->filter(fn ($e) => $e->edugain)->count(); | ||
|
||
// Number of SPs in eduID.cz | ||
$services = $entities->filter(fn ($e) => $e->type->value === 'sp')->count(); | ||
|
||
// Number of IdPs in eduID.cz | ||
$organizations = $entities->filter(fn ($e) => $e->type->value === 'idp')->count(); | ||
|
||
return view('statistics', compact('eduidcz', 'edugain', 'services', 'organizations')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
<title>eduID.cz statistics</title> | ||
<style> | ||
table { | ||
border: 1px solid black; | ||
border-collapse: collapse; | ||
} | ||
table td { | ||
border: 1px solid black; | ||
padding: 3px; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
|
||
<h1>Simple eduID.cz statistics</h1> | ||
|
||
<table> | ||
<tr> | ||
<td>eduID.cz</td> | ||
<td>{{ $eduidcz }}</td> | ||
</tr> | ||
<tr> | ||
<td>eduGAIN</td> | ||
<td>{{ $edugain }}</td> | ||
</tr> | ||
<tr> | ||
<td>eduID.cz services</td> | ||
<td>{{ $services }}</td> | ||
</tr> | ||
<tr> | ||
<td>eduID.cz organizations</td> | ||
<td>{{ $organizations }}</td> | ||
</tr> | ||
</table> | ||
|
||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters