Skip to content

Commit

Permalink
Add LinkBuilder interface
Browse files Browse the repository at this point in the history
  • Loading branch information
technicalguru committed Oct 10, 2021
1 parent e6400d6 commit 0eeea18
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/TgUtils/LinkBuilder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace TgUtils;

/** Helpers to construct URLs from objects */
interface LinkBuilder {

public const LIST = 'list';
public const VIEW = 'view';
public const CREATE = 'create';
public const EDIT = 'edit';
public const DELETE = 'delete';
public const COPY = 'copy';

/**
* Constructs and returns the link.
* @param mixed $subject - the subject of the link (an object or method or string or anything)
* @param string $action - the action that the link will fulfill with the subject
* @param array $params - parameters, either for the link construction process or the GET parameters in the link
* @return string - the link constructed, targeting the subject with the action and optional parameters.
*/
public function getLink($subject, $action = self::VIEW, $params = NULL);

}

0 comments on commit 0eeea18

Please sign in to comment.