Skip to content

Commit 07d1608

Browse files
committed
Make the defaultweight static
The uasort function is static, and needs a static config variable :(
1 parent 19cd533 commit 07d1608

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

lib/PowerIdPDisco.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ class PowerIdPDisco extends \SimpleSAML\XHTML\IdPDisco
4444
private $cdcLifetime;
4545

4646

47+
/**
48+
* The default sort weight for entries without 'discopower.weight'.
49+
*
50+
* @var int|null
51+
*/
52+
static $defaultWeight = 50;
53+
4754
/**
4855
* Initializes this discovery service.
4956
*
@@ -65,6 +72,8 @@ public function __construct(array $metadataSets, string $instance)
6572
}
6673

6774
$this->cdcLifetime = $this->discoconfig->getInteger('cdc.lifetime', null);
75+
76+
self::$defaultWeight = $this->discoconfig->getInteger('defaultweight', 50);
6877
}
6978

7079

@@ -99,10 +108,10 @@ public static function mcmp(array $a, array $b): int
99108
{
100109
// default weights
101110
if (!isset($a['discopower.weight']) || !is_int($a['discopower.weight'])) {
102-
$a['discopower.weight'] = $this->discoconfig->getInteger('defaultweight', 50);
111+
$a['discopower.weight'] = self::$defaultWeight;
103112
}
104113
if (!isset($b['discopower.weight']) || !is_int($b['discopower.weight'])) {
105-
$b['discopower.weight'] = $this->discoconfig->getInteger('defaultweight', 50);
114+
$b['discopower.weight'] = self::$defaultWeight;
106115
}
107116
if ($a['discopower.weight'] > $b['discopower.weight']) {
108117
return -1; // higher weights further up

0 commit comments

Comments
 (0)