Skip to content

Commit 0eeea18

Browse files
committed
Add LinkBuilder interface
1 parent e6400d6 commit 0eeea18

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/TgUtils/LinkBuilder.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
namespace TgUtils;
4+
5+
/** Helpers to construct URLs from objects */
6+
interface LinkBuilder {
7+
8+
public const LIST = 'list';
9+
public const VIEW = 'view';
10+
public const CREATE = 'create';
11+
public const EDIT = 'edit';
12+
public const DELETE = 'delete';
13+
public const COPY = 'copy';
14+
15+
/**
16+
* Constructs and returns the link.
17+
* @param mixed $subject - the subject of the link (an object or method or string or anything)
18+
* @param string $action - the action that the link will fulfill with the subject
19+
* @param array $params - parameters, either for the link construction process or the GET parameters in the link
20+
* @return string - the link constructed, targeting the subject with the action and optional parameters.
21+
*/
22+
public function getLink($subject, $action = self::VIEW, $params = NULL);
23+
24+
}
25+

0 commit comments

Comments
 (0)