Skip to content
Snippets Groups Projects
Commit 616eb824 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

replace calls to self with calls to static, fixes #4758

Closes #4758

Merge request studip/studip!3548
parent eef7f9f6
No related branches found
No related tags found
No related merge requests found
<?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));
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment