Skip to content

Commit

Permalink
feat: pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
slowlyo committed Jul 18, 2024
1 parent b32546c commit 85a4dd3
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/Support/Cores/AdminPipeline.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,17 @@ public static function handle($key, $passable, callable $callback = null)
return admin_pipeline($passable)->through($pipes)->then(fn($i) => $do($i));
}

/**
* @param $key
* @param callable $callback
*
* @return mixed
*/
public static function tap($key, callable $callback)
{
return self::handle($key, null, $callback);
}

/**
* @param array|mixed $pipes
*
Expand All @@ -65,4 +76,13 @@ public static function through($key, $pipes)
{
Admin::context()->set($key, $pipes);
}

public static function parseKey($suffix = '', $getChild = false)
{
$callUser = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 2)[1];

$callUser = $getChild ? get_class($callUser['object']) : $callUser['class'];

return $callUser . ($suffix ? ':' . $suffix : '');
}
}

0 comments on commit 85a4dd3

Please sign in to comment.