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.

BlockTypeAbstract   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 28
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
render() 0 1 ?
A renderInput() 0 8 2
1
<?php
2
3
namespace Chadanuk\MiniCms\Blocks;
4
5
use Chadanuk\MiniCms\Blocks\Block;
6
use Illuminate\Support\Facades\View;
7
use Chadanuk\MiniCms\Blocks\BlockContent;
8
9
abstract class BlockTypeAbstract
10
{
11
    protected static $blockType = 'markdown';
12
13
    public $block;
14
    public $blockContent;
15
    public $pageId;
16
17
    public function __construct(Block $block, BlockContent $blockContent, int $pageId = null)
18
    {
19
        $this->block = $block;
20
        $this->blockContent = $blockContent;
21
        $this->pageId = $pageId;
22
23
        return $this;
0 ignored issues
show
Bug introduced by
Constructors do not have meaningful return values, anything that is returned from here is discarded. Are you sure this is correct?
Loading history...
24
    }
25
26
    abstract public function render();
27
28
    public function renderInput()
29
    {
30
        if (View::exists('mini-cms.admin.blocks.' . static::$blockType)) {
31
            return View::make(View::exists('mini-cms.admin.blocks.' . static::$blockType, ['block' => $this]));
0 ignored issues
show
Unused Code introduced by
The call to View::exists() has too many arguments starting with array('block' => $this).

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
Documentation introduced by
\Illuminate\Support\Faca...rray('block' => $this)) is of type boolean, but the function expects a string.

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...
32
        }
33
34
        return View::make('mini-cms::admin.blocks.' . static::$blockType, ['block' => $this]);
35
    }
36
}
37