Completed
Branch FET-3467-waitlists (78124b)
by
unknown
141:27 queued 128:30
created

CoreAdmin::adminUrl()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 3
eloc 5
c 1
b 0
f 1
nc 4
nop 3
dl 0
loc 7
rs 9.4285
1
<?php
2
namespace Page;
3
4
/**
5
 * CoreAdmin
6
 * This is a set of page properties and helper methods for any generic EE Admin page stuff.  Typically,
7
 * specific EE Admin Page will extend this for their functionality.
8
 *
9
 * @package Page
10
 * @author  Darren Ethier
11
 * @since   1.0.0
12
 */
13
class CoreAdmin
14
{
15
16
    const URL_PREFIX = 'admin.php?page=';
17
18
19
    const ADMIN_LIST_TABLE_NEXT_PAGE_CLASS = '.next-page';
20
21
22
    /**
23
     * Get the EE admin url for the given properties.
24
     * Note, this is JUST the endpoint for the admin route.  It is expected that the actor/test would be calling this
25
     * with `amOnAdminPage` action.
26
     *
27
     * @param string $page
28
     * @param string $action
29
     * @param string $additional_params
30
     * @return string
31
     */
32
    public static function adminUrl($page = 'espresso_events', $action = 'default', $additional_params = '')
33
    {
34
        $url = self::URL_PREFIX . $page;
35
        $url .= $action ? '&action=' . $action : '';
36
        $url .= $additional_params ? '&' . ltrim('&', ltrim('?', $additional_params)) : '';
37
        return $url;
38
    }
39
40
}