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 — feature/gallery-template-clien... ( 275fef...a33793 )
by Brad
02:29
created

FooGallery_Extensions_Compatibility   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 32
rs 10
c 0
b 0
f 0
wmc 5
lcom 0
cbo 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 2
A add_video_class_to_item() 0 14 3
1
<?php
2
/**
3
 * FooGallery Extensions Compatibility Class
4
 * Date: 20 Sep 2017
5
 *
6
 * This class is used to make any overrides that are needed in extensions when updating FooGallery.
7
 * These are "hacks" that will make the upgrade process easier, and not have the requirement to upgrade the individual extensions.
8
 *
9
 */
10
if ( ! class_exists( 'FooGallery_Extensions_Compatibility' ) ) {
11
12
    class FooGallery_Extensions_Compatibility {
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
        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...
15
        	//FooVideo overrides
16
        	if ( class_exists( 'Foo_Video' ) ) {
17
				add_filter( 'foogallery_attachment_html_item_classes', array( $this, 'add_video_class_to_item' ), 10, 3 );
18
			}
19
        }
20
21
		/**
22
		 * @param $classes
23
		 * @param $foogallery_attachment
24
		 * @param $args
25
		 *
26
		 * @return mixed
27
		 */
28
		public function add_video_class_to_item( $classes, $foogallery_attachment, $args ) {
0 ignored issues
show
Unused Code introduced by
The parameter $args is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
29
30
			$video_info = get_post_meta( $foogallery_attachment->ID, FOO_VIDEO_POST_META, true );
31
			if ( $video_info && isset( $video_info['id'] ) ) {
32
				//we are dealing with a video
33
				$classes[] = 'fg-video';
34
35
				//include a specific css file to override issues with video hover effects
36
				$css = FOOGALLERY_URL . 'css/foogallery-foovideo-overrides.css';
37
				foogallery_enqueue_style( 'foogallery_foovideo_overrides', $css, array(), FOOGALLERY_VERSION );
0 ignored issues
show
Documentation introduced by
FOOGALLERY_VERSION is of type string, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
38
			}
39
40
			return $classes;
41
		}
42
43
    }
44
}
45