Upgrade framework
This commit is contained in:
54
vendor/league/commonmark/src/Event/AbstractEvent.php
vendored
Normal file
54
vendor/league/commonmark/src/Event/AbstractEvent.php
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the league/commonmark package.
|
||||
*
|
||||
* (c) Colin O'Dell <colinodell@gmail.com>
|
||||
*
|
||||
* Original code based on the Symfony EventDispatcher "Event" contract
|
||||
* - (c) 2018-2019 Fabien Potencier
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace League\CommonMark\Event;
|
||||
|
||||
use Psr\EventDispatcher\StoppableEventInterface;
|
||||
|
||||
/**
|
||||
* Base class for classes containing event data.
|
||||
*
|
||||
* This class contains no event data. It is used by events that do not pass
|
||||
* state information to an event handler when an event is raised.
|
||||
*
|
||||
* You can call the method stopPropagation() to abort the execution of
|
||||
* further listeners in your event listener.
|
||||
*/
|
||||
abstract class AbstractEvent implements StoppableEventInterface
|
||||
{
|
||||
/** @psalm-readonly-allow-private-mutation */
|
||||
private bool $propagationStopped = false;
|
||||
|
||||
/**
|
||||
* Returns whether further event listeners should be triggered.
|
||||
*/
|
||||
final public function isPropagationStopped(): bool
|
||||
{
|
||||
return $this->propagationStopped;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops the propagation of the event to further event listeners.
|
||||
*
|
||||
* If multiple event listeners are connected to the same event, no
|
||||
* further event listener will be triggered once any trigger calls
|
||||
* stopPropagation().
|
||||
*/
|
||||
final public function stopPropagation(): void
|
||||
{
|
||||
$this->propagationStopped = true;
|
||||
}
|
||||
}
|
||||
35
vendor/league/commonmark/src/Event/DocumentParsedEvent.php
vendored
Normal file
35
vendor/league/commonmark/src/Event/DocumentParsedEvent.php
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the league/commonmark package.
|
||||
*
|
||||
* (c) Colin O'Dell <colinodell@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace League\CommonMark\Event;
|
||||
|
||||
use League\CommonMark\Node\Block\Document;
|
||||
|
||||
/**
|
||||
* Event dispatched when the document has been fully parsed
|
||||
*/
|
||||
final class DocumentParsedEvent extends AbstractEvent
|
||||
{
|
||||
/** @psalm-readonly */
|
||||
private Document $document;
|
||||
|
||||
public function __construct(Document $document)
|
||||
{
|
||||
$this->document = $document;
|
||||
}
|
||||
|
||||
public function getDocument(): Document
|
||||
{
|
||||
return $this->document;
|
||||
}
|
||||
}
|
||||
49
vendor/league/commonmark/src/Event/DocumentPreParsedEvent.php
vendored
Normal file
49
vendor/league/commonmark/src/Event/DocumentPreParsedEvent.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the league/commonmark package.
|
||||
*
|
||||
* (c) Colin O'Dell <colinodell@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace League\CommonMark\Event;
|
||||
|
||||
use League\CommonMark\Input\MarkdownInputInterface;
|
||||
use League\CommonMark\Node\Block\Document;
|
||||
|
||||
/**
|
||||
* Event dispatched when the document is about to be parsed
|
||||
*/
|
||||
final class DocumentPreParsedEvent extends AbstractEvent
|
||||
{
|
||||
/** @psalm-readonly */
|
||||
private Document $document;
|
||||
|
||||
private MarkdownInputInterface $markdown;
|
||||
|
||||
public function __construct(Document $document, MarkdownInputInterface $markdown)
|
||||
{
|
||||
$this->document = $document;
|
||||
$this->markdown = $markdown;
|
||||
}
|
||||
|
||||
public function getDocument(): Document
|
||||
{
|
||||
return $this->document;
|
||||
}
|
||||
|
||||
public function getMarkdown(): MarkdownInputInterface
|
||||
{
|
||||
return $this->markdown;
|
||||
}
|
||||
|
||||
public function replaceMarkdown(MarkdownInputInterface $markdownInput): void
|
||||
{
|
||||
$this->markdown = $markdownInput;
|
||||
}
|
||||
}
|
||||
44
vendor/league/commonmark/src/Event/DocumentPreRenderEvent.php
vendored
Normal file
44
vendor/league/commonmark/src/Event/DocumentPreRenderEvent.php
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the league/commonmark package.
|
||||
*
|
||||
* (c) Colin O'Dell <colinodell@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace League\CommonMark\Event;
|
||||
|
||||
use League\CommonMark\Node\Block\Document;
|
||||
|
||||
/**
|
||||
* Event dispatched just before rendering begins
|
||||
*/
|
||||
final class DocumentPreRenderEvent extends AbstractEvent
|
||||
{
|
||||
/** @psalm-readonly */
|
||||
private Document $document;
|
||||
|
||||
/** @psalm-readonly */
|
||||
private string $format;
|
||||
|
||||
public function __construct(Document $document, string $format)
|
||||
{
|
||||
$this->document = $document;
|
||||
$this->format = $format;
|
||||
}
|
||||
|
||||
public function getDocument(): Document
|
||||
{
|
||||
return $this->document;
|
||||
}
|
||||
|
||||
public function getFormat(): string
|
||||
{
|
||||
return $this->format;
|
||||
}
|
||||
}
|
||||
42
vendor/league/commonmark/src/Event/DocumentRenderedEvent.php
vendored
Normal file
42
vendor/league/commonmark/src/Event/DocumentRenderedEvent.php
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the league/commonmark package.
|
||||
*
|
||||
* (c) Colin O'Dell <colinodell@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace League\CommonMark\Event;
|
||||
|
||||
use League\CommonMark\Output\RenderedContentInterface;
|
||||
|
||||
final class DocumentRenderedEvent extends AbstractEvent
|
||||
{
|
||||
private RenderedContentInterface $output;
|
||||
|
||||
public function __construct(RenderedContentInterface $output)
|
||||
{
|
||||
$this->output = $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-mutation-free
|
||||
*/
|
||||
public function getOutput(): RenderedContentInterface
|
||||
{
|
||||
return $this->output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-external-mutation-free
|
||||
*/
|
||||
public function replaceOutput(RenderedContentInterface $output): void
|
||||
{
|
||||
$this->output = $output;
|
||||
}
|
||||
}
|
||||
50
vendor/league/commonmark/src/Event/ListenerData.php
vendored
Normal file
50
vendor/league/commonmark/src/Event/ListenerData.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the league/commonmark package.
|
||||
*
|
||||
* (c) Colin O'Dell <colinodell@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace League\CommonMark\Event;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @psalm-immutable
|
||||
*/
|
||||
final class ListenerData
|
||||
{
|
||||
/** @var class-string */
|
||||
private string $event;
|
||||
|
||||
/** @var callable */
|
||||
private $listener;
|
||||
|
||||
/**
|
||||
* @param class-string $event
|
||||
*/
|
||||
public function __construct(string $event, callable $listener)
|
||||
{
|
||||
$this->event = $event;
|
||||
$this->listener = $listener;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return class-string
|
||||
*/
|
||||
public function getEvent(): string
|
||||
{
|
||||
return $this->event;
|
||||
}
|
||||
|
||||
public function getListener(): callable
|
||||
{
|
||||
return $this->listener;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user