Commaaa2
This commit is contained in:
@@ -14,62 +14,24 @@ declare(strict_types=1);
|
||||
|
||||
namespace League\CommonMark\Extension\Footnote\Node;
|
||||
|
||||
use League\CommonMark\Block\Element\AbstractBlock;
|
||||
use League\CommonMark\Cursor;
|
||||
use League\CommonMark\Node\Block\AbstractBlock;
|
||||
use League\CommonMark\Reference\ReferenceInterface;
|
||||
use League\CommonMark\Reference\ReferenceableInterface;
|
||||
|
||||
/**
|
||||
* @method children() AbstractBlock[]
|
||||
*/
|
||||
final class Footnote extends AbstractBlock
|
||||
final class Footnote extends AbstractBlock implements ReferenceableInterface
|
||||
{
|
||||
/**
|
||||
* @var FootnoteBackref[]
|
||||
*/
|
||||
private $backrefs = [];
|
||||
|
||||
/**
|
||||
* @var ReferenceInterface
|
||||
*/
|
||||
private $reference;
|
||||
/** @psalm-readonly */
|
||||
private ReferenceInterface $reference;
|
||||
|
||||
public function __construct(ReferenceInterface $reference)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->reference = $reference;
|
||||
}
|
||||
|
||||
public function canContain(AbstractBlock $block): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function isCode(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function matchesNextLine(Cursor $cursor): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getReference(): ReferenceInterface
|
||||
{
|
||||
return $this->reference;
|
||||
}
|
||||
|
||||
public function addBackref(FootnoteBackref $backref): self
|
||||
{
|
||||
$this->backrefs[] = $backref;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return FootnoteBackref[]
|
||||
*/
|
||||
public function getBackrefs(): array
|
||||
{
|
||||
return $this->backrefs;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,19 +14,22 @@ declare(strict_types=1);
|
||||
|
||||
namespace League\CommonMark\Extension\Footnote\Node;
|
||||
|
||||
use League\CommonMark\Inline\Element\AbstractInline;
|
||||
use League\CommonMark\Node\Inline\AbstractInline;
|
||||
use League\CommonMark\Reference\ReferenceInterface;
|
||||
use League\CommonMark\Reference\ReferenceableInterface;
|
||||
|
||||
/**
|
||||
* Link from the footnote on the bottom of the document back to the reference
|
||||
*/
|
||||
final class FootnoteBackref extends AbstractInline
|
||||
final class FootnoteBackref extends AbstractInline implements ReferenceableInterface
|
||||
{
|
||||
/** @var ReferenceInterface */
|
||||
private $reference;
|
||||
/** @psalm-readonly */
|
||||
private ReferenceInterface $reference;
|
||||
|
||||
public function __construct(ReferenceInterface $reference)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->reference = $reference;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,26 +14,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace League\CommonMark\Extension\Footnote\Node;
|
||||
|
||||
use League\CommonMark\Block\Element\AbstractBlock;
|
||||
use League\CommonMark\Cursor;
|
||||
use League\CommonMark\Node\Block\AbstractBlock;
|
||||
|
||||
/**
|
||||
* @method children() AbstractBlock[]
|
||||
*/
|
||||
final class FootnoteContainer extends AbstractBlock
|
||||
{
|
||||
public function canContain(AbstractBlock $block): bool
|
||||
{
|
||||
return $block instanceof Footnote;
|
||||
}
|
||||
|
||||
public function isCode(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function matchesNextLine(Cursor $cursor): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,27 +14,30 @@ declare(strict_types=1);
|
||||
|
||||
namespace League\CommonMark\Extension\Footnote\Node;
|
||||
|
||||
use League\CommonMark\Inline\Element\AbstractInline;
|
||||
use League\CommonMark\Node\Inline\AbstractInline;
|
||||
use League\CommonMark\Reference\ReferenceInterface;
|
||||
use League\CommonMark\Reference\ReferenceableInterface;
|
||||
|
||||
final class FootnoteRef extends AbstractInline
|
||||
final class FootnoteRef extends AbstractInline implements ReferenceableInterface
|
||||
{
|
||||
/** @var ReferenceInterface */
|
||||
private $reference;
|
||||
private ReferenceInterface $reference;
|
||||
|
||||
/** @var string|null */
|
||||
private $content;
|
||||
/** @psalm-readonly */
|
||||
private ?string $content = null;
|
||||
|
||||
/**
|
||||
* @param ReferenceInterface $reference
|
||||
* @param string|null $content
|
||||
* @param array<mixed> $data
|
||||
* @param array<mixed> $data
|
||||
*/
|
||||
public function __construct(ReferenceInterface $reference, ?string $content = null, array $data = [])
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->reference = $reference;
|
||||
$this->content = $content;
|
||||
$this->data = $data;
|
||||
$this->content = $content;
|
||||
|
||||
if (\count($data) > 0) {
|
||||
$this->data->import($data);
|
||||
}
|
||||
}
|
||||
|
||||
public function getReference(): ReferenceInterface
|
||||
@@ -42,11 +45,9 @@ final class FootnoteRef extends AbstractInline
|
||||
return $this->reference;
|
||||
}
|
||||
|
||||
public function setReference(ReferenceInterface $reference): FootnoteRef
|
||||
public function setReference(ReferenceInterface $reference): void
|
||||
{
|
||||
$this->reference = $reference;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getContent(): ?string
|
||||
|
||||
Reference in New Issue
Block a user