Completed
Branch dev (aae49a)
by
unknown
19:32
created

AdminPageFrameworkLoader_Utility   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 42
rs 10
ccs 0
cts 17
cp 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A isSilentMode() 0 3 2
A replyToShowRedirectError() 0 22 2
1
<?php
2
/**
3
 * @package         Admin Page Framework Loader
4
 * @copyright       Copyright (c) 2015, 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 {
2 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
Coding Style introduced by
As per PSR2, the opening brace for this class should be on a new line.
Loading history...
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() {
1 ignored issue
show
Coding Style introduced by
As per PSR2, the static declaration should come after the visibility declaration.
Loading history...
20
        return defined( 'APFL_SILENT_MODE' ) && APFL_SILENT_MODE;
21
    }
22
23
    /**
24
     * Caleld for upon a redirect failure.
25
     * @return      void
26
     * @since       DEVVER
27
     */
28
    static public function replyToShowRedirectError( $iType, $sURL ) {
1 ignored issue
show
Coding Style introduced by
As per PSR2, the static declaration should come after the visibility declaration.
Loading history...
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
}
1 ignored issue
show
Coding Style introduced by
According to PSR2, the closing brace of classes should be placed on the next line directly after the body.

Below you find some examples:

// Incorrect placement according to PSR2
class MyClass
{
    public function foo()
    {

    }
    // This blank line is not allowed.

}

// Correct
class MyClass
{
    public function foo()
    {

    } // No blank lines after this line.
}
Loading history...