Completed
Pull Request — master (#23)
by
unknown
01:52
created

TableCaption::handleRemainingContents()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This is part of the webuni/commonmark-table-extension package.
7
 *
8
 * (c) Martin Hasoň <[email protected]>
9
 * (c) Webuni s.r.o. <[email protected]>
10
 *
11
 * For the full copyright and license information, please view the LICENSE
12
 * file that was distributed with this source code.
13
 */
14
15
namespace Webuni\CommonMark\TableExtension;
16
17
use League\CommonMark\Block\Element\AbstractBlock;
18
use League\CommonMark\Block\Element\AbstractStringContainerBlock;
19
use League\CommonMark\Block\Element\InlineContainerInterface;
20
use League\CommonMark\ContextInterface;
21
use League\CommonMark\Cursor;
22
use League\CommonMark\Inline\Element\AbstractInline;
23
use League\CommonMark\Node\Node;
24
25
class TableCaption extends AbstractStringContainerBlock implements InlineContainerInterface
26
{
27
    public $id;
28
29
    public function __construct(string $caption, string $id = null)
30
    {
31
        parent::__construct();
32
        $this->finalStringContents = $caption;
33
        $this->id = $id;
34
    }
35
36
    public function canContain(AbstractBlock $block): bool
37
    {
38
        return false;
39
    }
40
41
    public function acceptsLines(): bool
42
    {
43
        return false;
44
    }
45
46
    public function isCode(): bool
47
    {
48
        return false;
49
    }
50
51
    public function matchesNextLine(Cursor $cursor): bool
52
    {
53
        return false;
54
    }
55
56
    /**
57
     * @return AbstractInline[]
58
     */
59
    public function children(): array
60
    {
61
        return array_filter(parent::children(), function (Node $child): bool { return $child instanceof AbstractInline; });
0 ignored issues
show
Bug introduced by
The class League\CommonMark\Inline\Element\AbstractInline does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
62
    }
63
64
    public function handleRemainingContents(ContextInterface $context, Cursor $cursor): void
65
    {
66
    }
67
}
68