aboutsummaryrefslogtreecommitdiff
path: root/lib/classes/SimpleCollection.php
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2024-10-24 13:11:02 +0000
committerJan-Hendrik Willms <tleilax+studip@gmail.com>2024-10-24 13:11:02 +0000
commit616eb8241966fd5cc752971cfa7c346ea854328e (patch)
tree962da81164b76df919ea6c6abcc8630a351486c3 /lib/classes/SimpleCollection.php
parenteef7f9f64f67afa97353e723457feada7edf4411 (diff)
replace calls to self with calls to static, fixes #4758
Closes #4758 Merge request studip/studip!3548
Diffstat (limited to 'lib/classes/SimpleCollection.php')
-rw-r--r--lib/classes/SimpleCollection.php17
1 files changed, 5 insertions, 12 deletions
diff --git a/lib/classes/SimpleCollection.php b/lib/classes/SimpleCollection.php
index ae773f5..bbfece2 100644
--- a/lib/classes/SimpleCollection.php
+++ b/lib/classes/SimpleCollection.php
@@ -1,11 +1,4 @@
<?php
-if (!defined('SORT_NATURAL')) {
- define('SORT_NATURAL', 6);
-}
-if (!defined('SORT_FLAG_CASE')) {
- define('SORT_FLAG_CASE', 8);
-}
-
/**
* SimpleCollection.php
* collection of assoc arrays with convenience
@@ -386,7 +379,7 @@ class SimpleCollection extends StudipArrayObject
*/
public function findBy($key, $values, $op = '==')
{
- $comp_func = self::getCompFunc($op, $values);
+ $comp_func = static::getCompFunc($op, $values);
return $this->filter(function ($record) use ($comp_func, $key) {
return $comp_func($record[$key]);
});
@@ -404,7 +397,7 @@ class SimpleCollection extends StudipArrayObject
*/
public function findOneBy($key, $values, $op = '==')
{
- $comp_func = self::getCompFunc($op, $values);
+ $comp_func = static::getCompFunc($op, $values);
return $this->filter(function ($record) use ($comp_func, $key) {
return $comp_func($record[$key]);
}, 1)->first();
@@ -462,7 +455,7 @@ class SimpleCollection extends StudipArrayObject
}
}
}
- return self::createFromArray($results);
+ return static::createFromArray($results);
}
/**
@@ -621,7 +614,7 @@ class SimpleCollection extends StudipArrayObject
public function unsetBy($key, $values, $op = '==')
{
$ret = false;
- $comp_func = self::getCompFunc($op, $values);
+ $comp_func = static::getCompFunc($op, $values);
foreach ($this->storage as $k => $record) {
if ($comp_func($record[$key])) {
$this->offsetunset($k);
@@ -737,7 +730,7 @@ class SimpleCollection extends StudipArrayObject
$offset = $arg1;
$row_count = $arg2;
}
- return self::createFromArray(array_slice($this->storage, $offset, $row_count, true));
+ return static::createFromArray(array_slice($this->storage, $offset, $row_count, true));
}
/**