GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( a83cd4...563189 )
by Brad
04:30 queued 02:20
created

get_section_slug()   B

Complexity

Conditions 8
Paths 8

Size

Total Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 8
nc 8
nop 1
dl 0
loc 19
rs 8.4444
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: bradvin
5
 * Date: 2017/04/19
6
 * Time: 1:19 PM
7
 */
8
9
10
if ( ! class_exists( 'FooGallery_Admin_Gallery_MetaBox_Settings' ) ) {
11
12
    class FooGallery_Admin_Gallery_MetaBox_Settings {
0 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...
13
14
        /**
15
         * FooGallery_Admin_Gallery_MetaBox_Settings constructor.
16
         */
17
        function __construct() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
18
            //enqueue assets for the new settings tabs
19
            add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) );
20
21
            //get the section slug
22
			add_filter( 'foogallery_gallery_settings_metabox_section_slug', array( $this, 'get_section_slug' ) );
23
24
            //set default settings tab icons
25
            add_filter( 'foogallery_gallery_settings_metabox_section_icon', array( $this, 'add_section_icons') );
26
        }
27
28
        /***
29
         * Enqueue the assets needed by the settings
30
         * @param $hook_suffix
31
         */
32
        function enqueue_assets( $hook_suffix ){
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
33
            if( in_array( $hook_suffix, array( 'post.php', 'post-new.php' ) ) ) {
34
                $screen = get_current_screen();
35
36
                if ( is_object( $screen ) && FOOGALLERY_CPT_GALLERY == $screen->post_type ){
37
38
                    // Register, enqueue scripts and styles here
39
                    wp_enqueue_script( 'foogallery-admin-settings', FOOGALLERY_URL . '/js/foogallery.admin.min.js', array('jquery'), FOOGALLERY_VERSION );
40
                    wp_enqueue_style( 'foogallery-admin-settings', FOOGALLERY_URL . '/css/foogallery.admin.min.css', array(), FOOGALLERY_VERSION );
41
                }
42
            }
43
        }
44
45
		/**
46
		 * Returns the section slug that can be used in the settings tabs
47
		 * @param $section
48
		 * @return string
49
		 */
50
		function get_section_slug( $section ) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
51
			switch ( $section ) {
52
				case __('General', 'foogallery'):
53
					return 'general';
54
				case __('Advanced', 'foogallery'):
55
					return 'advanced';
56
				case __('Appearance', 'foogallery'):
57
					return 'appearance';
58
				case __('Video', 'foogallery'):
59
					return 'video';
60
				case __('Hover Effects', 'foogallery'):
61
					return 'hover effects';
62
				case __('Captions', 'foogallery'):
63
					return 'captions';
64
				case __('Paging', 'foogallery'):
65
					return 'paging';
66
			}
67
			return strtolower( $section );
68
		}
69
70
        /**
71
         * Returns the Dashicon that can be used in the settings tabs
72
         * @param $section_slug
73
         * @return string
74
         */
75
        function add_section_icons( $section_slug ) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
76
            switch ( $section_slug ) {
77
                case 'general':
78
                    return 'dashicons-format-image';
79
                case 'advanced':
80
                    return 'dashicons-admin-generic';
81
                case 'appearance':
82
                    return 'dashicons-admin-appearance';
83
                case 'video':
84
                    return 'dashicons-format-video';
85
				case 'hover effects':
86
					return 'dashicons-admin-tools';
87
				case 'captions':
88
					return 'dashicons-testimonial';
89
                case 'paging':
90
                    return 'dashicons-admin-page';
91
            }
92
            return $section_slug;
93
        }
94
    }
95
}