Skip to content

Commit

Permalink
Linting: linting code
Browse files Browse the repository at this point in the history
  • Loading branch information
WunderJacob committed Dec 20, 2023
1 parent bf748bd commit c0ec75b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion classes/helper/user_path_relation.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public function get_user_path_relation($learningpathid, $userid) {
* Get active user path relation.
*
* @param object $userpath
* @param array $nodes
* @return object
*
*/
public function revision_user_path_relation($userpath) {
Expand Down
20 changes: 18 additions & 2 deletions classes/learning_paths.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public static function get_learning_user_relations($data) {
/**
* Get user path relation.
*
* @param string $json
* @param object $relationnodes
* @return array
*/
public static function getnodeprogress($relationnodes) {
Expand All @@ -261,7 +261,7 @@ public static function getnodeprogress($relationnodes) {
}
}

// Filter paths ending with childCondition null
// Filter paths ending with childCondition null.
$filteredpaths = array_filter($paths, function ($path) use ($pathnodes) {
$lastnode = self::findNodeById(end($path), $pathnodes);
return isset($lastnode['childCourse']) && empty($lastnode['childCourse']);
Expand All @@ -285,6 +285,15 @@ public static function getnodeprogress($relationnodes) {
];
}

/**
* Find a paths in learning path.
*
* @param array $node
* @param array $currentpath
* @param array $paths
* @param array $nodes
* @return array
*/
public static function findpaths($node, $currentpath, &$paths, $nodes) {
$currentpath[] = $node['id'];

Expand All @@ -301,6 +310,13 @@ public static function findpaths($node, $currentpath, &$paths, $nodes) {
}
}

/**
* Find a node by its id.
*
* @param int $id
* @param array $nodes
* @return array
*/
public static function findnodebyid($id, $nodes) {
global $data;
foreach ($nodes as $node) {
Expand Down
3 changes: 2 additions & 1 deletion classes/relation_update.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public static function updated_single($event) {
* Observer for course completed
*
* @param array $completionnodepaths
* @param string $key
* @return array
*/
public static function getcompletionnode($completionnodepaths) {
// TODO sort the valid completion paths.
Expand All @@ -115,6 +115,7 @@ public static function getcompletionnode($completionnodepaths) {
* @param array $haystack
* @param array $needle
* @param string $key
* @return array
*/
public static function searchnestedarray($haystack, $needle, $key) {
foreach ($haystack as $item) {
Expand Down

0 comments on commit c0ec75b

Please sign in to comment.