/var/www/hkosl.com/b2b2c/webadmin/libraies/klein/klein/src/Klein/AbstractRouteFactory.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?php
/**
 * Klein (klein.php) - A fast & flexible router for PHP
 *
 * @author      Chris O'Hara <cohara87@gmail.com>
 * @author      Trevor Suarez (Rican7) (contributor and v2 refactorer)
 * @copyright   (c) Chris O'Hara
 * @link        https://github.com/klein/klein.php
 * @license     MIT
 */

namespace Klein;

/**
 * AbstractRouteFactory
 *
 * Abstract class for a factory for building new Route instances
 */
abstract class AbstractRouteFactory
{

    
/**
     * Properties
     */

    /**
     * The namespace of which to collect the routes in
     * when matching, so you can define routes under a
     * common endpoint
     *
     * @type string
     */
    
protected $namespace;


    
/**
     * Methods
     */

    /**
     * Constructor
     *
     * @param string $namespace The initial namespace to set
     */
    
public function __construct($namespace null)
    {
        
$this->namespace $namespace;
    }

    
/**
     * Gets the value of namespace
     *
     * @return string
     */
    
public function getNamespace()
    {
        return 
$this->namespace;
    }

    
/**
     * Sets the value of namespace
     *
     * @param string $namespace The namespace from which to collect the Routes under
     * @return AbstractRouteFactory
     */
    
public function setNamespace($namespace)
    {
        
$this->namespace = (string) $namespace;

        return 
$this;
    }

    
/**
     * Append a namespace to the current namespace
     *
     * @param string $namespace The namespace from which to collect the Routes under
     * @return AbstractRouteFactory
     */
    
public function appendNamespace($namespace)
    {
        
$this->namespace .= (string) $namespace;

        return 
$this;
    }

    
/**
     * Build factory method
     *
     * This method should be implemented to return a Route instance
     *
     * @param callable $callback    Callable callback method to execute on route match
     * @param string $path          Route URI path to match
     * @param string|array $method  HTTP Method to match
     * @param boolean $count_match  Whether or not to count the route as a match when counting total matches
     * @param string $name          The name of the route
     * @return Route
     */
    
abstract public function build($callback$path null$method null$count_match true$name null);
}