InlineBoxHelper::BlockQuote()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
/*
4
 * rmarchiv.tk
5
 * (c) 2016-2017 by Marcel 'ryg' Hering
6
 */
7
8
namespace App\Helpers;
9
10
use App\Models\Game;
11
12
class InlineBoxHelper
13
{
14
    public static function GameBox($htmlcontent)
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
15
    {
16
        //Match for :123:
0 ignored issues
show
Unused Code Comprehensibility introduced by
58% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
17
        preg_match_all('/\:([0-9]+)\:/', $htmlcontent, $match);
18
19
        foreach ($match[1] as $item) {
20
            $game = Game::whereId($item)->first();
21
22
            $html = view('_partials.inline_gamebox', [
23
                'game' => $game,
24
            ]);
25
26
            if ($game) {
27
                $htmlcontent = str_replace(':'.$item.':', $html, $htmlcontent);
28
            }
29
        }
30
31
        $htmlcontent = self::TextColor($htmlcontent);
32
        $htmlcontent = self::StrikeText($htmlcontent);
33
        $htmlcontent = self::BlockQuote($htmlcontent);
34
35
        return $htmlcontent;
36
    }
37
38
    public static function TextColor($htmlcontent)
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
39
    {
40
        //Match for [color=CSSCODE]Text[/color]
0 ignored issues
show
Unused Code Comprehensibility introduced by
36% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
41
        $htmlcontent = preg_replace('/\[color\=(.*?)\](.*?)\[\/color\]/', '<span style="color: $1;">$2</span>', $htmlcontent);
42
43
        return $htmlcontent;
44
    }
45
46
    public static function StrikeText($htmlcontent){
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
47
        //match for ~~~Text~~
48
        $htmlcontent = preg_replace('/(~{2})(.*?)(~{2})/', '<s>$2</s>', $htmlcontent);
49
50
        return $htmlcontent;
51
    }
52
53
    public static function BlockQuote($mhtmcontent){
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
54
        $mhtmcontent = str_replace('<blockquote>', '<blockquote class="blockquote">', $mhtmcontent);
55
        return $mhtmcontent;
56
    }
57
}
58