Completed
Push — master ( 9de5ff...fc4463 )
by Beñat
03:57
created

CustomPostTypeFields::removeScreenAttributes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 5
rs 9.4286
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the WPFoundation library.
5
 *
6
 * Copyright (c) 2015 LIN3S <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace LIN3S\WPFoundation\PostTypes\Fields\Templates;
13
14
use LIN3S\WPFoundation\PostTypes\Fields\Fields;
15
16
/**
17
 * Abstract custom post type fields class that extends the fields basic
18
 * behaviour, implementing the "connector" and "removeScreenAttributes"
19
 * methods with the common use case.
20
 *
21
 * @author Beñat Espiña <[email protected]>
22
 */
23
abstract class CustomPostTypeFields extends Fields
24
{
25
    /**
26
     * {@inheritdoc}
27
     */
28 View Code Duplication
    public function connector()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
29
    {
30
        return [
31
            [
32
                [
33
                    'param'    => 'post_type',
34
                    'operator' => '==',
35
                    'value'    => $this->name,
36
                ],
37
            ],
38
        ];
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    public function removeScreenAttributes()
45
    {
46
        remove_post_type_support('page', 'comments');
47
        remove_post_type_support('page', 'custom-fields');
48
    }
49
}
50