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.

CreatesBlockFromContent::create()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.7998
c 0
b 0
f 0
cc 1
nc 1
nop 3
1
<?php
2
3
namespace Chadanuk\MiniCms\Blocks;
4
5
use Chadanuk\MiniCms\Blocks\Block;
6
use Chadanuk\MiniCms\Blocks\BlockContent;
7
use Chadanuk\MiniCms\Blocks\BlockTypeAbstract;
8
9
trait CreatesBlockFromContent
10
{
11
    public static function create($content, String $label = null, int $page_id = null): BlockTypeAbstract
12
    {
13
        $blockClass = \get_class();
14
15
        $block = Block::firstOrCreate(['type' => self::$blockType, 'label' => $label]);
16
17
        $blockContent = $block->blockContents()->create([
18
            'block_id' => $block->id,
19
            'page_id' => $page_id,
20
            'content' => $content,
21
        ]);
22
23
        return new $blockClass($block, $blockContent, $page_id);
24
    }
25
}
26