AdminPageFrameworkLoader_Utility::isSilentMode()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 2
rs 10
c 0
b 0
f 0
cc 2
ccs 0
cts 2
cp 0
nc 2
nop 0
crap 6
1
<?php
2
/**
3
 * @package         Admin Page Framework Loader
4
 * @copyright       Copyright (c) 2013-2022, Michael Uno
5
 * @license         http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
*/
7
8
/**
9
 * Retrieves an array of RSS feed items.
10
 * @since       DEVVER
11
 */
12
class AdminPageFrameworkLoader_Utility {
13
14
    /**
15
     * Checks if the loader runs on the silent mode or not.
16
     * @return      boolean
17
     * @since       DEVVER
18
     */
19
    static public function isSilentMode() {
20
        return defined( 'APFL_SILENT_MODE' ) && APFL_SILENT_MODE;
0 ignored issues
show
Bug introduced by
The constant APFL_SILENT_MODE was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
21
    }
22
23
    /**
24
     * Caleld for upon a redirect failure.
25
     * @return      void
26
     * @since       DEVVER
27
     */
28
    static public function replyToShowRedirectError( $iType, $sURL ) {
29
30
        $_aErrors = array(
31
            1 => sprintf(
32
                __( 'The URL is not valid: %1$s', 'admin-page-framework-loader' ),
33
                $sURL
34
            ),
35
            2 => __( 'Header already sent.', 'admin-page-framework-loader' ),
36
        );
37
        if ( ! class_exists( 'AdminPageFramework_AdminNotice' ) ) {
38
            return;
39
        }
40
        new AdminPageFramework_AdminNotice(
41
            $_aErrors[ $iType ]
42
                . ' '
43
                . sprintf(
44
                    __( 'Could not be redirected to %1$s.', 'admin-page-framework-loader' ),
45
                    $sURL
46
                )
47
        );
48
49
    }
50
51
52
53
}
54