-
Notifications
You must be signed in to change notification settings - Fork 1
/
Generator.php
45 lines (37 loc) · 998 Bytes
/
Generator.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/**
* Created by PhpStorm.
* User: Babacar Mbengue
* Date: 28/04/2019
* Time: 09:35
*/
namespace Babacar\Router;
class Generator
{
private static $_instance;
public static function getInstance()
{
if(self::$_instance === null)
{
self::$_instance = new self();
}
return self::$_instance;
}
/**
* @param string $name
* @param array $prams
* @param array $queryArgs
* @return mixed
* @throws Exceptions\RouteNotFoundException
* @throws Exceptions\RouteParameterNameException
* @throws Exceptions\RouteParameterNotMatchException
* @throws Exceptions\RouteParametersMissingException
*/
public static function url(string $name, array $prams = [], array $queryArgs = [])
{
$url =Router::generateUri($name,$prams,$queryArgs);
$baseUrl = base_url();
$baseUrl = substr($baseUrl,0,-1);
return $baseUrl.str_replace('//','/',$url);
}
}