1: <?php
2:
3: namespace Charcoal\Object;
4:
5: /**
6: * Defines an object as routable.
7: *
8: * Routable objects are accessible via a URI. The interface provides a "slug" property
9: * to track the latest "pretty" URI path.
10: *
11: * Available implementation as trait:
12: * - {@see \Charcoal\Object\RoutableTrait}.
13: */
14: interface RoutableInterface
15: {
16: /**
17: * Set the object's URL slug pattern.
18: *
19: * @param mixed $pattern The slug pattern.
20: * @return RoutableInterface Chainable
21: */
22: public function setSlugPattern($pattern);
23:
24: /**
25: * Retrieve the object's URL slug pattern.
26: *
27: * @return string|null
28: */
29: public function slugPattern();
30:
31: /**
32: * Set the object's URL slug.
33: *
34: * @param mixed $slug The slug.
35: * @return RoutableInterface Chainable
36: */
37: public function setSlug($slug);
38:
39: /**
40: * Retrieve the object's URL slug.
41: *
42: * @return string|null
43: */
44: public function slug();
45:
46: /**
47: * Generate a URL slug from the object's URL slug pattern.
48: *
49: * @return string|null
50: */
51: public function generateSlug();
52:
53: /**
54: * Retrieve the object's URI.
55: *
56: * @return string|null
57: */
58: public function url();
59:
60: /**
61: * Create a route object.
62: *
63: * @return \Charcoal\Object\ObjectRouteInterface
64: */
65: public function createRouteObject();
66:
67: /**
68: * Retrieve the class name of the object route model.
69: *
70: * @return string
71: */
72: public function objectRouteClass();
73: }
74: