Add 'plugi-core/' from commit '6c478c54d048ab2fd5af4e8e79074153fb594c16'

git-subtree-dir: plugi-core
git-subtree-mainline: d4c734cdbd
git-subtree-split: 6c478c54d0
This commit is contained in:
Paul Spenke
2023-06-13 07:27:11 +08:00
151 changed files with 46689 additions and 0 deletions
@@ -0,0 +1,41 @@
<?php
namespace Plugi\Contracts;
interface RouterContract
{
/**
* Return the page corresponding to the given URL.
*
* @param $url
* @return PageTranslationContract|null
*/
public function resolve($url);
/**
* Return the full page translation instance based on the given matched route or page translation id.
* (this method is helpful when extending a router to perform additional checks after a route has been matched)
*
* @param string $matchedRoute the matched route
* @param string $matchedPageTranslationId the page translation id corresponding to the matched route
* @return PageTranslationContract|null
*/
public function getMatchedPage(string $matchedRoute, string $matchedPageTranslationId);
/**
* Order the given routes into the order in which they need to be evaluated.
*
* @param $allRoutes
* @return array
*/
public function getRoutesInOrder($allRoutes);
/**
* Compare two given routes and return -1,0,1 indicating which route should be evaluated first.
*
* @param $route1
* @param $route2
* @return int
*/
public function routeOrderComparison($route1, $route2);
}