diff options
Diffstat (limited to 'vendor/league')
313 files changed, 0 insertions, 28215 deletions
diff --git a/vendor/league/commonmark/.phpstorm.meta.php b/vendor/league/commonmark/.phpstorm.meta.php deleted file mode 100644 index 53614d78e2..0000000000 --- a/vendor/league/commonmark/.phpstorm.meta.php +++ /dev/null @@ -1,34 +0,0 @@ -<?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. - */ - -namespace PHPSTORM_META -{ - expectedArguments(\League\CommonMark\HtmlElement::__construct(), 0, 'a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', 'bdi', 'bdo', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kdb', 'keygen', 'label', 'legend', 'li', 'link', 'main', 'map', 'mark', 'menu', 'menuitem', 'meta', 'meter', 'nav', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'pre', 'progress', 'q', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'u', 'ul', 'var', 'video', 'wbr'); - - expectedArguments(\League\CommonMark\Block\Element\Heading::__construct(), 0, 1, 2, 3, 4, 5, 6); - expectedReturnValues(\League\CommonMark\Block\Element\Heading::getLevel(), 1, 2, 3, 4, 5, 6); - - registerArgumentsSet('league_commonmark_htmlblock_types', \League\CommonMark\Block\Element\HtmlBlock::TYPE_1_CODE_CONTAINER, \League\CommonMark\Block\Element\HtmlBlock::TYPE_2_COMMENT, \League\CommonMark\Block\Element\HtmlBlock::TYPE_3, \League\CommonMark\Block\Element\HtmlBlock::TYPE_4, \League\CommonMark\Block\Element\HtmlBlock::TYPE_5_CDATA, \League\CommonMark\Block\Element\HtmlBlock::TYPE_6_BLOCK_ELEMENT, \League\CommonMark\Block\Element\HtmlBlock::TYPE_7_MISC_ELEMENT); - expectedArguments(\League\CommonMark\Block\Element\HtmlBlock::__construct(), 0, argumentsSet('league_commonmark_htmlblock_types')); - expectedArguments(\League\CommonMark\Block\Element\HtmlBlock::setType(), 0, argumentsSet('league_commonmark_htmlblock_types')); - expectedReturnValues(\League\CommonMark\Block\Element\HtmlBlock::getType(), argumentsSet('league_commonmark_htmlblock_types')); - expectedArguments(\League\CommonMark\Util\RegexHelper::getHtmlBlockOpenRegex(), 0, argumentsSet('league_commonmark_htmlblock_types')); - expectedArguments(\League\CommonMark\Util\RegexHelper::getHtmlBlockCloseRegex(), 0, argumentsSet('league_commonmark_htmlblock_types')); - - registerArgumentsSet('league_commonmark_newline_types', \League\CommonMark\Inline\Element\Newline::HARDBREAK, \League\CommonMark\Inline\Element\Newline::SOFTBREAK); - expectedArguments(\League\CommonMark\Inline\Element\Newline::__construct(), 0, argumentsSet('league_commonmark_newline_types')); - expectedReturnValues(\League\CommonMark\Inline\Element\Newline::getType(), argumentsSet('league_commonmark_newline_types')); - - registerArgumentsSet('league_commonmark_options', 'renderer', 'enable_em', 'enable_strong', 'use_asterisk', 'use_underscore', 'unordered_list_markers', 'html_input', 'allow_unsafe_links', 'max_nesting_level', 'external_link', 'external_link/nofollow', 'external_link/noopener', 'external_link/noreferrer', 'footnote', 'footnote/backref_class', 'footnote/container_add_hr', 'footnote/container_class', 'footnote/ref_class', 'footnote/ref_id_prefix', 'footnote/footnote_class', 'footnote/footnote_id_prefix', 'heading_permalink', 'heading_permalink/html_class', 'heading_permalink/id_prefix', 'heading_permalink/inner_contents', 'heading_permalink/insert', 'heading_permalink/slug_normalizer', 'heading_permalink/symbol', 'heading_permalink/title', 'table_of_contents', 'table_of_contents/style', 'table_of_contents/normalize', 'table_of_contents/position', 'table_of_contents/html_class', 'table_of_contents/min_heading_level', 'table_of_contents/max_heading_level', 'table_of_contents/placeholder'); - expectedArguments(\League\CommonMark\EnvironmentInterface::getConfig(), 0, argumentsSet('league_commonmark_options')); - expectedArguments(\League\CommonMark\Util\ConfigurationInterface::get(), 0, argumentsSet('league_commonmark_options')); - expectedArguments(\League\CommonMark\Util\ConfigurationInterface::set(), 0, argumentsSet('league_commonmark_options')); -} diff --git a/vendor/league/commonmark/CHANGELOG-0.x.md b/vendor/league/commonmark/CHANGELOG-0.x.md deleted file mode 100644 index 16f96dd124..0000000000 --- a/vendor/league/commonmark/CHANGELOG-0.x.md +++ /dev/null @@ -1,842 +0,0 @@ -# Change Log -All notable changes to this project will be documented in this file. -Updates should follow the [Keep a CHANGELOG](https://keepachangelog.com/) principles. - -## [0.19.3] - 2019-06-18 - -### Fixed - - - Fixed bug where elements with content of `"0"` wouldn't be rendered (#376) - -## [0.19.2] - 2019-05-19 - -### Fixed - - - Fixed bug where default values for nested configuration paths were inadvertently cast to strings - -## [0.19.1] - 2019-04-10 - -### Added - - - Added the missing `addExtension()` method to the new `ConfigurableEnvironmentInterface` - -### Fixed - - - Fixed extensions not being able to register other extensions - -## [0.19.0] - 2019-04-10 - -### Added - - - The priority of parsers, processors, and renderers can now be set when `add()`ing them; you no longer need to rely on the order in which they are added - - Added support for trying multiple parsers per block/inline - - Extracted two new base interfaces from `Environment`: - - `EnvironmentInterface` - - `ConfigurableEnvironmentInterface` - - Extracted a new `AbstractStringContainerBlock` base class and corresponding `StringContainerInterface` from `AbstractBlock` - - Added `Cursor::getEncoding()` method - - Added `.phpstorm.meta.php` file for better IDE code completion - - Made some minor optimizations here and there - -### Changed - - - Pretty much everything now has parameter and return types (#346) - - Attributes passed to `HtmlElement` will now be escaped by default - - `Environment` is now a `final` class - - `Environment::getBlockRendererForClass()` was replaced with `Environment::getBlockRenderersForClass()` (note the added `s`) - - `Environment::getInlineRendererForClass()` was replaced with `Environment::getInlineRenderersForClass()` (note the added `s`) - - The `Environment::get____()` methods now return an iterator instead of an array - - `Context::addBlock()` no longer returns the same block instance you passed into the method, as this served no useful purpose - - `RegexHelper::isEscapable()` no longer accepts `null` values - - `Node::replaceChildren()` now accepts any type of `iterable`, not just `array`s - - Some block elements now extend `AbstractStringContainerBlock` instead of `AbstractBlock` - - `InlineContainerInterface` now extends the new `StringContainerInterface` - - The `handleRemainingContents()` method (formerly on `AbstractBlock`, now on `AbstractStringContainerBlock`) is now an `abstract method - - The `InlineParserContext` constructor now requires an `AbstractStringContainerBlock` instead of an `AbstractBlock` - -### Removed - - - Removed support for PHP 5.6 and 7.0 (#346) - - Removed support for `add()`ing parsers with just the target block/inline class name - you need to include the full namespace now - - Removed the following unused methods from `Environment`: - - `getInlineParser($name)` - - `getInlineParsers()` - - `createInlineParserEngine()` - - Removed the unused `getName()` methods: - - `AbstractBlockParser::getName()` - - `AbstractInlineParser::getName()` - - `BlockParserInterface::getName()` - - `InlinerParserInterface::getName()` - - Removed the now-useless classes: - - `AbstractBlockParser` - - `AbstractInlinerParser` - - `InlineContainer` - - Removed the `AbstractBlock::acceptsLines()` method - - Removed the now-useless constructor from `AbstractBlock` - - Removed previously-deprecated functionality: - - `InlineContainer` class - - `RegexHelper::$instance` - - `RegexHelper::getInstance()` - - `RegexHelper::getPartialRegex()` - - `RegexHelper::getHtmlTagRegex()` - - `RegexHelper::getLinkTitleRegex()` - - `RegexHelper::getLinkDestinationBracesRegex()` - - `RegexHelper::getThematicBreakRegex()` - - Removed the second `$preserveEntities` parameter from `Xml:escape()` - -## [0.18.5] - 2019-03-28 - -### Fixed - - - Fixed the adjoining `Text` collapser not handling the full tree (thephpleague/commonmark-ext-autolink#10) - -## [0.18.4] - 2019-03-23 - -### Changed - - - Modified how URL normalization decodes certain characters in order to align with the JS library's output - - Disallowed unescaped `(` in parenthesized link title - -### Fixed - - - Fixed two exponential backtracking issues - -## [0.18.3] - 2019-03-21 - -This is a **security update** release. - -### Changed - - - XML/HTML entities in attributes will no longer be preserved when rendering (#353) - -### Fixed - - - Fix XSS vulnerability caused by improper preservation of entities when rendering (#353) - -### Deprecated - - - Deprecated the `$preserveEntites` argument of `Xml::escape()` for removal in the next release (#353) - -## [0.18.2] - 2019-03-16 - -### Fixed - - - Fixed adjoining `Text` elements not being collapsed after delimiter processing - -### Deprecated - - - Deprecated the `CommonmarkConverter::VERSION` constant for removal in 1.0.0 - -## [0.18.1] - 2018-12-29 - -This is a **security update** release. - -### Fixed - - - Fix XSS vulnerability caused by URL normalization not handling/encoding newlines properly (#337, CVE-2018-20583) - -## [0.18.0] - 2018-09-18 - -### Added - - - Added `ConverterInterface` to `Converter` and `CommonMarkConverter` (#330) - - Added `ListItem::getListData()` method (#329) - -### Changed - - - Links with `target="_blank"` will also get `rel="noopener noreferrer"` by default (#331) - - Implemented several performance optimizations (#324) - -## [0.17.5] - 2018-03-29 - -### Fixed - - - Fixed incorrect version constant value (again) - - Fixed release checklist to prevent the above from happening - - Fixed incorrect dates in CHANGELOG - -## [0.17.4] - 2018-03-28 - -### Added - - - Added `ListBlock::setTight()` method - -## [0.17.3] - 2018-03-26 - -### Fixed - - - Fixed incorrect version constant value - -## [0.17.2] - 2018-03-25 - -### Added - - - Added new `RegexHelper::isEscapable()` method - -### Fixed - - - Fixed spec compliance bug where escaped spaces should not be allowed in link destinations - -## [0.17.1] - 2018-03-18 - -### Added - - - Added a new constant containing the current version: `CommonMarkConverter::VERSION` (#314) - -## [0.17.0] - 2017-12-30 - -This release contains several breaking changes and a minimum PHP version bump - see <UPGRADE.md> for more details. - -### Added - - - Added new `max_nesting_level` setting (#243) - - Added minor performance optimizations to `Cursor` - -### Changed - - - Minimum PHP version is now 5.6.5. - - All full and partial regular expressions in `RegexHelper` are now defined as constants instead of being built on-the-fly. - - `Cursor::saveState()` now returns an `array` instead of a `CursorState` object. - - `Cursor::restoreState()` now accepts an `array` parameter instead of a `CursorState` object. - - Saving/restoring the Cursor state no longer tracks things that don't change (like the text content). - - `RegexHelper` is now `final`. - - References to `InlineContainer` changed to new `InlineContainerInterface` interface. - - `MiscExtension::addInlineParser()` and `MiscExtension::addBlockRenderer()` now return `$this` instead of nothing. - -### Fixed - - Fixed `Reference::normalizeReference()` not properly collapsing whitespace to a single space - -### Deprecated - - - `RegexHelper::getInstance()` and all instance (non-static) methods have been deprecated. - - The `InlineContainer` interface has been deprecated. Use `InlineContainerInterface` instead. - -### Removed - - - Removed support for PHP 5.4 and 5.5. - - Removed `CursorState` class - - Removed all previous deprecations: - - `Cursor::getFirstNonSpacePosition()` - - `Cursor::getFirstNonSpaceCharacter()` - - `Cursor::advanceWhileMatches()` - - `Cursor::advanceToFirstNonSpace()` - - `ElementRendererInterface::escape()` - - `HtmlRenderer::escape()` - - `RegexHelper::REGEX_UNICODE_WHITESPACE` - - `RegexHelper::getLinkDestinationRegex()` - -## [0.16.0] - 2017-10-30 - -This release contains breaking changes, several performance improvements, and two deprecations: - -### Added - - - Added new `Xml` utility class; moved HTML/XML escaping logic into there (see deprecations below) - -### Changed - - - `Environment::getInlineParsersForCharacter()` now returns an empty array (instead of `null`) when no matching parsers are found - - Three utility classes are now marked `final`: - - `Html5Entities` - - `LinkParserHelper` - - `UrlEncoder` - -### Fixed - - - Improved performance of several methods (for a 10% overall performance boost - #292) - -### Deprecated - -The following methods were deprecated and are scheduled for removal in 0.17.0 or 1.0.0 (whichever comes first). See <UPGRADE.md> for more information. - - - `Cursor::advanceWhileMatches()` deprecated; use `Cursor::match()` instead. - - `HtmlRenderer::escape()` deprecated; use `Xml::escape()` instead. - -### Removed - - - Removed `DelimiterStack::findFirstMatchingOpener()` which was previously deprecated in 0.15.0 - -## [0.15.7] - 2017-10-26 - -### Fixed - - - Improved performance of `Cursor::advanceBy()` (for a 16% performance boost) - -## [0.15.6] - 2017-08-08 - -### Fixed - - - Fixed URI normalization not properly encoding/decoding special characters in certain cases (#287) - -## [0.15.5] - 2017-08-05 - -This release bumps spec compliance to 0.28 without breaking changes to the API. - -### Added - - - Project is now tested against PHP 7.2 - -### Changed - - - Bumped CommonMark spec target to 0.28 - - Changed internal implementation of `LinkParserHelper::parseLinkDestination()` to allow nested parens - - Changed precedence of strong/emph when both nestings are possible (rule 14) - - Allow tabs before and after ATX closing header - -### Fixed - - - Fixed HTML type 6 block regex matching against `<pre>` (it shouldn't) and not matching `<iframe>` (it should) - - Fixed reference parser incorrectly handling escaped `]` characters - - Fixed "multiple of 3" delimiter run calculations - -### Deprecated - -An unused constant and static method were deprecated and will be removed in a future release. See <UPGRADE.md> for more information. - - - Deprecated `RegexHelper::REGEX_UNICODE_WHITESPACE` (no longer used) - - Deprecated `RegexHelper::getLinkDestinationRegex()` (no longer used) - -## [0.15.4] - 2017-05-09 - -### Added - - - Added new methods to `Cursor` (#280): - - `advanceToNextNonSpaceOrNewline()` - Identical replacement for the (now-deprecated) `advanceToFirstNonSpace()` method - - `advanceToNextNonSpaceOrTab()` - Similar replacement for `advanceToFirstNonSpace()` but with proper tab handling - - `getNextNonSpaceCharacter()` - Identical replacement for the (now-deprecated) `getFirstNonSpaceCharacter()` method - - `getNextNonSpacePosition()` - Identical replacement for the (now-deprecated) `getFirstNonSpacePosition()` method - - Added new method to `CursorState` (#280): - - `getNextNonSpaceCache()` - Identical replacement for the (now-deprecated) `getFirstNonSpaceCache()` method - -### Fixed - - - Fixed duplicate characters in non-intended lines containing tabs (#279) - -### Deprecated - -**All deprecations listed here will be removed in a future 0.x release.** See [UPGRADE.md](UPGRADE.md) for instructions on preparing your code for the eventual removal of these methods. - - - Deprecated `Cursor::advanceToFirstNonSpace()` (#280) - - Use `advanceToNextNonSpaceOrTab()` or `advanceToNextNonSpaceOrNewline()` instead, depending on your requirements - - Deprecated `Cursor::getFirstNonSpaceCharacter()` (#280) - - Use `Cursor::getNextNonSpaceCharacter()` instead - - Deprecated `Cursor::getFirstNonSpacePosition()` (#280) - - Use `Cursor::getNextNonSpacePosition()` instead - - Deprecated `CursorState::getFirstNonSpaceCache()` (#280) - - Use `CursorState::getNextNonSpaceCache()` instead - -## [0.15.3] - 2016-12-18 - -### Fixed - - Allow inline parsers matching regex delimiter to be created (#271, #272) - -## [0.15.2] - 2016-11-22 - -### Changed - - Bumped spec target version to 0.27 (#268) - - H2-H6 elements are now parsed as HTML block elements instead of HTML inlines - -### Fixed - - Fixed incomplete punctuation regex - - Fixed shortcut links not being allowed before a `(` - - Fixed distinction between Unicode whitespace and regular whitespace - -## [0.15.1] - 2016-11-08 - -### Fixed - - Fixed setext heading underlines not allowing trailing tabs (#266) - -## [0.15.0] - 2016-09-14 - -### Added - - Added preliminary support for PHP 7.1 (#259) - - Added more regression tests (#258, #260) - -### Changed - - Bumped spec target version to 0.26 (#260) - - The `CursorState` constructor requires an additional parameter (#258) - - Ordered lists cannot interupt a paragraph unless they start with `1` (#260) - - Blank list items cannot interupt a paragraph (#260) - -### Deprecated - - Deprecated `DelimiterStack::findFirstMatchingOpener()` - use `findMatchingOpener()` instead (#260) - -### Fixed - - Fixed tabs in ATX headers and thematic breaks (#260) - - Fixed issue where cursor state was not being restored properly (#258, #260) - - This fixed the lists-with-tabs regression reported in #258 - -### Removed - - Removed an unnecessary check in `Cursor::advanceBy()` (#260) - - Removed the two-blanks-break-out-of-lists feature (#260) - - -## [0.14.0] - 2016-07-02 -### Added - - The `safe` option is deprecated and replaced by 2 new options (#253, #255): - - `html_input` (`strip`, `allow` or `escape`): how to handle untrusted HTML input (the default is `strip` for BC reasons) - - `allow_unsafe_links` (`true` or `false`): whether to allow risky image URLs and links (the default is `true` for BC reasons) - -### Deprecated - - The `safe` option is now deprecated and will be removed in the 1.0.0 release. - -## [0.13.4] - 2016-06-14 - -### Fixed - - Fixed path to `autoload.php` within bin/commonmark (#250) - -## [0.13.3] - 2016-05-21 - -### Added - - Added `setUrl()` method for `Link` and `Image` elements (#227, #244) - - Added cebe/markdown to the benchmark tool (#245) - -## [0.13.2] - 2016-03-27 - -### Added - - Added ability to invoke `Converter` as a function (#233, #239) - - Added new `advanceBySpaceOrTab` convenience method to `Cursor` - -### Changed - - Bumped spec target version to 0.25 - - Adjusted how tabs are handled by the `Cursor` (#234) - - Made a couple small micro-optimizations to heavily used functions (#240) - - Updated URLs in docblocks to use HTTPS where possible (#238) - -## [0.13.1] - 2016-03-09 - -### Changed - - Refactored `EmphasisParser::parse()` to simplify it (#223) - - Updated dev dependencies (#218 & #220) - -### Fixed - - Fixed invalid regex generated when no inline parsers are defined (#224) - - Fixed logic bug with blank line after empty list item (#230) - - Fixed some incorrect code comments - -### Removed - - Removed unused variables (#223) - -## [0.13.0] - 2016-01-13 - -### Added - - Added AST document processors (#210) - - Added optional `Environment` parameter to `CommonMarkConverter` constructor - -### Changed - - Renamed "header" things to "heading" for spec consistency - - `Header` => `Heading` - - `ATXHeaderParser` => `ATXHeadingParser` - - `SetExtHeaderParser` => `SetExtHeadingParser` - - `HeaderRenderer` => `HeadingRenderer` - - Renamed "HorizontalRule" to "ThematicBreak" for spec consistency - - `HorizontalRule` => `ThematicBreak` - - `HorizontalRuleParser` => `ThematicBreakParser` - - `HorizontalRuleRenderer` => `ThematicBreakRenderer` - - `HorizontalRuleRendererTest` => `ThematicBreakRendererTest` - - `RegexHelper::getHRuleRegex()` => `RegexHelper::getThematicBreakRegex()` - - Renamed inline "Html" and "RawHtml" to "HtmlInline" for consistency - - `Html` => `HtmlInline` - - `RawHtmlParser` => `HtmlInlineParser` - - `RawHtmlRenderer` => `HtmlInlineRenderer` - - Don't allow whitespace between link text and link label of a reference link (spec change) - - Don't allow spaces in link destinations, even in `<>` - - Allow multiline setext header content - - The `Heading` constructor now allows `$contents` to be a `string` (old behavior) or `string[]` (new) - -### Fixed - - Fixed several list issues and regressions (jgm/commonmark.js#59) - -### Removed - - Removed schema whitelist from autolink regex - - Moved SmartPunct functionality into new [league/commonmark-extras](https://github.com/thephpleague/commonmark-extras) package - -## [0.12.0] - 2015-11-04 - -### Added - - Added ability to configure characters and disable emphasis/strong (#135) - - Added new ConfigurationAwareInterface support for all parsers, processors, and renderers (#201) - - Added HTML safe mode to handle untrusted input (#200, #201) - - Safe mode is disabled by default for backwards-compatibility - - To enable it, set the `safe` option to `true` - - Added AppVeyor integration for automated unit/functional testing on Windows (#195) - -### Changed - - `AbstractBlock::finalize()` now requires a second parameter, `$endLineNumber` - - `RegexHelper::REGEX_ENTITY` no longer includes the starting `/` or the ending `/i` (#194) - - `Node::setParent()` now accepts null values (#203) - -### Fixed - - Fixed incorrect `endLine` positions (#187) - - Fixed `DocParser::preProcessInput` dropping up to 2 ending newlines instead of just one - - Fixed `EntityParser` not checking for ampersands at the start of the current position (#192, #194) - -### Removed - - Removed protected function Context::addChild() - - It was a duplicate of the Context::addBlock() method - - Disabled STDIN reading on `bin/commonmark` for Windows due to PHP issues (#189, #195) - -## [0.11.3] - 2015-09-25 -### Fixed - - Reset container after closing containing lists (#183; jgm/commonmark.js#67) - - The temporary fix from 0.11.2 was reverted - -## [0.11.2] - 2015-09-23 -### Fixed - - Fixed parser checking acceptsLines on the wrong element (#183) - -## [0.11.1] - 2015-09-22 -### Changed - - Tightened up some loose comparisons - -### Fixed - - Fixed missing "bin" directive in composer.json - - Updated a docblock to match recent changes to method parameters - -### Removed - - Removed unused variable from within QuoteProcessor's closure - -## [0.11.0] - 2015-09-19 -### Added - - Added new `Node` class, which both `AbstractBlock` and `AbstractInline` extend from (#169) - - Added a `NodeWalker` and `NodeWalkerEvent` to traverse the AST without using recursion - - Added new `InlineContainer` interface for blocks - - Added new `getContainer()` and `getReferenceMap()` methods to `InlineParserContext` - - Added `iframe` to whitelist of HTML block tags (as per spec) - - Added `./bin/commonmark` for converting Markdown at the command line - -### Changed - - Bumped spec target version to 0.22 - - Revised AST to use a double-linked list (#169) - - `AbstractBlock` and `AbstractInline` both extend from `Node` - - Sub-classes must implement new `isContainer()` method - - Other major changes to `AbstractBlock`: - - `getParent()` is now `parent()` - - `setParent()` now expects a `Node` instead of an `AbstractBlock` - - `getChildren()` is now `children()` - - `getLastChild()` is now `lastChild()` - - `addChild()` is now `appendChild()` - - `InlineParserContext` is constructed using the container `AbstractBlock` and the document's `RefereceMap` - - The constructor will automatically create the `Cursor` using the container's string contents - - `InlineParserEngine::parse` now requires the `Node` container and the document's `ReferenceMap` instead of a `ContextInterface` and `Cursor` - - Changed `Delimiter` to reference the actual inline `Node` instead of the position - - The `int $pos` protected member and constructor arg is now `Node $node` - - Use `getInlineNode()` and `setInlineNode()` instead of `getPos()` and `setPos()` - - Changed `DocParser::processInlines` to use a `NodeWalker` to iterate through inlines - - Walker passed as second argument instead of `AbstractBlock` - - Uses a `while` loop instead of recursion to traverse the AST - - `Image` and `Link` now only accept a string as their second argument - - Refactored how `CloseBracketParser::parse()` works internally - - `CloseBracketParser::createInline` no longer accepts label inlines - - Disallow list item starting with multiple blank lines (see jgm/CommonMark#332) - - Modified `AbstractBlock::setLastLineBlank()` - - Functionality moved to `AbstractBlock::shouldLastLineBeBlank()` and new `DocParser::setAndPropagateLastLineBlank()` method - - `AbstractBlock::setLastLineBlank()` is now a setter method for `AbstractBlock::$lastLineBlank` - - `AbstractBlock::handleRemainingContents()` is no longer abstract - - A default implementation is provided - - Removed duplicate code from sub-classes which used the default implementation - they'll just use the parent method from now on - -### Fixed - - Fixed logic error in calculation of offset (see jgm/commonmark.js@94053a8) - - Fixed bug where `DocParser` checked the wrong method to determine remainder handling behavior - - Fixed bug where `HorizontalRuleParser` failed to advance the cursor beyond the parsed horizontal rule characters - - Fixed `DocParser` not ignoring the final newline of the input (like the reference parser does) - -### Removed - - Removed `Block\Element\AbstractInlineContainer` - - Extend `AbstractBlock` and implement `InlineContainer` instead - - Use child methods instead of `getInlines` and `setInlines` - - Removed `AbstractBlock::replaceChild()` - - Call `Node::replaceWith()` directly the child node instead - - Removed the `getInlines()` method from `InlineParserContext` - - Add parsed inlines using `$inlineContext->getContainer()->appendChild()` instead of `$inlineContext->getInlines()->add()` - - Removed the `ContextInterface` argument from `AbstractInlineParser::parse()` and `InlineParserEngine::parseCharacter` - - Removed the first `ArrayCollection $inlines` argument from `InlineProcessorInterface::processInlines()` - - Removed `CloseBracketParser::nullify()` - - Removed `pre` from rule 6 of HTML blocks (see jgm/CommonMark#355) - -## [0.10.0] - 2015-07-25 -### Added - - Added parent references to inline elements (#124) - - Added smart punctuation extension (#134) - - Added HTML block types - - Added indentation caching to the cursor - - Added automated code style checks (#133) - - Added support for tag attributes in renderers (#101, #165) - -### Changed - - Bumped spec target version to 0.21 - - Revised HTML block parsing to conform to new spec (jgm/commonmark.js@99bd473) - - Imposed 9-digit limit on ordered list markers, per spec - - Allow non-initial hyphens in html tag names (jgm/CommonMark#239) - - Updated list of block tag names - - Changed tab/indentation handling to meet the new spec behavior - - Modified spec tests to show spaces and tabs in test results - - Replaced `HtmlRendererInterface` with `ElementRendererInterface` (#141) - - Removed the unnecessary `trim()` and string cast from `ListItemRenderer` - -### Fixed - - Fixed link reference definition edge case (#120) - - Allow literal (non-escaping) backslashes in link destinations (#118) - - Allow backslash-escaped backslashes in link labels (#119) - - Allow link labels up to 999 characters (per the spec) - - Properly split on whitespace when determining code block class (jgm/commonmark.js#54) - - Fixed code style issues (#132, #133, #151, #152) - - Fixed wording for invalid inline exception (#136) - -### Removed - - Removed the advance-by-one optimization due to added cursor complexity - -## [0.9.0] - 2015-06-18 -### Added - - Added public $data array to block elements (#95) - - Added `isIndented` helper method to `Cursor` - - Added a new `Converter` base class which `CommonMarkConverter` extends from (#105) - -### Changed - - Bumped spec target version to 0.20 (#112) - - Renamed ListBlock::$data and ListItem::$data to $listData - - Require link labels to contain non-whitespace (jgm/CommonMark#322) - - Use U+FFFD for entities resolving to 0 (jgm/CommonMark#323) - - Moved `IndentedCodeParser::CODE_INDENT_LEVEL` to `Cursor::INDENT_LEVEL` - - Changed arrays to short syntax (#116) - - Improved efficiency of DelimiterStack iteration (jgm/commonmark.js#43) - -### Fixed - - Fixed open block tag followed by newline not being recognized (jgm/CommonMark#324) - - Fixed indented lists sometimes being parsed incorrectly (jgm/commonmark.js#42) - -## [0.8.0] - 2015-04-29 -### Added - - Allow swapping built-in renderers without using their fully qualified names (#84) - - Lots of unit tests (for existing code) - - Ability to include arbitrary functional tests in addition to spec-based tests - -### Changed - - Dropped support for PHP 5.3 (#64 and #76) - - Bumped spec target version to 0.19 - - Made the AbstractInlineContainer be abstract - - Moved environment config. logic into separate class - -### Fixed - - Fixed underscore emphasis to conform to spec changes (jgm/CommonMark#317) - -### Removed - - Removed PHP 5.3 workaround (see commit 5747822) - - Removed unused AbstractWebResource::setUrl() method - - Removed unnecessary check for hrule when parsing lists (#85) - -## [0.7.2] - 2015-03-08 -### Changed - - Bumped spec target version to 0.18 - -### Fixed - - Fixed broken parsing of emphasized text ending with a '0' character (#81) - -## [0.7.1] - 2015-03-01 -### Added - - All references can now be obtained from the `ReferenceMap` via `listReferences()` (#73) - - Test against PHP 7.0 (nightly) but allow failures - -### Changed - - ListData::$start now defaults to null instead of 0 (#74) - - Replace references to HtmlRenderer with new HtmlRendererInterface - -### Fixed - - Fixed 0-based ordered lists starting at 1 instead of 0 (#74) - - Fixed errors parsing multi-byte characters (#78 and #79) - -## [0.7.0] - 2015-02-16 -### Added - - More unit tests to increase code coverage - -### Changed - - Enabled the InlineParserEngine to parse several non-special characters at once (performance boost) - - NewlineParser no longer attempts to parse spaces; look-behind is used instead (major performance boost) - - Moved closeUnmatchedBlocks into its own class - - Image and link elements now extend AbstractInlineContainer; label data is stored via $inlineContents instead - - Renamed AbstractInlineContainer::$inlineContents and its getter/setter - -### Removed - - Removed the InlineCollection class - - Removed the unused ArrayCollection::splice() method - - Removed impossible-to-reach code in Cursor::advanceToFirstNonSpace - - Removed unnecessary test from the InlineParserEngine - - Removed unnecessary/unused RegexHelper::getMainRegex() method - -## [0.6.1] - 2015-01-25 -### Changed - - Bumped spec target version to 0.17 - - Updated emphasis parsing for underscores to prevent intra-word emphasis - - Deferred closing of fenced code blocks - -## [0.6.0] - 2015-01-09 -### Added - - Bulk registration of parsers/renderers via extensions (#45) - - Proper UTF-8 support, especially in the Cursor; mbstring extension is now required (#49) - - Environment is now configurable; options can be accessed in its parsers/renderers (#56) - - Added some unit tests - -### Changed - - Bumped spec target version to 0.15 (#50) - - Parsers/renderers are now lazy-initialized (#52) - - Some private elements are now protected for easier extending, especially on Element classes (#53) - - Renderer option keys changed from camelCase to underscore_case (#56) - - Moved CommonMark parser/render definitions into CommonMarkCoreExtension - -### Fixed - - Improved parsing of emphasis around punctuation - - Improved regexes for CDATA and HTML comments - - Fixed issue with HTML content that is considered false in loose comparisons, like `'0'` (#55) - - Fixed DocParser trying to add empty strings to closed containers (#58) - - Fixed incorrect use of a null parameter value in the HtmlElementTest - -### Removed - - Removed unused ReferenceDefinition* classes (#51) - - Removed UnicodeCaseFolder in favor of mb_strtoupper - -## [0.5.1] - 2014-12-27 -### Fixed - - Fixed infinite loop and link-in-link-in-image parsing (#37) - -### Removed - - Removed hard dependency on mbstring extension; workaround used if not installed (#38) - -## [0.5.0] - 2014-12-24 -### Added - - Support for custom directives, parsers, and renderers - -### Changed - - Major refactoring to de-couple directives from the parser, support custom directive functionality, and reduce complexity - - Updated references to stmd.js in README and docblocks - - Modified CHANGELOG formatting - - Improved travis configuration - - Put tests in autoload-dev - -### Fixed - - Fixed CommonMarkConverter re-creating object each time new text is converted (#26) - -### Removed - - Removed HtmlRenderer::render() (use the renderBlock method instead) - - Removed dependency on symfony/options-resolver (fixes #20) - -## [0.4.0] - 2014-12-15 -### Added - - Added some missing copyright info - -### Changed - - Changed namespace to League\CommonMark - - Made compatible with spec version 0.13 - - Moved delimiter stack functionality into separate class - -### Fixed - - Fixed regex which caused HHVM tests to fail - -## [0.3.0] - 2014-11-28 -### Added - - Made renderer options configurable (issue #7) - -### Changed - - Made compatible with spec version 0.12 - - Stack-based parsing now used for emphasis, links and images - - Protected some of the internal renderer methods which shouldn't have been `public` - - Minor code clean-up (including PSR-2 compliance) - -### Removed - - Removed unnecessary distinction between ATX and Setext headers - -## [0.2.1] - 2014-11-09 -### Added - - Added simpler string replacement to a method - -### Changed - - Removed "is" prefix from boolean methods - * Updated to latest version of PHPUnit - * Target specific spec version - -## [0.2.0] - 2014-11-09 -### Changed - - Mirrored significant changes and improvements from stmd.js - - Made compatible with spec version 0.10 - - Updated location of JGM's repository - - Allowed HHVM tests to fail without affecting overall build success - -### Removed - - Removed composer.lock - - Removed fixed reference to jgm/stmd@0275f34 - -## [0.1.2] - 2014-09-28 -### Added - - Added performance benchmarking tool (issue #2) - - Added more badges to the README - -### Changed - - Fix JS -> PHP null judgement (issue #4) - - Updated phpunit dependency - -## [0.1.1] - 2014-09-08 -### Added - - Add anchors to regexes - -### Changed - - Updated target spec (now compatible with jgm/stmd:spec.txt @ 2cf0750) - - Adjust HTML output for fenced code - - Adjust block-level tag regex (remove "br", add "iframe") - - Fix incorrect handling of nested emphasis - -## 0.1.0 -### Added - - Initial commit (compatible with jgm/stmd:spec.txt @ 0275f34) - -[0.19.3]: https://github.com/thephpleague/commonmark/compare/0.19.2...0.19.3 -[0.19.2]: https://github.com/thephpleague/commonmark/compare/0.19.1...0.19.2 -[0.19.1]: https://github.com/thephpleague/commonmark/compare/0.19.0...0.19.1 -[0.19.0]: https://github.com/thephpleague/commonmark/compare/0.18.5...0.19.0 -[0.18.5]: https://github.com/thephpleague/commonmark/compare/0.18.4...0.18.5 -[0.18.4]: https://github.com/thephpleague/commonmark/compare/0.18.3...0.18.4 -[0.18.3]: https://github.com/thephpleague/commonmark/compare/0.18.2...0.18.3 -[0.18.2]: https://github.com/thephpleague/commonmark/compare/0.18.1...0.18.2 -[0.18.1]: https://github.com/thephpleague/commonmark/compare/0.18.0...0.18.1 -[0.18.0]: https://github.com/thephpleague/commonmark/compare/0.17.5...0.18.0 -[0.17.5]: https://github.com/thephpleague/commonmark/compare/0.17.4...0.17.5 -[0.17.4]: https://github.com/thephpleague/commonmark/compare/0.17.3...0.17.4 -[0.17.3]: https://github.com/thephpleague/commonmark/compare/0.17.2...0.17.3 -[0.17.2]: https://github.com/thephpleague/commonmark/compare/0.17.1...0.17.2 -[0.17.1]: https://github.com/thephpleague/commonmark/compare/0.17.0...0.17.1 -[0.17.0]: https://github.com/thephpleague/commonmark/compare/0.16.0...0.17.0 -[0.16.0]: https://github.com/thephpleague/commonmark/compare/0.15.7...0.16.0 -[0.15.7]: https://github.com/thephpleague/commonmark/compare/0.15.6...0.15.7 -[0.15.6]: https://github.com/thephpleague/commonmark/compare/0.15.5...0.15.6 -[0.15.5]: https://github.com/thephpleague/commonmark/compare/0.15.4...0.15.5 -[0.15.4]: https://github.com/thephpleague/commonmark/compare/0.15.3...0.15.4 -[0.15.3]: https://github.com/thephpleague/commonmark/compare/0.15.2...0.15.3 -[0.15.2]: https://github.com/thephpleague/commonmark/compare/0.15.1...0.15.2 -[0.15.1]: https://github.com/thephpleague/commonmark/compare/0.15.0...0.15.1 -[0.15.0]: https://github.com/thephpleague/commonmark/compare/0.14.0...0.15.0 -[0.14.0]: https://github.com/thephpleague/commonmark/compare/0.13.4...0.14.0 -[0.13.4]: https://github.com/thephpleague/commonmark/compare/0.13.3...0.13.4 -[0.13.3]: https://github.com/thephpleague/commonmark/compare/0.13.2...0.13.3 -[0.13.2]: https://github.com/thephpleague/commonmark/compare/0.13.1...0.13.2 -[0.13.1]: https://github.com/thephpleague/commonmark/compare/0.13.0...0.13.1 -[0.13.0]: https://github.com/thephpleague/commonmark/compare/0.12.0...0.13.0 -[0.12.0]: https://github.com/thephpleague/commonmark/compare/0.11.3...0.12.0 -[0.11.3]: https://github.com/thephpleague/commonmark/compare/0.11.2...0.11.3 -[0.11.2]: https://github.com/thephpleague/commonmark/compare/0.11.1...0.11.2 -[0.11.1]: https://github.com/thephpleague/commonmark/compare/0.11.0...0.11.1 -[0.11.0]: https://github.com/thephpleague/commonmark/compare/0.10.0...0.11.0 -[0.10.0]: https://github.com/thephpleague/commonmark/compare/0.9.0...0.10.0 -[0.9.0]: https://github.com/thephpleague/commonmark/compare/0.8.0...0.9.0 -[0.8.0]: https://github.com/thephpleague/commonmark/compare/0.7.2...0.8.0 -[0.7.2]: https://github.com/thephpleague/commonmark/compare/0.7.1...0.7.2 -[0.7.1]: https://github.com/thephpleague/commonmark/compare/0.7.0...0.7.1 -[0.7.0]: https://github.com/thephpleague/commonmark/compare/0.6.1...0.7.0 -[0.6.1]: https://github.com/thephpleague/commonmark/compare/0.6.0...0.6.1 -[0.6.0]: https://github.com/thephpleague/commonmark/compare/0.5.1...0.6.0 -[0.5.1]: https://github.com/thephpleague/commonmark/compare/0.5.0...0.5.1 -[0.5.0]: https://github.com/thephpleague/commonmark/compare/0.4.0...0.5.0 -[0.4.0]: https://github.com/thephpleague/commonmark/compare/0.3.0...0.4.0 -[0.3.0]: https://github.com/thephpleague/commonmark/compare/0.2.1...0.3.0 -[0.2.1]: https://github.com/thephpleague/commonmark/compare/0.2.0...0.2.1 -[0.2.0]: https://github.com/thephpleague/commonmark/compare/0.1.2...0.2.0 -[0.1.2]: https://github.com/thephpleague/commonmark/compare/0.1.1...0.1.2 -[0.1.1]: https://github.com/thephpleague/commonmark/compare/0.1.0...0.1.1 diff --git a/vendor/league/commonmark/CHANGELOG.md b/vendor/league/commonmark/CHANGELOG.md deleted file mode 100644 index 4784a15306..0000000000 --- a/vendor/league/commonmark/CHANGELOG.md +++ /dev/null @@ -1,431 +0,0 @@ -# Change Log -All notable changes to this project will be documented in this file. -Updates should follow the [Keep a CHANGELOG](https://keepachangelog.com/) principles. - -## [Unreleased][unreleased] - -## [1.5.7] - 2020-10-31 - -### Fixed - - - Fixed mentions not being parsed when appearing after non-word characters (#582) - -## [1.5.6] - 2020-10-17 - -### Changed - - - Blocks added outside of the parsing context now have their start/end line numbers defaulted to 0 to avoid type errors (#579) - -### Fixed - - - Fixed replacement blocks not inheriting the start line number of the container they're replacing (#579) - - Fixed Table of Contents blocks not having correct start/end line numbers (#579) - -## [1.5.5] - 2020-09-13 - -### Changed - - - Bumped CommonMark spec compliance to 0.28.2 - -### Fixed - - - Fixed `textarea` elements not being treated as a type 1 HTML block (like `script`, `style`, or `pre`) - - Fixed autolink processor not handling other unmatched trailing parentheses - -## [1.5.4] - 2020-08-17 - -### Fixed - - - Fixed footnote ID configuration not taking effect (#524, #530) - - Fixed heading permalink slugs not being unique (#531, #534) - -## [1.5.3] - 2020-07-19 - -### Fixed - - - Fixed regression of multi-byte inline parser characters not being matched - -## [1.5.2] - 2020-07-19 - -### Changed - - - Significantly improved performance of the inline parser regex - -### Fixed - - - Fixed parent class lookups for non-existent classes on PHP 8 (#517) - -## [1.5.1] - 2020-06-27 - -### Fixed - - - Fixed UTF-8 encoding not being checked in the `UrlEncoder` utility (#509) or the `Cursor` - -## [1.5.0] - 2020-06-21 - -### Added - - - Added new `AttributesExtension` based on <https://github.com/webuni/commonmark-attributes-extension> (#474) - - Added new `FootnoteExtension` based on <https://github.com/rezozero/commonmark-ext-footnotes> (#474) - - Added new `MentionExtension` to replace `InlineMentionParser` with more flexibility and customization - - Added the ability to render `TableOfContents` nodes anywhere in a document (given by a placeholder) - - Added the ability to properly clone `Node` objects - - Added options to customize the value of `rel` attributes set via the `ExternalLink` extension (#476) - - Added a new `heading_permalink/slug_normalizer` configuration option to allow custom slug generation (#460) - - Added a new `heading_permalink/symbol` configuration option to replace the now deprecated `heading_permalink/inner_contents` configuration option (#505) - - Added `SlugNormalizer` and `TextNormalizer` classes to make normalization reusable by extensions (#485) - - Added new classes: - - `TableOfContentsGenerator` - - `TableOfContentsGeneratorInterface` - - `TableOfContentsPlaceholder` - - `TableOfContentsPlaceholderParser` - - `TableOfContentsPlaceholderRenderer` - -### Changed - - - "Moved" the `TableOfContents` class into a new `Node` sub-namespace (with backward-compatibility) - - Reference labels are now generated and stored in lower-case instead of upper-case - - Reference labels are no longer normalized inside the `Reference`, only the `ReferenceMap` - -### Fixed - - - Fixed reference label case folding polyfill not being consistent between different PHP versions - -### Deprecated - - - Deprecated the `CommonMarkConverter::VERSION` constant (#496) - - Deprecated `League\CommonMark\Extension\Autolink\InlineMentionParser` (use `League\CommonMark\Extension\Mention\MentionParser` instead) - - Deprecated everything under `League\CommonMark\Extension\HeadingPermalink\Slug` (use the classes under `League\CommonMark\Normalizer` instead) - - Deprecated `League\CommonMark\Extension\TableOfContents\TableOfContents` (use the one in the new `Node` sub-namespace instead) - - Deprecated the `STYLE_` and `NORMALIZE_` constants in `TableOfContentsBuilder` (use the ones in `TableOfContentsGenerator` instead) - - Deprecated the `\League\CommonMark\Extension\HeadingPermalink\HeadingPermalinkRenderer::DEFAULT_INNER_CONTENTS` constant (#505) - - Deprecated the `heading_permalink/inner_contents` configuration option in the `HeadingPermalink` extension (use the new `heading_permalink/symbol` configuration option instead) (#505) - -## [1.4.3] - 2020-05-04 - -### Fixed - - - Fixed certain Unicode letters, numbers, and marks not being preserved when generating URL slugs (#467) - -## [1.4.2] - 2020-04-24 - -### Fixed - - - Fixed inline code blocks not be included within heading permalinks (#457) - -## [1.4.1] - 2020-04-20 - -### Fixed - - - Fixed BC break caused by ConverterInterface alias not being used by some DI containers (#454) - -## [1.4.0] - 2020-04-18 - -### Added - - - Added new [Heading Permalink extension](https://commonmark.thephpleague.com/extensions/heading-permalinks/) (#420) - - Added new [Table of Contents extension](https://commonmark.thephpleague.com/extensions/table-of-contents/) (#441) - - Added new `MarkdownConverterInterface` as a long-term replacement for `ConverterInterface` (#439) - - Added new `DocumentPreParsedEvent` event (#427, #359, #399) - - Added new `ListBlock::TYPE_BULLET` constant as a replacement for `ListBlock::TYPE_UNORDERED` - - Added new `MarkdownInput` class and `MarkdownInputInterface` to handle pre-parsing and allow listeners to replace Markdown contents - -### Changed - - - Block & inline renderers will now render child classes automatically (#222, #209) - - The `ListBlock` constants now use fully-lowercased values instead of titlecased values - - Significantly improved typing - -### Fixed - - - Fixed loose comparison when checking for table alignment - - Fixed `StaggeredDelimiterProcessor` returning from a `void` function - -### Deprecated - - - The `Converter` class has been deprecated; use `CommonMarkConverter` instead (#438, #439) - - The `ConverterInterface` has been deprecated; use `MarkdownConverterInterface` instead (#438, #439) - - The `bin/commonmark` script has been deprecated - - The following methods of `ArrayCollection` have been deprecated: - - `add()` - - `set()` - - `get()` - - `remove()` - - `isEmpty()` - - `contains()` - - `indexOf()` - - `containsKey()` - - `replaceWith()` - - `removeGaps()` - - The `ListBlock::TYPE_UNORDERED` constant has been deprecated, use `ListBlock::TYPE_BULLET` instead - -## [1.3.4] - 2020-04-13 - -### Fixed - - - Fixed configuration/environment not being injected into event listeners when adding them via `[$instance, 'method']` callable syntax (#440) - -## [1.3.3] - 2020-04-05 - -### Fixed - - - Fixed event listeners not having the environment or configuration injected if they implemented the `EnvironmentAwareInterface` or `ConfigurationAwareInterface` (#423) - -## [1.3.2] - 2020-03-25 - -### Fixed - - - Optimized URL normalization in cases where URLs don't contain special characters (#417, #418) - -## [1.3.1] - 2020-02-28 - -### Fixed - - - Fixed return types of `Environment::createCommonMarkEnvironment()` and `Environment::createGFMEnvironment()` - -## [1.3.0] - 2020-02-08 - -### Added - - - Added (optional) **full GFM support!** 🎉🎉🎉 (#409) - - Added check to ensure Markdown input is valid UTF-8 (#401, #405) - - Added new `unordered_list_markers` configuration option (#408, #411) - -### Changed - - - Introduced several micro-optimizations for a 5-10% performance boost - -## [1.2.2] - 2020-01-15 - -This release contains the same changes as 1.1.3: - -### Fixed - - - Fixed link parsing edge case (#403) - -## [1.1.3] - 2020-01-15 - -### Fixed - - - Fixed link parsing edge case (#403) - -## [1.2.1] - 2020-01-14 - -### Changed - - - Introduced several micro-optimizations, reducing the parse time by 8% - -## [1.2.0] - 2020-01-09 - -### Changed - - - Removed URL decoding step before encoding (more performant and better matches the JS library) - - Removed redundant token from HTML tag regex - -## [1.1.2] - 2019-12-09 - -### Fixed - - - Fixed URL normalization not handling non-UTF-8 sequences properly (#395, #396) - -## [1.1.1] - 2019-11-11 - -### Fixed - - - Fixed handling of link destinations with unbalanced unescaped parens - - Fixed adding delimiters to stack which can neither open nor close a run - -## [1.1.0] - 2019-10-31 - -### Added - - - Added a new `Html5EntityDecoder` class (#387) - -### Changed - - - Improved performance by 10% (#389) - - Made entity decoding less memory-intensive (#386, #387) - -### Fixed - - - Fixed PHP 7.4 compatibility issues - -### Deprecated - - - Deprecated the `Html5Entities` class - use `Html5EntityDecoder` instead (#387) - -## [1.0.0] - 2019-06-29 - -No changes were made since 1.0.0-rc1. - -## [1.0.0-rc1] - 2019-06-19 - -### Added - - - Extracted a `ReferenceMapInterface` from the `ReferenceMap` class - - Added optional `ReferenceMapInterface` parameter to the `Document` constructor - -### Changed - - - Replaced all references to `ReferenceMap` with `ReferenceMapInterface` - - `ReferenceMap::addReference()` no longer returns `$this` - -### Fixed - - - Fixed bug where elements with content of `"0"` wouldn't be rendered (#376) - -## [1.0.0-beta4] - 2019-06-05 - -### Added - - - Added event dispatcher functionality (#359, #372) - -### Removed - - - Removed `DocumentProcessorInterface` functionality in favor of event dispatching (#373) - -## [1.0.0-beta3] - 2019-05-27 - -### Changed - - - Made the `Delimiter` class final and extracted a new `DelimiterInterface` - - Modified most external usages to use this new interface - - Renamed three `Delimiter` methods: - - `getOrigDelims()` renamed to `getOriginalLength()` - - `getNumDelims()` renamed to `getLength()` - - `setNumDelims()` renamed to `setLength()` - - Made additional classes final: - - `DelimiterStack` - - `ReferenceMap` - - `ReferenceParser` - - Moved `ReferenceParser` into the `Reference` sub-namespace - -### Removed - - - Removed unused `Delimiter` methods: - - `setCanOpen()` - - `setCanClose()` - - `setChar()` - - `setIndex()` - - `setInlineNode()` - - Removed fluent interface from `Delimiter` (setter methods now have no return values) - -## [1.0.0-beta2] - 2019-05-27 - -### Changed - - - `DelimiterProcessorInterface::process()` will accept any type of `AbstractStringContainer` now, not just `Text` nodes - - The `Delimiter` constructor, `getInlineNode()`, and `setInlineNode()` no longer accept generic `Node` elements - only `AbstractStringContainer`s - - -### Removed - - - Removed all deprecated functionality: - - The `safe` option (use `html_input` and `allow_unsafe_links` options instead) - - All deprecated `RegexHelper` constants - - `DocParser::getEnvironment()` (you should obtain it some other way) - - `AbstractInlineContainer` (use `AbstractInline` instead and make `isContainer()` return `true`) - -## [1.0.0-beta1] - 2019-05-26 - -### Added - - - Added proper support for delimiters, including custom delimiters - - `addDelimiterProcessor()` added to `ConfigurableEnvironmentInterface` and `Environment` - - Basic delimiters no longer need custom parsers - they'll be parsed automatically - - Added new methods: - - `AdjacentTextMerger::mergeTextNodesBetweenExclusive()` - - `CommonMarkConveter::getEnvironment()` - - `Configuration::set()` - - Extracted some new interfaces from base classes: - - `DocParserInterface` created from `DocParser` - - `ConfigurationInterface` created from `Configuration` - - `ReferenceInterface` created from `Reference` - -### Changed - - - Renamed several methods of the `Configuration` class: - - `getConfig()` renamed to `get()` - - `mergeConfig()` renamed to `merge()` - - `setConfig()` renamed to `replace()` - - Changed `ConfigurationAwareInterface::setConfiguration()` to accept the new `ConfigurationInterface` instead of the concrete class - - Renamed the `AdjoiningTextCollapser` class to `AdjacentTextMerger` - - Replaced its `collapseTextNodes()` method with the new `mergeChildNodes()` method - - Made several classes `final`: - - `Configuration` - - `DocParser` - - `HtmlRenderer` - - `InlineParserEngine` - - `NodeWalker` - - `Reference` - - All of the block/inline parsers and renderers - - Reduced visibility of several internal methods to `private`: - - `DelimiterStack::findEarliest()` - - All `protected` methods in `InlineParserEngine` - - Marked some classes and methods as `@internal` - - `ElementRendererInterface` now requires a public `renderInline()` method; added this to `HtmlRenderer` - - Changed `InlineParserEngine::parse()` to require an `AbstractStringContainerBlock` instead of the generic `Node` class - - Un-deprecated the `CommonmarkConverter::VERSION` constant - - The `Converter` constructor now requires an instance of `DocParserInterface` instead of the concrete `DocParser` - - Changed `Emphasis`, `Strong`, and `AbstractWebResource` to directly extend `AbstractInline` instead of the (now-deprecated) intermediary `AbstractInlineContainer` class - -### Fixed - - - Fixed null errors when inserting sibling `Node`s without parents - - Fixed `NodeWalkerEvent` not requiring a `Node` via its constructor - - Fixed `Reference::normalizeReference()` improperly converting to uppercase instead of performing proper Unicode case-folding - - Fixed strong emphasis delimiters not being preserved when `enable_strong` is set to `false` (it now works identically to `enable_em`) - -### Deprecated - - - Deprecated `DocParser::getEnvironment()` (you should obtain it some other way) - - Deprecated `AbstractInlineContainer` (use `AbstractInline` instead and make `isContainer()` return `true`) - -### Removed - - - Removed inline processor functionality now that we have proper delimiter support: - - Removed `addInlineProcessor()` from `ConfigurableEnvironmentInterface` and `Environment` - - Removed `getInlineProcessors()` from `EnvironmentInterface` and `Environment` - - Removed `EmphasisProcessor` - - Removed `InlineProcessorInterface` - - Removed `EmphasisParser` now that we have proper delimiter support - - Removed support for non-UTF-8-compatible encodings - - Removed `getEncoding()` from `ContextInterface` - - Removed `getEncoding()`, `setEncoding()`, and `$encoding` from `Context` - - Removed `getEncoding()` and the second `$encoding` constructor param from `Cursor` - - Removed now-unused methods - - Removed `DelimiterStack::getTop()` (no replacement) - - Removed `DelimiterStack::iterateByCharacters()` (use the new `processDelimiters()` method instead) - - Removed the protected `DelimiterStack::findMatchingOpener()` method - -[unreleased]: https://github.com/thephpleague/commonmark/compare/1.5.7...1.5 -[1.5.7]: https://github.com/thephpleague/commonmark/compare/1.5.6...1.5.7 -[1.5.6]: https://github.com/thephpleague/commonmark/compare/1.5.5...1.5.6 -[1.5.5]: https://github.com/thephpleague/commonmark/compare/1.5.4...1.5.5 -[1.5.4]: https://github.com/thephpleague/commonmark/compare/1.5.3...1.5.4 -[1.5.3]: https://github.com/thephpleague/commonmark/compare/1.5.2...1.5.3 -[1.5.2]: https://github.com/thephpleague/commonmark/compare/1.5.1...1.5.2 -[1.5.1]: https://github.com/thephpleague/commonmark/compare/1.5.0...1.5.1 -[1.5.0]: https://github.com/thephpleague/commonmark/compare/1.4.3...1.5.0 -[1.4.3]: https://github.com/thephpleague/commonmark/compare/1.4.2...1.4.3 -[1.4.2]: https://github.com/thephpleague/commonmark/compare/1.4.1...1.4.2 -[1.4.1]: https://github.com/thephpleague/commonmark/compare/1.4.0...1.4.1 -[1.4.0]: https://github.com/thephpleague/commonmark/compare/1.3.4...1.4.0 -[1.3.4]: https://github.com/thephpleague/commonmark/compare/1.3.3...1.3.4 -[1.3.3]: https://github.com/thephpleague/commonmark/compare/1.3.2...1.3.3 -[1.3.2]: https://github.com/thephpleague/commonmark/compare/1.3.1...1.3.2 -[1.3.1]: https://github.com/thephpleague/commonmark/compare/1.3.0...1.3.1 -[1.3.0]: https://github.com/thephpleague/commonmark/compare/1.2.2...1.3.0 -[1.2.2]: https://github.com/thephpleague/commonmark/compare/1.2.1...1.2.2 -[1.2.1]: https://github.com/thephpleague/commonmark/compare/1.2.0...1.2.1 -[1.2.0]: https://github.com/thephpleague/commonmark/compare/1.1.2...1.2.0 -[1.1.3]: https://github.com/thephpleague/commonmark/compare/1.1.2...1.1.3 -[1.1.2]: https://github.com/thephpleague/commonmark/compare/1.1.1...1.1.2 -[1.1.1]: https://github.com/thephpleague/commonmark/compare/1.1.0...1.1.1 -[1.1.0]: https://github.com/thephpleague/commonmark/compare/1.0.0...1.1.0 -[1.0.0]: https://github.com/thephpleague/commonmark/compare/1.0.0-rc1...1.0.0 -[1.0.0-rc1]: https://github.com/thephpleague/commonmark/compare/1.0.0-beta4...1.0.0-rc1 -[1.0.0-beta4]: https://github.com/thephpleague/commonmark/compare/1.0.0-beta3...1.0.0-beta4 -[1.0.0-beta3]: https://github.com/thephpleague/commonmark/compare/1.0.0-beta2...1.0.0-beta3 -[1.0.0-beta2]: https://github.com/thephpleague/commonmark/compare/1.0.0-beta1...1.0.0-beta2 -[1.0.0-beta1]: https://github.com/thephpleague/commonmark/compare/0.19.2...1.0.0-beta1 diff --git a/vendor/league/commonmark/LICENSE b/vendor/league/commonmark/LICENSE deleted file mode 100644 index 7441468b8b..0000000000 --- a/vendor/league/commonmark/LICENSE +++ /dev/null @@ -1,28 +0,0 @@ -BSD 3-Clause License - -Copyright (c) 2014-2019, Colin O'Dell. All rights reserved. Based on commonmark.js,copyright (c) 2014-2018, John MacFarlane - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -* Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/league/commonmark/README.md b/vendor/league/commonmark/README.md deleted file mode 100644 index 11342983b7..0000000000 --- a/vendor/league/commonmark/README.md +++ /dev/null @@ -1,217 +0,0 @@ -# league/commonmark - -[](https://packagist.org/packages/league/commonmark) -[](https://packagist.org/packages/league/commonmark) -[](LICENSE) -[](https://travis-ci.org/thephpleague/commonmark) -[](https://scrutinizer-ci.com/g/thephpleague/commonmark/code-structure) -[](https://scrutinizer-ci.com/g/thephpleague/commonmark) -[](https://bestpractices.coreinfrastructure.org/projects/126) - -[](https://www.colinodell.com/sponsor) - - - -**league/commonmark** is a highly-extensible PHP Markdown parser created by [Colin O'Dell][@colinodell] which supports the full [CommonMark] spec and [Github-Flavored Markdown]. It is based on the [CommonMark JS reference implementation][commonmark.js] by [John MacFarlane] \([@jgm]\). - -## 📦 Installation & Basic Usage - -This project requires PHP 7.1 or higher with the `mbstring` extension. To install it via [Composer] simply run: - -``` bash -$ composer require league/commonmark -``` - -The `CommonMarkConverter` class provides a simple wrapper for converting CommonMark to HTML: - -```php -use League\CommonMark\CommonMarkConverter; - -$converter = new CommonMarkConverter([ - 'html_input' => 'strip', - 'allow_unsafe_links' => false, -]); - -echo $converter->convertToHtml('# Hello World!'); - -// <h1>Hello World!</h1> -``` - -Or if you want Github-Flavored Markdown, use the `GithubFlavoredMarkdownConverter` class instead: - -```php -use League\CommonMark\GithubFlavoredMarkdownConverter; - -$converter = new GithubFlavoredMarkdownConverter([ - 'html_input' => 'strip', - 'allow_unsafe_links' => false, -]); - -echo $converter->convertToHtml('# Hello World!'); - -// <h1>Hello World!</h1> -``` - -Please note that only UTF-8 and ASCII encodings are supported. If your Markdown uses a different encoding please convert it to UTF-8 before running it through this library. - -🔒 If you will be parsing untrusted input from users, please consider setting the `html_input` and `allow_unsafe_links` options per the example above. See <https://commonmark.thephpleague.com/security/> for more details. If you also do choose to allow raw HTML input from untrusted users, considering using a library (like [HTML Purifier](https://github.com/ezyang/htmlpurifier)) to provide additional HTML filtering. - -## 📓 Documentation - -Full documentation on advanced usage, configuration, and customization can be found at [commonmark.thephpleague.com][docs]. - -## ⏫ Upgrading - -Information on how to upgrade to newer versions of this library can be found at <https://commonmark.thephpleague.com/releases>. - -## 💻 Github-Flavored Markdown - -The `GithubFlavoredMarkdownConverter` shown earlier is a drop-in replacement for the `CommonMarkConverter` which adds additional features found in the GFM spec: - - - Autolinks - - Disallowed raw HTML - - Strikethrough - - Tables - - Task Lists - -See the [Extensions documentation](https://commonmark.thephpleague.com/customization/extensions/) for more details on how to include only certain GFM features if you don't want them all. - -## 🗃️ Related Packages - -### Integrations - -- [CakePHP 3](https://github.com/gourmet/common-mark) -- [Drupal](https://www.drupal.org/project/markdown) -- [Laravel 4 & 5](https://github.com/GrahamCampbell/Laravel-Markdown) -- [Sculpin](https://github.com/bcremer/sculpin-commonmark-bundle) -- [Symfony 2 & 3](https://github.com/webuni/commonmark-bundle) -- [Symfony 4](https://github.com/avensome/commonmark-bundle) -- [Twig Markdown extension](https://github.com/twigphp/markdown-extension) -- [Twig filter and tag](https://github.com/aptoma/twig-markdown) - -### Included Extensions - -See [our extension documentation](https://commonmark.thephpleague.com/extensions/overview) for a full list of extensions bundled with this library. - -### Community Extensions - -Custom parsers/renderers can be bundled into extensions which extend CommonMark. Here are some that you may find interesting: - - - [Alt Three Emoji](https://github.com/AltThree/Emoji) An emoji parser for CommonMark. - - [Sup Sub extensions](https://github.com/OWS/commonmark-sup-sub-extensions) - Adds support of superscript and subscript (`<sup>` and `<sub>` HTML tags) - - [YouTube iframe extension](https://github.com/zoonru/commonmark-ext-youtube-iframe) - Replaces youtube link with iframe. - -Others can be found on [Packagist under the `commonmark-extension` package type](https://packagist.org/packages/league/commonmark?type=commonmark-extension). - -If you build your own, feel free to submit a PR to add it to this list! - -### Others - -Check out the other cool things people are doing with `league/commonmark`: <https://packagist.org/packages/league/commonmark/dependents> - -## 🏷️ Versioning - -[SemVer](http://semver.org/) is followed closely. Minor and patch releases should not introduce breaking changes to the codebase; however, they might change the resulting AST or HTML output of parsed Markdown (due to bug fixes, spec changes, etc.) As a result, you might get slightly different HTML, but any custom code built onto this library should still function correctly. - -Any classes or methods marked `@internal` are not intended for use outside of this library and are subject to breaking changes at any time, so please avoid using them. - -## 🛠️ Maintenance & Support - -When a new **minor** version (e.g. `1.4` -> `1.5`) is released, the previous one (`1.4`) will continue to receive security and critical bug fixes for *at least* 3 months. - -When a new **major** version is released (e.g. `1.5` -> `2.0`), the previous one (`1.5`) will receive critical bug fixes for *at least* 3 months and security updates for 6 months after that new release comes out. - -(This policy may change in the future and exceptions may be made on a case-by-case basis.) - -**Professional support, including notification of new releases and security updates, is available through a [Tidelift Subscription](https://tidelift.com/subscription/pkg/packagist-league-commonmark?utm_source=packagist-league-commonmark&utm_medium=referral&utm_campaign=readme).** - -## 👷♀️ Contributing - -To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure with us. - -If you encounter a bug in the spec, please report it to the [CommonMark] project. Any resulting fix will eventually be implemented in this project as well. - -Contributions to this library are **welcome**, especially ones that: - - * Improve usability or flexibility without compromising our ability to adhere to the [CommonMark spec] - * Mirror fixes made to the [reference implementation][commonmark.js] - * Optimize performance - * Fix issues with adhering to the [CommonMark spec] - -Major refactoring to core parsing logic should be avoided if possible so that we can easily follow updates made to [the reference implementation][commonmark.js]. That being said, we will absolutely consider changes which don't deviate too far from the reference spec or which are favored by other popular CommonMark implementations. - -Please see [CONTRIBUTING](https://github.com/thephpleague/commonmark/blob/latest/.github/CONTRIBUTING.md) for additional details. - -## 🧪 Testing - -``` bash -$ composer test -``` - -This will also test league/commonmark against the latest supported spec. - -## 🚀 Performance Benchmarks - -You can compare the performance of **league/commonmark** to other popular parsers by running the included benchmark tool: - -``` bash -$ ./tests/benchmark/benchmark.php -``` - -## 👥 Credits & Acknowledgements - -- [Colin O'Dell][@colinodell] -- [John MacFarlane][@jgm] -- [All Contributors] - -This code is partially based on the [CommonMark JS reference implementation][commonmark.js] which is written, maintained and copyrighted by [John MacFarlane]. This project simply wouldn't exist without his work. - -### Sponsors - -We'd also like to extend our sincere thanks the following sponsors who support ongoing development of this project: - - - [Tidelift](https://tidelift.com/subscription/pkg/packagist-league-commonmark?utm_source=packagist-league-commonmark&utm_medium=referral&utm_campaign=readme) for offering support to both the maintainers and end-users through their [professional support](https://tidelift.com/subscription/pkg/packagist-league-commonmark?utm_source=packagist-league-commonmark&utm_medium=referral&utm_campaign=readme) program - - [RIPS Technologies](https://www.ripstech.com/) for supporting this project with a complimentary [RIPS SaaS](https://www.ripstech.com/product/) license - - [JetBrains](https://www.jetbrains.com/) for supporting this project with complimentary [PhpStorm](https://www.jetbrains.com/phpstorm/) licenses - -Are you interested in sponsoring development of this project? See <https://www.colinodell.com/sponsor> for a list of ways to contribute. - -## 📄 License - -**league/commonmark** is licensed under the BSD-3 license. See the [`LICENSE`](LICENSE) file for more details. - -## 🏛️ Governance - -This project is primarily maintained by [Colin O'Dell][@colinodell]. Members of the [PHP League] Leadership Team may occasionally assist with some of these duties. - -## 🗺️ Who Uses It? - -This project is used by [Drupal](https://www.drupal.org/project/markdown), [Laravel Framework](https://laravel.com/), [Cachet](https://cachethq.io/), [Firefly III](https://firefly-iii.org/), [Neos](https://www.neos.io/), [Daux.io](https://daux.io/), and [more](https://packagist.org/packages/league/commonmark/dependents)! - ---- - -<div align="center"> - <b> - <a href="https://tidelift.com/subscription/pkg/packagist-league-commonmark?utm_source=packagist-league-commonmark&utm_medium=referral&utm_campaign=readme">Get professional support for league/commonmark with a Tidelift subscription</a> - </b> - <br> - <sub> - Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies. - </sub> -</div> - -[CommonMark]: http://commonmark.org/ -[CommonMark spec]: http://spec.commonmark.org/ -[commonmark.js]: https://github.com/jgm/commonmark.js -[Github-Flavored Markdown]: https://github.github.com/gfm/ -[John MacFarlane]: http://johnmacfarlane.net -[docs]: https://commonmark.thephpleague.com/ -[docs-examples]: https://commonmark.thephpleague.com/customization/overview/#examples -[docs-example-twitter]: https://commonmark.thephpleague.com/customization/inline-parsing#example-1---twitter-handles -[docs-example-smilies]: https://commonmark.thephpleague.com/customization/inline-parsing#example-2---emoticons -[All Contributors]: https://github.com/thephpleague/commonmark/contributors -[@colinodell]: https://www.twitter.com/colinodell -[@jgm]: https://github.com/jgm -[jgm/stmd]: https://github.com/jgm/stmd -[Composer]: https://getcomposer.org/ -[PHP League]: https://thephpleague.com diff --git a/vendor/league/commonmark/bin/commonmark b/vendor/league/commonmark/bin/commonmark deleted file mode 100755 index 4c009ac052..0000000000 --- a/vendor/league/commonmark/bin/commonmark +++ /dev/null @@ -1,181 +0,0 @@ -#!/usr/bin/env php -<?php - -trigger_error('The "bin/commonmark" command has been deprecated since league/commonmark 1.4', E_USER_DEPRECATED); - -requireAutoloader(); - -ini_set('display_errors', 'stderr'); - -$options = array(); -$options_raw = getopt('', array( - 'use-asterisk', - 'use-underscore', - 'enable-strong', - 'enable-em', - 'safe', -)); -foreach ($options_raw as $option => $value) { - switch ($option) { - case 'safe': - $options['html_input'] = 'strip'; - $options['allow_unsafe_links'] = false; - break; - case 'use-asterisk': - case 'use-underscore': - case 'enable-strong': - case 'enable-em': - if ($value !== true && $value !== false) { - fail("Invalid value '$value' for option '$option'"); - } - break; - } - $options[str_replace('-', '_', $option)] = $value; -} - -foreach ($argv as $i => $arg) { - if ($i === 0) { - continue; - } - - if (substr($arg, 0, 1) === '-') { - switch ($arg) { - case '-h': - case '--help': - echo getHelpText(); - exit(0); - case '-v': - case '--version': - echo \League\CommonMark\CommonMarkConverter::VERSION . "\n"; - exit(0); - case '--safe': - $options['safe'] = true; - break; - default: - $option = explode('=', $arg, 2)[0]; - if (!preg_match('/^--[^-]/', $option) - || !array_key_exists(ltrim($option, '-'), $options_raw)) { - fail('Unknown option: ' . $arg); - } - } - } else { - $src = $arg; - } -} - -if (isset($src)) { - if (!file_exists($src)) { - fail('File not found: ' . $src); - } - - $markdown = file_get_contents($src); -} else { - $stdin = fopen('php://stdin', 'r'); - - if (stream_set_blocking($stdin, false)) { - $markdown = stream_get_contents($stdin); - } - - fclose($stdin); - - if (empty($markdown)) { - fail(getHelpText()); - } -} - -$converter = new \League\CommonMark\CommonMarkConverter($options); -echo $converter->convertToHtml($markdown); - -/** - * Get help and usage info - * - * @return string - */ -function getHelpText() -{ - if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { - return <<<WINDOWSHELP -CommonMark - Markdown done right - -Usage: commonmark [OPTIONS] [FILE] - - -h, --help Shows help and usage information - - -v, --version Shows the currently installed version - - (Reading data from STDIN is not currently supported on Windows) - -Examples: - - Converting a file named document.md: - - commonmark document.md - - Converting a file and saving its output: - - commonmark document.md > output.html - -Full documentation can be found at http://commonmark.thephpleague.com/ -WINDOWSHELP; - } - - return <<<HELP -CommonMark - Markdown done right - -Usage: commonmark [OPTIONS] [FILE] - - -h, --help Shows help and usage information - - -v, --version Shows the currently installed version - - --safe Escapes all raw HTML input and removes unsafe URLs - - If no file is given, input will be read from STDIN - -Examples: - - Converting a file named document.md: - - commonmark document.md - - Converting a file and saving its output: - - commonmark document.md > output.html - - Converting from STDIN: - - echo -e '# Hello World!' | commonmark - - Converting from STDIN and saving the output: - - echo -e '# Hello World!' | commonmark > output.html - -Full documentation can be found at http://commonmark.thephpleague.com/ - -HELP; -} - -/** - * @param string $message Error message - */ -function fail($message) -{ - fwrite(STDERR, $message . "\n"); - exit(1); -} - -function requireAutoloader() -{ - $autoloadPaths = [ - // Local package usage - __DIR__ . '/../vendor/autoload.php', - // Package was included as a library - __DIR__ . '/../../../autoload.php', - ]; - foreach ($autoloadPaths as $path) { - if (file_exists($path)) { - require_once $path; - break; - } - } -} diff --git a/vendor/league/commonmark/composer.json b/vendor/league/commonmark/composer.json deleted file mode 100644 index 04aa07b60f..0000000000 --- a/vendor/league/commonmark/composer.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "name": "league/commonmark", - "type": "library", - "description": "Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and Github-Flavored Markdown (GFM)", - "keywords": ["markdown","parser","commonmark","gfm","github","flavored","github-flavored","md"], - "homepage": "https://commonmark.thephpleague.com", - "license": "BSD-3-Clause", - "authors": [ - { - "name": "Colin O'Dell", - "email": "colinodell@gmail.com", - "homepage": "https://www.colinodell.com", - "role": "Lead Developer" - } - ], - "support": { - "docs": "https://commonmark.thephpleague.com/", - "issues": "https://github.com/thephpleague/commonmark/issues", - "rss": "https://github.com/thephpleague/commonmark/releases.atom", - "source": "https://github.com/thephpleague/commonmark" - }, - "require": { - "php": "^7.1 || ^8.0", - "ext-mbstring": "*" - }, - "require-dev": { - "ext-json": "*", - "cebe/markdown": "~1.0", - "commonmark/commonmark.js": "0.29.2", - "erusev/parsedown": "~1.0", - "github/gfm": "0.29.0", - "michelf/php-markdown": "~1.4", - "mikehaertl/php-shellcommand": "^1.4", - "phpstan/phpstan": "^0.12", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.2", - "scrutinizer/ocular": "^1.5", - "symfony/finder": "^4.2" - }, - "minimum-stability": "dev", - "prefer-stable": true, - "conflict": { - "scrutinizer/ocular": "1.7.*" - }, - "repositories": [ - { - "type": "package", - "package": { - "name": "commonmark/commonmark.js", - "version": "0.29.2", - "dist": { - "url": "https://github.com/commonmark/commonmark.js/archive/0.29.2.zip", - "type": "zip" - } - } - }, - { - "type": "package", - "package": { - "name": "github/gfm", - "version": "0.29.0", - "dist": { - "url": "https://github.com/github/cmark-gfm/archive/0.29.0.gfm.0.zip", - "type": "zip" - } - } - } - ], - "autoload": { - "psr-4": { - "League\\CommonMark\\": "src" - } - }, - "autoload-dev": { - "psr-4": { - "League\\CommonMark\\Tests\\Unit\\": "tests/unit", - "League\\CommonMark\\Tests\\Functional\\": "tests/functional" - } - }, - "bin": ["bin/commonmark"], - "scripts": { - "phpstan": "phpstan analyse", - "phpunit": "phpunit --no-coverage", - "test": [ - "@phpstan", - "@phpunit" - ] - }, - "config": { - "sort-packages": true - } -} diff --git a/vendor/league/commonmark/src/Block/Element/AbstractBlock.php b/vendor/league/commonmark/src/Block/Element/AbstractBlock.php deleted file mode 100644 index 1edd683f2a..0000000000 --- a/vendor/league/commonmark/src/Block/Element/AbstractBlock.php +++ /dev/null @@ -1,222 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Block\Element; - -use League\CommonMark\ContextInterface; -use League\CommonMark\Cursor; -use League\CommonMark\Node\Node; - -/** - * Block-level element - * - * @method parent() ?AbstractBlock - */ -abstract class AbstractBlock extends Node -{ - /** - * Used for storage of arbitrary data. - * - * @var array<string, mixed> - */ - public $data = []; - - /** - * @var bool - */ - protected $open = true; - - /** - * @var bool - */ - protected $lastLineBlank = false; - - /** - * @var int - */ - protected $startLine = 0; - - /** - * @var int - */ - protected $endLine = 0; - - protected function setParent(Node $node = null) - { - if ($node && !$node instanceof self) { - throw new \InvalidArgumentException('Parent of block must also be block (can not be inline)'); - } - - parent::setParent($node); - } - - public function isContainer(): bool - { - return true; - } - - /** - * @return bool - */ - public function hasChildren(): bool - { - return $this->firstChild !== null; - } - - /** - * Returns true if this block can contain the given block as a child node - * - * @param AbstractBlock $block - * - * @return bool - */ - abstract public function canContain(AbstractBlock $block): bool; - - /** - * Whether this is a code block - * - * Code blocks are extra-greedy - they'll try to consume all subsequent - * lines of content without calling matchesNextLine() each time. - * - * @return bool - */ - abstract public function isCode(): bool; - - /** - * @param Cursor $cursor - * - * @return bool - */ - abstract public function matchesNextLine(Cursor $cursor): bool; - - /** - * @param int $startLine - * - * @return $this - */ - public function setStartLine(int $startLine) - { - $this->startLine = $startLine; - if (empty($this->endLine)) { - $this->endLine = $startLine; - } - - return $this; - } - - /** - * @return int - */ - public function getStartLine(): int - { - return $this->startLine; - } - - /** - * @param int $endLine - * - * @return $this - */ - public function setEndLine(int $endLine) - { - $this->endLine = $endLine; - - return $this; - } - - /** - * @return int - */ - public function getEndLine(): int - { - return $this->endLine; - } - - /** - * Whether the block ends with a blank line - * - * @return bool - */ - public function endsWithBlankLine(): bool - { - return $this->lastLineBlank; - } - - /** - * @param bool $blank - * - * @return void - */ - public function setLastLineBlank(bool $blank) - { - $this->lastLineBlank = $blank; - } - - /** - * Determines whether the last line should be marked as blank - * - * @param Cursor $cursor - * @param int $currentLineNumber - * - * @return bool - */ - public function shouldLastLineBeBlank(Cursor $cursor, int $currentLineNumber): bool - { - return $cursor->isBlank(); - } - - /** - * Whether the block is open for modifications - * - * @return bool - */ - public function isOpen(): bool - { - return $this->open; - } - - /** - * Finalize the block; mark it closed for modification - * - * @param ContextInterface $context - * @param int $endLineNumber - * - * @return void - */ - public function finalize(ContextInterface $context, int $endLineNumber) - { - if (!$this->open) { - return; - } - - $this->open = false; - $this->endLine = $endLineNumber; - - // This should almost always be true - if ($context->getTip() !== null) { - $context->setTip($context->getTip()->parent()); - } - } - - /** - * @param string $key - * @param mixed $default - * - * @return mixed - */ - public function getData(string $key, $default = null) - { - return \array_key_exists($key, $this->data) ? $this->data[$key] : $default; - } -} diff --git a/vendor/league/commonmark/src/Block/Element/AbstractStringContainerBlock.php b/vendor/league/commonmark/src/Block/Element/AbstractStringContainerBlock.php deleted file mode 100644 index 55466ad24d..0000000000 --- a/vendor/league/commonmark/src/Block/Element/AbstractStringContainerBlock.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Block\Element; - -use League\CommonMark\ContextInterface; -use League\CommonMark\Cursor; -use League\CommonMark\Util\ArrayCollection; - -/** - * @method children() AbstractInline[] - */ -abstract class AbstractStringContainerBlock extends AbstractBlock implements StringContainerInterface -{ - /** - * @var ArrayCollection<int, string> - */ - protected $strings; - - /** - * @var string - */ - protected $finalStringContents = ''; - - /** - * Constructor - */ - public function __construct() - { - $this->strings = new ArrayCollection(); - } - - public function addLine(string $line) - { - $this->strings[] = $line; - } - - abstract public function handleRemainingContents(ContextInterface $context, Cursor $cursor); - - public function getStringContent(): string - { - return $this->finalStringContents; - } -} diff --git a/vendor/league/commonmark/src/Block/Element/BlockQuote.php b/vendor/league/commonmark/src/Block/Element/BlockQuote.php deleted file mode 100644 index 7cbe6e175e..0000000000 --- a/vendor/league/commonmark/src/Block/Element/BlockQuote.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Block\Element; - -use League\CommonMark\Cursor; - -/** - * @method children() AbstractBlock[] - */ -class BlockQuote extends AbstractBlock -{ - public function canContain(AbstractBlock $block): bool - { - return true; - } - - public function isCode(): bool - { - return false; - } - - public function matchesNextLine(Cursor $cursor): bool - { - if (!$cursor->isIndented() && $cursor->getNextNonSpaceCharacter() === '>') { - $cursor->advanceToNextNonSpaceOrTab(); - $cursor->advanceBy(1); - $cursor->advanceBySpaceOrTab(); - - return true; - } - - return false; - } - - public function shouldLastLineBeBlank(Cursor $cursor, int $currentLineNumber): bool - { - return false; - } -} diff --git a/vendor/league/commonmark/src/Block/Element/Document.php b/vendor/league/commonmark/src/Block/Element/Document.php deleted file mode 100644 index 69f21042c9..0000000000 --- a/vendor/league/commonmark/src/Block/Element/Document.php +++ /dev/null @@ -1,58 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Block\Element; - -use League\CommonMark\Cursor; -use League\CommonMark\Reference\ReferenceMap; -use League\CommonMark\Reference\ReferenceMapInterface; - -/** - * @method children() AbstractBlock[] - */ -class Document extends AbstractBlock -{ - /** @var ReferenceMapInterface */ - protected $referenceMap; - - public function __construct(?ReferenceMapInterface $referenceMap = null) - { - $this->setStartLine(1); - - $this->referenceMap = $referenceMap ?? new ReferenceMap(); - } - - /** - * @return ReferenceMapInterface - */ - public function getReferenceMap(): ReferenceMapInterface - { - return $this->referenceMap; - } - - public function canContain(AbstractBlock $block): bool - { - return true; - } - - public function isCode(): bool - { - return false; - } - - public function matchesNextLine(Cursor $cursor): bool - { - return true; - } -} diff --git a/vendor/league/commonmark/src/Block/Element/FencedCode.php b/vendor/league/commonmark/src/Block/Element/FencedCode.php deleted file mode 100644 index 6f87519cf4..0000000000 --- a/vendor/league/commonmark/src/Block/Element/FencedCode.php +++ /dev/null @@ -1,201 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Block\Element; - -use League\CommonMark\ContextInterface; -use League\CommonMark\Cursor; -use League\CommonMark\Util\RegexHelper; - -class FencedCode extends AbstractStringContainerBlock -{ - /** - * @var string - */ - protected $info; - - /** - * @var int - */ - protected $length; - - /** - * @var string - */ - protected $char; - - /** - * @var int - */ - protected $offset; - - /** - * @param int $length - * @param string $char - * @param int $offset - */ - public function __construct(int $length, string $char, int $offset) - { - parent::__construct(); - - $this->length = $length; - $this->char = $char; - $this->offset = $offset; - } - - /** - * @return string - */ - public function getInfo(): string - { - return $this->info; - } - - /** - * @return string[] - */ - public function getInfoWords(): array - { - return \preg_split('/\s+/', $this->info) ?: []; - } - - /** - * @return string - */ - public function getChar(): string - { - return $this->char; - } - - /** - * @param string $char - * - * @return $this - */ - public function setChar(string $char): self - { - $this->char = $char; - - return $this; - } - - /** - * @return int - */ - public function getLength(): int - { - return $this->length; - } - - /** - * @param int $length - * - * @return $this - */ - public function setLength(int $length): self - { - $this->length = $length; - - return $this; - } - - /** - * @return int - */ - public function getOffset(): int - { - return $this->offset; - } - - /** - * @param int $offset - * - * @return $this - */ - public function setOffset(int $offset): self - { - $this->offset = $offset; - - return $this; - } - - public function canContain(AbstractBlock $block): bool - { - return false; - } - - public function isCode(): bool - { - return true; - } - - public function matchesNextLine(Cursor $cursor): bool - { - if ($this->length === -1) { - if ($cursor->isBlank()) { - $this->lastLineBlank = true; - } - - return false; - } - - // Skip optional spaces of fence offset - $cursor->match('/^ {0,' . $this->offset . '}/'); - - return true; - } - - public function finalize(ContextInterface $context, int $endLineNumber) - { - parent::finalize($context, $endLineNumber); - - // first line becomes info string - $firstLine = $this->strings->first(); - if ($firstLine === false) { - $firstLine = ''; - } - - $this->info = RegexHelper::unescape(\trim($firstLine)); - - if ($this->strings->count() === 1) { - $this->finalStringContents = ''; - } else { - $this->finalStringContents = \implode("\n", $this->strings->slice(1)) . "\n"; - } - } - - public function handleRemainingContents(ContextInterface $context, Cursor $cursor) - { - /** @var self $container */ - $container = $context->getContainer(); - - // check for closing code fence - if ($cursor->getIndent() <= 3 && $cursor->getNextNonSpaceCharacter() === $container->getChar()) { - $match = RegexHelper::matchAll('/^(?:`{3,}|~{3,})(?= *$)/', $cursor->getLine(), $cursor->getNextNonSpacePosition()); - if ($match !== null && \strlen($match[0]) >= $container->getLength()) { - // don't add closing fence to container; instead, close it: - $this->setLength(-1); // -1 means we've passed closer - - return; - } - } - - $container->addLine($cursor->getRemainder()); - } - - public function shouldLastLineBeBlank(Cursor $cursor, int $currentLineNumber): bool - { - return false; - } -} diff --git a/vendor/league/commonmark/src/Block/Element/Heading.php b/vendor/league/commonmark/src/Block/Element/Heading.php deleted file mode 100644 index 5b4e470f6b..0000000000 --- a/vendor/league/commonmark/src/Block/Element/Heading.php +++ /dev/null @@ -1,80 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Block\Element; - -use League\CommonMark\ContextInterface; -use League\CommonMark\Cursor; - -class Heading extends AbstractStringContainerBlock implements InlineContainerInterface -{ - /** - * @var int - */ - protected $level; - - /** - * @param int $level - * @param string|string[] $contents - */ - public function __construct(int $level, $contents) - { - parent::__construct(); - - $this->level = $level; - - if (!\is_array($contents)) { - $contents = [$contents]; - } - - foreach ($contents as $line) { - $this->addLine($line); - } - } - - /** - * @return int - */ - public function getLevel(): int - { - return $this->level; - } - - public function finalize(ContextInterface $context, int $endLineNumber) - { - parent::finalize($context, $endLineNumber); - - $this->finalStringContents = \implode("\n", $this->strings->toArray()); - } - - public function canContain(AbstractBlock $block): bool - { - return false; - } - - public function isCode(): bool - { - return false; - } - - public function matchesNextLine(Cursor $cursor): bool - { - return false; - } - - public function handleRemainingContents(ContextInterface $context, Cursor $cursor) - { - // nothing to do; contents were already added via the constructor. - } -} diff --git a/vendor/league/commonmark/src/Block/Element/HtmlBlock.php b/vendor/league/commonmark/src/Block/Element/HtmlBlock.php deleted file mode 100644 index e869ed5b60..0000000000 --- a/vendor/league/commonmark/src/Block/Element/HtmlBlock.php +++ /dev/null @@ -1,104 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Block\Element; - -use League\CommonMark\ContextInterface; -use League\CommonMark\Cursor; -use League\CommonMark\Util\RegexHelper; - -class HtmlBlock extends AbstractStringContainerBlock -{ - // Any changes to these constants should be reflected in .phpstorm.meta.php - const TYPE_1_CODE_CONTAINER = 1; - const TYPE_2_COMMENT = 2; - const TYPE_3 = 3; - const TYPE_4 = 4; - const TYPE_5_CDATA = 5; - const TYPE_6_BLOCK_ELEMENT = 6; - const TYPE_7_MISC_ELEMENT = 7; - - /** - * @var int - */ - protected $type; - - /** - * @param int $type - */ - public function __construct(int $type) - { - parent::__construct(); - - $this->type = $type; - } - - /** - * @return int - */ - public function getType(): int - { - return $this->type; - } - - /** - * @param int $type - * - * @return void - */ - public function setType(int $type) - { - $this->type = $type; - } - - public function canContain(AbstractBlock $block): bool - { - return false; - } - - public function isCode(): bool - { - return true; - } - - public function matchesNextLine(Cursor $cursor): bool - { - if ($cursor->isBlank() && ($this->type === self::TYPE_6_BLOCK_ELEMENT || $this->type === self::TYPE_7_MISC_ELEMENT)) { - return false; - } - - return true; - } - - public function finalize(ContextInterface $context, int $endLineNumber) - { - parent::finalize($context, $endLineNumber); - - $this->finalStringContents = \implode("\n", $this->strings->toArray()); - } - - public function handleRemainingContents(ContextInterface $context, Cursor $cursor) - { - /** @var self $tip */ - $tip = $context->getTip(); - $tip->addLine($cursor->getRemainder()); - - // Check for end condition - if ($this->type >= self::TYPE_1_CODE_CONTAINER && $this->type <= self::TYPE_5_CDATA) { - if ($cursor->match(RegexHelper::getHtmlBlockCloseRegex($this->type)) !== null) { - $this->finalize($context, $context->getLineNumber()); - } - } - } -} diff --git a/vendor/league/commonmark/src/Block/Element/IndentedCode.php b/vendor/league/commonmark/src/Block/Element/IndentedCode.php deleted file mode 100644 index 9dc90840ce..0000000000 --- a/vendor/league/commonmark/src/Block/Element/IndentedCode.php +++ /dev/null @@ -1,72 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Block\Element; - -use League\CommonMark\ContextInterface; -use League\CommonMark\Cursor; - -class IndentedCode extends AbstractStringContainerBlock -{ - public function canContain(AbstractBlock $block): bool - { - return false; - } - - public function isCode(): bool - { - return true; - } - - public function matchesNextLine(Cursor $cursor): bool - { - if ($cursor->isIndented()) { - $cursor->advanceBy(Cursor::INDENT_LEVEL, true); - } elseif ($cursor->isBlank()) { - $cursor->advanceToNextNonSpaceOrTab(); - } else { - return false; - } - - return true; - } - - public function finalize(ContextInterface $context, int $endLineNumber) - { - parent::finalize($context, $endLineNumber); - - $reversed = \array_reverse($this->strings->toArray(), true); - foreach ($reversed as $index => $line) { - if ($line === '' || $line === "\n" || \preg_match('/^(\n *)$/', $line)) { - unset($reversed[$index]); - } else { - break; - } - } - $fixed = \array_reverse($reversed); - $tmp = \implode("\n", $fixed); - if (\substr($tmp, -1) !== "\n") { - $tmp .= "\n"; - } - - $this->finalStringContents = $tmp; - } - - public function handleRemainingContents(ContextInterface $context, Cursor $cursor) - { - /** @var self $tip */ - $tip = $context->getTip(); - $tip->addLine($cursor->getRemainder()); - } -} diff --git a/vendor/league/commonmark/src/Block/Element/InlineContainerInterface.php b/vendor/league/commonmark/src/Block/Element/InlineContainerInterface.php deleted file mode 100644 index d2d114a5b9..0000000000 --- a/vendor/league/commonmark/src/Block/Element/InlineContainerInterface.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Block\Element; - -interface InlineContainerInterface extends StringContainerInterface -{ - public function getStringContent(): string; -} diff --git a/vendor/league/commonmark/src/Block/Element/ListBlock.php b/vendor/league/commonmark/src/Block/Element/ListBlock.php deleted file mode 100644 index abd5d054f5..0000000000 --- a/vendor/league/commonmark/src/Block/Element/ListBlock.php +++ /dev/null @@ -1,123 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Block\Element; - -use League\CommonMark\ContextInterface; -use League\CommonMark\Cursor; - -/** - * @method children() AbstractBlock[] - */ -class ListBlock extends AbstractBlock -{ - const TYPE_BULLET = 'bullet'; - const TYPE_ORDERED = 'ordered'; - - /** - * @deprecated This constant is deprecated in league/commonmark 1.4 and will be removed in 2.0; use TYPE_BULLET instead - */ - const TYPE_UNORDERED = self::TYPE_BULLET; - - /** - * @var bool - */ - protected $tight = false; - - /** - * @var ListData - */ - protected $listData; - - public function __construct(ListData $listData) - { - $this->listData = $listData; - } - - /** - * @return ListData - */ - public function getListData(): ListData - { - return $this->listData; - } - - public function endsWithBlankLine(): bool - { - if ($this->lastLineBlank) { - return true; - } - - if ($this->hasChildren()) { - return $this->lastChild() instanceof AbstractBlock && $this->lastChild()->endsWithBlankLine(); - } - - return false; - } - - public function canContain(AbstractBlock $block): bool - { - return $block instanceof ListItem; - } - - public function isCode(): bool - { - return false; - } - - public function matchesNextLine(Cursor $cursor): bool - { - return true; - } - - public function finalize(ContextInterface $context, int $endLineNumber) - { - parent::finalize($context, $endLineNumber); - - $this->tight = true; // tight by default - - foreach ($this->children() as $item) { - if (!($item instanceof AbstractBlock)) { - continue; - } - - // check for non-final list item ending with blank line: - if ($item->endsWithBlankLine() && $item !== $this->lastChild()) { - $this->tight = false; - break; - } - - // Recurse into children of list item, to see if there are - // spaces between any of them: - foreach ($item->children() as $subItem) { - if ($subItem instanceof AbstractBlock && $subItem->endsWithBlankLine() && ($item !== $this->lastChild() || $subItem !== $item->lastChild())) { - $this->tight = false; - break; - } - } - } - } - - public function isTight(): bool - { - return $this->tight; - } - - public function setTight(bool $tight): self - { - $this->tight = $tight; - - return $this; - } -} diff --git a/vendor/league/commonmark/src/Block/Element/ListData.php b/vendor/league/commonmark/src/Block/Element/ListData.php deleted file mode 100644 index 8f86889f39..0000000000 --- a/vendor/league/commonmark/src/Block/Element/ListData.php +++ /dev/null @@ -1,60 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Block\Element; - -class ListData -{ - /** - * @var int|null - */ - public $start; - - /** - * @var int - */ - public $padding = 0; - - /** - * @var string - */ - public $type; - - /** - * @var string|null - */ - public $delimiter; - - /** - * @var string|null - */ - public $bulletChar; - - /** - * @var int - */ - public $markerOffset; - - /** - * @param ListData $data - * - * @return bool - */ - public function equals(ListData $data) - { - return $this->type === $data->type && - $this->delimiter === $data->delimiter && - $this->bulletChar === $data->bulletChar; - } -} diff --git a/vendor/league/commonmark/src/Block/Element/ListItem.php b/vendor/league/commonmark/src/Block/Element/ListItem.php deleted file mode 100644 index 5675b3510f..0000000000 --- a/vendor/league/commonmark/src/Block/Element/ListItem.php +++ /dev/null @@ -1,73 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Block\Element; - -use League\CommonMark\Cursor; - -/** - * @method children() AbstractBlock[] - */ -class ListItem extends AbstractBlock -{ - /** - * @var ListData - */ - protected $listData; - - public function __construct(ListData $listData) - { - $this->listData = $listData; - } - - /** - * @return ListData - */ - public function getListData(): ListData - { - return $this->listData; - } - - public function canContain(AbstractBlock $block): bool - { - return true; - } - - public function isCode(): bool - { - return false; - } - - public function matchesNextLine(Cursor $cursor): bool - { - if ($cursor->isBlank()) { - if ($this->firstChild === null) { - return false; - } - - $cursor->advanceToNextNonSpaceOrTab(); - } elseif ($cursor->getIndent() >= $this->listData->markerOffset + $this->listData->padding) { - $cursor->advanceBy($this->listData->markerOffset + $this->listData->padding, true); - } else { - return false; - } - - return true; - } - - public function shouldLastLineBeBlank(Cursor $cursor, int $currentLineNumber): bool - { - return $cursor->isBlank() && $this->startLine < $currentLineNumber; - } -} diff --git a/vendor/league/commonmark/src/Block/Element/Paragraph.php b/vendor/league/commonmark/src/Block/Element/Paragraph.php deleted file mode 100644 index 85c9411818..0000000000 --- a/vendor/league/commonmark/src/Block/Element/Paragraph.php +++ /dev/null @@ -1,98 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Block\Element; - -use League\CommonMark\ContextInterface; -use League\CommonMark\Cursor; - -class Paragraph extends AbstractStringContainerBlock implements InlineContainerInterface -{ - public function canContain(AbstractBlock $block): bool - { - return false; - } - - public function isCode(): bool - { - return false; - } - - public function matchesNextLine(Cursor $cursor): bool - { - if ($cursor->isBlank()) { - $this->lastLineBlank = true; - - return false; - } - - return true; - } - - public function finalize(ContextInterface $context, int $endLineNumber) - { - parent::finalize($context, $endLineNumber); - - $this->finalStringContents = \preg_replace('/^ */m', '', \implode("\n", $this->getStrings())); - - // Short-circuit - if ($this->finalStringContents === '' || $this->finalStringContents[0] !== '[') { - return; - } - - $cursor = new Cursor($this->finalStringContents); - - $referenceFound = $this->parseReferences($context, $cursor); - - $this->finalStringContents = $cursor->getRemainder(); - - if ($referenceFound && $cursor->isAtEnd()) { - $this->detach(); - } - } - - /** - * @param ContextInterface $context - * @param Cursor $cursor - * - * @return bool - */ - protected function parseReferences(ContextInterface $context, Cursor $cursor) - { - $referenceFound = false; - while ($cursor->getCharacter() === '[' && $context->getReferenceParser()->parse($cursor)) { - $this->finalStringContents = $cursor->getRemainder(); - $referenceFound = true; - } - - return $referenceFound; - } - - public function handleRemainingContents(ContextInterface $context, Cursor $cursor) - { - $cursor->advanceToNextNonSpaceOrTab(); - - /** @var self $tip */ - $tip = $context->getTip(); - $tip->addLine($cursor->getRemainder()); - } - - /** - * @return string[] - */ - public function getStrings(): array - { - return $this->strings->toArray(); - } -} diff --git a/vendor/league/commonmark/src/Block/Element/StringContainerInterface.php b/vendor/league/commonmark/src/Block/Element/StringContainerInterface.php deleted file mode 100644 index 834145e7a8..0000000000 --- a/vendor/league/commonmark/src/Block/Element/StringContainerInterface.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Block\Element; - -use League\CommonMark\ContextInterface; -use League\CommonMark\Cursor; - -/** - * Interface for a block which can contain line(s) of strings - */ -interface StringContainerInterface -{ - /** - * @param string $line - * - * @return void - */ - public function addLine(string $line); - - /** - * @return string - */ - public function getStringContent(): string; - - /** - * @param ContextInterface $context - * @param Cursor $cursor - * - * @return void - */ - public function handleRemainingContents(ContextInterface $context, Cursor $cursor); -} diff --git a/vendor/league/commonmark/src/Block/Element/ThematicBreak.php b/vendor/league/commonmark/src/Block/Element/ThematicBreak.php deleted file mode 100644 index 48e2fd66d0..0000000000 --- a/vendor/league/commonmark/src/Block/Element/ThematicBreak.php +++ /dev/null @@ -1,35 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Block\Element; - -use League\CommonMark\Cursor; - -class ThematicBreak extends AbstractBlock -{ - public function canContain(AbstractBlock $block): bool - { - return false; - } - - public function isCode(): bool - { - return false; - } - - public function matchesNextLine(Cursor $cursor): bool - { - return false; - } -} diff --git a/vendor/league/commonmark/src/Block/Parser/ATXHeadingParser.php b/vendor/league/commonmark/src/Block/Parser/ATXHeadingParser.php deleted file mode 100644 index 8f03969deb..0000000000 --- a/vendor/league/commonmark/src/Block/Parser/ATXHeadingParser.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Block\Parser; - -use League\CommonMark\Block\Element\Heading; -use League\CommonMark\ContextInterface; -use League\CommonMark\Cursor; -use League\CommonMark\Util\RegexHelper; - -final class ATXHeadingParser implements BlockParserInterface -{ - public function parse(ContextInterface $context, Cursor $cursor): bool - { - if ($cursor->isIndented()) { - return false; - } - - $match = RegexHelper::matchAll('/^#{1,6}(?:[ \t]+|$)/', $cursor->getLine(), $cursor->getNextNonSpacePosition()); - if (!$match) { - return false; - } - - $cursor->advanceToNextNonSpaceOrTab(); - - $cursor->advanceBy(\strlen($match[0])); - - $level = \strlen(\trim($match[0])); - $str = $cursor->getRemainder(); - /** @var string $str */ - $str = \preg_replace('/^[ \t]*#+[ \t]*$/', '', $str); - /** @var string $str */ - $str = \preg_replace('/[ \t]+#+[ \t]*$/', '', $str); - - $context->addBlock(new Heading($level, $str)); - $context->setBlocksParsed(true); - - return true; - } -} diff --git a/vendor/league/commonmark/src/Block/Parser/BlockParserInterface.php b/vendor/league/commonmark/src/Block/Parser/BlockParserInterface.php deleted file mode 100644 index 6e5753a83c..0000000000 --- a/vendor/league/commonmark/src/Block/Parser/BlockParserInterface.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Block\Parser; - -use League\CommonMark\ContextInterface; -use League\CommonMark\Cursor; - -interface BlockParserInterface -{ - /** - * @param ContextInterface $context - * @param Cursor $cursor - * - * @return bool - */ - public function parse(ContextInterface $context, Cursor $cursor): bool; -} diff --git a/vendor/league/commonmark/src/Block/Parser/BlockQuoteParser.php b/vendor/league/commonmark/src/Block/Parser/BlockQuoteParser.php deleted file mode 100644 index db18b1abfe..0000000000 --- a/vendor/league/commonmark/src/Block/Parser/BlockQuoteParser.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Block\Parser; - -use League\CommonMark\Block\Element\BlockQuote; -use League\CommonMark\ContextInterface; -use League\CommonMark\Cursor; - -final class BlockQuoteParser implements BlockParserInterface -{ - public function parse(ContextInterface $context, Cursor $cursor): bool - { - if ($cursor->isIndented()) { - return false; - } - - if ($cursor->getNextNonSpaceCharacter() !== '>') { - return false; - } - - $cursor->advanceToNextNonSpaceOrTab(); - $cursor->advanceBy(1); - $cursor->advanceBySpaceOrTab(); - - $context->addBlock(new BlockQuote()); - - return true; - } -} diff --git a/vendor/league/commonmark/src/Block/Parser/FencedCodeParser.php b/vendor/league/commonmark/src/Block/Parser/FencedCodeParser.php deleted file mode 100644 index b243ac942b..0000000000 --- a/vendor/league/commonmark/src/Block/Parser/FencedCodeParser.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Block\Parser; - -use League\CommonMark\Block\Element\FencedCode; -use League\CommonMark\ContextInterface; -use League\CommonMark\Cursor; - -final class FencedCodeParser implements BlockParserInterface -{ - public function parse(ContextInterface $context, Cursor $cursor): bool - { - if ($cursor->isIndented()) { - return false; - } - - $c = $cursor->getCharacter(); - if ($c !== ' ' && $c !== "\t" && $c !== '`' && $c !== '~') { - return false; - } - - $indent = $cursor->getIndent(); - $fence = $cursor->match('/^[ \t]*(?:`{3,}(?!.*`)|^~{3,})/'); - if ($fence === null) { - return false; - } - - // fenced code block - $fence = \ltrim($fence, " \t"); - $fenceLength = \strlen($fence); - $context->addBlock(new FencedCode($fenceLength, $fence[0], $indent)); - - return true; - } -} diff --git a/vendor/league/commonmark/src/Block/Parser/HtmlBlockParser.php b/vendor/league/commonmark/src/Block/Parser/HtmlBlockParser.php deleted file mode 100644 index 1eaca70660..0000000000 --- a/vendor/league/commonmark/src/Block/Parser/HtmlBlockParser.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Block\Parser; - -use League\CommonMark\Block\Element\HtmlBlock; -use League\CommonMark\Block\Element\Paragraph; -use League\CommonMark\ContextInterface; -use League\CommonMark\Cursor; -use League\CommonMark\Util\RegexHelper; - -final class HtmlBlockParser implements BlockParserInterface -{ - public function parse(ContextInterface $context, Cursor $cursor): bool - { - if ($cursor->isIndented()) { - return false; - } - - if ($cursor->getNextNonSpaceCharacter() !== '<') { - return false; - } - - $savedState = $cursor->saveState(); - - $cursor->advanceToNextNonSpaceOrTab(); - $line = $cursor->getRemainder(); - - for ($blockType = 1; $blockType <= 7; $blockType++) { - $match = RegexHelper::matchAt( - RegexHelper::getHtmlBlockOpenRegex($blockType), - $line - ); - - if ($match !== null && ($blockType < 7 || !($context->getContainer() instanceof Paragraph))) { - $cursor->restoreState($savedState); - $context->addBlock(new HtmlBlock($blockType)); - $context->setBlocksParsed(true); - - return true; - } - } - - $cursor->restoreState($savedState); - - return false; - } -} diff --git a/vendor/league/commonmark/src/Block/Parser/IndentedCodeParser.php b/vendor/league/commonmark/src/Block/Parser/IndentedCodeParser.php deleted file mode 100644 index 6846f67493..0000000000 --- a/vendor/league/commonmark/src/Block/Parser/IndentedCodeParser.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Block\Parser; - -use League\CommonMark\Block\Element\IndentedCode; -use League\CommonMark\Block\Element\Paragraph; -use League\CommonMark\ContextInterface; -use League\CommonMark\Cursor; - -final class IndentedCodeParser implements BlockParserInterface -{ - public function parse(ContextInterface $context, Cursor $cursor): bool - { - if (!$cursor->isIndented()) { - return false; - } - - if ($context->getTip() instanceof Paragraph) { - return false; - } - - if ($cursor->isBlank()) { - return false; - } - - $cursor->advanceBy(Cursor::INDENT_LEVEL, true); - $context->addBlock(new IndentedCode()); - - return true; - } -} diff --git a/vendor/league/commonmark/src/Block/Parser/LazyParagraphParser.php b/vendor/league/commonmark/src/Block/Parser/LazyParagraphParser.php deleted file mode 100644 index 754af7c659..0000000000 --- a/vendor/league/commonmark/src/Block/Parser/LazyParagraphParser.php +++ /dev/null @@ -1,32 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Block\Parser; - -use League\CommonMark\ContextInterface; -use League\CommonMark\Cursor; - -final class LazyParagraphParser implements BlockParserInterface -{ - public function parse(ContextInterface $context, Cursor $cursor): bool - { - if (!$cursor->isIndented()) { - return false; - } - - $context->setBlocksParsed(true); - - return true; - } -} diff --git a/vendor/league/commonmark/src/Block/Parser/ListParser.php b/vendor/league/commonmark/src/Block/Parser/ListParser.php deleted file mode 100644 index b4cd133b17..0000000000 --- a/vendor/league/commonmark/src/Block/Parser/ListParser.php +++ /dev/null @@ -1,147 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Block\Parser; - -use League\CommonMark\Block\Element\ListBlock; -use League\CommonMark\Block\Element\ListData; -use League\CommonMark\Block\Element\ListItem; -use League\CommonMark\Block\Element\Paragraph; -use League\CommonMark\ContextInterface; -use League\CommonMark\Cursor; -use League\CommonMark\Util\ConfigurationAwareInterface; -use League\CommonMark\Util\ConfigurationInterface; -use League\CommonMark\Util\RegexHelper; - -final class ListParser implements BlockParserInterface, ConfigurationAwareInterface -{ - /** @var ConfigurationInterface|null */ - private $config; - - /** @var string|null */ - private $listMarkerRegex; - - public function setConfiguration(ConfigurationInterface $configuration) - { - $this->config = $configuration; - } - - public function parse(ContextInterface $context, Cursor $cursor): bool - { - if ($cursor->isIndented() && !($context->getContainer() instanceof ListBlock)) { - return false; - } - - $indent = $cursor->getIndent(); - if ($indent >= 4) { - return false; - } - - $tmpCursor = clone $cursor; - $tmpCursor->advanceToNextNonSpaceOrTab(); - $rest = $tmpCursor->getRemainder(); - - if (\preg_match($this->listMarkerRegex ?? $this->generateListMarkerRegex(), $rest) === 1) { - $data = new ListData(); - $data->markerOffset = $indent; - $data->type = ListBlock::TYPE_BULLET; - $data->delimiter = null; - $data->bulletChar = $rest[0]; - $markerLength = 1; - } elseif (($matches = RegexHelper::matchAll('/^(\d{1,9})([.)])/', $rest)) && (!($context->getContainer() instanceof Paragraph) || $matches[1] === '1')) { - $data = new ListData(); - $data->markerOffset = $indent; - $data->type = ListBlock::TYPE_ORDERED; - $data->start = (int) $matches[1]; - $data->delimiter = $matches[2]; - $data->bulletChar = null; - $markerLength = \strlen($matches[0]); - } else { - return false; - } - - // Make sure we have spaces after - $nextChar = $tmpCursor->peek($markerLength); - if (!($nextChar === null || $nextChar === "\t" || $nextChar === ' ')) { - return false; - } - - // If it interrupts paragraph, make sure first line isn't blank - $container = $context->getContainer(); - if ($container instanceof Paragraph && !RegexHelper::matchAt(RegexHelper::REGEX_NON_SPACE, $rest, $markerLength)) { - return false; - } - - // We've got a match! Advance offset and calculate padding - $cursor->advanceToNextNonSpaceOrTab(); // to start of marker - $cursor->advanceBy($markerLength, true); // to end of marker - $data->padding = $this->calculateListMarkerPadding($cursor, $markerLength); - - // add the list if needed - if (!($container instanceof ListBlock) || !$data->equals($container->getListData())) { - $context->addBlock(new ListBlock($data)); - } - - // add the list item - $context->addBlock(new ListItem($data)); - - return true; - } - - /** - * @param Cursor $cursor - * @param int $markerLength - * - * @return int - */ - private function calculateListMarkerPadding(Cursor $cursor, int $markerLength): int - { - $start = $cursor->saveState(); - $spacesStartCol = $cursor->getColumn(); - - while ($cursor->getColumn() - $spacesStartCol < 5) { - if (!$cursor->advanceBySpaceOrTab()) { - break; - } - } - - $blankItem = $cursor->peek() === null; - $spacesAfterMarker = $cursor->getColumn() - $spacesStartCol; - - if ($spacesAfterMarker >= 5 || $spacesAfterMarker < 1 || $blankItem) { - $cursor->restoreState($start); - $cursor->advanceBySpaceOrTab(); - - return $markerLength + 1; - } - - return $markerLength + $spacesAfterMarker; - } - - private function generateListMarkerRegex(): string - { - // No configuration given - use the defaults - if ($this->config === null) { - return $this->listMarkerRegex = '/^[*+-]/'; - } - - $markers = $this->config->get('unordered_list_markers', ['*', '+', '-']); - - if (!\is_array($markers)) { - throw new \RuntimeException('Invalid configuration option "unordered_list_markers": value must be an array of strings'); - } - - return $this->listMarkerRegex = '/^[' . \preg_quote(\implode('', $markers), '/') . ']/'; - } -} diff --git a/vendor/league/commonmark/src/Block/Parser/SetExtHeadingParser.php b/vendor/league/commonmark/src/Block/Parser/SetExtHeadingParser.php deleted file mode 100644 index dc1bb630dd..0000000000 --- a/vendor/league/commonmark/src/Block/Parser/SetExtHeadingParser.php +++ /dev/null @@ -1,81 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Block\Parser; - -use League\CommonMark\Block\Element\Heading; -use League\CommonMark\Block\Element\Paragraph; -use League\CommonMark\ContextInterface; -use League\CommonMark\Cursor; -use League\CommonMark\Reference\ReferenceParser; -use League\CommonMark\Util\RegexHelper; - -final class SetExtHeadingParser implements BlockParserInterface -{ - public function parse(ContextInterface $context, Cursor $cursor): bool - { - if ($cursor->isIndented()) { - return false; - } - - if (!($context->getContainer() instanceof Paragraph)) { - return false; - } - - $match = RegexHelper::matchAll('/^(?:=+|-+)[ \t]*$/', $cursor->getLine(), $cursor->getNextNonSpacePosition()); - if ($match === null) { - return false; - } - - $level = $match[0][0] === '=' ? 1 : 2; - $strings = $context->getContainer()->getStrings(); - - $strings = $this->resolveReferenceLinkDefinitions($strings, $context->getReferenceParser()); - if (empty($strings)) { - return false; - } - - $context->replaceContainerBlock(new Heading($level, $strings)); - - return true; - } - - /** - * Resolve reference link definition - * - * @see https://github.com/commonmark/commonmark.js/commit/993bbe335931af847460effa99b2411eb643577d - * - * @param string[] $strings - * @param ReferenceParser $referenceParser - * - * @return string[] - */ - private function resolveReferenceLinkDefinitions(array $strings, ReferenceParser $referenceParser): array - { - foreach ($strings as &$string) { - $cursor = new Cursor($string); - while ($cursor->getCharacter() === '[' && $referenceParser->parse($cursor)) { - $string = $cursor->getRemainder(); - } - - if ($string !== '') { - break; - } - } - - return \array_filter($strings, function ($s) { - return $s !== ''; - }); - } -} diff --git a/vendor/league/commonmark/src/Block/Parser/ThematicBreakParser.php b/vendor/league/commonmark/src/Block/Parser/ThematicBreakParser.php deleted file mode 100644 index ef1dc21cc5..0000000000 --- a/vendor/league/commonmark/src/Block/Parser/ThematicBreakParser.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Block\Parser; - -use League\CommonMark\Block\Element\ThematicBreak; -use League\CommonMark\ContextInterface; -use League\CommonMark\Cursor; -use League\CommonMark\Util\RegexHelper; - -final class ThematicBreakParser implements BlockParserInterface -{ - public function parse(ContextInterface $context, Cursor $cursor): bool - { - if ($cursor->isIndented()) { - return false; - } - - $match = RegexHelper::matchAt(RegexHelper::REGEX_THEMATIC_BREAK, $cursor->getLine(), $cursor->getNextNonSpacePosition()); - if ($match === null) { - return false; - } - - // Advance to the end of the string, consuming the entire line (of the thematic break) - $cursor->advanceToEnd(); - - $context->addBlock(new ThematicBreak()); - $context->setBlocksParsed(true); - - return true; - } -} diff --git a/vendor/league/commonmark/src/Block/Renderer/BlockQuoteRenderer.php b/vendor/league/commonmark/src/Block/Renderer/BlockQuoteRenderer.php deleted file mode 100644 index 3fcb1c7202..0000000000 --- a/vendor/league/commonmark/src/Block/Renderer/BlockQuoteRenderer.php +++ /dev/null @@ -1,50 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Block\Renderer; - -use League\CommonMark\Block\Element\AbstractBlock; -use League\CommonMark\Block\Element\BlockQuote; -use League\CommonMark\ElementRendererInterface; -use League\CommonMark\HtmlElement; - -final class BlockQuoteRenderer implements BlockRendererInterface -{ - /** - * @param BlockQuote $block - * @param ElementRendererInterface $htmlRenderer - * @param bool $inTightList - * - * @return HtmlElement - */ - public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, bool $inTightList = false) - { - if (!($block instanceof BlockQuote)) { - throw new \InvalidArgumentException('Incompatible block type: ' . \get_class($block)); - } - - $attrs = $block->getData('attributes', []); - - $filling = $htmlRenderer->renderBlocks($block->children()); - if ($filling === '') { - return new HtmlElement('blockquote', $attrs, $htmlRenderer->getOption('inner_separator', "\n")); - } - - return new HtmlElement( - 'blockquote', - $attrs, - $htmlRenderer->getOption('inner_separator', "\n") . $filling . $htmlRenderer->getOption('inner_separator', "\n") - ); - } -} diff --git a/vendor/league/commonmark/src/Block/Renderer/BlockRendererInterface.php b/vendor/league/commonmark/src/Block/Renderer/BlockRendererInterface.php deleted file mode 100644 index dd339da9c2..0000000000 --- a/vendor/league/commonmark/src/Block/Renderer/BlockRendererInterface.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Block\Renderer; - -use League\CommonMark\Block\Element\AbstractBlock; -use League\CommonMark\ElementRendererInterface; -use League\CommonMark\HtmlElement; - -interface BlockRendererInterface -{ - /** - * @param AbstractBlock $block - * @param ElementRendererInterface $htmlRenderer - * @param bool $inTightList - * - * @return HtmlElement|string|null - */ - public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, bool $inTightList = false); -} diff --git a/vendor/league/commonmark/src/Block/Renderer/DocumentRenderer.php b/vendor/league/commonmark/src/Block/Renderer/DocumentRenderer.php deleted file mode 100644 index 5c354962b4..0000000000 --- a/vendor/league/commonmark/src/Block/Renderer/DocumentRenderer.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Block\Renderer; - -use League\CommonMark\Block\Element\AbstractBlock; -use League\CommonMark\Block\Element\Document; -use League\CommonMark\ElementRendererInterface; - -final class DocumentRenderer implements BlockRendererInterface -{ - /** - * @param Document $block - * @param ElementRendererInterface $htmlRenderer - * @param bool $inTightList - * - * @return string - */ - public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, bool $inTightList = false) - { - if (!($block instanceof Document)) { - throw new \InvalidArgumentException('Incompatible block type: ' . \get_class($block)); - } - - $wholeDoc = $htmlRenderer->renderBlocks($block->children()); - - return $wholeDoc === '' ? '' : $wholeDoc . "\n"; - } -} diff --git a/vendor/league/commonmark/src/Block/Renderer/FencedCodeRenderer.php b/vendor/league/commonmark/src/Block/Renderer/FencedCodeRenderer.php deleted file mode 100644 index b6ffd4bce6..0000000000 --- a/vendor/league/commonmark/src/Block/Renderer/FencedCodeRenderer.php +++ /dev/null @@ -1,52 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Block\Renderer; - -use League\CommonMark\Block\Element\AbstractBlock; -use League\CommonMark\Block\Element\FencedCode; -use League\CommonMark\ElementRendererInterface; -use League\CommonMark\HtmlElement; -use League\CommonMark\Util\Xml; - -final class FencedCodeRenderer implements BlockRendererInterface -{ - /** - * @param FencedCode $block - * @param ElementRendererInterface $htmlRenderer - * @param bool $inTightList - * - * @return HtmlElement - */ - public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, bool $inTightList = false) - { - if (!($block instanceof FencedCode)) { - throw new \InvalidArgumentException('Incompatible block type: ' . \get_class($block)); - } - - $attrs = $block->getData('attributes', []); - - $infoWords = $block->getInfoWords(); - if (\count($infoWords) !== 0 && \strlen($infoWords[0]) !== 0) { - $attrs['class'] = isset($attrs['class']) ? $attrs['class'] . ' ' : ''; - $attrs['class'] .= 'language-' . $infoWords[0]; - } - - return new HtmlElement( - 'pre', - [], - new HtmlElement('code', $attrs, Xml::escape($block->getStringContent())) - ); - } -} diff --git a/vendor/league/commonmark/src/Block/Renderer/HeadingRenderer.php b/vendor/league/commonmark/src/Block/Renderer/HeadingRenderer.php deleted file mode 100644 index 1c4f13f15c..0000000000 --- a/vendor/league/commonmark/src/Block/Renderer/HeadingRenderer.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Block\Renderer; - -use League\CommonMark\Block\Element\AbstractBlock; -use League\CommonMark\Block\Element\Heading; -use League\CommonMark\ElementRendererInterface; -use League\CommonMark\HtmlElement; - -final class HeadingRenderer implements BlockRendererInterface -{ - /** - * @param Heading $block - * @param ElementRendererInterface $htmlRenderer - * @param bool $inTightList - * - * @return HtmlElement - */ - public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, bool $inTightList = false) - { - if (!($block instanceof Heading)) { - throw new \InvalidArgumentException('Incompatible block type: ' . \get_class($block)); - } - - $tag = 'h' . $block->getLevel(); - - $attrs = $block->getData('attributes', []); - - return new HtmlElement($tag, $attrs, $htmlRenderer->renderInlines($block->children())); - } -} diff --git a/vendor/league/commonmark/src/Block/Renderer/HtmlBlockRenderer.php b/vendor/league/commonmark/src/Block/Renderer/HtmlBlockRenderer.php deleted file mode 100644 index f45dcaf63b..0000000000 --- a/vendor/league/commonmark/src/Block/Renderer/HtmlBlockRenderer.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Block\Renderer; - -use League\CommonMark\Block\Element\AbstractBlock; -use League\CommonMark\Block\Element\HtmlBlock; -use League\CommonMark\ElementRendererInterface; -use League\CommonMark\EnvironmentInterface; -use League\CommonMark\Util\ConfigurationAwareInterface; -use League\CommonMark\Util\ConfigurationInterface; - -final class HtmlBlockRenderer implements BlockRendererInterface, ConfigurationAwareInterface -{ - /** - * @var ConfigurationInterface - */ - protected $config; - - /** - * @param HtmlBlock $block - * @param ElementRendererInterface $htmlRenderer - * @param bool $inTightList - * - * @return string - */ - public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, bool $inTightList = false) - { - if (!($block instanceof HtmlBlock)) { - throw new \InvalidArgumentException('Incompatible block type: ' . \get_class($block)); - } - - if ($this->config->get('html_input') === EnvironmentInterface::HTML_INPUT_STRIP) { - return ''; - } - - if ($this->config->get('html_input') === EnvironmentInterface::HTML_INPUT_ESCAPE) { - return \htmlspecialchars($block->getStringContent(), \ENT_NOQUOTES); - } - - return $block->getStringContent(); - } - - public function setConfiguration(ConfigurationInterface $configuration) - { - $this->config = $configuration; - } -} diff --git a/vendor/league/commonmark/src/Block/Renderer/IndentedCodeRenderer.php b/vendor/league/commonmark/src/Block/Renderer/IndentedCodeRenderer.php deleted file mode 100644 index 93518b3aac..0000000000 --- a/vendor/league/commonmark/src/Block/Renderer/IndentedCodeRenderer.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Block\Renderer; - -use League\CommonMark\Block\Element\AbstractBlock; -use League\CommonMark\Block\Element\IndentedCode; -use League\CommonMark\ElementRendererInterface; -use League\CommonMark\HtmlElement; -use League\CommonMark\Util\Xml; - -final class IndentedCodeRenderer implements BlockRendererInterface -{ - /** - * @param IndentedCode $block - * @param ElementRendererInterface $htmlRenderer - * @param bool $inTightList - * - * @return HtmlElement - */ - public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, bool $inTightList = false) - { - if (!($block instanceof IndentedCode)) { - throw new \InvalidArgumentException('Incompatible block type: ' . \get_class($block)); - } - - $attrs = $block->getData('attributes', []); - - return new HtmlElement( - 'pre', - [], - new HtmlElement('code', $attrs, Xml::escape($block->getStringContent())) - ); - } -} diff --git a/vendor/league/commonmark/src/Block/Renderer/ListBlockRenderer.php b/vendor/league/commonmark/src/Block/Renderer/ListBlockRenderer.php deleted file mode 100644 index 8f04b6d5a2..0000000000 --- a/vendor/league/commonmark/src/Block/Renderer/ListBlockRenderer.php +++ /dev/null @@ -1,56 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Block\Renderer; - -use League\CommonMark\Block\Element\AbstractBlock; -use League\CommonMark\Block\Element\ListBlock; -use League\CommonMark\ElementRendererInterface; -use League\CommonMark\HtmlElement; - -final class ListBlockRenderer implements BlockRendererInterface -{ - /** - * @param ListBlock $block - * @param ElementRendererInterface $htmlRenderer - * @param bool $inTightList - * - * @return HtmlElement - */ - public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, bool $inTightList = false) - { - if (!($block instanceof ListBlock)) { - throw new \InvalidArgumentException('Incompatible block type: ' . \get_class($block)); - } - - $listData = $block->getListData(); - - $tag = $listData->type === ListBlock::TYPE_BULLET ? 'ul' : 'ol'; - - $attrs = $block->getData('attributes', []); - - if ($listData->start !== null && $listData->start !== 1) { - $attrs['start'] = (string) $listData->start; - } - - return new HtmlElement( - $tag, - $attrs, - $htmlRenderer->getOption('inner_separator', "\n") . $htmlRenderer->renderBlocks( - $block->children(), - $block->isTight() - ) . $htmlRenderer->getOption('inner_separator', "\n") - ); - } -} diff --git a/vendor/league/commonmark/src/Block/Renderer/ListItemRenderer.php b/vendor/league/commonmark/src/Block/Renderer/ListItemRenderer.php deleted file mode 100644 index c9972fad5a..0000000000 --- a/vendor/league/commonmark/src/Block/Renderer/ListItemRenderer.php +++ /dev/null @@ -1,60 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Block\Renderer; - -use League\CommonMark\Block\Element\AbstractBlock; -use League\CommonMark\Block\Element\ListItem; -use League\CommonMark\Block\Element\Paragraph; -use League\CommonMark\ElementRendererInterface; -use League\CommonMark\Extension\TaskList\TaskListItemMarker; -use League\CommonMark\HtmlElement; - -final class ListItemRenderer implements BlockRendererInterface -{ - /** - * @param ListItem $block - * @param ElementRendererInterface $htmlRenderer - * @param bool $inTightList - * - * @return string - */ - public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, bool $inTightList = false) - { - if (!($block instanceof ListItem)) { - throw new \InvalidArgumentException('Incompatible block type: ' . \get_class($block)); - } - - $contents = $htmlRenderer->renderBlocks($block->children(), $inTightList); - if (\substr($contents, 0, 1) === '<' && !$this->startsTaskListItem($block)) { - $contents = "\n" . $contents; - } - if (\substr($contents, -1, 1) === '>') { - $contents .= "\n"; - } - - $attrs = $block->getData('attributes', []); - - $li = new HtmlElement('li', $attrs, $contents); - - return $li; - } - - private function startsTaskListItem(ListItem $block): bool - { - $firstChild = $block->firstChild(); - - return $firstChild instanceof Paragraph && $firstChild->firstChild() instanceof TaskListItemMarker; - } -} diff --git a/vendor/league/commonmark/src/Block/Renderer/ParagraphRenderer.php b/vendor/league/commonmark/src/Block/Renderer/ParagraphRenderer.php deleted file mode 100644 index c530ade6b2..0000000000 --- a/vendor/league/commonmark/src/Block/Renderer/ParagraphRenderer.php +++ /dev/null @@ -1,45 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Block\Renderer; - -use League\CommonMark\Block\Element\AbstractBlock; -use League\CommonMark\Block\Element\Paragraph; -use League\CommonMark\ElementRendererInterface; -use League\CommonMark\HtmlElement; - -final class ParagraphRenderer implements BlockRendererInterface -{ - /** - * @param Paragraph $block - * @param ElementRendererInterface $htmlRenderer - * @param bool $inTightList - * - * @return HtmlElement|string - */ - public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, bool $inTightList = false) - { - if (!($block instanceof Paragraph)) { - throw new \InvalidArgumentException('Incompatible block type: ' . \get_class($block)); - } - - if ($inTightList) { - return $htmlRenderer->renderInlines($block->children()); - } - - $attrs = $block->getData('attributes', []); - - return new HtmlElement('p', $attrs, $htmlRenderer->renderInlines($block->children())); - } -} diff --git a/vendor/league/commonmark/src/Block/Renderer/ThematicBreakRenderer.php b/vendor/league/commonmark/src/Block/Renderer/ThematicBreakRenderer.php deleted file mode 100644 index 775f877aea..0000000000 --- a/vendor/league/commonmark/src/Block/Renderer/ThematicBreakRenderer.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Block\Renderer; - -use League\CommonMark\Block\Element\AbstractBlock; -use League\CommonMark\Block\Element\ThematicBreak; -use League\CommonMark\ElementRendererInterface; -use League\CommonMark\HtmlElement; - -final class ThematicBreakRenderer implements BlockRendererInterface -{ - /** - * @param ThematicBreak $block - * @param ElementRendererInterface $htmlRenderer - * @param bool $inTightList - * - * @return HtmlElement - */ - public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, bool $inTightList = false) - { - if (!($block instanceof ThematicBreak)) { - throw new \InvalidArgumentException('Incompatible block type: ' . \get_class($block)); - } - - $attrs = $block->getData('attributes', []); - - return new HtmlElement('hr', $attrs, '', true); - } -} diff --git a/vendor/league/commonmark/src/CommonMarkConverter.php b/vendor/league/commonmark/src/CommonMarkConverter.php deleted file mode 100644 index 6950481f2b..0000000000 --- a/vendor/league/commonmark/src/CommonMarkConverter.php +++ /dev/null @@ -1,60 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark; - -/** - * Converts CommonMark-compatible Markdown to HTML. - */ -class CommonMarkConverter extends Converter -{ - /** - * The currently-installed version. - * - * This might be a typical `x.y.z` version, or `x.y-dev`. - * - * @deprecated in 1.5.0 and will be removed from 2.0.0. - * Use \Composer\InstalledVersions provided by composer-runtime-api instead. - */ - public const VERSION = '1.5.7'; - - /** @var EnvironmentInterface */ - protected $environment; - - /** - * Create a new commonmark converter instance. - * - * @param array<string, mixed> $config - * @param EnvironmentInterface|null $environment - */ - public function __construct(array $config = [], EnvironmentInterface $environment = null) - { - if ($environment === null) { - $environment = Environment::createCommonMarkEnvironment(); - } - - if ($environment instanceof ConfigurableEnvironmentInterface) { - $environment->mergeConfig($config); - } - - $this->environment = $environment; - - parent::__construct(new DocParser($environment), new HtmlRenderer($environment)); - } - - public function getEnvironment(): EnvironmentInterface - { - return $this->environment; - } -} diff --git a/vendor/league/commonmark/src/ConfigurableEnvironmentInterface.php b/vendor/league/commonmark/src/ConfigurableEnvironmentInterface.php deleted file mode 100644 index 8cbe47ccf2..0000000000 --- a/vendor/league/commonmark/src/ConfigurableEnvironmentInterface.php +++ /dev/null @@ -1,108 +0,0 @@ -<?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. - */ - -namespace League\CommonMark; - -use League\CommonMark\Block\Parser\BlockParserInterface; -use League\CommonMark\Block\Renderer\BlockRendererInterface; -use League\CommonMark\Delimiter\Processor\DelimiterProcessorInterface; -use League\CommonMark\Extension\ExtensionInterface; -use League\CommonMark\Inline\Parser\InlineParserInterface; -use League\CommonMark\Inline\Renderer\InlineRendererInterface; - -/** - * Interface for an Environment which can be configured with config settings, parsers, processors, and renderers - */ -interface ConfigurableEnvironmentInterface extends EnvironmentInterface -{ - /** - * @param array<string, mixed> $config - * - * @return void - */ - public function mergeConfig(array $config = []); - - /** - * @param array<string, mixed> $config - * - * @return void - */ - public function setConfig(array $config = []); - - /** - * Registers the given extension with the Environment - * - * @param ExtensionInterface $extension - * - * @return ConfigurableEnvironmentInterface - */ - public function addExtension(ExtensionInterface $extension): ConfigurableEnvironmentInterface; - - /** - * Registers the given block parser with the Environment - * - * @param BlockParserInterface $parser Block parser instance - * @param int $priority Priority (a higher number will be executed earlier) - * - * @return self - */ - public function addBlockParser(BlockParserInterface $parser, int $priority = 0): ConfigurableEnvironmentInterface; - - /** - * Registers the given inline parser with the Environment - * - * @param InlineParserInterface $parser Inline parser instance - * @param int $priority Priority (a higher number will be executed earlier) - * - * @return self - */ - public function addInlineParser(InlineParserInterface $parser, int $priority = 0): ConfigurableEnvironmentInterface; - - /** - * Registers the given delimiter processor with the Environment - * - * @param DelimiterProcessorInterface $processor Delimiter processors instance - * - * @return ConfigurableEnvironmentInterface - */ - public function addDelimiterProcessor(DelimiterProcessorInterface $processor): ConfigurableEnvironmentInterface; - - /** - * @param string $blockClass The fully-qualified block element class name the renderer below should handle - * @param BlockRendererInterface $blockRenderer The renderer responsible for rendering the type of element given above - * @param int $priority Priority (a higher number will be executed earlier) - * - * @return self - */ - public function addBlockRenderer($blockClass, BlockRendererInterface $blockRenderer, int $priority = 0): ConfigurableEnvironmentInterface; - - /** - * Registers the given inline renderer with the Environment - * - * @param string $inlineClass The fully-qualified inline element class name the renderer below should handle - * @param InlineRendererInterface $renderer The renderer responsible for rendering the type of element given above - * @param int $priority Priority (a higher number will be executed earlier) - * - * @return self - */ - public function addInlineRenderer(string $inlineClass, InlineRendererInterface $renderer, int $priority = 0): ConfigurableEnvironmentInterface; - - /** - * Registers the given event listener - * - * @param string $eventClass Fully-qualified class name of the event this listener should respond to - * @param callable $listener Listener to be executed - * @param int $priority Priority (a higher number will be executed earlier) - * - * @return self - */ - public function addEventListener(string $eventClass, callable $listener, int $priority = 0): ConfigurableEnvironmentInterface; -} diff --git a/vendor/league/commonmark/src/Context.php b/vendor/league/commonmark/src/Context.php deleted file mode 100644 index fa6f12b01b..0000000000 --- a/vendor/league/commonmark/src/Context.php +++ /dev/null @@ -1,201 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark; - -use League\CommonMark\Block\Element\AbstractBlock; -use League\CommonMark\Block\Element\Document; -use League\CommonMark\Reference\ReferenceParser; - -/** - * Maintains the current state of the Markdown parser engine - */ -class Context implements ContextInterface -{ - /** - * @var EnvironmentInterface - */ - protected $environment; - - /** - * @var Document - */ - protected $doc; - - /** - * @var AbstractBlock|null - */ - protected $tip; - - /** - * @var AbstractBlock - */ - protected $container; - - /** - * @var int - */ - protected $lineNumber; - - /** - * @var string - */ - protected $line; - - /** - * @var UnmatchedBlockCloser - */ - protected $blockCloser; - - /** - * @var bool - */ - protected $blocksParsed = false; - - /** - * @var ReferenceParser - */ - protected $referenceParser; - - public function __construct(Document $document, EnvironmentInterface $environment) - { - $this->doc = $document; - $this->tip = $this->doc; - $this->container = $this->doc; - - $this->environment = $environment; - - $this->referenceParser = new ReferenceParser($document->getReferenceMap()); - - $this->blockCloser = new UnmatchedBlockCloser($this); - } - - /** - * @param string $line - * - * @return void - */ - public function setNextLine(string $line) - { - ++$this->lineNumber; - $this->line = $line; - } - - public function getDocument(): Document - { - return $this->doc; - } - - public function getTip(): ?AbstractBlock - { - return $this->tip; - } - - /** - * @param AbstractBlock|null $block - * - * @return $this - */ - public function setTip(?AbstractBlock $block) - { - $this->tip = $block; - - return $this; - } - - public function getLineNumber(): int - { - return $this->lineNumber; - } - - public function getLine(): string - { - return $this->line; - } - - public function getBlockCloser(): UnmatchedBlockCloser - { - return $this->blockCloser; - } - - public function getContainer(): AbstractBlock - { - return $this->container; - } - - /** - * @param AbstractBlock $container - * - * @return $this - */ - public function setContainer(AbstractBlock $container) - { - $this->container = $container; - - return $this; - } - - public function addBlock(AbstractBlock $block) - { - $this->blockCloser->closeUnmatchedBlocks(); - $block->setStartLine($this->lineNumber); - - while ($this->tip !== null && !$this->tip->canContain($block)) { - $this->tip->finalize($this, $this->lineNumber); - } - - // This should always be true - if ($this->tip !== null) { - $this->tip->appendChild($block); - } - - $this->tip = $block; - $this->container = $block; - } - - public function replaceContainerBlock(AbstractBlock $replacement) - { - $this->blockCloser->closeUnmatchedBlocks(); - $replacement->setStartLine($this->container->getStartLine()); - $this->container->replaceWith($replacement); - - if ($this->tip === $this->container) { - $this->tip = $replacement; - } - - $this->container = $replacement; - } - - public function getBlocksParsed(): bool - { - return $this->blocksParsed; - } - - /** - * @param bool $bool - * - * @return $this - */ - public function setBlocksParsed(bool $bool) - { - $this->blocksParsed = $bool; - - return $this; - } - - public function getReferenceParser(): ReferenceParser - { - return $this->referenceParser; - } -} diff --git a/vendor/league/commonmark/src/ContextInterface.php b/vendor/league/commonmark/src/ContextInterface.php deleted file mode 100644 index 8d04862d83..0000000000 --- a/vendor/league/commonmark/src/ContextInterface.php +++ /dev/null @@ -1,99 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark; - -use League\CommonMark\Block\Element\AbstractBlock; -use League\CommonMark\Block\Element\Document; -use League\CommonMark\Reference\ReferenceParser; - -interface ContextInterface -{ - /** - * @return Document - */ - public function getDocument(): Document; - - /** - * @return AbstractBlock|null - */ - public function getTip(): ?AbstractBlock; - - /** - * @param AbstractBlock|null $block - * - * @return void - */ - public function setTip(?AbstractBlock $block); - - /** - * @return int - */ - public function getLineNumber(): int; - - /** - * @return string - */ - public function getLine(): string; - - /** - * Finalize and close any unmatched blocks - * - * @return UnmatchedBlockCloser - */ - public function getBlockCloser(): UnmatchedBlockCloser; - - /** - * @return AbstractBlock - */ - public function getContainer(): AbstractBlock; - - /** - * @param AbstractBlock $container - * - * @return void - */ - public function setContainer(AbstractBlock $container); - - /** - * @param AbstractBlock $block - * - * @return void - */ - public function addBlock(AbstractBlock $block); - - /** - * @param AbstractBlock $replacement - * - * @return void - */ - public function replaceContainerBlock(AbstractBlock $replacement); - - /** - * @return bool - */ - public function getBlocksParsed(): bool; - - /** - * @param bool $bool - * - * @return $this - */ - public function setBlocksParsed(bool $bool); - - /** - * @return ReferenceParser - */ - public function getReferenceParser(): ReferenceParser; -} diff --git a/vendor/league/commonmark/src/Converter.php b/vendor/league/commonmark/src/Converter.php deleted file mode 100644 index 570e556914..0000000000 --- a/vendor/league/commonmark/src/Converter.php +++ /dev/null @@ -1,84 +0,0 @@ -<?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. - */ - -namespace League\CommonMark; - -/** - * Converts CommonMark-compatible Markdown to HTML. - * - * @deprecated This class is deprecated since league/commonmark 1.4, use CommonMarkConverter instead. - */ -class Converter implements ConverterInterface -{ - /** - * The document parser instance. - * - * @var DocParserInterface - */ - protected $docParser; - - /** - * The html renderer instance. - * - * @var ElementRendererInterface - */ - protected $htmlRenderer; - - /** - * Create a new commonmark converter instance. - * - * @param DocParserInterface $docParser - * @param ElementRendererInterface $htmlRenderer - */ - public function __construct(DocParserInterface $docParser, ElementRendererInterface $htmlRenderer) - { - if (!($this instanceof CommonMarkConverter)) { - @trigger_error(sprintf('The %s class is deprecated since league/commonmark 1.4, use %s instead.', self::class, CommonMarkConverter::class), E_USER_DEPRECATED); - } - - $this->docParser = $docParser; - $this->htmlRenderer = $htmlRenderer; - } - - /** - * Converts CommonMark to HTML. - * - * @param string $commonMark - * - * @throws \RuntimeException - * - * @return string - * - * @api - */ - public function convertToHtml(string $commonMark): string - { - $documentAST = $this->docParser->parse($commonMark); - - return $this->htmlRenderer->renderBlock($documentAST); - } - - /** - * Converts CommonMark to HTML. - * - * @see Converter::convertToHtml - * - * @param string $commonMark - * - * @throws \RuntimeException - * - * @return string - */ - public function __invoke(string $commonMark): string - { - return $this->convertToHtml($commonMark); - } -} diff --git a/vendor/league/commonmark/src/ConverterInterface.php b/vendor/league/commonmark/src/ConverterInterface.php deleted file mode 100644 index 85e261da7b..0000000000 --- a/vendor/league/commonmark/src/ConverterInterface.php +++ /dev/null @@ -1,21 +0,0 @@ -<?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. - */ - -namespace League\CommonMark; - -/** - * Interface for a service which converts CommonMark to HTML. - * - * @deprecated ConverterInterface is deprecated since league/commonmark 1.4, use MarkdownConverterInterface instead - */ -interface ConverterInterface extends MarkdownConverterInterface -{ -} diff --git a/vendor/league/commonmark/src/Cursor.php b/vendor/league/commonmark/src/Cursor.php deleted file mode 100644 index 4b66b5e157..0000000000 --- a/vendor/league/commonmark/src/Cursor.php +++ /dev/null @@ -1,502 +0,0 @@ -<?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; - -use League\CommonMark\Exception\UnexpectedEncodingException; - -class Cursor -{ - public const INDENT_LEVEL = 4; - - /** - * @var string - */ - private $line; - - /** - * @var int - */ - private $length; - - /** - * @var int - * - * It's possible for this to be 1 char past the end, meaning we've parsed all chars and have - * reached the end. In this state, any character-returning method MUST return null. - */ - private $currentPosition = 0; - - /** - * @var int - */ - private $column = 0; - - /** - * @var int - */ - private $indent = 0; - - /** - * @var int - */ - private $previousPosition = 0; - - /** - * @var int|null - */ - private $nextNonSpaceCache; - - /** - * @var bool - */ - private $partiallyConsumedTab = false; - - /** - * @var bool - */ - private $lineContainsTabs; - - /** - * @var bool - */ - private $isMultibyte; - - /** - * @var array<int, string> - */ - private $charCache = []; - - /** - * @param string $line The line being parsed (ASCII or UTF-8) - */ - public function __construct(string $line) - { - if (!\mb_check_encoding($line, 'UTF-8')) { - throw new UnexpectedEncodingException('Unexpected encoding - UTF-8 or ASCII was expected'); - } - - $this->line = $line; - $this->length = \mb_strlen($line, 'UTF-8') ?: 0; - $this->isMultibyte = $this->length !== \strlen($line); - $this->lineContainsTabs = false !== \strpos($line, "\t"); - } - - /** - * Returns the position of the next character which is not a space (or tab) - * - * @return int - */ - public function getNextNonSpacePosition(): int - { - if ($this->nextNonSpaceCache !== null) { - return $this->nextNonSpaceCache; - } - - $i = $this->currentPosition; - $cols = $this->column; - - while (($c = $this->getCharacter($i)) !== null) { - if ($c === ' ') { - $i++; - $cols++; - } elseif ($c === "\t") { - $i++; - $cols += (4 - ($cols % 4)); - } else { - break; - } - } - - $nextNonSpace = ($c === null) ? $this->length : $i; - $this->indent = $cols - $this->column; - - return $this->nextNonSpaceCache = $nextNonSpace; - } - - /** - * Returns the next character which isn't a space (or tab) - * - * @return string - */ - public function getNextNonSpaceCharacter(): ?string - { - return $this->getCharacter($this->getNextNonSpacePosition()); - } - - /** - * Calculates the current indent (number of spaces after current position) - * - * @return int - */ - public function getIndent(): int - { - if ($this->nextNonSpaceCache === null) { - $this->getNextNonSpacePosition(); - } - - return $this->indent; - } - - /** - * Whether the cursor is indented to INDENT_LEVEL - * - * @return bool - */ - public function isIndented(): bool - { - return $this->getIndent() >= self::INDENT_LEVEL; - } - - /** - * @param int|null $index - * - * @return string|null - */ - public function getCharacter(?int $index = null): ?string - { - if ($index === null) { - $index = $this->currentPosition; - } - - // Index out-of-bounds, or we're at the end - if ($index < 0 || $index >= $this->length) { - return null; - } - - if ($this->isMultibyte) { - if (isset($this->charCache[$index])) { - return $this->charCache[$index]; - } - - return $this->charCache[$index] = \mb_substr($this->line, $index, 1, 'UTF-8'); - } - - return $this->line[$index]; - } - - /** - * Returns the next character (or null, if none) without advancing forwards - * - * @param int $offset - * - * @return string|null - */ - public function peek(int $offset = 1): ?string - { - return $this->getCharacter($this->currentPosition + $offset); - } - - /** - * Whether the remainder is blank - * - * @return bool - */ - public function isBlank(): bool - { - return $this->nextNonSpaceCache === $this->length || $this->getNextNonSpacePosition() === $this->length; - } - - /** - * Move the cursor forwards - * - * @return void - */ - public function advance() - { - $this->advanceBy(1); - } - - /** - * Move the cursor forwards - * - * @param int $characters Number of characters to advance by - * @param bool $advanceByColumns Whether to advance by columns instead of spaces - * - * @return void - */ - public function advanceBy(int $characters, bool $advanceByColumns = false) - { - if ($characters === 0) { - $this->previousPosition = $this->currentPosition; - - return; - } - - $this->previousPosition = $this->currentPosition; - $this->nextNonSpaceCache = null; - - // Optimization to avoid tab handling logic if we have no tabs - if (!$this->lineContainsTabs || false === \strpos( - $nextFewChars = $this->isMultibyte ? - \mb_substr($this->line, $this->currentPosition, $characters, 'UTF-8') : - \substr($this->line, $this->currentPosition, $characters), - "\t" - )) { - $length = \min($characters, $this->length - $this->currentPosition); - $this->partiallyConsumedTab = false; - $this->currentPosition += $length; - $this->column += $length; - - return; - } - - if ($characters === 1 && !empty($nextFewChars)) { - $asArray = [$nextFewChars]; - } elseif ($this->isMultibyte) { - /** @var string[] $asArray */ - $asArray = \preg_split('//u', $nextFewChars, -1, \PREG_SPLIT_NO_EMPTY); - } else { - $asArray = \str_split($nextFewChars); - } - - foreach ($asArray as $relPos => $c) { - if ($c === "\t") { - $charsToTab = 4 - ($this->column % 4); - if ($advanceByColumns) { - $this->partiallyConsumedTab = $charsToTab > $characters; - $charsToAdvance = $charsToTab > $characters ? $characters : $charsToTab; - $this->column += $charsToAdvance; - $this->currentPosition += $this->partiallyConsumedTab ? 0 : 1; - $characters -= $charsToAdvance; - } else { - $this->partiallyConsumedTab = false; - $this->column += $charsToTab; - $this->currentPosition++; - $characters--; - } - } else { - $this->partiallyConsumedTab = false; - $this->currentPosition++; - $this->column++; - $characters--; - } - - if ($characters <= 0) { - break; - } - } - } - - /** - * Advances the cursor by a single space or tab, if present - * - * @return bool - */ - public function advanceBySpaceOrTab(): bool - { - $character = $this->getCharacter(); - - if ($character === ' ' || $character === "\t") { - $this->advanceBy(1, true); - - return true; - } - - return false; - } - - /** - * Parse zero or more space/tab characters - * - * @return int Number of positions moved - */ - public function advanceToNextNonSpaceOrTab(): int - { - $newPosition = $this->getNextNonSpacePosition(); - $this->advanceBy($newPosition - $this->currentPosition); - $this->partiallyConsumedTab = false; - - return $this->currentPosition - $this->previousPosition; - } - - /** - * Parse zero or more space characters, including at most one newline. - * - * Tab characters are not parsed with this function. - * - * @return int Number of positions moved - */ - public function advanceToNextNonSpaceOrNewline(): int - { - $remainder = $this->getRemainder(); - - // Optimization: Avoid the regex if we know there are no spaces or newlines - if (empty($remainder) || ($remainder[0] !== ' ' && $remainder[0] !== "\n")) { - $this->previousPosition = $this->currentPosition; - - return 0; - } - - $matches = []; - \preg_match('/^ *(?:\n *)?/', $remainder, $matches, \PREG_OFFSET_CAPTURE); - - // [0][0] contains the matched text - // [0][1] contains the index of that match - $increment = $matches[0][1] + \strlen($matches[0][0]); - - $this->advanceBy($increment); - - return $this->currentPosition - $this->previousPosition; - } - - /** - * Move the position to the very end of the line - * - * @return int The number of characters moved - */ - public function advanceToEnd(): int - { - $this->previousPosition = $this->currentPosition; - $this->nextNonSpaceCache = null; - - $this->currentPosition = $this->length; - - return $this->currentPosition - $this->previousPosition; - } - - public function getRemainder(): string - { - if ($this->currentPosition >= $this->length) { - return ''; - } - - $prefix = ''; - $position = $this->currentPosition; - if ($this->partiallyConsumedTab) { - $position++; - $charsToTab = 4 - ($this->column % 4); - $prefix = \str_repeat(' ', $charsToTab); - } - - $subString = $this->isMultibyte ? - \mb_substr($this->line, $position, null, 'UTF-8') : - \substr($this->line, $position); - - return $prefix . $subString; - } - - public function getLine(): string - { - return $this->line; - } - - public function isAtEnd(): bool - { - return $this->currentPosition >= $this->length; - } - - /** - * Try to match a regular expression - * - * Returns the matching text and advances to the end of that match - * - * @param string $regex - * - * @return string|null - */ - public function match(string $regex): ?string - { - $subject = $this->getRemainder(); - - if (!\preg_match($regex, $subject, $matches, \PREG_OFFSET_CAPTURE)) { - return null; - } - - // $matches[0][0] contains the matched text - // $matches[0][1] contains the index of that match - - if ($this->isMultibyte) { - // PREG_OFFSET_CAPTURE always returns the byte offset, not the char offset, which is annoying - $offset = \mb_strlen(\substr($subject, 0, $matches[0][1]), 'UTF-8'); - $matchLength = \mb_strlen($matches[0][0], 'UTF-8'); - } else { - $offset = $matches[0][1]; - $matchLength = \strlen($matches[0][0]); - } - - // [0][0] contains the matched text - // [0][1] contains the index of that match - $this->advanceBy($offset + $matchLength); - - return $matches[0][0]; - } - - /** - * Encapsulates the current state of this cursor in case you need to rollback later. - * - * WARNING: Do not parse or use the return value for ANYTHING except for - * passing it back into restoreState(), as the number of values and their - * contents may change in any future release without warning. - * - * @return array<mixed> - */ - public function saveState() - { - return [ - $this->currentPosition, - $this->previousPosition, - $this->nextNonSpaceCache, - $this->indent, - $this->column, - $this->partiallyConsumedTab, - ]; - } - - /** - * Restore the cursor to a previous state. - * - * Pass in the value previously obtained by calling saveState(). - * - * @param array<mixed> $state - * - * @return void - */ - public function restoreState($state) - { - list( - $this->currentPosition, - $this->previousPosition, - $this->nextNonSpaceCache, - $this->indent, - $this->column, - $this->partiallyConsumedTab, - ) = $state; - } - - public function getPosition(): int - { - return $this->currentPosition; - } - - public function getPreviousText(): string - { - return \mb_substr($this->line, $this->previousPosition, $this->currentPosition - $this->previousPosition, 'UTF-8'); - } - - public function getSubstring(int $start, ?int $length = null): string - { - if ($this->isMultibyte) { - return \mb_substr($this->line, $start, $length, 'UTF-8'); - } elseif ($length !== null) { - return \substr($this->line, $start, $length); - } - - return \substr($this->line, $start); - } - - public function getColumn(): int - { - return $this->column; - } -} diff --git a/vendor/league/commonmark/src/Delimiter/Delimiter.php b/vendor/league/commonmark/src/Delimiter/Delimiter.php deleted file mode 100644 index 179543c46a..0000000000 --- a/vendor/league/commonmark/src/Delimiter/Delimiter.php +++ /dev/null @@ -1,152 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Delimiter; - -use League\CommonMark\Inline\Element\AbstractStringContainer; - -final class Delimiter implements DelimiterInterface -{ - /** @var string */ - private $char; - - /** @var int */ - private $length; - - /** @var int */ - private $originalLength; - - /** @var AbstractStringContainer */ - private $inlineNode; - - /** @var DelimiterInterface|null */ - private $previous; - - /** @var DelimiterInterface|null */ - private $next; - - /** @var bool */ - private $canOpen; - - /** @var bool */ - private $canClose; - - /** @var bool */ - private $active; - - /** @var int|null */ - private $index; - - /** - * @param string $char - * @param int $numDelims - * @param AbstractStringContainer $node - * @param bool $canOpen - * @param bool $canClose - * @param int|null $index - */ - public function __construct(string $char, int $numDelims, AbstractStringContainer $node, bool $canOpen, bool $canClose, ?int $index = null) - { - $this->char = $char; - $this->length = $numDelims; - $this->originalLength = $numDelims; - $this->inlineNode = $node; - $this->canOpen = $canOpen; - $this->canClose = $canClose; - $this->active = true; - $this->index = $index; - } - - public function canClose(): bool - { - return $this->canClose; - } - - /** - * @param bool $canClose - * - * @return void - */ - public function setCanClose(bool $canClose) - { - $this->canClose = $canClose; - } - - public function canOpen(): bool - { - return $this->canOpen; - } - - public function isActive(): bool - { - return $this->active; - } - - public function setActive(bool $active) - { - $this->active = $active; - } - - public function getChar(): string - { - return $this->char; - } - - public function getIndex(): ?int - { - return $this->index; - } - - public function getNext(): ?DelimiterInterface - { - return $this->next; - } - - public function setNext(?DelimiterInterface $next) - { - $this->next = $next; - } - - public function getLength(): int - { - return $this->length; - } - - public function setLength(int $length) - { - $this->length = $length; - } - - public function getOriginalLength(): int - { - return $this->originalLength; - } - - public function getInlineNode(): AbstractStringContainer - { - return $this->inlineNode; - } - - public function getPrevious(): ?DelimiterInterface - { - return $this->previous; - } - - public function setPrevious(?DelimiterInterface $previous): DelimiterInterface - { - $this->previous = $previous; - - return $this; - } -} diff --git a/vendor/league/commonmark/src/Delimiter/DelimiterInterface.php b/vendor/league/commonmark/src/Delimiter/DelimiterInterface.php deleted file mode 100644 index 4669e36e75..0000000000 --- a/vendor/league/commonmark/src/Delimiter/DelimiterInterface.php +++ /dev/null @@ -1,71 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Delimiter; - -use League\CommonMark\Inline\Element\AbstractStringContainer; - -interface DelimiterInterface -{ - public function canClose(): bool; - - public function canOpen(): bool; - - public function isActive(): bool; - - /** - * @param bool $active - * - * @return void - */ - public function setActive(bool $active); - - /** - * @return string - */ - public function getChar(): string; - - public function getIndex(): ?int; - - public function getNext(): ?DelimiterInterface; - - /** - * @param DelimiterInterface|null $next - * - * @return void - */ - public function setNext(?DelimiterInterface $next); - - public function getLength(): int; - - /** - * @param int $length - * - * @return void - */ - public function setLength(int $length); - - public function getOriginalLength(): int; - - public function getInlineNode(): AbstractStringContainer; - - public function getPrevious(): ?DelimiterInterface; - - /** - * @param DelimiterInterface|null $previous - * - * @return mixed|void - */ - public function setPrevious(?DelimiterInterface $previous); -} diff --git a/vendor/league/commonmark/src/Delimiter/DelimiterStack.php b/vendor/league/commonmark/src/Delimiter/DelimiterStack.php deleted file mode 100644 index a0bf2f9ff7..0000000000 --- a/vendor/league/commonmark/src/Delimiter/DelimiterStack.php +++ /dev/null @@ -1,234 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * Additional emphasis processing code based on commonmark-java (https://github.com/atlassian/commonmark-java) - * - (c) Atlassian Pty Ltd - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Delimiter; - -use League\CommonMark\Delimiter\Processor\DelimiterProcessorCollection; -use League\CommonMark\Inline\AdjacentTextMerger; - -final class DelimiterStack -{ - /** - * @var DelimiterInterface|null - */ - private $top; - - /** - * @param DelimiterInterface $newDelimiter - * - * @return void - */ - public function push(DelimiterInterface $newDelimiter) - { - $newDelimiter->setPrevious($this->top); - - if ($this->top !== null) { - $this->top->setNext($newDelimiter); - } - - $this->top = $newDelimiter; - } - - private function findEarliest(DelimiterInterface $stackBottom = null): ?DelimiterInterface - { - $delimiter = $this->top; - while ($delimiter !== null && $delimiter->getPrevious() !== $stackBottom) { - $delimiter = $delimiter->getPrevious(); - } - - return $delimiter; - } - - /** - * @param DelimiterInterface $delimiter - * - * @return void - */ - public function removeDelimiter(DelimiterInterface $delimiter) - { - if ($delimiter->getPrevious() !== null) { - $delimiter->getPrevious()->setNext($delimiter->getNext()); - } - - if ($delimiter->getNext() === null) { - // top of stack - $this->top = $delimiter->getPrevious(); - } else { - $delimiter->getNext()->setPrevious($delimiter->getPrevious()); - } - } - - private function removeDelimiterAndNode(DelimiterInterface $delimiter): void - { - $delimiter->getInlineNode()->detach(); - $this->removeDelimiter($delimiter); - } - - private function removeDelimitersBetween(DelimiterInterface $opener, DelimiterInterface $closer): void - { - $delimiter = $closer->getPrevious(); - while ($delimiter !== null && $delimiter !== $opener) { - $previous = $delimiter->getPrevious(); - $this->removeDelimiter($delimiter); - $delimiter = $previous; - } - } - - /** - * @param DelimiterInterface|null $stackBottom - * - * @return void - */ - public function removeAll(DelimiterInterface $stackBottom = null) - { - while ($this->top && $this->top !== $stackBottom) { - $this->removeDelimiter($this->top); - } - } - - /** - * @param string $character - * - * @return void - */ - public function removeEarlierMatches(string $character) - { - $opener = $this->top; - while ($opener !== null) { - if ($opener->getChar() === $character) { - $opener->setActive(false); - } - - $opener = $opener->getPrevious(); - } - } - - /** - * @param string|string[] $characters - * - * @return DelimiterInterface|null - */ - public function searchByCharacter($characters): ?DelimiterInterface - { - if (!\is_array($characters)) { - $characters = [$characters]; - } - - $opener = $this->top; - while ($opener !== null) { - if (\in_array($opener->getChar(), $characters)) { - break; - } - $opener = $opener->getPrevious(); - } - - return $opener; - } - - /** - * @param DelimiterInterface|null $stackBottom - * @param DelimiterProcessorCollection $processors - * - * @return void - */ - public function processDelimiters(?DelimiterInterface $stackBottom, DelimiterProcessorCollection $processors) - { - $openersBottom = []; - - // Find first closer above stackBottom - $closer = $this->findEarliest($stackBottom); - - // Move forward, looking for closers, and handling each - while ($closer !== null) { - $delimiterChar = $closer->getChar(); - - $delimiterProcessor = $processors->getDelimiterProcessor($delimiterChar); - if (!$closer->canClose() || $delimiterProcessor === null) { - $closer = $closer->getNext(); - continue; - } - - $openingDelimiterChar = $delimiterProcessor->getOpeningCharacter(); - - $useDelims = 0; - $openerFound = false; - $potentialOpenerFound = false; - $opener = $closer->getPrevious(); - while ($opener !== null && $opener !== $stackBottom && $opener !== ($openersBottom[$delimiterChar] ?? null)) { - if ($opener->canOpen() && $opener->getChar() === $openingDelimiterChar) { - $potentialOpenerFound = true; - $useDelims = $delimiterProcessor->getDelimiterUse($opener, $closer); - if ($useDelims > 0) { - $openerFound = true; - break; - } - } - $opener = $opener->getPrevious(); - } - - if (!$openerFound) { - if (!$potentialOpenerFound) { - // Only do this when we didn't even have a potential - // opener (one that matches the character and can open). - // If an opener was rejected because of the number of - // delimiters (e.g. because of the "multiple of 3" - // Set lower bound for future searches for openersrule), - // we want to consider it next time because the number - // of delimiters can change as we continue processing. - $openersBottom[$delimiterChar] = $closer->getPrevious(); - if (!$closer->canOpen()) { - // We can remove a closer that can't be an opener, - // once we've seen there's no matching opener. - $this->removeDelimiter($closer); - } - } - $closer = $closer->getNext(); - continue; - } - - $openerNode = $opener->getInlineNode(); - $closerNode = $closer->getInlineNode(); - - // Remove number of used delimiters from stack and inline nodes. - $opener->setLength($opener->getLength() - $useDelims); - $closer->setLength($closer->getLength() - $useDelims); - - $openerNode->setContent(\substr($openerNode->getContent(), 0, -$useDelims)); - $closerNode->setContent(\substr($closerNode->getContent(), 0, -$useDelims)); - - $this->removeDelimitersBetween($opener, $closer); - // The delimiter processor can re-parent the nodes between opener and closer, - // so make sure they're contiguous already. Exclusive because we want to keep opener/closer themselves. - AdjacentTextMerger::mergeTextNodesBetweenExclusive($openerNode, $closerNode); - $delimiterProcessor->process($openerNode, $closerNode, $useDelims); - - // No delimiter characters left to process, so we can remove delimiter and the now empty node. - if ($opener->getLength() === 0) { - $this->removeDelimiterAndNode($opener); - } - - if ($closer->getLength() === 0) { - $next = $closer->getNext(); - $this->removeDelimiterAndNode($closer); - $closer = $next; - } - } - - // Remove all delimiters - $this->removeAll($stackBottom); - } -} diff --git a/vendor/league/commonmark/src/Delimiter/Processor/DelimiterProcessorCollection.php b/vendor/league/commonmark/src/Delimiter/Processor/DelimiterProcessorCollection.php deleted file mode 100644 index 03ced91d44..0000000000 --- a/vendor/league/commonmark/src/Delimiter/Processor/DelimiterProcessorCollection.php +++ /dev/null @@ -1,73 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * Additional emphasis processing code based on commonmark-java (https://github.com/atlassian/commonmark-java) - * - (c) Atlassian Pty Ltd - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Delimiter\Processor; - -final class DelimiterProcessorCollection implements DelimiterProcessorCollectionInterface -{ - /** @var array<string,DelimiterProcessorInterface>|DelimiterProcessorInterface[] */ - private $processorsByChar = []; - - public function add(DelimiterProcessorInterface $processor) - { - $opening = $processor->getOpeningCharacter(); - $closing = $processor->getClosingCharacter(); - - if ($opening === $closing) { - $old = $this->processorsByChar[$opening] ?? null; - if ($old !== null && $old->getOpeningCharacter() === $old->getClosingCharacter()) { - $this->addStaggeredDelimiterProcessorForChar($opening, $old, $processor); - } else { - $this->addDelimiterProcessorForChar($opening, $processor); - } - } else { - $this->addDelimiterProcessorForChar($opening, $processor); - $this->addDelimiterProcessorForChar($closing, $processor); - } - } - - public function getDelimiterProcessor(string $char): ?DelimiterProcessorInterface - { - return $this->processorsByChar[$char] ?? null; - } - - public function getDelimiterCharacters(): array - { - return \array_keys($this->processorsByChar); - } - - private function addDelimiterProcessorForChar(string $delimiterChar, DelimiterProcessorInterface $processor): void - { - if (isset($this->processorsByChar[$delimiterChar])) { - throw new \InvalidArgumentException(\sprintf('Delim processor for character "%s" already exists', $processor->getOpeningCharacter())); - } - - $this->processorsByChar[$delimiterChar] = $processor; - } - - private function addStaggeredDelimiterProcessorForChar(string $opening, DelimiterProcessorInterface $old, DelimiterProcessorInterface $new): void - { - if ($old instanceof StaggeredDelimiterProcessor) { - $s = $old; - } else { - $s = new StaggeredDelimiterProcessor($opening, $old); - } - - $s->add($new); - $this->processorsByChar[$opening] = $s; - } -} diff --git a/vendor/league/commonmark/src/Delimiter/Processor/DelimiterProcessorCollectionInterface.php b/vendor/league/commonmark/src/Delimiter/Processor/DelimiterProcessorCollectionInterface.php deleted file mode 100644 index 58eba09ea4..0000000000 --- a/vendor/league/commonmark/src/Delimiter/Processor/DelimiterProcessorCollectionInterface.php +++ /dev/null @@ -1,48 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * Additional emphasis processing code based on commonmark-java (https://github.com/atlassian/commonmark-java) - * - (c) Atlassian Pty Ltd - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Delimiter\Processor; - -interface DelimiterProcessorCollectionInterface -{ - /** - * Add the given delim processor to the collection - * - * @param DelimiterProcessorInterface $processor The delim processor to add - * - * @throws \InvalidArgumentException Exception will be thrown if attempting to add multiple processors for the same character - * - * @return void - */ - public function add(DelimiterProcessorInterface $processor); - - /** - * Returns the delim processor which handles the given character if one exists - * - * @param string $char - * - * @return DelimiterProcessorInterface|null - */ - public function getDelimiterProcessor(string $char): ?DelimiterProcessorInterface; - - /** - * Returns an array of delimiter characters who have associated processors - * - * @return string[] - */ - public function getDelimiterCharacters(): array; -} diff --git a/vendor/league/commonmark/src/Delimiter/Processor/DelimiterProcessorInterface.php b/vendor/league/commonmark/src/Delimiter/Processor/DelimiterProcessorInterface.php deleted file mode 100644 index d237781709..0000000000 --- a/vendor/league/commonmark/src/Delimiter/Processor/DelimiterProcessorInterface.php +++ /dev/null @@ -1,86 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * Additional emphasis processing code based on commonmark-java (https://github.com/atlassian/commonmark-java) - * - (c) Atlassian Pty Ltd - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Delimiter\Processor; - -use League\CommonMark\Delimiter\DelimiterInterface; -use League\CommonMark\Inline\Element\AbstractStringContainer; - -/** - * Interface for a delimiter processor - */ -interface DelimiterProcessorInterface -{ - /** - * Returns the character that marks the beginning of a delimited node. - * - * This must not clash with any other processors being added to the environment. - * - * @return string - */ - public function getOpeningCharacter(): string; - - /** - * Returns the character that marks the ending of a delimited node. - * - * This must not clash with any other processors being added to the environment. - * - * Note that for a symmetric delimiter such as "*", this is the same as the opening. - * - * @return string - */ - public function getClosingCharacter(): string; - - /** - * Minimum number of delimiter characters that are needed to active this. - * - * Must be at least 1. - * - * @return int - */ - public function getMinLength(): int; - - /** - * Determine how many (if any) of the delimiter characters should be used. - * - * This allows implementations to decide how many characters to be used - * based on the properties of the delimiter runs. An implementation can also - * return 0 when it doesn't want to allow this particular combination of - * delimiter runs. - * - * @param DelimiterInterface $opener The opening delimiter run - * @param DelimiterInterface $closer The closing delimiter run - * - * @return int - */ - public function getDelimiterUse(DelimiterInterface $opener, DelimiterInterface $closer): int; - - /** - * Process the matched delimiters, e.g. by wrapping the nodes between opener - * and closer in a new node, or appending a new node after the opener. - * - * Note that removal of the delimiter from the delimiter nodes and detaching - * them is done by the caller. - * - * @param AbstractStringContainer $opener The node that contained the opening delimiter - * @param AbstractStringContainer $closer The node that contained the closing delimiter - * @param int $delimiterUse The number of delimiters that were used - * - * @return void - */ - public function process(AbstractStringContainer $opener, AbstractStringContainer $closer, int $delimiterUse); -} diff --git a/vendor/league/commonmark/src/Delimiter/Processor/EmphasisDelimiterProcessor.php b/vendor/league/commonmark/src/Delimiter/Processor/EmphasisDelimiterProcessor.php deleted file mode 100644 index c4c54fdc6b..0000000000 --- a/vendor/league/commonmark/src/Delimiter/Processor/EmphasisDelimiterProcessor.php +++ /dev/null @@ -1,105 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * Additional emphasis processing code based on commonmark-java (https://github.com/atlassian/commonmark-java) - * - (c) Atlassian Pty Ltd - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Delimiter\Processor; - -use League\CommonMark\Delimiter\DelimiterInterface; -use League\CommonMark\Inline\Element\AbstractStringContainer; -use League\CommonMark\Inline\Element\Emphasis; -use League\CommonMark\Inline\Element\Strong; -use League\CommonMark\Util\ConfigurationAwareInterface; -use League\CommonMark\Util\ConfigurationInterface; - -final class EmphasisDelimiterProcessor implements DelimiterProcessorInterface, ConfigurationAwareInterface -{ - /** @var string */ - private $char; - - /** @var ConfigurationInterface|null */ - private $config; - - /** - * @param string $char The emphasis character to use (typically '*' or '_') - */ - public function __construct(string $char) - { - $this->char = $char; - } - - public function getOpeningCharacter(): string - { - return $this->char; - } - - public function getClosingCharacter(): string - { - return $this->char; - } - - public function getMinLength(): int - { - return 1; - } - - public function getDelimiterUse(DelimiterInterface $opener, DelimiterInterface $closer): int - { - // "Multiple of 3" rule for internal delimiter runs - if (($opener->canClose() || $closer->canOpen()) && $closer->getOriginalLength() % 3 !== 0 && ($opener->getOriginalLength() + $closer->getOriginalLength()) % 3 === 0) { - return 0; - } - - // Calculate actual number of delimiters used from this closer - if ($opener->getLength() >= 2 && $closer->getLength() >= 2) { - if ($this->config && $this->config->get('enable_strong', true)) { - return 2; - } - - return 0; - } - - if ($this->config && $this->config->get('enable_em', true)) { - return 1; - } - - return 0; - } - - public function process(AbstractStringContainer $opener, AbstractStringContainer $closer, int $delimiterUse) - { - if ($delimiterUse === 1) { - $emphasis = new Emphasis(); - } elseif ($delimiterUse === 2) { - $emphasis = new Strong(); - } else { - return; - } - - $next = $opener->next(); - while ($next !== null && $next !== $closer) { - $tmp = $next->next(); - $emphasis->appendChild($next); - $next = $tmp; - } - - $opener->insertAfter($emphasis); - } - - public function setConfiguration(ConfigurationInterface $configuration) - { - $this->config = $configuration; - } -} diff --git a/vendor/league/commonmark/src/Delimiter/Processor/StaggeredDelimiterProcessor.php b/vendor/league/commonmark/src/Delimiter/Processor/StaggeredDelimiterProcessor.php deleted file mode 100644 index d5bdb6d0e6..0000000000 --- a/vendor/league/commonmark/src/Delimiter/Processor/StaggeredDelimiterProcessor.php +++ /dev/null @@ -1,106 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Additional emphasis processing code based on commonmark-java (https://github.com/atlassian/commonmark-java) - * - (c) Atlassian Pty Ltd - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Delimiter\Processor; - -use League\CommonMark\Delimiter\DelimiterInterface; -use League\CommonMark\Inline\Element\AbstractStringContainer; - -/** - * An implementation of DelimiterProcessorInterface that dispatches all calls to two or more other DelimiterProcessors - * depending on the length of the delimiter run. All child DelimiterProcessors must have different minimum - * lengths. A given delimiter run is dispatched to the child with the largest acceptable minimum length. If no - * child is applicable, the one with the largest minimum length is chosen. - * - * @internal - */ -final class StaggeredDelimiterProcessor implements DelimiterProcessorInterface -{ - /** @var string */ - private $delimiterChar; - - /** @var int */ - private $minLength = 0; - - /** @var array<int, DelimiterProcessorInterface>|DelimiterProcessorInterface[] */ - private $processors = []; // keyed by minLength in reverse order - - public function __construct(string $char, DelimiterProcessorInterface $processor) - { - $this->delimiterChar = $char; - $this->add($processor); - } - - public function getOpeningCharacter(): string - { - return $this->delimiterChar; - } - - public function getClosingCharacter(): string - { - return $this->delimiterChar; - } - - public function getMinLength(): int - { - return $this->minLength; - } - - /** - * Adds the given processor to this staggered delimiter processor - * - * @param DelimiterProcessorInterface $processor - * - * @return void - */ - public function add(DelimiterProcessorInterface $processor) - { - $len = $processor->getMinLength(); - - if (isset($this->processors[$len])) { - throw new \InvalidArgumentException(\sprintf('Cannot add two delimiter processors for char "%s" and minimum length %d', $this->delimiterChar, $len)); - } - - $this->processors[$len] = $processor; - \krsort($this->processors); - - $this->minLength = \min($this->minLength, $len); - } - - public function getDelimiterUse(DelimiterInterface $opener, DelimiterInterface $closer): int - { - return $this->findProcessor($opener->getLength())->getDelimiterUse($opener, $closer); - } - - public function process(AbstractStringContainer $opener, AbstractStringContainer $closer, int $delimiterUse) - { - $this->findProcessor($delimiterUse)->process($opener, $closer, $delimiterUse); - } - - private function findProcessor(int $len): DelimiterProcessorInterface - { - // Find the "longest" processor which can handle this length - foreach ($this->processors as $processor) { - if ($processor->getMinLength() <= $len) { - return $processor; - } - } - - // Just use the first one in our list - /** @var DelimiterProcessorInterface $first */ - $first = \reset($this->processors); - - return $first; - } -} diff --git a/vendor/league/commonmark/src/DocParser.php b/vendor/league/commonmark/src/DocParser.php deleted file mode 100644 index c797290c72..0000000000 --- a/vendor/league/commonmark/src/DocParser.php +++ /dev/null @@ -1,229 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark; - -use League\CommonMark\Block\Element\AbstractBlock; -use League\CommonMark\Block\Element\AbstractStringContainerBlock; -use League\CommonMark\Block\Element\Document; -use League\CommonMark\Block\Element\Paragraph; -use League\CommonMark\Block\Element\StringContainerInterface; -use League\CommonMark\Event\DocumentParsedEvent; -use League\CommonMark\Event\DocumentPreParsedEvent; -use League\CommonMark\Input\MarkdownInput; - -final class DocParser implements DocParserInterface -{ - /** - * @var EnvironmentInterface - */ - private $environment; - - /** - * @var InlineParserEngine - */ - private $inlineParserEngine; - - /** - * @var int|float - */ - private $maxNestingLevel; - - /** - * @param EnvironmentInterface $environment - */ - public function __construct(EnvironmentInterface $environment) - { - $this->environment = $environment; - $this->inlineParserEngine = new InlineParserEngine($environment); - $this->maxNestingLevel = $environment->getConfig('max_nesting_level', \INF); - } - - /** - * @param string $input - * - * @throws \RuntimeException - * - * @return Document - */ - public function parse(string $input): Document - { - $document = new Document(); - - $preParsedEvent = new DocumentPreParsedEvent($document, new MarkdownInput($input)); - $this->environment->dispatch($preParsedEvent); - $markdown = $preParsedEvent->getMarkdown(); - - $context = new Context($document, $this->environment); - - foreach ($markdown->getLines() as $line) { - $context->setNextLine($line); - $this->incorporateLine($context); - } - - $lineCount = $markdown->getLineCount(); - while ($tip = $context->getTip()) { - $tip->finalize($context, $lineCount); - } - - $this->processInlines($context); - - $this->environment->dispatch(new DocumentParsedEvent($document)); - - return $document; - } - - private function incorporateLine(ContextInterface $context): void - { - $context->getBlockCloser()->resetTip(); - $context->setBlocksParsed(false); - - $cursor = new Cursor($context->getLine()); - - $this->resetContainer($context, $cursor); - $context->getBlockCloser()->setLastMatchedContainer($context->getContainer()); - - $this->parseBlocks($context, $cursor); - - // What remains at the offset is a text line. Add the text to the appropriate container. - // First check for a lazy paragraph continuation: - if ($this->handleLazyParagraphContinuation($context, $cursor)) { - return; - } - - // not a lazy continuation - // finalize any blocks not matched - $context->getBlockCloser()->closeUnmatchedBlocks(); - - // Determine whether the last line is blank, updating parents as needed - $this->setAndPropagateLastLineBlank($context, $cursor); - - // Handle any remaining cursor contents - if ($context->getContainer() instanceof StringContainerInterface) { - $context->getContainer()->handleRemainingContents($context, $cursor); - } elseif (!$cursor->isBlank()) { - // Create paragraph container for line - $p = new Paragraph(); - $context->addBlock($p); - $cursor->advanceToNextNonSpaceOrTab(); - $p->addLine($cursor->getRemainder()); - } - } - - private function processInlines(ContextInterface $context): void - { - $walker = $context->getDocument()->walker(); - - while ($event = $walker->next()) { - if (!$event->isEntering()) { - continue; - } - - $node = $event->getNode(); - if ($node instanceof AbstractStringContainerBlock) { - $this->inlineParserEngine->parse($node, $context->getDocument()->getReferenceMap()); - } - } - } - - /** - * Sets the container to the last open child (or its parent) - * - * @param ContextInterface $context - * @param Cursor $cursor - */ - private function resetContainer(ContextInterface $context, Cursor $cursor): void - { - $container = $context->getDocument(); - - while ($lastChild = $container->lastChild()) { - if (!($lastChild instanceof AbstractBlock)) { - break; - } - - if (!$lastChild->isOpen()) { - break; - } - - $container = $lastChild; - if (!$container->matchesNextLine($cursor)) { - $container = $container->parent(); // back up to the last matching block - break; - } - } - - $context->setContainer($container); - } - - /** - * Parse blocks - * - * @param ContextInterface $context - * @param Cursor $cursor - */ - private function parseBlocks(ContextInterface $context, Cursor $cursor): void - { - while (!$context->getContainer()->isCode() && !$context->getBlocksParsed()) { - $parsed = false; - foreach ($this->environment->getBlockParsers() as $parser) { - if ($parser->parse($context, $cursor)) { - $parsed = true; - break; - } - } - - if (!$parsed || $context->getContainer() instanceof StringContainerInterface || (($tip = $context->getTip()) && $tip->getDepth() >= $this->maxNestingLevel)) { - $context->setBlocksParsed(true); - break; - } - } - } - - private function handleLazyParagraphContinuation(ContextInterface $context, Cursor $cursor): bool - { - $tip = $context->getTip(); - - if ($tip instanceof Paragraph && - !$context->getBlockCloser()->areAllClosed() && - !$cursor->isBlank() && - \count($tip->getStrings()) > 0) { - - // lazy paragraph continuation - $tip->addLine($cursor->getRemainder()); - - return true; - } - - return false; - } - - private function setAndPropagateLastLineBlank(ContextInterface $context, Cursor $cursor): void - { - $container = $context->getContainer(); - - if ($cursor->isBlank() && $lastChild = $container->lastChild()) { - if ($lastChild instanceof AbstractBlock) { - $lastChild->setLastLineBlank(true); - } - } - - $lastLineBlank = $container->shouldLastLineBeBlank($cursor, $context->getLineNumber()); - - // Propagate lastLineBlank up through parents: - while ($container instanceof AbstractBlock && $container->endsWithBlankLine() !== $lastLineBlank) { - $container->setLastLineBlank($lastLineBlank); - $container = $container->parent(); - } - } -} diff --git a/vendor/league/commonmark/src/DocParserInterface.php b/vendor/league/commonmark/src/DocParserInterface.php deleted file mode 100644 index 23725ad476..0000000000 --- a/vendor/league/commonmark/src/DocParserInterface.php +++ /dev/null @@ -1,26 +0,0 @@ -<?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. - */ - -namespace League\CommonMark; - -use League\CommonMark\Block\Element\Document; - -interface DocParserInterface -{ - /** - * @param string $input - * - * @throws \RuntimeException - * - * @return Document - */ - public function parse(string $input): Document; -} diff --git a/vendor/league/commonmark/src/ElementRendererInterface.php b/vendor/league/commonmark/src/ElementRendererInterface.php deleted file mode 100644 index 86f28b3f50..0000000000 --- a/vendor/league/commonmark/src/ElementRendererInterface.php +++ /dev/null @@ -1,64 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark; - -use League\CommonMark\Block\Element\AbstractBlock; -use League\CommonMark\Inline\Element\AbstractInline; - -/** - * Renders a parsed AST to a string representation - */ -interface ElementRendererInterface -{ - /** - * @param string $option - * @param mixed $default - * - * @return mixed|null - */ - public function getOption(string $option, $default = null); - - /** - * @param AbstractInline $inline - * - * @return string - */ - public function renderInline(AbstractInline $inline): string; - - /** - * @param AbstractInline[] $inlines - * - * @return string - */ - public function renderInlines(iterable $inlines): string; - - /** - * @param AbstractBlock $block - * @param bool $inTightList - * - * @throws \RuntimeException - * - * @return string - */ - public function renderBlock(AbstractBlock $block, bool $inTightList = false): string; - - /** - * @param AbstractBlock[] $blocks - * @param bool $inTightList - * - * @return string - */ - public function renderBlocks(iterable $blocks, bool $inTightList = false): string; -} diff --git a/vendor/league/commonmark/src/Environment.php b/vendor/league/commonmark/src/Environment.php deleted file mode 100644 index 3943738630..0000000000 --- a/vendor/league/commonmark/src/Environment.php +++ /dev/null @@ -1,429 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark; - -use League\CommonMark\Block\Parser\BlockParserInterface; -use League\CommonMark\Block\Renderer\BlockRendererInterface; -use League\CommonMark\Delimiter\Processor\DelimiterProcessorCollection; -use League\CommonMark\Delimiter\Processor\DelimiterProcessorInterface; -use League\CommonMark\Event\AbstractEvent; -use League\CommonMark\Extension\CommonMarkCoreExtension; -use League\CommonMark\Extension\ExtensionInterface; -use League\CommonMark\Extension\GithubFlavoredMarkdownExtension; -use League\CommonMark\Inline\Parser\InlineParserInterface; -use League\CommonMark\Inline\Renderer\InlineRendererInterface; -use League\CommonMark\Util\Configuration; -use League\CommonMark\Util\ConfigurationAwareInterface; -use League\CommonMark\Util\PrioritizedList; - -final class Environment implements ConfigurableEnvironmentInterface -{ - /** - * @var ExtensionInterface[] - */ - private $extensions = []; - - /** - * @var ExtensionInterface[] - */ - private $uninitializedExtensions = []; - - /** - * @var bool - */ - private $extensionsInitialized = false; - - /** - * @var PrioritizedList<BlockParserInterface> - */ - private $blockParsers; - - /** - * @var PrioritizedList<InlineParserInterface> - */ - private $inlineParsers; - - /** - * @var array<string, PrioritizedList<InlineParserInterface>> - */ - private $inlineParsersByCharacter = []; - - /** - * @var DelimiterProcessorCollection - */ - private $delimiterProcessors; - - /** - * @var array<string, PrioritizedList<BlockRendererInterface>> - */ - private $blockRenderersByClass = []; - - /** - * @var array<string, PrioritizedList<InlineRendererInterface>> - */ - private $inlineRenderersByClass = []; - - /** - * @var array<string, PrioritizedList<callable>> - */ - private $listeners = []; - - /** - * @var Configuration - */ - private $config; - - /** - * @var string - */ - private $inlineParserCharacterRegex; - - /** - * @param array<string, mixed> $config - */ - public function __construct(array $config = []) - { - $this->config = new Configuration($config); - - $this->blockParsers = new PrioritizedList(); - $this->inlineParsers = new PrioritizedList(); - $this->delimiterProcessors = new DelimiterProcessorCollection(); - } - - public function mergeConfig(array $config = []) - { - $this->assertUninitialized('Failed to modify configuration.'); - - $this->config->merge($config); - } - - public function setConfig(array $config = []) - { - $this->assertUninitialized('Failed to modify configuration.'); - - $this->config->replace($config); - } - - public function getConfig($key = null, $default = null) - { - return $this->config->get($key, $default); - } - - public function addBlockParser(BlockParserInterface $parser, int $priority = 0): ConfigurableEnvironmentInterface - { - $this->assertUninitialized('Failed to add block parser.'); - - $this->blockParsers->add($parser, $priority); - $this->injectEnvironmentAndConfigurationIfNeeded($parser); - - return $this; - } - - public function addInlineParser(InlineParserInterface $parser, int $priority = 0): ConfigurableEnvironmentInterface - { - $this->assertUninitialized('Failed to add inline parser.'); - - $this->inlineParsers->add($parser, $priority); - $this->injectEnvironmentAndConfigurationIfNeeded($parser); - - foreach ($parser->getCharacters() as $character) { - if (!isset($this->inlineParsersByCharacter[$character])) { - $this->inlineParsersByCharacter[$character] = new PrioritizedList(); - } - - $this->inlineParsersByCharacter[$character]->add($parser, $priority); - } - - return $this; - } - - public function addDelimiterProcessor(DelimiterProcessorInterface $processor): ConfigurableEnvironmentInterface - { - $this->assertUninitialized('Failed to add delimiter processor.'); - $this->delimiterProcessors->add($processor); - $this->injectEnvironmentAndConfigurationIfNeeded($processor); - - return $this; - } - - public function addBlockRenderer($blockClass, BlockRendererInterface $blockRenderer, int $priority = 0): ConfigurableEnvironmentInterface - { - $this->assertUninitialized('Failed to add block renderer.'); - - if (!isset($this->blockRenderersByClass[$blockClass])) { - $this->blockRenderersByClass[$blockClass] = new PrioritizedList(); - } - - $this->blockRenderersByClass[$blockClass]->add($blockRenderer, $priority); - $this->injectEnvironmentAndConfigurationIfNeeded($blockRenderer); - - return $this; - } - - public function addInlineRenderer(string $inlineClass, InlineRendererInterface $renderer, int $priority = 0): ConfigurableEnvironmentInterface - { - $this->assertUninitialized('Failed to add inline renderer.'); - - if (!isset($this->inlineRenderersByClass[$inlineClass])) { - $this->inlineRenderersByClass[$inlineClass] = new PrioritizedList(); - } - - $this->inlineRenderersByClass[$inlineClass]->add($renderer, $priority); - $this->injectEnvironmentAndConfigurationIfNeeded($renderer); - - return $this; - } - - public function getBlockParsers(): iterable - { - if (!$this->extensionsInitialized) { - $this->initializeExtensions(); - } - - return $this->blockParsers->getIterator(); - } - - public function getInlineParsersForCharacter(string $character): iterable - { - if (!$this->extensionsInitialized) { - $this->initializeExtensions(); - } - - if (!isset($this->inlineParsersByCharacter[$character])) { - return []; - } - - return $this->inlineParsersByCharacter[$character]->getIterator(); - } - - public function getDelimiterProcessors(): DelimiterProcessorCollection - { - if (!$this->extensionsInitialized) { - $this->initializeExtensions(); - } - - return $this->delimiterProcessors; - } - - public function getBlockRenderersForClass(string $blockClass): iterable - { - if (!$this->extensionsInitialized) { - $this->initializeExtensions(); - } - - return $this->getRenderersByClass($this->blockRenderersByClass, $blockClass, BlockRendererInterface::class); - } - - public function getInlineRenderersForClass(string $inlineClass): iterable - { - if (!$this->extensionsInitialized) { - $this->initializeExtensions(); - } - - return $this->getRenderersByClass($this->inlineRenderersByClass, $inlineClass, InlineRendererInterface::class); - } - - /** - * Get all registered extensions - * - * @return ExtensionInterface[] - */ - public function getExtensions(): iterable - { - return $this->extensions; - } - - /** - * Add a single extension - * - * @param ExtensionInterface $extension - * - * @return $this - */ - public function addExtension(ExtensionInterface $extension): ConfigurableEnvironmentInterface - { - $this->assertUninitialized('Failed to add extension.'); - - $this->extensions[] = $extension; - $this->uninitializedExtensions[] = $extension; - - return $this; - } - - private function initializeExtensions(): void - { - // Ask all extensions to register their components - while (!empty($this->uninitializedExtensions)) { - foreach ($this->uninitializedExtensions as $i => $extension) { - $extension->register($this); - unset($this->uninitializedExtensions[$i]); - } - } - - $this->extensionsInitialized = true; - - // Lastly, let's build a regex which matches non-inline characters - // This will enable a huge performance boost with inline parsing - $this->buildInlineParserCharacterRegex(); - } - - /** - * @param object $object - */ - private function injectEnvironmentAndConfigurationIfNeeded($object): void - { - if ($object instanceof EnvironmentAwareInterface) { - $object->setEnvironment($this); - } - - if ($object instanceof ConfigurationAwareInterface) { - $object->setConfiguration($this->config); - } - } - - public static function createCommonMarkEnvironment(): ConfigurableEnvironmentInterface - { - $environment = new static(); - $environment->addExtension(new CommonMarkCoreExtension()); - $environment->mergeConfig([ - 'renderer' => [ - 'block_separator' => "\n", - 'inner_separator' => "\n", - 'soft_break' => "\n", - ], - 'html_input' => self::HTML_INPUT_ALLOW, - 'allow_unsafe_links' => true, - 'max_nesting_level' => \INF, - ]); - - return $environment; - } - - public static function createGFMEnvironment(): ConfigurableEnvironmentInterface - { - $environment = self::createCommonMarkEnvironment(); - $environment->addExtension(new GithubFlavoredMarkdownExtension()); - - return $environment; - } - - public function getInlineParserCharacterRegex(): string - { - return $this->inlineParserCharacterRegex; - } - - public function addEventListener(string $eventClass, callable $listener, int $priority = 0): ConfigurableEnvironmentInterface - { - $this->assertUninitialized('Failed to add event listener.'); - - if (!isset($this->listeners[$eventClass])) { - $this->listeners[$eventClass] = new PrioritizedList(); - } - - $this->listeners[$eventClass]->add($listener, $priority); - - if (\is_object($listener)) { - $this->injectEnvironmentAndConfigurationIfNeeded($listener); - } elseif (\is_array($listener) && \is_object($listener[0])) { - $this->injectEnvironmentAndConfigurationIfNeeded($listener[0]); - } - - return $this; - } - - public function dispatch(AbstractEvent $event): void - { - if (!$this->extensionsInitialized) { - $this->initializeExtensions(); - } - - $type = \get_class($event); - - foreach ($this->listeners[$type] ?? [] as $listener) { - if ($event->isPropagationStopped()) { - return; - } - - $listener($event); - } - } - - private function buildInlineParserCharacterRegex(): void - { - $chars = \array_unique(\array_merge( - \array_keys($this->inlineParsersByCharacter), - $this->delimiterProcessors->getDelimiterCharacters() - )); - - if (empty($chars)) { - // If no special inline characters exist then parse the whole line - $this->inlineParserCharacterRegex = '/^.+$/'; - } else { - // Match any character which inline parsers are not interested in - $this->inlineParserCharacterRegex = '/^[^' . \preg_quote(\implode('', $chars), '/') . ']+/'; - - // Only add the u modifier (which slows down performance) if we have a multi-byte UTF-8 character in our regex - if (\strlen($this->inlineParserCharacterRegex) > \mb_strlen($this->inlineParserCharacterRegex)) { - $this->inlineParserCharacterRegex .= 'u'; - } - } - } - - /** - * @param string $message - * - * @throws \RuntimeException - */ - private function assertUninitialized(string $message): void - { - if ($this->extensionsInitialized) { - throw new \RuntimeException($message . ' Extensions have already been initialized.'); - } - } - - /** - * @param array<string, PrioritizedList> $list - * @param string $class - * @param string $type - * - * @return iterable - * - * @phpstan-template T - * - * @phpstan-param array<string, PrioritizedList<T>> $list - * @phpstan-param string $class - * @phpstan-param class-string<T> $type - * - * @phpstan-return iterable<T> - */ - private function getRenderersByClass(array &$list, string $class, string $type): iterable - { - // If renderers are defined for this specific class, return them immediately - if (isset($list[$class])) { - return $list[$class]; - } - - while (\class_exists($parent = $parent ?? $class) && $parent = \get_parent_class($parent)) { - if (!isset($list[$parent])) { - continue; - } - - // "Cache" this result to avoid future loops - return $list[$class] = $list[$parent]; - } - - return []; - } -} diff --git a/vendor/league/commonmark/src/EnvironmentAwareInterface.php b/vendor/league/commonmark/src/EnvironmentAwareInterface.php deleted file mode 100644 index dfe3978d3f..0000000000 --- a/vendor/league/commonmark/src/EnvironmentAwareInterface.php +++ /dev/null @@ -1,22 +0,0 @@ -<?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. - */ - -namespace League\CommonMark; - -interface EnvironmentAwareInterface -{ - /** - * @param EnvironmentInterface $environment - * - * @return void - */ - public function setEnvironment(EnvironmentInterface $environment); -} diff --git a/vendor/league/commonmark/src/EnvironmentInterface.php b/vendor/league/commonmark/src/EnvironmentInterface.php deleted file mode 100644 index c0f53fcfa1..0000000000 --- a/vendor/league/commonmark/src/EnvironmentInterface.php +++ /dev/null @@ -1,83 +0,0 @@ -<?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. - */ - -namespace League\CommonMark; - -use League\CommonMark\Block\Parser\BlockParserInterface; -use League\CommonMark\Block\Renderer\BlockRendererInterface; -use League\CommonMark\Delimiter\Processor\DelimiterProcessorCollection; -use League\CommonMark\Event\AbstractEvent; -use League\CommonMark\Inline\Parser\InlineParserInterface; -use League\CommonMark\Inline\Renderer\InlineRendererInterface; - -interface EnvironmentInterface -{ - const HTML_INPUT_STRIP = 'strip'; - const HTML_INPUT_ALLOW = 'allow'; - const HTML_INPUT_ESCAPE = 'escape'; - - /** - * @param string|null $key - * @param mixed $default - * - * @return mixed - */ - public function getConfig($key = null, $default = null); - - /** - * @return iterable<BlockParserInterface> - */ - public function getBlockParsers(): iterable; - - /** - * @param string $character - * - * @return iterable<InlineParserInterface> - */ - public function getInlineParsersForCharacter(string $character): iterable; - - /** - * @return DelimiterProcessorCollection - */ - public function getDelimiterProcessors(): DelimiterProcessorCollection; - - /** - * @param string $blockClass - * - * @return iterable<BlockRendererInterface> - */ - public function getBlockRenderersForClass(string $blockClass): iterable; - - /** - * @param string $inlineClass - * - * @return iterable<InlineRendererInterface> - */ - public function getInlineRenderersForClass(string $inlineClass): iterable; - - /** - * Regex which matches any character which doesn't indicate an inline element - * - * This allows us to parse multiple non-special characters at once - * - * @return string - */ - public function getInlineParserCharacterRegex(): string; - - /** - * Dispatches the given event to listeners - * - * @param AbstractEvent $event - * - * @return void - */ - public function dispatch(AbstractEvent $event): void; -} diff --git a/vendor/league/commonmark/src/Event/AbstractEvent.php b/vendor/league/commonmark/src/Event/AbstractEvent.php deleted file mode 100644 index 1ab2cc3a4b..0000000000 --- a/vendor/league/commonmark/src/Event/AbstractEvent.php +++ /dev/null @@ -1,50 +0,0 @@ -<?php - -/** - * 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; - -/** - * 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 -{ - /** @var bool */ - private $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; - } -} diff --git a/vendor/league/commonmark/src/Event/DocumentParsedEvent.php b/vendor/league/commonmark/src/Event/DocumentParsedEvent.php deleted file mode 100644 index ad5a9d4bf7..0000000000 --- a/vendor/league/commonmark/src/Event/DocumentParsedEvent.php +++ /dev/null @@ -1,33 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Event; - -use League\CommonMark\Block\Element\Document; - -/** - * Event dispatched when the document has been fully parsed - */ -final class DocumentParsedEvent extends AbstractEvent -{ - /** @var Document */ - private $document; - - public function __construct(Document $document) - { - $this->document = $document; - } - - public function getDocument(): Document - { - return $this->document; - } -} diff --git a/vendor/league/commonmark/src/Event/DocumentPreParsedEvent.php b/vendor/league/commonmark/src/Event/DocumentPreParsedEvent.php deleted file mode 100644 index b9d897e657..0000000000 --- a/vendor/league/commonmark/src/Event/DocumentPreParsedEvent.php +++ /dev/null @@ -1,48 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Event; - -use League\CommonMark\Block\Element\Document; -use League\CommonMark\Input\MarkdownInputInterface; - -/** - * Event dispatched when the document is about to be parsed - */ -final class DocumentPreParsedEvent extends AbstractEvent -{ - /** @var Document */ - private $document; - - /** @var MarkdownInputInterface */ - private $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; - } -} diff --git a/vendor/league/commonmark/src/Exception/InvalidOptionException.php b/vendor/league/commonmark/src/Exception/InvalidOptionException.php deleted file mode 100644 index 610dde51cb..0000000000 --- a/vendor/league/commonmark/src/Exception/InvalidOptionException.php +++ /dev/null @@ -1,16 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Exception; - -final class InvalidOptionException extends \RuntimeException -{ -} diff --git a/vendor/league/commonmark/src/Exception/UnexpectedEncodingException.php b/vendor/league/commonmark/src/Exception/UnexpectedEncodingException.php deleted file mode 100644 index ada054bc90..0000000000 --- a/vendor/league/commonmark/src/Exception/UnexpectedEncodingException.php +++ /dev/null @@ -1,16 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Exception; - -final class UnexpectedEncodingException extends \RuntimeException -{ -} diff --git a/vendor/league/commonmark/src/Extension/Attributes/AttributesExtension.php b/vendor/league/commonmark/src/Extension/Attributes/AttributesExtension.php deleted file mode 100644 index f98ac26acd..0000000000 --- a/vendor/league/commonmark/src/Extension/Attributes/AttributesExtension.php +++ /dev/null @@ -1,32 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * (c) 2015 Martin Hasoň <martin.hason@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\Extension\Attributes; - -use League\CommonMark\ConfigurableEnvironmentInterface; -use League\CommonMark\Event\DocumentParsedEvent; -use League\CommonMark\Extension\Attributes\Event\AttributesListener; -use League\CommonMark\Extension\Attributes\Parser\AttributesBlockParser; -use League\CommonMark\Extension\Attributes\Parser\AttributesInlineParser; -use League\CommonMark\Extension\ExtensionInterface; - -final class AttributesExtension implements ExtensionInterface -{ - public function register(ConfigurableEnvironmentInterface $environment) - { - $environment->addBlockParser(new AttributesBlockParser()); - $environment->addInlineParser(new AttributesInlineParser()); - $environment->addEventListener(DocumentParsedEvent::class, [new AttributesListener(), 'processDocument']); - } -} diff --git a/vendor/league/commonmark/src/Extension/Attributes/Event/AttributesListener.php b/vendor/league/commonmark/src/Extension/Attributes/Event/AttributesListener.php deleted file mode 100644 index c83ccc7404..0000000000 --- a/vendor/league/commonmark/src/Extension/Attributes/Event/AttributesListener.php +++ /dev/null @@ -1,141 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * (c) 2015 Martin Hasoň <martin.hason@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\Extension\Attributes\Event; - -use League\CommonMark\Block\Element\AbstractBlock; -use League\CommonMark\Block\Element\FencedCode; -use League\CommonMark\Block\Element\ListBlock; -use League\CommonMark\Block\Element\ListItem; -use League\CommonMark\Event\DocumentParsedEvent; -use League\CommonMark\Extension\Attributes\Node\Attributes; -use League\CommonMark\Extension\Attributes\Node\AttributesInline; -use League\CommonMark\Extension\Attributes\Util\AttributesHelper; -use League\CommonMark\Inline\Element\AbstractInline; -use League\CommonMark\Node\Node; - -final class AttributesListener -{ - private const DIRECTION_PREFIX = 'prefix'; - private const DIRECTION_SUFFIX = 'suffix'; - - public function processDocument(DocumentParsedEvent $event): void - { - $walker = $event->getDocument()->walker(); - while ($event = $walker->next()) { - $node = $event->getNode(); - if (!$node instanceof AttributesInline && ($event->isEntering() || !$node instanceof Attributes)) { - continue; - } - - [$target, $direction] = self::findTargetAndDirection($node); - - if ($target instanceof AbstractBlock || $target instanceof AbstractInline) { - $parent = $target->parent(); - if ($parent instanceof ListItem && $parent->parent() instanceof ListBlock && $parent->parent()->isTight()) { - $target = $parent; - } - - if ($direction === self::DIRECTION_SUFFIX) { - $attributes = AttributesHelper::mergeAttributes($target, $node->getAttributes()); - } else { - $attributes = AttributesHelper::mergeAttributes($node->getAttributes(), $target); - } - - $target->data['attributes'] = $attributes; - } - - if ($node instanceof AbstractBlock && $node->endsWithBlankLine() && $node->next() && $node->previous()) { - $previous = $node->previous(); - if ($previous instanceof AbstractBlock) { - $previous->setLastLineBlank(true); - } - } - - $node->detach(); - } - } - - /** - * @param Node $node - * - * @return array<Node|string|null> - */ - private static function findTargetAndDirection(Node $node): array - { - $target = null; - $direction = null; - $previous = $next = $node; - while (true) { - $previous = self::getPrevious($previous); - $next = self::getNext($next); - - if ($previous === null && $next === null) { - if (!$node->parent() instanceof FencedCode) { - $target = $node->parent(); - $direction = self::DIRECTION_SUFFIX; - } - - break; - } - - if ($node instanceof AttributesInline && ($previous === null || ($previous instanceof AbstractInline && $node->isBlock()))) { - continue; - } - - if ($previous !== null && !self::isAttributesNode($previous)) { - $target = $previous; - $direction = self::DIRECTION_SUFFIX; - - break; - } - - if ($next !== null && !self::isAttributesNode($next)) { - $target = $next; - $direction = self::DIRECTION_PREFIX; - - break; - } - } - - return [$target, $direction]; - } - - private static function getPrevious(?Node $node = null): ?Node - { - $previous = $node instanceof Node ? $node->previous() : null; - - if ($previous instanceof AbstractBlock && $previous->endsWithBlankLine()) { - $previous = null; - } - - return $previous; - } - - private static function getNext(?Node $node = null): ?Node - { - $next = $node instanceof Node ? $node->next() : null; - - if ($node instanceof AbstractBlock && $node->endsWithBlankLine()) { - $next = null; - } - - return $next; - } - - private static function isAttributesNode(Node $node): bool - { - return $node instanceof Attributes || $node instanceof AttributesInline; - } -} diff --git a/vendor/league/commonmark/src/Extension/Attributes/Node/Attributes.php b/vendor/league/commonmark/src/Extension/Attributes/Node/Attributes.php deleted file mode 100644 index 13cd5fe28d..0000000000 --- a/vendor/league/commonmark/src/Extension/Attributes/Node/Attributes.php +++ /dev/null @@ -1,62 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * (c) 2015 Martin Hasoň <martin.hason@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\Extension\Attributes\Node; - -use League\CommonMark\Block\Element\AbstractBlock; -use League\CommonMark\Cursor; - -final class Attributes extends AbstractBlock -{ - /** @var array<string, mixed> */ - private $attributes; - - /** - * @param array<string, mixed> $attributes - */ - public function __construct(array $attributes) - { - $this->attributes = $attributes; - } - - /** - * @return array<string, mixed> - */ - public function getAttributes(): array - { - return $this->attributes; - } - - public function canContain(AbstractBlock $block): bool - { - return false; - } - - public function isCode(): bool - { - return false; - } - - public function matchesNextLine(Cursor $cursor): bool - { - $this->setLastLineBlank($cursor->isBlank()); - - return false; - } - - public function shouldLastLineBeBlank(Cursor $cursor, int $currentLineNumber): bool - { - return false; - } -} diff --git a/vendor/league/commonmark/src/Extension/Attributes/Node/AttributesInline.php b/vendor/league/commonmark/src/Extension/Attributes/Node/AttributesInline.php deleted file mode 100644 index 01cfa1825c..0000000000 --- a/vendor/league/commonmark/src/Extension/Attributes/Node/AttributesInline.php +++ /dev/null @@ -1,50 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * (c) 2015 Martin Hasoň <martin.hason@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\Extension\Attributes\Node; - -use League\CommonMark\Inline\Element\AbstractInline; - -final class AttributesInline extends AbstractInline -{ - /** @var array<string, mixed> */ - public $attributes; - - /** @var bool */ - public $block; - - /** - * @param array<string, mixed> $attributes - * @param bool $block - */ - public function __construct(array $attributes, bool $block) - { - $this->attributes = $attributes; - $this->block = $block; - $this->data = ['delim' => true]; // TODO: Re-implement as a delimiter? - } - - /** - * @return array<string, mixed> - */ - public function getAttributes(): array - { - return $this->attributes; - } - - public function isBlock(): bool - { - return $this->block; - } -} diff --git a/vendor/league/commonmark/src/Extension/Attributes/Parser/AttributesBlockParser.php b/vendor/league/commonmark/src/Extension/Attributes/Parser/AttributesBlockParser.php deleted file mode 100644 index 6eb4b74353..0000000000 --- a/vendor/league/commonmark/src/Extension/Attributes/Parser/AttributesBlockParser.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * (c) 2015 Martin Hasoň <martin.hason@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\Extension\Attributes\Parser; - -use League\CommonMark\Block\Parser\BlockParserInterface; -use League\CommonMark\ContextInterface; -use League\CommonMark\Cursor; -use League\CommonMark\Extension\Attributes\Node\Attributes; -use League\CommonMark\Extension\Attributes\Util\AttributesHelper; - -final class AttributesBlockParser implements BlockParserInterface -{ - public function parse(ContextInterface $context, Cursor $cursor): bool - { - $state = $cursor->saveState(); - $attributes = AttributesHelper::parseAttributes($cursor); - if ($attributes === []) { - return false; - } - - if ($cursor->getNextNonSpaceCharacter() !== null) { - $cursor->restoreState($state); - - return false; - } - - $context->addBlock(new Attributes($attributes)); - $context->setBlocksParsed(true); - - return true; - } -} diff --git a/vendor/league/commonmark/src/Extension/Attributes/Parser/AttributesInlineParser.php b/vendor/league/commonmark/src/Extension/Attributes/Parser/AttributesInlineParser.php deleted file mode 100644 index d7cf02b253..0000000000 --- a/vendor/league/commonmark/src/Extension/Attributes/Parser/AttributesInlineParser.php +++ /dev/null @@ -1,58 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * (c) 2015 Martin Hasoň <martin.hason@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\Extension\Attributes\Parser; - -use League\CommonMark\Extension\Attributes\Node\AttributesInline; -use League\CommonMark\Extension\Attributes\Util\AttributesHelper; -use League\CommonMark\Inline\Parser\InlineParserInterface; -use League\CommonMark\InlineParserContext; - -final class AttributesInlineParser implements InlineParserInterface -{ - /** - * {@inheritdoc} - */ - public function getCharacters(): array - { - return [' ', '{']; - } - - public function parse(InlineParserContext $inlineContext): bool - { - $cursor = $inlineContext->getCursor(); - if ($cursor->getNextNonSpaceCharacter() !== '{') { - return false; - } - - $char = $cursor->getCharacter(); - if ($char === '{') { - $char = (string) $cursor->getCharacter($cursor->getPosition() - 1); - } - - $attributes = AttributesHelper::parseAttributes($cursor); - if ($attributes === []) { - return false; - } - - if ($char === '') { - $cursor->advanceToNextNonSpaceOrNewline(); - } - - $node = new AttributesInline($attributes, $char === ' ' || $char === ''); - $inlineContext->getContainer()->appendChild($node); - - return true; - } -} diff --git a/vendor/league/commonmark/src/Extension/Attributes/Util/AttributesHelper.php b/vendor/league/commonmark/src/Extension/Attributes/Util/AttributesHelper.php deleted file mode 100644 index 8649abfe9c..0000000000 --- a/vendor/league/commonmark/src/Extension/Attributes/Util/AttributesHelper.php +++ /dev/null @@ -1,130 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * (c) 2015 Martin Hasoň <martin.hason@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\Extension\Attributes\Util; - -use League\CommonMark\Block\Element\AbstractBlock; -use League\CommonMark\Cursor; -use League\CommonMark\Inline\Element\AbstractInline; -use League\CommonMark\Util\RegexHelper; - -/** - * @internal - */ -final class AttributesHelper -{ - /** - * @param Cursor $cursor - * - * @return array<string, mixed> - */ - public static function parseAttributes(Cursor $cursor): array - { - $state = $cursor->saveState(); - $cursor->advanceToNextNonSpaceOrNewline(); - if ($cursor->getCharacter() !== '{') { - $cursor->restoreState($state); - - return []; - } - - $cursor->advanceBy(1); - if ($cursor->getCharacter() === ':') { - $cursor->advanceBy(1); - } - - $attributes = []; - $regex = '/^\s*([.#][_a-z0-9-]+|' . RegexHelper::PARTIAL_ATTRIBUTENAME . RegexHelper::PARTIAL_ATTRIBUTEVALUESPEC . ')(?<!})\s*/i'; - while ($attribute = \trim((string) $cursor->match($regex))) { - if ($attribute[0] === '#') { - $attributes['id'] = \substr($attribute, 1); - - continue; - } - - if ($attribute[0] === '.') { - $attributes['class'][] = \substr($attribute, 1); - - continue; - } - - [$name, $value] = \explode('=', $attribute, 2); - $first = $value[0]; - $last = \substr($value, -1); - if ((($first === '"' && $last === '"') || ($first === "'" && $last === "'")) && \strlen($value) > 1) { - $value = \substr($value, 1, -1); - } - - if (\strtolower(\trim($name)) === 'class') { - foreach (\array_filter(\explode(' ', \trim($value))) as $class) { - $attributes['class'][] = $class; - } - } else { - $attributes[trim($name)] = trim($value); - } - } - - if ($cursor->match('/}/') === null) { - $cursor->restoreState($state); - - return []; - } - - if ($attributes === []) { - $cursor->restoreState($state); - - return []; - } - - if (isset($attributes['class'])) { - $attributes['class'] = \implode(' ', (array) $attributes['class']); - } - - return $attributes; - } - - /** - * @param AbstractBlock|AbstractInline|array<string, mixed> $attributes1 - * @param AbstractBlock|AbstractInline|array<string, mixed> $attributes2 - * - * @return array<string, mixed> - */ - public static function mergeAttributes($attributes1, $attributes2): array - { - $attributes = []; - foreach ([$attributes1, $attributes2] as $arg) { - if ($arg instanceof AbstractBlock || $arg instanceof AbstractInline) { - $arg = $arg->data['attributes'] ?? []; - } - - /** @var array<string, mixed> $arg */ - $arg = (array) $arg; - if (isset($arg['class'])) { - foreach (\array_filter(\explode(' ', \trim($arg['class']))) as $class) { - $attributes['class'][] = $class; - } - - unset($arg['class']); - } - - $attributes = \array_merge($attributes, $arg); - } - - if (isset($attributes['class'])) { - $attributes['class'] = \implode(' ', $attributes['class']); - } - - return $attributes; - } -} diff --git a/vendor/league/commonmark/src/Extension/Autolink/AutolinkExtension.php b/vendor/league/commonmark/src/Extension/Autolink/AutolinkExtension.php deleted file mode 100644 index 76ab3dcc2e..0000000000 --- a/vendor/league/commonmark/src/Extension/Autolink/AutolinkExtension.php +++ /dev/null @@ -1,25 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension\Autolink; - -use League\CommonMark\ConfigurableEnvironmentInterface; -use League\CommonMark\Event\DocumentParsedEvent; -use League\CommonMark\Extension\ExtensionInterface; - -final class AutolinkExtension implements ExtensionInterface -{ - public function register(ConfigurableEnvironmentInterface $environment) - { - $environment->addEventListener(DocumentParsedEvent::class, new EmailAutolinkProcessor()); - $environment->addEventListener(DocumentParsedEvent::class, new UrlAutolinkProcessor()); - } -} diff --git a/vendor/league/commonmark/src/Extension/Autolink/EmailAutolinkProcessor.php b/vendor/league/commonmark/src/Extension/Autolink/EmailAutolinkProcessor.php deleted file mode 100644 index 81be4160c0..0000000000 --- a/vendor/league/commonmark/src/Extension/Autolink/EmailAutolinkProcessor.php +++ /dev/null @@ -1,78 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension\Autolink; - -use League\CommonMark\Event\DocumentParsedEvent; -use League\CommonMark\Inline\Element\Link; -use League\CommonMark\Inline\Element\Text; - -final class EmailAutolinkProcessor -{ - const REGEX = '/([A-Za-z0-9.\-_+]+@[A-Za-z0-9\-_]+\.[A-Za-z0-9\-_.]+)/'; - - /** - * @param DocumentParsedEvent $e - * - * @return void - */ - public function __invoke(DocumentParsedEvent $e) - { - $walker = $e->getDocument()->walker(); - - while ($event = $walker->next()) { - $node = $event->getNode(); - if ($node instanceof Text && !($node->parent() instanceof Link)) { - self::processAutolinks($node); - } - } - } - - private static function processAutolinks(Text $node): void - { - $contents = \preg_split(self::REGEX, $node->getContent(), -1, PREG_SPLIT_DELIM_CAPTURE); - - if ($contents === false || \count($contents) === 1) { - return; - } - - $leftovers = ''; - foreach ($contents as $i => $content) { - if ($i % 2 === 0) { - $text = $leftovers . $content; - if ($text !== '') { - $node->insertBefore(new Text($leftovers . $content)); - } - - $leftovers = ''; - continue; - } - - // Does the URL end with punctuation that should be stripped? - if (\substr($content, -1) === '.') { - // Add the punctuation later - $content = \substr($content, 0, -1); - $leftovers = '.'; - } - - // The last character cannot be - or _ - if (\in_array(\substr($content, -1), ['-', '_'])) { - $node->insertBefore(new Text($content . $leftovers)); - $leftovers = ''; - continue; - } - - $node->insertBefore(new Link('mailto:' . $content, $content)); - } - - $node->detach(); - } -} diff --git a/vendor/league/commonmark/src/Extension/Autolink/InlineMentionParser.php b/vendor/league/commonmark/src/Extension/Autolink/InlineMentionParser.php deleted file mode 100644 index 99e068a6d6..0000000000 --- a/vendor/league/commonmark/src/Extension/Autolink/InlineMentionParser.php +++ /dev/null @@ -1,96 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension\Autolink; - -use League\CommonMark\Extension\Mention\MentionParser; -use League\CommonMark\Inline\Element\Link; -use League\CommonMark\Inline\Parser\InlineParserInterface; -use League\CommonMark\InlineParserContext; - -@trigger_error(sprintf('%s is deprecated; use %s instead', InlineMentionParser::class, MentionParser::class), E_USER_DEPRECATED); - -/** - * @deprecated Use MentionParser instead - */ -final class InlineMentionParser implements InlineParserInterface -{ - /** @var string */ - private $linkPattern; - - /** @var string */ - private $handleRegex; - - /** - * @param string $linkPattern - * @param string $handleRegex - */ - public function __construct($linkPattern, $handleRegex = '/^[A-Za-z0-9_]+(?!\w)/') - { - $this->linkPattern = $linkPattern; - $this->handleRegex = $handleRegex; - } - - public function getCharacters(): array - { - return ['@']; - } - - public function parse(InlineParserContext $inlineContext): bool - { - $cursor = $inlineContext->getCursor(); - - // The @ symbol must not have any other characters immediately prior - $previousChar = $cursor->peek(-1); - if ($previousChar !== null && $previousChar !== ' ') { - // peek() doesn't modify the cursor, so no need to restore state first - return false; - } - - // Save the cursor state in case we need to rewind and bail - $previousState = $cursor->saveState(); - - // Advance past the @ symbol to keep parsing simpler - $cursor->advance(); - - // Parse the handle - $handle = $cursor->match($this->handleRegex); - if (empty($handle)) { - // Regex failed to match; this isn't a valid Twitter handle - $cursor->restoreState($previousState); - - return false; - } - - $url = \sprintf($this->linkPattern, $handle); - - $inlineContext->getContainer()->appendChild(new Link($url, '@' . $handle)); - - return true; - } - - /** - * @return InlineMentionParser - */ - public static function createTwitterHandleParser() - { - return new self('https://twitter.com/%s', '/^[A-Za-z0-9_]{1,15}(?!\w)/'); - } - - /** - * @return InlineMentionParser - */ - public static function createGithubHandleParser() - { - // RegEx adapted from https://github.com/shinnn/github-username-regex/blob/master/index.js - return new self('https://www.github.com/%s', '/^[a-z\d](?:[a-z\d]|-(?=[a-z\d])){0,38}(?!\w)/'); - } -} diff --git a/vendor/league/commonmark/src/Extension/Autolink/UrlAutolinkProcessor.php b/vendor/league/commonmark/src/Extension/Autolink/UrlAutolinkProcessor.php deleted file mode 100644 index b5d12fbe68..0000000000 --- a/vendor/league/commonmark/src/Extension/Autolink/UrlAutolinkProcessor.php +++ /dev/null @@ -1,153 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension\Autolink; - -use League\CommonMark\Event\DocumentParsedEvent; -use League\CommonMark\Inline\Element\Link; -use League\CommonMark\Inline\Element\Text; - -final class UrlAutolinkProcessor -{ - // RegEx adapted from https://github.com/symfony/symfony/blob/4.2/src/Symfony/Component/Validator/Constraints/UrlValidator.php - const REGEX = '~ - (?<=^|[ \\t\\n\\x0b\\x0c\\x0d*_\\~\\(]) # Can only come at the beginning of a line, after whitespace, or certain delimiting characters - ( - # Must start with a supported scheme + auth, or "www" - (?: - (?:%s):// # protocol - (?:([\.\pL\pN-]+:)?([\.\pL\pN-]+)@)? # basic auth - |www\.) - (?: - (?:[\pL\pN\pS\-\.])+(?:\.?(?:[\pL\pN]|xn\-\-[\pL\pN-]+)+\.?) # a domain name - | # or - \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} # an IP address - | # or - \[ - (?:(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){6})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:::(?:(?:(?:[0-9a-f]{1,4})):){5})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){4})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,1}(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){3})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,2}(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){2})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,3}(?:(?:[0-9a-f]{1,4})))?::(?:(?:[0-9a-f]{1,4})):)(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,4}(?:(?:[0-9a-f]{1,4})))?::)(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,5}(?:(?:[0-9a-f]{1,4})))?::)(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,6}(?:(?:[0-9a-f]{1,4})))?::)))) - \] # an IPv6 address - ) - (?::[0-9]+)? # a port (optional) - (?:/ (?:[\pL\pN\-._\~!$&\'()*+,;=:@]|%%[0-9A-Fa-f]{2})* )* # a path - (?:\? (?:[\pL\pN\-._\~!$&\'()*+,;=:@/?]|%%[0-9A-Fa-f]{2})* )? # a query (optional) - (?:\# (?:[\pL\pN\-._\~!$&\'()*+,;=:@/?]|%%[0-9A-Fa-f]{2})* )? # a fragment (optional) - )~ixu'; - - /** @var string */ - private $finalRegex; - - /** - * @param array<int, string> $allowedProtocols - */ - public function __construct(array $allowedProtocols = ['http', 'https', 'ftp']) - { - $this->finalRegex = \sprintf(self::REGEX, \implode('|', $allowedProtocols)); - } - - /** - * @param DocumentParsedEvent $e - * - * @return void - */ - public function __invoke(DocumentParsedEvent $e) - { - $walker = $e->getDocument()->walker(); - - while ($event = $walker->next()) { - $node = $event->getNode(); - if ($node instanceof Text && !($node->parent() instanceof Link)) { - self::processAutolinks($node, $this->finalRegex); - } - } - } - - private static function processAutolinks(Text $node, string $regex): void - { - $contents = \preg_split($regex, $node->getContent(), -1, PREG_SPLIT_DELIM_CAPTURE); - - if ($contents === false || \count($contents) === 1) { - return; - } - - $leftovers = ''; - foreach ($contents as $i => $content) { - // Even-indexed elements are things before/after the URLs - if ($i % 2 === 0) { - // Insert any left-over characters here as well - $text = $leftovers . $content; - if ($text !== '') { - $node->insertBefore(new Text($leftovers . $content)); - } - - $leftovers = ''; - continue; - } - - $leftovers = ''; - - // Does the URL end with punctuation that should be stripped? - if (\preg_match('/(.+)([?!.,:*_~]+)$/', $content, $matches)) { - // Add the punctuation later - $content = $matches[1]; - $leftovers = $matches[2]; - } - - // Does the URL end with something that looks like an entity reference? - if (\preg_match('/(.+)(&[A-Za-z0-9]+;)$/', $content, $matches)) { - $content = $matches[1]; - $leftovers = $matches[2] . $leftovers; - } - - // Does the URL need its closing paren chopped off? - if (\substr($content, -1) === ')' && ($diff = self::diffParens($content)) > 0) { - $content = \substr($content, 0, -$diff); - $leftovers = str_repeat(')', $diff) . $leftovers; - } - - self::addLink($node, $content); - } - - $node->detach(); - } - - private static function addLink(Text $node, string $url): void - { - // Auto-prefix 'http://' onto 'www' URLs - if (\substr($url, 0, 4) === 'www.') { - $node->insertBefore(new Link('http://' . $url, $url)); - - return; - } - - $node->insertBefore(new Link($url, $url)); - } - - /** - * @param string $content - * - * @return int - */ - private static function diffParens(string $content): int - { - // Scan the entire autolink for the total number of parentheses. - // If there is a greater number of closing parentheses than opening ones, - // we don’t consider ANY of the last characters as part of the autolink, - // in order to facilitate including an autolink inside a parenthesis. - \preg_match_all('/[()]/', $content, $matches); - - $charCount = ['(' => 0, ')' => 0]; - foreach ($matches[0] as $char) { - $charCount[$char]++; - } - - return $charCount[')'] - $charCount['(']; - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMarkCoreExtension.php b/vendor/league/commonmark/src/Extension/CommonMarkCoreExtension.php deleted file mode 100644 index 903e8991a0..0000000000 --- a/vendor/league/commonmark/src/Extension/CommonMarkCoreExtension.php +++ /dev/null @@ -1,80 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension; - -use League\CommonMark\Block\Element as BlockElement; -use League\CommonMark\Block\Parser as BlockParser; -use League\CommonMark\Block\Renderer as BlockRenderer; -use League\CommonMark\ConfigurableEnvironmentInterface; -use League\CommonMark\Delimiter\Processor\EmphasisDelimiterProcessor; -use League\CommonMark\Inline\Element as InlineElement; -use League\CommonMark\Inline\Parser as InlineParser; -use League\CommonMark\Inline\Renderer as InlineRenderer; - -final class CommonMarkCoreExtension implements ExtensionInterface -{ - public function register(ConfigurableEnvironmentInterface $environment) - { - $environment - ->addBlockParser(new BlockParser\BlockQuoteParser(), 70) - ->addBlockParser(new BlockParser\ATXHeadingParser(), 60) - ->addBlockParser(new BlockParser\FencedCodeParser(), 50) - ->addBlockParser(new BlockParser\HtmlBlockParser(), 40) - ->addBlockParser(new BlockParser\SetExtHeadingParser(), 30) - ->addBlockParser(new BlockParser\ThematicBreakParser(), 20) - ->addBlockParser(new BlockParser\ListParser(), 10) - ->addBlockParser(new BlockParser\IndentedCodeParser(), -100) - ->addBlockParser(new BlockParser\LazyParagraphParser(), -200) - - ->addInlineParser(new InlineParser\NewlineParser(), 200) - ->addInlineParser(new InlineParser\BacktickParser(), 150) - ->addInlineParser(new InlineParser\EscapableParser(), 80) - ->addInlineParser(new InlineParser\EntityParser(), 70) - ->addInlineParser(new InlineParser\AutolinkParser(), 50) - ->addInlineParser(new InlineParser\HtmlInlineParser(), 40) - ->addInlineParser(new InlineParser\CloseBracketParser(), 30) - ->addInlineParser(new InlineParser\OpenBracketParser(), 20) - ->addInlineParser(new InlineParser\BangParser(), 10) - - ->addBlockRenderer(BlockElement\BlockQuote::class, new BlockRenderer\BlockQuoteRenderer(), 0) - ->addBlockRenderer(BlockElement\Document::class, new BlockRenderer\DocumentRenderer(), 0) - ->addBlockRenderer(BlockElement\FencedCode::class, new BlockRenderer\FencedCodeRenderer(), 0) - ->addBlockRenderer(BlockElement\Heading::class, new BlockRenderer\HeadingRenderer(), 0) - ->addBlockRenderer(BlockElement\HtmlBlock::class, new BlockRenderer\HtmlBlockRenderer(), 0) - ->addBlockRenderer(BlockElement\IndentedCode::class, new BlockRenderer\IndentedCodeRenderer(), 0) - ->addBlockRenderer(BlockElement\ListBlock::class, new BlockRenderer\ListBlockRenderer(), 0) - ->addBlockRenderer(BlockElement\ListItem::class, new BlockRenderer\ListItemRenderer(), 0) - ->addBlockRenderer(BlockElement\Paragraph::class, new BlockRenderer\ParagraphRenderer(), 0) - ->addBlockRenderer(BlockElement\ThematicBreak::class, new BlockRenderer\ThematicBreakRenderer(), 0) - - ->addInlineRenderer(InlineElement\Code::class, new InlineRenderer\CodeRenderer(), 0) - ->addInlineRenderer(InlineElement\Emphasis::class, new InlineRenderer\EmphasisRenderer(), 0) - ->addInlineRenderer(InlineElement\HtmlInline::class, new InlineRenderer\HtmlInlineRenderer(), 0) - ->addInlineRenderer(InlineElement\Image::class, new InlineRenderer\ImageRenderer(), 0) - ->addInlineRenderer(InlineElement\Link::class, new InlineRenderer\LinkRenderer(), 0) - ->addInlineRenderer(InlineElement\Newline::class, new InlineRenderer\NewlineRenderer(), 0) - ->addInlineRenderer(InlineElement\Strong::class, new InlineRenderer\StrongRenderer(), 0) - ->addInlineRenderer(InlineElement\Text::class, new InlineRenderer\TextRenderer(), 0) - ; - - if ($environment->getConfig('use_asterisk', true)) { - $environment->addDelimiterProcessor(new EmphasisDelimiterProcessor('*')); - } - - if ($environment->getConfig('use_underscore', true)) { - $environment->addDelimiterProcessor(new EmphasisDelimiterProcessor('_')); - } - } -} diff --git a/vendor/league/commonmark/src/Extension/DisallowedRawHtml/DisallowedRawHtmlBlockRenderer.php b/vendor/league/commonmark/src/Extension/DisallowedRawHtml/DisallowedRawHtmlBlockRenderer.php deleted file mode 100644 index 1bd17d8692..0000000000 --- a/vendor/league/commonmark/src/Extension/DisallowedRawHtml/DisallowedRawHtmlBlockRenderer.php +++ /dev/null @@ -1,48 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension\DisallowedRawHtml; - -use League\CommonMark\Block\Element\AbstractBlock; -use League\CommonMark\Block\Renderer\BlockRendererInterface; -use League\CommonMark\ElementRendererInterface; -use League\CommonMark\Util\ConfigurationAwareInterface; -use League\CommonMark\Util\ConfigurationInterface; - -final class DisallowedRawHtmlBlockRenderer implements BlockRendererInterface, ConfigurationAwareInterface -{ - /** @var BlockRendererInterface */ - private $htmlBlockRenderer; - - public function __construct(BlockRendererInterface $htmlBlockRenderer) - { - $this->htmlBlockRenderer = $htmlBlockRenderer; - } - - public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, bool $inTightList = false) - { - $rendered = $this->htmlBlockRenderer->render($block, $htmlRenderer, $inTightList); - - if ($rendered === '') { - return ''; - } - - // Match these types of tags: <title> </title> <title x="sdf"> <title/> <title /> - return preg_replace('/<(\/?(?:title|textarea|style|xmp|iframe|noembed|noframes|script|plaintext)[ \/>])/i', '<$1', $rendered); - } - - public function setConfiguration(ConfigurationInterface $configuration) - { - if ($this->htmlBlockRenderer instanceof ConfigurationAwareInterface) { - $this->htmlBlockRenderer->setConfiguration($configuration); - } - } -} diff --git a/vendor/league/commonmark/src/Extension/DisallowedRawHtml/DisallowedRawHtmlExtension.php b/vendor/league/commonmark/src/Extension/DisallowedRawHtml/DisallowedRawHtmlExtension.php deleted file mode 100644 index f5579dba5f..0000000000 --- a/vendor/league/commonmark/src/Extension/DisallowedRawHtml/DisallowedRawHtmlExtension.php +++ /dev/null @@ -1,28 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension\DisallowedRawHtml; - -use League\CommonMark\Block\Element\HtmlBlock; -use League\CommonMark\Block\Renderer\HtmlBlockRenderer; -use League\CommonMark\ConfigurableEnvironmentInterface; -use League\CommonMark\Extension\ExtensionInterface; -use League\CommonMark\Inline\Element\HtmlInline; -use League\CommonMark\Inline\Renderer\HtmlInlineRenderer; - -final class DisallowedRawHtmlExtension implements ExtensionInterface -{ - public function register(ConfigurableEnvironmentInterface $environment) - { - $environment->addBlockRenderer(HtmlBlock::class, new DisallowedRawHtmlBlockRenderer(new HtmlBlockRenderer()), 50); - $environment->addInlineRenderer(HtmlInline::class, new DisallowedRawHtmlInlineRenderer(new HtmlInlineRenderer()), 50); - } -} diff --git a/vendor/league/commonmark/src/Extension/DisallowedRawHtml/DisallowedRawHtmlInlineRenderer.php b/vendor/league/commonmark/src/Extension/DisallowedRawHtml/DisallowedRawHtmlInlineRenderer.php deleted file mode 100644 index 12eaa78e7d..0000000000 --- a/vendor/league/commonmark/src/Extension/DisallowedRawHtml/DisallowedRawHtmlInlineRenderer.php +++ /dev/null @@ -1,48 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension\DisallowedRawHtml; - -use League\CommonMark\ElementRendererInterface; -use League\CommonMark\Inline\Element\AbstractInline; -use League\CommonMark\Inline\Renderer\InlineRendererInterface; -use League\CommonMark\Util\ConfigurationAwareInterface; -use League\CommonMark\Util\ConfigurationInterface; - -final class DisallowedRawHtmlInlineRenderer implements InlineRendererInterface, ConfigurationAwareInterface -{ - /** @var InlineRendererInterface */ - private $htmlInlineRenderer; - - public function __construct(InlineRendererInterface $htmlBlockRenderer) - { - $this->htmlInlineRenderer = $htmlBlockRenderer; - } - - public function render(AbstractInline $inline, ElementRendererInterface $htmlRenderer) - { - $rendered = $this->htmlInlineRenderer->render($inline, $htmlRenderer); - - if ($rendered === '') { - return ''; - } - - // Match these types of tags: <title> </title> <title x="sdf"> <title/> <title /> - return preg_replace('/<(\/?(?:title|textarea|style|xmp|iframe|noembed|noframes|script|plaintext)[ \/>])/i', '<$1', $rendered); - } - - public function setConfiguration(ConfigurationInterface $configuration) - { - if ($this->htmlInlineRenderer instanceof ConfigurationAwareInterface) { - $this->htmlInlineRenderer->setConfiguration($configuration); - } - } -} diff --git a/vendor/league/commonmark/src/Extension/ExtensionInterface.php b/vendor/league/commonmark/src/Extension/ExtensionInterface.php deleted file mode 100644 index d461ef6551..0000000000 --- a/vendor/league/commonmark/src/Extension/ExtensionInterface.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension; - -use League\CommonMark\ConfigurableEnvironmentInterface; - -interface ExtensionInterface -{ - /** - * @param ConfigurableEnvironmentInterface $environment - * - * @return void - */ - public function register(ConfigurableEnvironmentInterface $environment); -} diff --git a/vendor/league/commonmark/src/Extension/ExternalLink/ExternalLinkExtension.php b/vendor/league/commonmark/src/Extension/ExternalLink/ExternalLinkExtension.php deleted file mode 100644 index 9deee0bd0e..0000000000 --- a/vendor/league/commonmark/src/Extension/ExternalLink/ExternalLinkExtension.php +++ /dev/null @@ -1,24 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension\ExternalLink; - -use League\CommonMark\ConfigurableEnvironmentInterface; -use League\CommonMark\Event\DocumentParsedEvent; -use League\CommonMark\Extension\ExtensionInterface; - -final class ExternalLinkExtension implements ExtensionInterface -{ - public function register(ConfigurableEnvironmentInterface $environment) - { - $environment->addEventListener(DocumentParsedEvent::class, new ExternalLinkProcessor($environment)); - } -} diff --git a/vendor/league/commonmark/src/Extension/ExternalLink/ExternalLinkProcessor.php b/vendor/league/commonmark/src/Extension/ExternalLink/ExternalLinkProcessor.php deleted file mode 100644 index 6a88d5859c..0000000000 --- a/vendor/league/commonmark/src/Extension/ExternalLink/ExternalLinkProcessor.php +++ /dev/null @@ -1,131 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension\ExternalLink; - -use League\CommonMark\EnvironmentInterface; -use League\CommonMark\Event\DocumentParsedEvent; -use League\CommonMark\Inline\Element\Link; - -final class ExternalLinkProcessor -{ - public const APPLY_NONE = ''; - public const APPLY_ALL = 'all'; - public const APPLY_EXTERNAL = 'external'; - public const APPLY_INTERNAL = 'internal'; - - /** @var EnvironmentInterface */ - private $environment; - - public function __construct(EnvironmentInterface $environment) - { - $this->environment = $environment; - } - - /** - * @param DocumentParsedEvent $e - * - * @return void - */ - public function __invoke(DocumentParsedEvent $e) - { - $internalHosts = $this->environment->getConfig('external_link/internal_hosts', []); - $openInNewWindow = $this->environment->getConfig('external_link/open_in_new_window', false); - $classes = $this->environment->getConfig('external_link/html_class', ''); - - $walker = $e->getDocument()->walker(); - while ($event = $walker->next()) { - if ($event->isEntering() && $event->getNode() instanceof Link) { - /** @var Link $link */ - $link = $event->getNode(); - - $host = parse_url($link->getUrl(), PHP_URL_HOST); - if (empty($host)) { - // Something is terribly wrong with this URL - continue; - } - - if (self::hostMatches($host, $internalHosts)) { - $link->data['external'] = false; - $this->applyRelAttribute($link, false); - continue; - } - - // Host does not match our list - $this->markLinkAsExternal($link, $openInNewWindow, $classes); - } - } - } - - private function markLinkAsExternal(Link $link, bool $openInNewWindow, string $classes): void - { - $link->data['external'] = true; - $link->data['attributes'] = $link->getData('attributes', []); - $this->applyRelAttribute($link, true); - - if ($openInNewWindow) { - $link->data['attributes']['target'] = '_blank'; - } - - if (!empty($classes)) { - $link->data['attributes']['class'] = trim(($link->data['attributes']['class'] ?? '') . ' ' . $classes); - } - } - - private function applyRelAttribute(Link $link, bool $isExternal): void - { - $rel = []; - - $options = [ - 'nofollow' => $this->environment->getConfig('external_link/nofollow', self::APPLY_NONE), - 'noopener' => $this->environment->getConfig('external_link/noopener', self::APPLY_EXTERNAL), - 'noreferrer' => $this->environment->getConfig('external_link/noreferrer', self::APPLY_EXTERNAL), - ]; - - foreach ($options as $type => $option) { - switch (true) { - case $option === self::APPLY_ALL: - case $isExternal && $option === self::APPLY_EXTERNAL: - case !$isExternal && $option === self::APPLY_INTERNAL: - $rel[] = $type; - } - } - - if ($rel === []) { - return; - } - - $link->data['attributes']['rel'] = \implode(' ', $rel); - } - - /** - * @param string $host - * @param mixed $compareTo - * - * @return bool - * - * @internal This method is only public so we can easily test it. DO NOT USE THIS OUTSIDE OF THIS EXTENSION! - */ - public static function hostMatches(string $host, $compareTo) - { - foreach ((array) $compareTo as $c) { - if (strpos($c, '/') === 0) { - if (preg_match($c, $host)) { - return true; - } - } elseif ($c === $host) { - return true; - } - } - - return false; - } -} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Event/AnonymousFootnotesListener.php b/vendor/league/commonmark/src/Extension/Footnote/Event/AnonymousFootnotesListener.php deleted file mode 100644 index 304e686068..0000000000 --- a/vendor/league/commonmark/src/Extension/Footnote/Event/AnonymousFootnotesListener.php +++ /dev/null @@ -1,61 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * (c) Rezo Zero / Ambroise Maupate - * - * 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\Extension\Footnote\Event; - -use League\CommonMark\Block\Element\Paragraph; -use League\CommonMark\Event\DocumentParsedEvent; -use League\CommonMark\Extension\Footnote\Node\Footnote; -use League\CommonMark\Extension\Footnote\Node\FootnoteBackref; -use League\CommonMark\Extension\Footnote\Node\FootnoteRef; -use League\CommonMark\Inline\Element\Text; -use League\CommonMark\Reference\Reference; -use League\CommonMark\Util\ConfigurationAwareInterface; -use League\CommonMark\Util\ConfigurationInterface; - -final class AnonymousFootnotesListener implements ConfigurationAwareInterface -{ - /** @var ConfigurationInterface */ - private $config; - - public function onDocumentParsed(DocumentParsedEvent $event): void - { - $document = $event->getDocument(); - $walker = $document->walker(); - - while ($event = $walker->next()) { - $node = $event->getNode(); - if ($node instanceof FootnoteRef && $event->isEntering() && null !== $text = $node->getContent()) { - // Anonymous footnote needs to create a footnote from its content - $existingReference = $node->getReference(); - $reference = new Reference( - $existingReference->getLabel(), - '#' . $this->config->get('footnote/ref_id_prefix', 'fnref:') . $existingReference->getLabel(), - $existingReference->getTitle() - ); - $footnote = new Footnote($reference); - $footnote->addBackref(new FootnoteBackref($reference)); - $paragraph = new Paragraph(); - $paragraph->appendChild(new Text($text)); - $footnote->appendChild($paragraph); - $document->appendChild($footnote); - } - } - } - - public function setConfiguration(ConfigurationInterface $config): void - { - $this->config = $config; - } -} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Event/GatherFootnotesListener.php b/vendor/league/commonmark/src/Extension/Footnote/Event/GatherFootnotesListener.php deleted file mode 100644 index a54ca26d83..0000000000 --- a/vendor/league/commonmark/src/Extension/Footnote/Event/GatherFootnotesListener.php +++ /dev/null @@ -1,100 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * (c) Rezo Zero / Ambroise Maupate - * - * 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\Extension\Footnote\Event; - -use League\CommonMark\Block\Element\Document; -use League\CommonMark\Event\DocumentParsedEvent; -use League\CommonMark\Extension\Footnote\Node\Footnote; -use League\CommonMark\Extension\Footnote\Node\FootnoteBackref; -use League\CommonMark\Extension\Footnote\Node\FootnoteContainer; -use League\CommonMark\Reference\Reference; -use League\CommonMark\Util\ConfigurationAwareInterface; -use League\CommonMark\Util\ConfigurationInterface; - -final class GatherFootnotesListener implements ConfigurationAwareInterface -{ - /** @var ConfigurationInterface */ - private $config; - - public function onDocumentParsed(DocumentParsedEvent $event): void - { - $document = $event->getDocument(); - $walker = $document->walker(); - - $footnotes = []; - while ($event = $walker->next()) { - if (!$event->isEntering()) { - continue; - } - - $node = $event->getNode(); - if (!$node instanceof Footnote) { - continue; - } - - // Look for existing reference with footnote label - $ref = $document->getReferenceMap()->getReference($node->getReference()->getLabel()); - if ($ref !== null) { - // Use numeric title to get footnotes order - $footnotes[\intval($ref->getTitle())] = $node; - } else { - // Footnote call is missing, append footnote at the end - $footnotes[INF] = $node; - } - - /* - * Look for all footnote refs pointing to this footnote - * and create each footnote backrefs. - */ - $backrefs = $document->getData( - '#' . $this->config->get('footnote/footnote_id_prefix', 'fn:') . $node->getReference()->getDestination(), - [] - ); - /** @var Reference $backref */ - foreach ($backrefs as $backref) { - $node->addBackref(new FootnoteBackref(new Reference( - $backref->getLabel(), - '#' . $this->config->get('footnote/ref_id_prefix', 'fnref:') . $backref->getLabel(), - $backref->getTitle() - ))); - } - } - - // Only add a footnote container if there are any - if (\count($footnotes) === 0) { - return; - } - - $container = $this->getFootnotesContainer($document); - - \ksort($footnotes); - foreach ($footnotes as $footnote) { - $container->appendChild($footnote); - } - } - - private function getFootnotesContainer(Document $document): FootnoteContainer - { - $footnoteContainer = new FootnoteContainer(); - $document->appendChild($footnoteContainer); - - return $footnoteContainer; - } - - public function setConfiguration(ConfigurationInterface $config): void - { - $this->config = $config; - } -} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Event/NumberFootnotesListener.php b/vendor/league/commonmark/src/Extension/Footnote/Event/NumberFootnotesListener.php deleted file mode 100644 index 5b3f992503..0000000000 --- a/vendor/league/commonmark/src/Extension/Footnote/Event/NumberFootnotesListener.php +++ /dev/null @@ -1,86 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * (c) Rezo Zero / Ambroise Maupate - * - * 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\Extension\Footnote\Event; - -use League\CommonMark\Event\DocumentParsedEvent; -use League\CommonMark\Extension\Footnote\Node\FootnoteRef; -use League\CommonMark\Reference\Reference; - -final class NumberFootnotesListener -{ - public function onDocumentParsed(DocumentParsedEvent $event): void - { - $document = $event->getDocument(); - $walker = $document->walker(); - $nextCounter = 1; - $usedLabels = []; - $usedCounters = []; - - while ($event = $walker->next()) { - if (!$event->isEntering()) { - continue; - } - - $node = $event->getNode(); - - if (!$node instanceof FootnoteRef) { - continue; - } - - $existingReference = $node->getReference(); - $label = $existingReference->getLabel(); - $counter = $nextCounter; - $canIncrementCounter = true; - - if (\array_key_exists($label, $usedLabels)) { - /* - * Reference is used again, we need to point - * to the same footnote. But with a different ID - */ - $counter = $usedCounters[$label]; - $label = $label . '__' . ++$usedLabels[$label]; - $canIncrementCounter = false; - } - - // rewrite reference title to use a numeric link - $newReference = new Reference( - $label, - $existingReference->getDestination(), - (string) $counter - ); - - // Override reference with numeric link - $node->setReference($newReference); - $document->getReferenceMap()->addReference($newReference); - - /* - * Store created references in document for - * creating FootnoteBackrefs - */ - if (false === $document->getData($existingReference->getDestination(), false)) { - $document->data[$existingReference->getDestination()] = []; - } - - $document->data[$existingReference->getDestination()][] = $newReference; - - $usedLabels[$label] = 1; - $usedCounters[$label] = $nextCounter; - - if ($canIncrementCounter) { - $nextCounter++; - } - } - } -} diff --git a/vendor/league/commonmark/src/Extension/Footnote/FootnoteExtension.php b/vendor/league/commonmark/src/Extension/Footnote/FootnoteExtension.php deleted file mode 100644 index 1e896f9cbc..0000000000 --- a/vendor/league/commonmark/src/Extension/Footnote/FootnoteExtension.php +++ /dev/null @@ -1,53 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * (c) Rezo Zero / Ambroise Maupate - * - * 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\Extension\Footnote; - -use League\CommonMark\ConfigurableEnvironmentInterface; -use League\CommonMark\Event\DocumentParsedEvent; -use League\CommonMark\Extension\ExtensionInterface; -use League\CommonMark\Extension\Footnote\Event\AnonymousFootnotesListener; -use League\CommonMark\Extension\Footnote\Event\GatherFootnotesListener; -use League\CommonMark\Extension\Footnote\Event\NumberFootnotesListener; -use League\CommonMark\Extension\Footnote\Node\Footnote; -use League\CommonMark\Extension\Footnote\Node\FootnoteBackref; -use League\CommonMark\Extension\Footnote\Node\FootnoteContainer; -use League\CommonMark\Extension\Footnote\Node\FootnoteRef; -use League\CommonMark\Extension\Footnote\Parser\AnonymousFootnoteRefParser; -use League\CommonMark\Extension\Footnote\Parser\FootnoteParser; -use League\CommonMark\Extension\Footnote\Parser\FootnoteRefParser; -use League\CommonMark\Extension\Footnote\Renderer\FootnoteBackrefRenderer; -use League\CommonMark\Extension\Footnote\Renderer\FootnoteContainerRenderer; -use League\CommonMark\Extension\Footnote\Renderer\FootnoteRefRenderer; -use League\CommonMark\Extension\Footnote\Renderer\FootnoteRenderer; - -final class FootnoteExtension implements ExtensionInterface -{ - public function register(ConfigurableEnvironmentInterface $environment) - { - $environment->addBlockParser(new FootnoteParser(), 51); - $environment->addInlineParser(new AnonymousFootnoteRefParser(), 35); - $environment->addInlineParser(new FootnoteRefParser(), 51); - - $environment->addBlockRenderer(FootnoteContainer::class, new FootnoteContainerRenderer()); - $environment->addBlockRenderer(Footnote::class, new FootnoteRenderer()); - - $environment->addInlineRenderer(FootnoteRef::class, new FootnoteRefRenderer()); - $environment->addInlineRenderer(FootnoteBackref::class, new FootnoteBackrefRenderer()); - - $environment->addEventListener(DocumentParsedEvent::class, [new AnonymousFootnotesListener(), 'onDocumentParsed']); - $environment->addEventListener(DocumentParsedEvent::class, [new NumberFootnotesListener(), 'onDocumentParsed']); - $environment->addEventListener(DocumentParsedEvent::class, [new GatherFootnotesListener(), 'onDocumentParsed']); - } -} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Node/Footnote.php b/vendor/league/commonmark/src/Extension/Footnote/Node/Footnote.php deleted file mode 100644 index d296d1930e..0000000000 --- a/vendor/league/commonmark/src/Extension/Footnote/Node/Footnote.php +++ /dev/null @@ -1,75 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * (c) Rezo Zero / Ambroise Maupate - * - * 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\Extension\Footnote\Node; - -use League\CommonMark\Block\Element\AbstractBlock; -use League\CommonMark\Cursor; -use League\CommonMark\Reference\ReferenceInterface; - -/** - * @method children() AbstractBlock[] - */ -final class Footnote extends AbstractBlock -{ - /** - * @var FootnoteBackref[] - */ - private $backrefs = []; - - /** - * @var ReferenceInterface - */ - private $reference; - - public function __construct(ReferenceInterface $reference) - { - $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; - } -} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Node/FootnoteBackref.php b/vendor/league/commonmark/src/Extension/Footnote/Node/FootnoteBackref.php deleted file mode 100644 index 91747d31c6..0000000000 --- a/vendor/league/commonmark/src/Extension/Footnote/Node/FootnoteBackref.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * (c) Rezo Zero / Ambroise Maupate - * - * 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\Extension\Footnote\Node; - -use League\CommonMark\Inline\Element\AbstractInline; -use League\CommonMark\Reference\ReferenceInterface; - -/** - * Link from the footnote on the bottom of the document back to the reference - */ -final class FootnoteBackref extends AbstractInline -{ - /** @var ReferenceInterface */ - private $reference; - - public function __construct(ReferenceInterface $reference) - { - $this->reference = $reference; - } - - public function getReference(): ReferenceInterface - { - return $this->reference; - } -} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Node/FootnoteContainer.php b/vendor/league/commonmark/src/Extension/Footnote/Node/FootnoteContainer.php deleted file mode 100644 index ad151efe5b..0000000000 --- a/vendor/league/commonmark/src/Extension/Footnote/Node/FootnoteContainer.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * (c) Rezo Zero / Ambroise Maupate - * - * 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\Extension\Footnote\Node; - -use League\CommonMark\Block\Element\AbstractBlock; -use League\CommonMark\Cursor; - -/** - * @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; - } -} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Node/FootnoteRef.php b/vendor/league/commonmark/src/Extension/Footnote/Node/FootnoteRef.php deleted file mode 100644 index 27b98b5573..0000000000 --- a/vendor/league/commonmark/src/Extension/Footnote/Node/FootnoteRef.php +++ /dev/null @@ -1,56 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * (c) Rezo Zero / Ambroise Maupate - * - * 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\Extension\Footnote\Node; - -use League\CommonMark\Inline\Element\AbstractInline; -use League\CommonMark\Reference\ReferenceInterface; - -final class FootnoteRef extends AbstractInline -{ - /** @var ReferenceInterface */ - private $reference; - - /** @var string|null */ - private $content; - - /** - * @param ReferenceInterface $reference - * @param string|null $content - * @param array<mixed> $data - */ - public function __construct(ReferenceInterface $reference, ?string $content = null, array $data = []) - { - $this->reference = $reference; - $this->content = $content; - $this->data = $data; - } - - public function getReference(): ReferenceInterface - { - return $this->reference; - } - - public function setReference(ReferenceInterface $reference): FootnoteRef - { - $this->reference = $reference; - - return $this; - } - - public function getContent(): ?string - { - return $this->content; - } -} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Parser/AnonymousFootnoteRefParser.php b/vendor/league/commonmark/src/Extension/Footnote/Parser/AnonymousFootnoteRefParser.php deleted file mode 100644 index 525bbfc9aa..0000000000 --- a/vendor/league/commonmark/src/Extension/Footnote/Parser/AnonymousFootnoteRefParser.php +++ /dev/null @@ -1,85 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * (c) Rezo Zero / Ambroise Maupate - * - * 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\Extension\Footnote\Parser; - -use League\CommonMark\Extension\Footnote\Node\FootnoteRef; -use League\CommonMark\Inline\Parser\InlineParserInterface; -use League\CommonMark\InlineParserContext; -use League\CommonMark\Normalizer\SlugNormalizer; -use League\CommonMark\Normalizer\TextNormalizerInterface; -use League\CommonMark\Reference\Reference; -use League\CommonMark\Util\ConfigurationAwareInterface; -use League\CommonMark\Util\ConfigurationInterface; - -final class AnonymousFootnoteRefParser implements InlineParserInterface, ConfigurationAwareInterface -{ - /** @var ConfigurationInterface */ - private $config; - - /** @var TextNormalizerInterface */ - private $slugNormalizer; - - public function __construct() - { - $this->slugNormalizer = new SlugNormalizer(); - } - - public function getCharacters(): array - { - return ['^']; - } - - public function parse(InlineParserContext $inlineContext): bool - { - $container = $inlineContext->getContainer(); - $cursor = $inlineContext->getCursor(); - $nextChar = $cursor->peek(); - if ($nextChar !== '[') { - return false; - } - $state = $cursor->saveState(); - - $m = $cursor->match('/\^\[[^\n^\]]+\]/'); - if ($m !== null) { - if (\preg_match('#\^\[([^\]]+)\]#', $m, $matches) > 0) { - $reference = $this->createReference($matches[1]); - $container->appendChild(new FootnoteRef($reference, $matches[1])); - - return true; - } - } - - $cursor->restoreState($state); - - return false; - } - - private function createReference(string $label): Reference - { - $refLabel = $this->slugNormalizer->normalize($label); - $refLabel = \mb_substr($refLabel, 0, 20); - - return new Reference( - $refLabel, - '#' . $this->config->get('footnote/footnote_id_prefix', 'fn:') . $refLabel, - $label - ); - } - - public function setConfiguration(ConfigurationInterface $config): void - { - $this->config = $config; - } -} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Parser/FootnoteParser.php b/vendor/league/commonmark/src/Extension/Footnote/Parser/FootnoteParser.php deleted file mode 100644 index 231c2aa5e0..0000000000 --- a/vendor/league/commonmark/src/Extension/Footnote/Parser/FootnoteParser.php +++ /dev/null @@ -1,63 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * (c) Rezo Zero / Ambroise Maupate - * - * 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\Extension\Footnote\Parser; - -use League\CommonMark\Block\Parser\BlockParserInterface; -use League\CommonMark\ContextInterface; -use League\CommonMark\Cursor; -use League\CommonMark\Extension\Footnote\Node\Footnote; -use League\CommonMark\Reference\Reference; -use League\CommonMark\Util\RegexHelper; - -final class FootnoteParser implements BlockParserInterface -{ - public function parse(ContextInterface $context, Cursor $cursor): bool - { - if ($cursor->isIndented()) { - return false; - } - - $match = RegexHelper::matchAll( - '/^\[\^([^\n^\]]+)\]\:\s/', - $cursor->getLine(), - $cursor->getNextNonSpacePosition() - ); - - if (!$match) { - return false; - } - - $cursor->advanceToNextNonSpaceOrTab(); - $cursor->advanceBy(\strlen($match[0])); - $str = $cursor->getRemainder(); - \preg_replace('/^\[\^([^\n^\]]+)\]\:\s/', '', $str); - - if (\preg_match('/^\[\^([^\n^\]]+)\]\:\s/', $match[0], $matches) > 0) { - $context->addBlock($this->createFootnote($matches[1])); - $context->setBlocksParsed(true); - - return true; - } - - return false; - } - - private function createFootnote(string $label): Footnote - { - return new Footnote( - new Reference($label, $label, $label) - ); - } -} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Parser/FootnoteRefParser.php b/vendor/league/commonmark/src/Extension/Footnote/Parser/FootnoteRefParser.php deleted file mode 100644 index 313b5dd214..0000000000 --- a/vendor/league/commonmark/src/Extension/Footnote/Parser/FootnoteRefParser.php +++ /dev/null @@ -1,72 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * (c) Rezo Zero / Ambroise Maupate - * - * 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\Extension\Footnote\Parser; - -use League\CommonMark\Extension\Footnote\Node\FootnoteRef; -use League\CommonMark\Inline\Parser\InlineParserInterface; -use League\CommonMark\InlineParserContext; -use League\CommonMark\Reference\Reference; -use League\CommonMark\Util\ConfigurationAwareInterface; -use League\CommonMark\Util\ConfigurationInterface; - -final class FootnoteRefParser implements InlineParserInterface, ConfigurationAwareInterface -{ - /** @var ConfigurationInterface */ - private $config; - - public function getCharacters(): array - { - return ['[']; - } - - public function parse(InlineParserContext $inlineContext): bool - { - $container = $inlineContext->getContainer(); - $cursor = $inlineContext->getCursor(); - $nextChar = $cursor->peek(); - if ($nextChar !== '^') { - return false; - } - - $state = $cursor->saveState(); - - $m = $cursor->match('#\[\^([^\]]+)\]#'); - if ($m !== null) { - if (\preg_match('#\[\^([^\]]+)\]#', $m, $matches) > 0) { - $container->appendChild(new FootnoteRef($this->createReference($matches[1]))); - - return true; - } - } - - $cursor->restoreState($state); - - return false; - } - - private function createReference(string $label): Reference - { - return new Reference( - $label, - '#' . $this->config->get('footnote/footnote_id_prefix', 'fn:') . $label, - $label - ); - } - - public function setConfiguration(ConfigurationInterface $config): void - { - $this->config = $config; - } -} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteBackrefRenderer.php b/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteBackrefRenderer.php deleted file mode 100644 index 1bbf68943d..0000000000 --- a/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteBackrefRenderer.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * (c) Rezo Zero / Ambroise Maupate - * - * 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\Extension\Footnote\Renderer; - -use League\CommonMark\ElementRendererInterface; -use League\CommonMark\Extension\Footnote\Node\FootnoteBackref; -use League\CommonMark\HtmlElement; -use League\CommonMark\Inline\Element\AbstractInline; -use League\CommonMark\Inline\Renderer\InlineRendererInterface; -use League\CommonMark\Util\ConfigurationAwareInterface; -use League\CommonMark\Util\ConfigurationInterface; - -final class FootnoteBackrefRenderer implements InlineRendererInterface, ConfigurationAwareInterface -{ - /** @var ConfigurationInterface */ - private $config; - - public function render(AbstractInline $inline, ElementRendererInterface $htmlRenderer) - { - if (!($inline instanceof FootnoteBackref)) { - throw new \InvalidArgumentException('Incompatible inline type: ' . \get_class($inline)); - } - - $attrs = $inline->getData('attributes', []); - $attrs['class'] = $attrs['class'] ?? $this->config->get('footnote/backref_class', 'footnote-backref'); - $attrs['rev'] = 'footnote'; - $attrs['href'] = \mb_strtolower($inline->getReference()->getDestination()); - $attrs['role'] = 'doc-backlink'; - - return ' ' . new HtmlElement('a', $attrs, '↩', true); - } - - public function setConfiguration(ConfigurationInterface $configuration) - { - $this->config = $configuration; - } -} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteContainerRenderer.php b/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteContainerRenderer.php deleted file mode 100644 index 24be14ea60..0000000000 --- a/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteContainerRenderer.php +++ /dev/null @@ -1,52 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * (c) Rezo Zero / Ambroise Maupate - * - * 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\Extension\Footnote\Renderer; - -use League\CommonMark\Block\Element\AbstractBlock; -use League\CommonMark\Block\Renderer\BlockRendererInterface; -use League\CommonMark\ElementRendererInterface; -use League\CommonMark\Extension\Footnote\Node\FootnoteContainer; -use League\CommonMark\HtmlElement; -use League\CommonMark\Util\ConfigurationAwareInterface; -use League\CommonMark\Util\ConfigurationInterface; - -final class FootnoteContainerRenderer implements BlockRendererInterface, ConfigurationAwareInterface -{ - /** @var ConfigurationInterface */ - private $config; - - public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, bool $inTightList = false) - { - if (!($block instanceof FootnoteContainer)) { - throw new \InvalidArgumentException('Incompatible block type: ' . \get_class($block)); - } - - $attrs = $block->getData('attributes', []); - $attrs['class'] = $attrs['class'] ?? $this->config->get('footnote/container_class', 'footnotes'); - $attrs['role'] = 'doc-endnotes'; - - $contents = new HtmlElement('ol', [], $htmlRenderer->renderBlocks($block->children())); - if ($this->config->get('footnote/container_add_hr', true)) { - $contents = [new HtmlElement('hr', [], null, true), $contents]; - } - - return new HtmlElement('div', $attrs, $contents); - } - - public function setConfiguration(ConfigurationInterface $configuration) - { - $this->config = $configuration; - } -} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteRefRenderer.php b/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteRefRenderer.php deleted file mode 100644 index 14d57f4d72..0000000000 --- a/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteRefRenderer.php +++ /dev/null @@ -1,62 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * (c) Rezo Zero / Ambroise Maupate - * - * 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\Extension\Footnote\Renderer; - -use League\CommonMark\ElementRendererInterface; -use League\CommonMark\Extension\Footnote\Node\FootnoteRef; -use League\CommonMark\HtmlElement; -use League\CommonMark\Inline\Element\AbstractInline; -use League\CommonMark\Inline\Renderer\InlineRendererInterface; -use League\CommonMark\Util\ConfigurationAwareInterface; -use League\CommonMark\Util\ConfigurationInterface; - -final class FootnoteRefRenderer implements InlineRendererInterface, ConfigurationAwareInterface -{ - /** @var ConfigurationInterface */ - private $config; - - public function render(AbstractInline $inline, ElementRendererInterface $htmlRenderer) - { - if (!($inline instanceof FootnoteRef)) { - throw new \InvalidArgumentException('Incompatible inline type: ' . \get_class($inline)); - } - - $attrs = $inline->getData('attributes', []); - $class = $attrs['class'] ?? $this->config->get('footnote/ref_class', 'footnote-ref'); - $idPrefix = $this->config->get('footnote/ref_id_prefix', 'fnref:'); - - return new HtmlElement( - 'sup', - [ - 'id' => $idPrefix . \mb_strtolower($inline->getReference()->getLabel()), - ], - new HTMLElement( - 'a', - [ - 'class' => $class, - 'href' => \mb_strtolower($inline->getReference()->getDestination()), - 'role' => 'doc-noteref', - ], - $inline->getReference()->getTitle() - ), - true - ); - } - - public function setConfiguration(ConfigurationInterface $configuration) - { - $this->config = $configuration; - } -} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteRenderer.php b/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteRenderer.php deleted file mode 100644 index f18e35a2a1..0000000000 --- a/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteRenderer.php +++ /dev/null @@ -1,64 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * (c) Rezo Zero / Ambroise Maupate - * - * 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\Extension\Footnote\Renderer; - -use League\CommonMark\Block\Element\AbstractBlock; -use League\CommonMark\Block\Renderer\BlockRendererInterface; -use League\CommonMark\ElementRendererInterface; -use League\CommonMark\Extension\Footnote\Node\Footnote; -use League\CommonMark\HtmlElement; -use League\CommonMark\Util\ConfigurationAwareInterface; -use League\CommonMark\Util\ConfigurationInterface; - -final class FootnoteRenderer implements BlockRendererInterface, ConfigurationAwareInterface -{ - /** @var ConfigurationInterface */ - private $config; - - /** - * @param Footnote $block - * @param ElementRendererInterface $htmlRenderer - * @param bool $inTightList - * - * @return HtmlElement - */ - public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, bool $inTightList = false) - { - if (!($block instanceof Footnote)) { - throw new \InvalidArgumentException('Incompatible block type: ' . \get_class($block)); - } - - $attrs = $block->getData('attributes', []); - $attrs['class'] = $attrs['class'] ?? $this->config->get('footnote/footnote_class', 'footnote'); - $attrs['id'] = $this->config->get('footnote/footnote_id_prefix', 'fn:') . \mb_strtolower($block->getReference()->getLabel()); - $attrs['role'] = 'doc-endnote'; - - foreach ($block->getBackrefs() as $backref) { - $block->lastChild()->appendChild($backref); - } - - return new HtmlElement( - 'li', - $attrs, - $htmlRenderer->renderBlocks($block->children()), - true - ); - } - - public function setConfiguration(ConfigurationInterface $configuration) - { - $this->config = $configuration; - } -} diff --git a/vendor/league/commonmark/src/Extension/GithubFlavoredMarkdownExtension.php b/vendor/league/commonmark/src/Extension/GithubFlavoredMarkdownExtension.php deleted file mode 100644 index 41659c126b..0000000000 --- a/vendor/league/commonmark/src/Extension/GithubFlavoredMarkdownExtension.php +++ /dev/null @@ -1,31 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension; - -use League\CommonMark\ConfigurableEnvironmentInterface; -use League\CommonMark\Extension\Autolink\AutolinkExtension; -use League\CommonMark\Extension\DisallowedRawHtml\DisallowedRawHtmlExtension; -use League\CommonMark\Extension\Strikethrough\StrikethroughExtension; -use League\CommonMark\Extension\Table\TableExtension; -use League\CommonMark\Extension\TaskList\TaskListExtension; - -final class GithubFlavoredMarkdownExtension implements ExtensionInterface -{ - public function register(ConfigurableEnvironmentInterface $environment) - { - $environment->addExtension(new AutolinkExtension()); - $environment->addExtension(new DisallowedRawHtmlExtension()); - $environment->addExtension(new StrikethroughExtension()); - $environment->addExtension(new TableExtension()); - $environment->addExtension(new TaskListExtension()); - } -} diff --git a/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalink.php b/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalink.php deleted file mode 100644 index c5975ed479..0000000000 --- a/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalink.php +++ /dev/null @@ -1,33 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension\HeadingPermalink; - -use League\CommonMark\Inline\Element\AbstractInline; - -/** - * Represents an anchor link within a heading - */ -final class HeadingPermalink extends AbstractInline -{ - /** @var string */ - private $slug; - - public function __construct(string $slug) - { - $this->slug = $slug; - } - - public function getSlug(): string - { - return $this->slug; - } -} diff --git a/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkExtension.php b/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkExtension.php deleted file mode 100644 index 161674384b..0000000000 --- a/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkExtension.php +++ /dev/null @@ -1,28 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension\HeadingPermalink; - -use League\CommonMark\ConfigurableEnvironmentInterface; -use League\CommonMark\Event\DocumentParsedEvent; -use League\CommonMark\Extension\ExtensionInterface; - -/** - * Extension which automatically anchor links to heading elements - */ -final class HeadingPermalinkExtension implements ExtensionInterface -{ - public function register(ConfigurableEnvironmentInterface $environment) - { - $environment->addEventListener(DocumentParsedEvent::class, new HeadingPermalinkProcessor(), -100); - $environment->addInlineRenderer(HeadingPermalink::class, new HeadingPermalinkRenderer()); - } -} diff --git a/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkProcessor.php b/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkProcessor.php deleted file mode 100644 index 3e89d9668a..0000000000 --- a/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkProcessor.php +++ /dev/null @@ -1,148 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension\HeadingPermalink; - -use League\CommonMark\Block\Element\Document; -use League\CommonMark\Block\Element\Heading; -use League\CommonMark\Event\DocumentParsedEvent; -use League\CommonMark\Exception\InvalidOptionException; -use League\CommonMark\Extension\HeadingPermalink\Slug\SlugGeneratorInterface as DeprecatedSlugGeneratorInterface; -use League\CommonMark\Inline\Element\Code; -use League\CommonMark\Inline\Element\Text; -use League\CommonMark\Node\Node; -use League\CommonMark\Normalizer\SlugNormalizer; -use League\CommonMark\Normalizer\TextNormalizerInterface; -use League\CommonMark\Util\ConfigurationAwareInterface; -use League\CommonMark\Util\ConfigurationInterface; - -/** - * Searches the Document for Heading elements and adds HeadingPermalinks to each one - */ -final class HeadingPermalinkProcessor implements ConfigurationAwareInterface -{ - const INSERT_BEFORE = 'before'; - const INSERT_AFTER = 'after'; - - /** @var TextNormalizerInterface|DeprecatedSlugGeneratorInterface */ - private $slugNormalizer; - - /** @var ConfigurationInterface */ - private $config; - - /** - * @param TextNormalizerInterface|DeprecatedSlugGeneratorInterface|null $slugNormalizer - */ - public function __construct($slugNormalizer = null) - { - if ($slugNormalizer instanceof DeprecatedSlugGeneratorInterface) { - @trigger_error(sprintf('Passing a %s into the %s constructor is deprecated; use a %s instead', DeprecatedSlugGeneratorInterface::class, self::class, TextNormalizerInterface::class), E_USER_DEPRECATED); - } - - $this->slugNormalizer = $slugNormalizer ?? new SlugNormalizer(); - } - - public function setConfiguration(ConfigurationInterface $configuration) - { - $this->config = $configuration; - } - - public function __invoke(DocumentParsedEvent $e): void - { - $this->useNormalizerFromConfigurationIfProvided(); - - $walker = $e->getDocument()->walker(); - - while ($event = $walker->next()) { - $node = $event->getNode(); - if ($node instanceof Heading && $event->isEntering()) { - $this->addHeadingLink($node, $e->getDocument()); - } - } - } - - private function useNormalizerFromConfigurationIfProvided(): void - { - $generator = $this->config->get('heading_permalink/slug_normalizer'); - if ($generator === null) { - return; - } - - if (!($generator instanceof DeprecatedSlugGeneratorInterface || $generator instanceof TextNormalizerInterface)) { - throw new InvalidOptionException('The heading_permalink/slug_normalizer option must be an instance of ' . TextNormalizerInterface::class); - } - - $this->slugNormalizer = $generator; - } - - private function addHeadingLink(Heading $heading, Document $document): void - { - $text = $this->getChildText($heading); - if ($this->slugNormalizer instanceof DeprecatedSlugGeneratorInterface) { - $slug = $this->slugNormalizer->createSlug($text); - } else { - $slug = $this->slugNormalizer->normalize($text, $heading); - } - - $slug = $this->ensureUnique($slug, $document); - - $headingLinkAnchor = new HeadingPermalink($slug); - - switch ($this->config->get('heading_permalink/insert', 'before')) { - case self::INSERT_BEFORE: - $heading->prependChild($headingLinkAnchor); - - return; - case self::INSERT_AFTER: - $heading->appendChild($headingLinkAnchor); - - return; - default: - throw new \RuntimeException("Invalid configuration value for heading_permalink/insert; expected 'before' or 'after'"); - } - } - - /** - * @deprecated Not needed in 2.0 - */ - private function getChildText(Node $node): string - { - $text = ''; - - $walker = $node->walker(); - while ($event = $walker->next()) { - if ($event->isEntering() && (($child = $event->getNode()) instanceof Text || $child instanceof Code)) { - $text .= $child->getContent(); - } - } - - return $text; - } - - private function ensureUnique(string $proposed, Document $document): string - { - // Quick path, it's a unique ID - if (!isset($document->data['heading_ids'][$proposed])) { - $document->data['heading_ids'][$proposed] = true; - - return $proposed; - } - - $extension = 0; - do { - ++$extension; - } while (isset($document->data['heading_ids']["$proposed-$extension"])); - - $document->data['heading_ids']["$proposed-$extension"] = true; - - return "$proposed-$extension"; - } -} diff --git a/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkRenderer.php b/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkRenderer.php deleted file mode 100644 index 5bdab9575f..0000000000 --- a/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkRenderer.php +++ /dev/null @@ -1,72 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension\HeadingPermalink; - -use League\CommonMark\ElementRendererInterface; -use League\CommonMark\HtmlElement; -use League\CommonMark\Inline\Element\AbstractInline; -use League\CommonMark\Inline\Renderer\InlineRendererInterface; -use League\CommonMark\Util\ConfigurationAwareInterface; -use League\CommonMark\Util\ConfigurationInterface; - -/** - * Renders the HeadingPermalink elements - */ -final class HeadingPermalinkRenderer implements InlineRendererInterface, ConfigurationAwareInterface -{ - /** @deprecated */ - const DEFAULT_INNER_CONTENTS = '<svg class="heading-permalink-icon" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg>'; - - const DEFAULT_SYMBOL = '¶'; - - /** @var ConfigurationInterface */ - private $config; - - public function setConfiguration(ConfigurationInterface $configuration) - { - $this->config = $configuration; - } - - public function render(AbstractInline $inline, ElementRendererInterface $htmlRenderer) - { - if (!$inline instanceof HeadingPermalink) { - throw new \InvalidArgumentException('Incompatible inline type: ' . \get_class($inline)); - } - - $slug = $inline->getSlug(); - - $idPrefix = (string) $this->config->get('heading_permalink/id_prefix', 'user-content'); - if ($idPrefix !== '') { - $idPrefix .= '-'; - } - - $attrs = [ - 'id' => $idPrefix . $slug, - 'href' => '#' . $slug, - 'name' => $slug, - 'class' => $this->config->get('heading_permalink/html_class', 'heading-permalink'), - 'aria-hidden' => 'true', - 'title' => $this->config->get('heading_permalink/title', 'Permalink'), - ]; - - $innerContents = $this->config->get('heading_permalink/inner_contents'); - if ($innerContents !== null) { - @trigger_error(sprintf('The %s config option is deprecated; use %s instead', 'inner_contents', 'symbol'), E_USER_DEPRECATED); - - return new HtmlElement('a', $attrs, $innerContents, false); - } - - $symbol = $this->config->get('heading_permalink/symbol', self::DEFAULT_SYMBOL); - - return new HtmlElement('a', $attrs, \htmlspecialchars($symbol), false); - } -} diff --git a/vendor/league/commonmark/src/Extension/HeadingPermalink/Slug/DefaultSlugGenerator.php b/vendor/league/commonmark/src/Extension/HeadingPermalink/Slug/DefaultSlugGenerator.php deleted file mode 100644 index 72faba8a95..0000000000 --- a/vendor/league/commonmark/src/Extension/HeadingPermalink/Slug/DefaultSlugGenerator.php +++ /dev/null @@ -1,38 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension\HeadingPermalink\Slug; - -use League\CommonMark\Normalizer\SlugNormalizer; - -@trigger_error(sprintf('%s is deprecated; use %s instead', DefaultSlugGenerator::class, SlugNormalizer::class), E_USER_DEPRECATED); - -/** - * Creates URL-friendly strings - * - * @deprecated Use League\CommonMark\Normalizer\SlugNormalizer instead - */ -final class DefaultSlugGenerator implements SlugGeneratorInterface -{ - public function createSlug(string $input): string - { - // Trim whitespace - $slug = \trim($input); - // Convert to lowercase - $slug = \mb_strtolower($slug); - // Try replacing whitespace with a dash - $slug = \preg_replace('/\s+/u', '-', $slug) ?? $slug; - // Try removing characters other than letters, numbers, and marks. - $slug = \preg_replace('/[^\p{L}\p{Nd}\p{Nl}\p{M}-]+/u', '', $slug) ?? $slug; - - return $slug; - } -} diff --git a/vendor/league/commonmark/src/Extension/HeadingPermalink/Slug/SlugGeneratorInterface.php b/vendor/league/commonmark/src/Extension/HeadingPermalink/Slug/SlugGeneratorInterface.php deleted file mode 100644 index d238de7375..0000000000 --- a/vendor/league/commonmark/src/Extension/HeadingPermalink/Slug/SlugGeneratorInterface.php +++ /dev/null @@ -1,31 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension\HeadingPermalink\Slug; - -use League\CommonMark\Normalizer\TextNormalizerInterface; - -@trigger_error(sprintf('%s is deprecated; use %s instead', SlugGeneratorInterface::class, TextNormalizerInterface::class), E_USER_DEPRECATED); - -/** - * @deprecated Use League\CommonMark\Normalizer\TextNormalizerInterface instead - */ -interface SlugGeneratorInterface -{ - /** - * Create a URL-friendly slug based on the given input string - * - * @param string $input - * - * @return string - */ - public function createSlug(string $input): string; -} diff --git a/vendor/league/commonmark/src/Extension/InlinesOnly/ChildRenderer.php b/vendor/league/commonmark/src/Extension/InlinesOnly/ChildRenderer.php deleted file mode 100644 index a7b7a253ec..0000000000 --- a/vendor/league/commonmark/src/Extension/InlinesOnly/ChildRenderer.php +++ /dev/null @@ -1,46 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension\InlinesOnly; - -use League\CommonMark\Block\Element\AbstractBlock; -use League\CommonMark\Block\Element\Document; -use League\CommonMark\Block\Element\InlineContainerInterface; -use League\CommonMark\Block\Renderer\BlockRendererInterface; -use League\CommonMark\ElementRendererInterface; -use League\CommonMark\Inline\Element\AbstractInline; - -/** - * Simply renders child elements as-is, adding newlines as needed. - */ -final class ChildRenderer implements BlockRendererInterface -{ - public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, bool $inTightList = false) - { - $out = ''; - - if ($block instanceof InlineContainerInterface) { - /** @var iterable<AbstractInline> $children */ - $children = $block->children(); - $out .= $htmlRenderer->renderInlines($children); - } else { - /** @var iterable<AbstractBlock> $children */ - $children = $block->children(); - $out .= $htmlRenderer->renderBlocks($children); - } - - if (!($block instanceof Document)) { - $out .= "\n"; - } - - return $out; - } -} diff --git a/vendor/league/commonmark/src/Extension/InlinesOnly/InlinesOnlyExtension.php b/vendor/league/commonmark/src/Extension/InlinesOnly/InlinesOnlyExtension.php deleted file mode 100644 index 29ffb303a5..0000000000 --- a/vendor/league/commonmark/src/Extension/InlinesOnly/InlinesOnlyExtension.php +++ /dev/null @@ -1,63 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension\InlinesOnly; - -use League\CommonMark\Block\Element\Document; -use League\CommonMark\Block\Element\Paragraph; -use League\CommonMark\Block\Parser as BlockParser; -use League\CommonMark\ConfigurableEnvironmentInterface; -use League\CommonMark\Delimiter\Processor\EmphasisDelimiterProcessor; -use League\CommonMark\Extension\ExtensionInterface; -use League\CommonMark\Inline\Element as InlineElement; -use League\CommonMark\Inline\Parser as InlineParser; -use League\CommonMark\Inline\Renderer as InlineRenderer; - -final class InlinesOnlyExtension implements ExtensionInterface -{ - public function register(ConfigurableEnvironmentInterface $environment) - { - $childRenderer = new ChildRenderer(); - - $environment - ->addBlockParser(new BlockParser\LazyParagraphParser(), -200) - - ->addInlineParser(new InlineParser\NewlineParser(), 200) - ->addInlineParser(new InlineParser\BacktickParser(), 150) - ->addInlineParser(new InlineParser\EscapableParser(), 80) - ->addInlineParser(new InlineParser\EntityParser(), 70) - ->addInlineParser(new InlineParser\AutolinkParser(), 50) - ->addInlineParser(new InlineParser\HtmlInlineParser(), 40) - ->addInlineParser(new InlineParser\CloseBracketParser(), 30) - ->addInlineParser(new InlineParser\OpenBracketParser(), 20) - ->addInlineParser(new InlineParser\BangParser(), 10) - - ->addBlockRenderer(Document::class, $childRenderer, 0) - ->addBlockRenderer(Paragraph::class, $childRenderer, 0) - - ->addInlineRenderer(InlineElement\Code::class, new InlineRenderer\CodeRenderer(), 0) - ->addInlineRenderer(InlineElement\Emphasis::class, new InlineRenderer\EmphasisRenderer(), 0) - ->addInlineRenderer(InlineElement\HtmlInline::class, new InlineRenderer\HtmlInlineRenderer(), 0) - ->addInlineRenderer(InlineElement\Image::class, new InlineRenderer\ImageRenderer(), 0) - ->addInlineRenderer(InlineElement\Link::class, new InlineRenderer\LinkRenderer(), 0) - ->addInlineRenderer(InlineElement\Newline::class, new InlineRenderer\NewlineRenderer(), 0) - ->addInlineRenderer(InlineElement\Strong::class, new InlineRenderer\StrongRenderer(), 0) - ->addInlineRenderer(InlineElement\Text::class, new InlineRenderer\TextRenderer(), 0) - ; - - if ($environment->getConfig('use_asterisk', true)) { - $environment->addDelimiterProcessor(new EmphasisDelimiterProcessor('*')); - } - if ($environment->getConfig('use_underscore', true)) { - $environment->addDelimiterProcessor(new EmphasisDelimiterProcessor('_')); - } - } -} diff --git a/vendor/league/commonmark/src/Extension/Mention/Generator/CallbackGenerator.php b/vendor/league/commonmark/src/Extension/Mention/Generator/CallbackGenerator.php deleted file mode 100644 index 58f9bb66a3..0000000000 --- a/vendor/league/commonmark/src/Extension/Mention/Generator/CallbackGenerator.php +++ /dev/null @@ -1,48 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension\Mention\Generator; - -use League\CommonMark\Extension\Mention\Mention; -use League\CommonMark\Inline\Element\AbstractInline; - -final class CallbackGenerator implements MentionGeneratorInterface -{ - /** - * A callback function which sets the URL on the passed mention and returns the mention, return a new AbstractInline based object or null if the mention is not a match - * - * @var callable(Mention): ?AbstractInline - */ - private $callback; - - public function __construct(callable $callback) - { - $this->callback = $callback; - } - - public function generateMention(Mention $mention): ?AbstractInline - { - $result = \call_user_func_array($this->callback, [$mention]); - if ($result === null) { - return null; - } - - if ($result instanceof AbstractInline && !($result instanceof Mention)) { - return $result; - } - - if ($result instanceof Mention && $result->hasUrl()) { - return $mention; - } - - throw new \RuntimeException('CallbackGenerator callable must set the URL on the passed mention and return the mention, return a new AbstractInline based object or null if the mention is not a match'); - } -} diff --git a/vendor/league/commonmark/src/Extension/Mention/Generator/MentionGeneratorInterface.php b/vendor/league/commonmark/src/Extension/Mention/Generator/MentionGeneratorInterface.php deleted file mode 100644 index 4f834ee90b..0000000000 --- a/vendor/league/commonmark/src/Extension/Mention/Generator/MentionGeneratorInterface.php +++ /dev/null @@ -1,25 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension\Mention\Generator; - -use League\CommonMark\Extension\Mention\Mention; -use League\CommonMark\Inline\Element\AbstractInline; - -interface MentionGeneratorInterface -{ - /** - * @param Mention $mention - * - * @return AbstractInline|null - */ - public function generateMention(Mention $mention): ?AbstractInline; -} diff --git a/vendor/league/commonmark/src/Extension/Mention/Generator/StringTemplateLinkGenerator.php b/vendor/league/commonmark/src/Extension/Mention/Generator/StringTemplateLinkGenerator.php deleted file mode 100644 index 2f2c485de9..0000000000 --- a/vendor/league/commonmark/src/Extension/Mention/Generator/StringTemplateLinkGenerator.php +++ /dev/null @@ -1,31 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension\Mention\Generator; - -use League\CommonMark\Extension\Mention\Mention; -use League\CommonMark\Inline\Element\AbstractInline; - -final class StringTemplateLinkGenerator implements MentionGeneratorInterface -{ - /** @var string */ - private $urlTemplate; - - public function __construct(string $urlTemplate) - { - $this->urlTemplate = $urlTemplate; - } - - public function generateMention(Mention $mention): ?AbstractInline - { - return $mention->setUrl(\sprintf($this->urlTemplate, $mention->getIdentifier())); - } -} diff --git a/vendor/league/commonmark/src/Extension/Mention/Mention.php b/vendor/league/commonmark/src/Extension/Mention/Mention.php deleted file mode 100644 index 3344d53ead..0000000000 --- a/vendor/league/commonmark/src/Extension/Mention/Mention.php +++ /dev/null @@ -1,104 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\Mention; - -use League\CommonMark\Inline\Element\Link; -use League\CommonMark\Inline\Element\Text; - -class Mention extends Link -{ - /** @var string */ - private $symbol; - - /** @var string */ - private $identifier; - - /** - * @param string $symbol - * @param string $identifier - * @param string $label - */ - public function __construct(string $symbol, string $identifier, string $label = null) - { - $this->symbol = $symbol; - $this->identifier = $identifier; - - parent::__construct('', $label ?? \sprintf('%s%s', $symbol, $identifier)); - } - - /** - * @return string|null - */ - public function getLabel(): ?string - { - if (($labelNode = $this->findLabelNode()) === null) { - return null; - } - - return $labelNode->getContent(); - } - - /** - * @return string - */ - public function getIdentifier(): string - { - return $this->identifier; - } - - /** - * @return string - */ - public function getSymbol(): string - { - return $this->symbol; - } - - /** - * @return bool - */ - public function hasUrl(): bool - { - return !empty($this->url); - } - - /** - * @param string $label - * - * @return $this - */ - public function setLabel(string $label): self - { - if (($labelNode = $this->findLabelNode()) === null) { - $labelNode = new Text(); - $this->prependChild($labelNode); - } - - $labelNode->setContent($label); - - return $this; - } - - private function findLabelNode(): ?Text - { - foreach ($this->children() as $child) { - if ($child instanceof Text) { - return $child; - } - } - - return null; - } -} diff --git a/vendor/league/commonmark/src/Extension/Mention/MentionExtension.php b/vendor/league/commonmark/src/Extension/Mention/MentionExtension.php deleted file mode 100644 index 19a981fe0c..0000000000 --- a/vendor/league/commonmark/src/Extension/Mention/MentionExtension.php +++ /dev/null @@ -1,40 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension\Mention; - -use League\CommonMark\ConfigurableEnvironmentInterface; -use League\CommonMark\Extension\ExtensionInterface; -use League\CommonMark\Extension\Mention\Generator\MentionGeneratorInterface; - -final class MentionExtension implements ExtensionInterface -{ - public function register(ConfigurableEnvironmentInterface $environment) - { - $mentions = $environment->getConfig('mentions', []); - foreach ($mentions as $name => $mention) { - foreach (['symbol', 'regex', 'generator'] as $key) { - if (empty($mention[$key])) { - throw new \RuntimeException("Missing \"$key\" from MentionParser configuration"); - } - } - if ($mention['generator'] instanceof MentionGeneratorInterface) { - $environment->addInlineParser(new MentionParser($mention['symbol'], $mention['regex'], $mention['generator'])); - } elseif (is_string($mention['generator'])) { - $environment->addInlineParser(MentionParser::createWithStringTemplate($mention['symbol'], $mention['regex'], $mention['generator'])); - } elseif (is_callable($mention['generator'])) { - $environment->addInlineParser(MentionParser::createWithCallback($mention['symbol'], $mention['regex'], $mention['generator'])); - } else { - throw new \RuntimeException(sprintf('The "generator" provided for the MentionParser configuration must be a string template, callable, or an object that implements %s.', MentionGeneratorInterface::class)); - } - } - } -} diff --git a/vendor/league/commonmark/src/Extension/Mention/MentionParser.php b/vendor/league/commonmark/src/Extension/Mention/MentionParser.php deleted file mode 100644 index 2518a34751..0000000000 --- a/vendor/league/commonmark/src/Extension/Mention/MentionParser.php +++ /dev/null @@ -1,91 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension\Mention; - -use League\CommonMark\Extension\Mention\Generator\CallbackGenerator; -use League\CommonMark\Extension\Mention\Generator\MentionGeneratorInterface; -use League\CommonMark\Extension\Mention\Generator\StringTemplateLinkGenerator; -use League\CommonMark\Inline\Parser\InlineParserInterface; -use League\CommonMark\InlineParserContext; - -final class MentionParser implements InlineParserInterface -{ - /** @var string */ - private $symbol; - - /** @var string */ - private $mentionRegex; - - /** @var MentionGeneratorInterface */ - private $mentionGenerator; - - public function __construct(string $symbol, string $mentionRegex, MentionGeneratorInterface $mentionGenerator) - { - $this->symbol = $symbol; - $this->mentionRegex = $mentionRegex; - $this->mentionGenerator = $mentionGenerator; - } - - public function getCharacters(): array - { - return [$this->symbol]; - } - - public function parse(InlineParserContext $inlineContext): bool - { - $cursor = $inlineContext->getCursor(); - - // The symbol must not have any other characters immediately prior - $previousChar = $cursor->peek(-1); - if ($previousChar !== null && \preg_match('/\w/', $previousChar)) { - // peek() doesn't modify the cursor, so no need to restore state first - return false; - } - - // Save the cursor state in case we need to rewind and bail - $previousState = $cursor->saveState(); - - // Advance past the symbol to keep parsing simpler - $cursor->advance(); - - // Parse the mention match value - $identifier = $cursor->match($this->mentionRegex); - if ($identifier === null) { - // Regex failed to match; this isn't a valid mention - $cursor->restoreState($previousState); - - return false; - } - - $mention = $this->mentionGenerator->generateMention(new Mention($this->symbol, $identifier)); - - if ($mention === null) { - $cursor->restoreState($previousState); - - return false; - } - - $inlineContext->getContainer()->appendChild($mention); - - return true; - } - - public static function createWithStringTemplate(string $symbol, string $mentionRegex, string $urlTemplate): MentionParser - { - return new self($symbol, $mentionRegex, new StringTemplateLinkGenerator($urlTemplate)); - } - - public static function createWithCallback(string $symbol, string $mentionRegex, callable $callback): MentionParser - { - return new self($symbol, $mentionRegex, new CallbackGenerator($callback)); - } -} diff --git a/vendor/league/commonmark/src/Extension/SmartPunct/PunctuationParser.php b/vendor/league/commonmark/src/Extension/SmartPunct/PunctuationParser.php deleted file mode 100644 index 64cec44618..0000000000 --- a/vendor/league/commonmark/src/Extension/SmartPunct/PunctuationParser.php +++ /dev/null @@ -1,70 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (http://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\SmartPunct; - -use League\CommonMark\Inline\Element\Text; -use League\CommonMark\Inline\Parser\InlineParserInterface; -use League\CommonMark\InlineParserContext; - -final class PunctuationParser implements InlineParserInterface -{ - /** - * @return string[] - */ - public function getCharacters(): array - { - return ['-', '.']; - } - - public function parse(InlineParserContext $inlineContext): bool - { - $cursor = $inlineContext->getCursor(); - $ch = $cursor->getCharacter(); - - // Ellipses - if ($ch === '.' && $matched = $cursor->match('/^\\.( ?\\.)\\1/')) { - $inlineContext->getContainer()->appendChild(new Text('…')); - - return true; - } - - // Em/En-dashes - elseif ($ch === '-' && $matched = $cursor->match('/^(?<!-)(-{2,})/')) { - $count = strlen($matched); - $en_dash = '–'; - $en_count = 0; - $em_dash = '—'; - $em_count = 0; - if ($count % 3 === 0) { // If divisible by 3, use all em dashes - $em_count = $count / 3; - } elseif ($count % 2 === 0) { // If divisible by 2, use all en dashes - $en_count = $count / 2; - } elseif ($count % 3 === 2) { // If 2 extra dashes, use en dash for last 2; em dashes for rest - $em_count = ($count - 2) / 3; - $en_count = 1; - } else { // Use en dashes for last 4 hyphens; em dashes for rest - $em_count = ($count - 4) / 3; - $en_count = 2; - } - $inlineContext->getContainer()->appendChild(new Text( - str_repeat($em_dash, $em_count) . str_repeat($en_dash, $en_count) - )); - - return true; - } - - return false; - } -} diff --git a/vendor/league/commonmark/src/Extension/SmartPunct/Quote.php b/vendor/league/commonmark/src/Extension/SmartPunct/Quote.php deleted file mode 100644 index cf3c15b406..0000000000 --- a/vendor/league/commonmark/src/Extension/SmartPunct/Quote.php +++ /dev/null @@ -1,28 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (http://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\SmartPunct; - -use League\CommonMark\Inline\Element\AbstractStringContainer; - -final class Quote extends AbstractStringContainer -{ - public const DOUBLE_QUOTE = '"'; - public const DOUBLE_QUOTE_OPENER = '“'; - public const DOUBLE_QUOTE_CLOSER = '”'; - - public const SINGLE_QUOTE = "'"; - public const SINGLE_QUOTE_OPENER = '‘'; - public const SINGLE_QUOTE_CLOSER = '’'; -} diff --git a/vendor/league/commonmark/src/Extension/SmartPunct/QuoteParser.php b/vendor/league/commonmark/src/Extension/SmartPunct/QuoteParser.php deleted file mode 100644 index ffd77eaa7c..0000000000 --- a/vendor/league/commonmark/src/Extension/SmartPunct/QuoteParser.php +++ /dev/null @@ -1,104 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (http://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\SmartPunct; - -use League\CommonMark\Delimiter\Delimiter; -use League\CommonMark\Inline\Parser\InlineParserInterface; -use League\CommonMark\InlineParserContext; -use League\CommonMark\Util\RegexHelper; - -final class QuoteParser implements InlineParserInterface -{ - public const DOUBLE_QUOTES = [Quote::DOUBLE_QUOTE, Quote::DOUBLE_QUOTE_OPENER, Quote::DOUBLE_QUOTE_CLOSER]; - public const SINGLE_QUOTES = [Quote::SINGLE_QUOTE, Quote::SINGLE_QUOTE_OPENER, Quote::SINGLE_QUOTE_CLOSER]; - - /** - * @return string[] - */ - public function getCharacters(): array - { - return array_merge(self::DOUBLE_QUOTES, self::SINGLE_QUOTES); - } - - /** - * Normalizes any quote characters found and manually adds them to the delimiter stack - */ - public function parse(InlineParserContext $inlineContext): bool - { - $cursor = $inlineContext->getCursor(); - $normalizedCharacter = $this->getNormalizedQuoteCharacter($cursor->getCharacter()); - - $charBefore = $cursor->peek(-1); - if ($charBefore === null) { - $charBefore = "\n"; - } - - $cursor->advance(); - - $charAfter = $cursor->getCharacter(); - if ($charAfter === null) { - $charAfter = "\n"; - } - - [$leftFlanking, $rightFlanking] = $this->determineFlanking($charBefore, $charAfter); - $canOpen = $leftFlanking && !$rightFlanking; - $canClose = $rightFlanking; - - $node = new Quote($normalizedCharacter, ['delim' => true]); - $inlineContext->getContainer()->appendChild($node); - - // Add entry to stack to this opener - $inlineContext->getDelimiterStack()->push(new Delimiter($normalizedCharacter, 1, $node, $canOpen, $canClose)); - - return true; - } - - private function getNormalizedQuoteCharacter(string $character): string - { - if (in_array($character, self::DOUBLE_QUOTES)) { - return Quote::DOUBLE_QUOTE; - } elseif (in_array($character, self::SINGLE_QUOTES)) { - return Quote::SINGLE_QUOTE; - } - - return $character; - } - - /** - * @param string $charBefore - * @param string $charAfter - * - * @return bool[] - */ - private function determineFlanking(string $charBefore, string $charAfter) - { - $afterIsWhitespace = preg_match('/\pZ|\s/u', $charAfter); - $afterIsPunctuation = preg_match(RegexHelper::REGEX_PUNCTUATION, $charAfter); - $beforeIsWhitespace = preg_match('/\pZ|\s/u', $charBefore); - $beforeIsPunctuation = preg_match(RegexHelper::REGEX_PUNCTUATION, $charBefore); - - $leftFlanking = !$afterIsWhitespace && - !($afterIsPunctuation && - !$beforeIsWhitespace && - !$beforeIsPunctuation); - - $rightFlanking = !$beforeIsWhitespace && - !($beforeIsPunctuation && - !$afterIsWhitespace && - !$afterIsPunctuation); - - return [$leftFlanking, $rightFlanking]; - } -} diff --git a/vendor/league/commonmark/src/Extension/SmartPunct/QuoteProcessor.php b/vendor/league/commonmark/src/Extension/SmartPunct/QuoteProcessor.php deleted file mode 100644 index 132ce46b9a..0000000000 --- a/vendor/league/commonmark/src/Extension/SmartPunct/QuoteProcessor.php +++ /dev/null @@ -1,90 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (http://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\SmartPunct; - -use League\CommonMark\Delimiter\DelimiterInterface; -use League\CommonMark\Delimiter\Processor\DelimiterProcessorInterface; -use League\CommonMark\Inline\Element\AbstractStringContainer; - -final class QuoteProcessor implements DelimiterProcessorInterface -{ - /** @var string */ - private $normalizedCharacter; - - /** @var string */ - private $openerCharacter; - - /** @var string */ - private $closerCharacter; - - private function __construct(string $char, string $opener, string $closer) - { - $this->normalizedCharacter = $char; - $this->openerCharacter = $opener; - $this->closerCharacter = $closer; - } - - public function getOpeningCharacter(): string - { - return $this->normalizedCharacter; - } - - public function getClosingCharacter(): string - { - return $this->normalizedCharacter; - } - - public function getMinLength(): int - { - return 1; - } - - public function getDelimiterUse(DelimiterInterface $opener, DelimiterInterface $closer): int - { - return 1; - } - - public function process(AbstractStringContainer $opener, AbstractStringContainer $closer, int $delimiterUse) - { - $opener->insertAfter(new Quote($this->openerCharacter)); - $closer->insertBefore(new Quote($this->closerCharacter)); - } - - /** - * Create a double-quote processor - * - * @param string $opener - * @param string $closer - * - * @return QuoteProcessor - */ - public static function createDoubleQuoteProcessor(string $opener = Quote::DOUBLE_QUOTE_OPENER, string $closer = Quote::DOUBLE_QUOTE_CLOSER): self - { - return new self(Quote::DOUBLE_QUOTE, $opener, $closer); - } - - /** - * Create a single-quote processor - * - * @param string $opener - * @param string $closer - * - * @return QuoteProcessor - */ - public static function createSingleQuoteProcessor(string $opener = Quote::SINGLE_QUOTE_OPENER, string $closer = Quote::SINGLE_QUOTE_CLOSER): self - { - return new self(Quote::SINGLE_QUOTE, $opener, $closer); - } -} diff --git a/vendor/league/commonmark/src/Extension/SmartPunct/QuoteRenderer.php b/vendor/league/commonmark/src/Extension/SmartPunct/QuoteRenderer.php deleted file mode 100644 index ac2c2fb6e6..0000000000 --- a/vendor/league/commonmark/src/Extension/SmartPunct/QuoteRenderer.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (http://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\SmartPunct; - -use League\CommonMark\ElementRendererInterface; -use League\CommonMark\HtmlElement; -use League\CommonMark\Inline\Element\AbstractInline; -use League\CommonMark\Inline\Renderer\InlineRendererInterface; - -final class QuoteRenderer implements InlineRendererInterface -{ - /** - * @param Quote $inline - * @param ElementRendererInterface $htmlRenderer - * - * @return HtmlElement|string|null - */ - public function render(AbstractInline $inline, ElementRendererInterface $htmlRenderer) - { - if (!$inline instanceof Quote) { - throw new \InvalidArgumentException(sprintf('Expected an instance of "%s", got "%s" instead', Quote::class, get_class($inline))); - } - - // Handles unpaired quotes which remain after processing delimiters - if ($inline->getContent() === Quote::SINGLE_QUOTE) { - // Render as an apostrophe - return Quote::SINGLE_QUOTE_CLOSER; - } elseif ($inline->getContent() === Quote::DOUBLE_QUOTE) { - // Render as an opening quote - return Quote::DOUBLE_QUOTE_OPENER; - } - - return $inline->getContent(); - } -} diff --git a/vendor/league/commonmark/src/Extension/SmartPunct/SmartPunctExtension.php b/vendor/league/commonmark/src/Extension/SmartPunct/SmartPunctExtension.php deleted file mode 100644 index f3a19d8e74..0000000000 --- a/vendor/league/commonmark/src/Extension/SmartPunct/SmartPunctExtension.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (http://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\SmartPunct; - -use League\CommonMark\Block\Element\Document; -use League\CommonMark\Block\Element\Paragraph; -use League\CommonMark\Block\Renderer as CoreBlockRenderer; -use League\CommonMark\ConfigurableEnvironmentInterface; -use League\CommonMark\Extension\ExtensionInterface; -use League\CommonMark\Inline\Element\Text; -use League\CommonMark\Inline\Renderer as CoreInlineRenderer; - -final class SmartPunctExtension implements ExtensionInterface -{ - public function register(ConfigurableEnvironmentInterface $environment) - { - $environment - ->addInlineParser(new QuoteParser(), 10) - ->addInlineParser(new PunctuationParser(), 0) - - ->addDelimiterProcessor(QuoteProcessor::createDoubleQuoteProcessor( - $environment->getConfig('smartpunct/double_quote_opener', Quote::DOUBLE_QUOTE_OPENER), - $environment->getConfig('smartpunct/double_quote_closer', Quote::DOUBLE_QUOTE_CLOSER) - )) - ->addDelimiterProcessor(QuoteProcessor::createSingleQuoteProcessor( - $environment->getConfig('smartpunct/single_quote_opener', Quote::SINGLE_QUOTE_OPENER), - $environment->getConfig('smartpunct/single_quote_closer', Quote::SINGLE_QUOTE_CLOSER) - )) - - ->addBlockRenderer(Document::class, new CoreBlockRenderer\DocumentRenderer(), 0) - ->addBlockRenderer(Paragraph::class, new CoreBlockRenderer\ParagraphRenderer(), 0) - - ->addInlineRenderer(Quote::class, new QuoteRenderer(), 100) - ->addInlineRenderer(Text::class, new CoreInlineRenderer\TextRenderer(), 0) - ; - } -} diff --git a/vendor/league/commonmark/src/Extension/Strikethrough/Strikethrough.php b/vendor/league/commonmark/src/Extension/Strikethrough/Strikethrough.php deleted file mode 100644 index 8219b7592b..0000000000 --- a/vendor/league/commonmark/src/Extension/Strikethrough/Strikethrough.php +++ /dev/null @@ -1,22 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> and uAfrica.com (http://uafrica.com) - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\Strikethrough; - -use League\CommonMark\Inline\Element\AbstractInline; - -final class Strikethrough extends AbstractInline -{ - public function isContainer(): bool - { - return true; - } -} diff --git a/vendor/league/commonmark/src/Extension/Strikethrough/StrikethroughDelimiterProcessor.php b/vendor/league/commonmark/src/Extension/Strikethrough/StrikethroughDelimiterProcessor.php deleted file mode 100644 index eda318d879..0000000000 --- a/vendor/league/commonmark/src/Extension/Strikethrough/StrikethroughDelimiterProcessor.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> and uAfrica.com (http://uafrica.com) - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\Strikethrough; - -use League\CommonMark\Delimiter\DelimiterInterface; -use League\CommonMark\Delimiter\Processor\DelimiterProcessorInterface; -use League\CommonMark\Inline\Element\AbstractStringContainer; - -final class StrikethroughDelimiterProcessor implements DelimiterProcessorInterface -{ - public function getOpeningCharacter(): string - { - return '~'; - } - - public function getClosingCharacter(): string - { - return '~'; - } - - public function getMinLength(): int - { - return 2; - } - - public function getDelimiterUse(DelimiterInterface $opener, DelimiterInterface $closer): int - { - $min = \min($opener->getLength(), $closer->getLength()); - - return $min >= 2 ? $min : 0; - } - - public function process(AbstractStringContainer $opener, AbstractStringContainer $closer, int $delimiterUse) - { - $strikethrough = new Strikethrough(); - - $tmp = $opener->next(); - while ($tmp !== null && $tmp !== $closer) { - $next = $tmp->next(); - $strikethrough->appendChild($tmp); - $tmp = $next; - } - - $opener->insertAfter($strikethrough); - } -} diff --git a/vendor/league/commonmark/src/Extension/Strikethrough/StrikethroughExtension.php b/vendor/league/commonmark/src/Extension/Strikethrough/StrikethroughExtension.php deleted file mode 100644 index a77d80c2a0..0000000000 --- a/vendor/league/commonmark/src/Extension/Strikethrough/StrikethroughExtension.php +++ /dev/null @@ -1,24 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> and uAfrica.com (http://uafrica.com) - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\Strikethrough; - -use League\CommonMark\ConfigurableEnvironmentInterface; -use League\CommonMark\Extension\ExtensionInterface; - -final class StrikethroughExtension implements ExtensionInterface -{ - public function register(ConfigurableEnvironmentInterface $environment) - { - $environment->addDelimiterProcessor(new StrikethroughDelimiterProcessor()); - $environment->addInlineRenderer(Strikethrough::class, new StrikethroughRenderer()); - } -} diff --git a/vendor/league/commonmark/src/Extension/Strikethrough/StrikethroughRenderer.php b/vendor/league/commonmark/src/Extension/Strikethrough/StrikethroughRenderer.php deleted file mode 100644 index 8772939c20..0000000000 --- a/vendor/league/commonmark/src/Extension/Strikethrough/StrikethroughRenderer.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> and uAfrica.com (http://uafrica.com) - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\Strikethrough; - -use League\CommonMark\ElementRendererInterface; -use League\CommonMark\HtmlElement; -use League\CommonMark\Inline\Element\AbstractInline; -use League\CommonMark\Inline\Renderer\InlineRendererInterface; - -final class StrikethroughRenderer implements InlineRendererInterface -{ - public function render(AbstractInline $inline, ElementRendererInterface $htmlRenderer) - { - if (!($inline instanceof Strikethrough)) { - throw new \InvalidArgumentException('Incompatible inline type: ' . get_class($inline)); - } - - return new HtmlElement('del', $inline->getData('attributes', []), $htmlRenderer->renderInlines($inline->children())); - } -} diff --git a/vendor/league/commonmark/src/Extension/Table/Table.php b/vendor/league/commonmark/src/Extension/Table/Table.php deleted file mode 100644 index 10beab2b1e..0000000000 --- a/vendor/league/commonmark/src/Extension/Table/Table.php +++ /dev/null @@ -1,69 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This is part of the league/commonmark package. - * - * (c) Martin Hasoň <martin.hason@gmail.com> - * (c) Webuni s.r.o. <info@webuni.cz> - * (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\Extension\Table; - -use League\CommonMark\Block\Element\AbstractBlock; -use League\CommonMark\Block\Element\AbstractStringContainerBlock; -use League\CommonMark\Block\Element\InlineContainerInterface; -use League\CommonMark\ContextInterface; -use League\CommonMark\Cursor; - -final class Table extends AbstractStringContainerBlock implements InlineContainerInterface -{ - /** @var TableSection */ - private $head; - /** @var TableSection */ - private $body; - /** @var \Closure */ - private $parser; - - public function __construct(\Closure $parser) - { - parent::__construct(); - $this->appendChild($this->head = new TableSection(TableSection::TYPE_HEAD)); - $this->appendChild($this->body = new TableSection(TableSection::TYPE_BODY)); - $this->parser = $parser; - } - - public function canContain(AbstractBlock $block): bool - { - return $block instanceof TableSection; - } - - public function isCode(): bool - { - return false; - } - - public function getHead(): TableSection - { - return $this->head; - } - - public function getBody(): TableSection - { - return $this->body; - } - - public function matchesNextLine(Cursor $cursor): bool - { - return call_user_func($this->parser, $cursor, $this); - } - - public function handleRemainingContents(ContextInterface $context, Cursor $cursor): void - { - } -} diff --git a/vendor/league/commonmark/src/Extension/Table/TableCell.php b/vendor/league/commonmark/src/Extension/Table/TableCell.php deleted file mode 100644 index 74128931cc..0000000000 --- a/vendor/league/commonmark/src/Extension/Table/TableCell.php +++ /dev/null @@ -1,66 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This is part of the league/commonmark package. - * - * (c) Martin Hasoň <martin.hason@gmail.com> - * (c) Webuni s.r.o. <info@webuni.cz> - * (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\Extension\Table; - -use League\CommonMark\Block\Element\AbstractBlock; -use League\CommonMark\Block\Element\AbstractStringContainerBlock; -use League\CommonMark\Block\Element\InlineContainerInterface; -use League\CommonMark\ContextInterface; -use League\CommonMark\Cursor; - -final class TableCell extends AbstractStringContainerBlock implements InlineContainerInterface -{ - const TYPE_HEAD = 'th'; - const TYPE_BODY = 'td'; - - const ALIGN_LEFT = 'left'; - const ALIGN_RIGHT = 'right'; - const ALIGN_CENTER = 'center'; - - /** @var string */ - public $type = self::TYPE_BODY; - - /** @var string|null */ - public $align; - - public function __construct(string $string = '', string $type = self::TYPE_BODY, string $align = null) - { - parent::__construct(); - $this->finalStringContents = $string; - $this->addLine($string); - $this->type = $type; - $this->align = $align; - } - - public function canContain(AbstractBlock $block): bool - { - return false; - } - - public function isCode(): bool - { - return false; - } - - public function matchesNextLine(Cursor $cursor): bool - { - return false; - } - - public function handleRemainingContents(ContextInterface $context, Cursor $cursor): void - { - } -} diff --git a/vendor/league/commonmark/src/Extension/Table/TableCellRenderer.php b/vendor/league/commonmark/src/Extension/Table/TableCellRenderer.php deleted file mode 100644 index 248f70781c..0000000000 --- a/vendor/league/commonmark/src/Extension/Table/TableCellRenderer.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This is part of the league/commonmark package. - * - * (c) Martin Hasoň <martin.hason@gmail.com> - * (c) Webuni s.r.o. <info@webuni.cz> - * (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\Extension\Table; - -use League\CommonMark\Block\Element\AbstractBlock; -use League\CommonMark\Block\Renderer\BlockRendererInterface; -use League\CommonMark\ElementRendererInterface; -use League\CommonMark\HtmlElement; - -final class TableCellRenderer implements BlockRendererInterface -{ - public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, bool $inTightList = false) - { - if (!$block instanceof TableCell) { - throw new \InvalidArgumentException('Incompatible block type: ' . get_class($block)); - } - - $attrs = $block->getData('attributes', []); - - if ($block->align !== null) { - $attrs['align'] = $block->align; - } - - return new HtmlElement($block->type, $attrs, $htmlRenderer->renderInlines($block->children())); - } -} diff --git a/vendor/league/commonmark/src/Extension/Table/TableExtension.php b/vendor/league/commonmark/src/Extension/Table/TableExtension.php deleted file mode 100644 index 0046b1bea6..0000000000 --- a/vendor/league/commonmark/src/Extension/Table/TableExtension.php +++ /dev/null @@ -1,34 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This is part of the league/commonmark package. - * - * (c) Martin Hasoň <martin.hason@gmail.com> - * (c) Webuni s.r.o. <info@webuni.cz> - * (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\Extension\Table; - -use League\CommonMark\ConfigurableEnvironmentInterface; -use League\CommonMark\Extension\ExtensionInterface; - -final class TableExtension implements ExtensionInterface -{ - public function register(ConfigurableEnvironmentInterface $environment): void - { - $environment - ->addBlockParser(new TableParser()) - - ->addBlockRenderer(Table::class, new TableRenderer()) - ->addBlockRenderer(TableSection::class, new TableSectionRenderer()) - ->addBlockRenderer(TableRow::class, new TableRowRenderer()) - ->addBlockRenderer(TableCell::class, new TableCellRenderer()) - ; - } -} diff --git a/vendor/league/commonmark/src/Extension/Table/TableParser.php b/vendor/league/commonmark/src/Extension/Table/TableParser.php deleted file mode 100644 index ce44332b0e..0000000000 --- a/vendor/league/commonmark/src/Extension/Table/TableParser.php +++ /dev/null @@ -1,283 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This is part of the league/commonmark package. - * - * (c) Martin Hasoň <martin.hason@gmail.com> - * (c) Webuni s.r.o. <info@webuni.cz> - * (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\Extension\Table; - -use League\CommonMark\Block\Element\Document; -use League\CommonMark\Block\Element\Paragraph; -use League\CommonMark\Block\Parser\BlockParserInterface; -use League\CommonMark\Context; -use League\CommonMark\ContextInterface; -use League\CommonMark\Cursor; -use League\CommonMark\EnvironmentAwareInterface; -use League\CommonMark\EnvironmentInterface; - -final class TableParser implements BlockParserInterface, EnvironmentAwareInterface -{ - /** - * @var EnvironmentInterface - */ - private $environment; - - public function parse(ContextInterface $context, Cursor $cursor): bool - { - $container = $context->getContainer(); - if (!$container instanceof Paragraph) { - return false; - } - - $lines = $container->getStrings(); - if (count($lines) !== 1) { - return false; - } - - if (\strpos($lines[0], '|') === false) { - return false; - } - - $oldState = $cursor->saveState(); - $cursor->advanceToNextNonSpaceOrTab(); - $columns = $this->parseColumns($cursor); - - if (empty($columns)) { - $cursor->restoreState($oldState); - - return false; - } - - $head = $this->parseRow(trim((string) array_pop($lines)), $columns, TableCell::TYPE_HEAD); - if (null === $head) { - $cursor->restoreState($oldState); - - return false; - } - - $table = new Table(function (Cursor $cursor, Table $table) use ($columns): bool { - // The next line cannot be a new block start - // This is a bit inefficient, but it's the only feasible way to check - // given the current v1 API. - if (self::isANewBlock($this->environment, $cursor->getLine())) { - return false; - } - - $row = $this->parseRow(\trim($cursor->getLine()), $columns); - if (null === $row) { - return false; - } - - $table->getBody()->appendChild($row); - - return true; - }); - - $table->getHead()->appendChild($head); - - if (count($lines) >= 1) { - $paragraph = new Paragraph(); - foreach ($lines as $line) { - $paragraph->addLine($line); - } - - $context->replaceContainerBlock($paragraph); - $context->addBlock($table); - } else { - $context->replaceContainerBlock($table); - } - - return true; - } - - /** - * @param string $line - * @param array<int, string> $columns - * @param string $type - * - * @return TableRow|null - */ - private function parseRow(string $line, array $columns, string $type = TableCell::TYPE_BODY): ?TableRow - { - $cells = $this->split(new Cursor(\trim($line))); - - if (empty($cells)) { - return null; - } - - // The header row must match the delimiter row in the number of cells - if ($type === TableCell::TYPE_HEAD && \count($cells) !== \count($columns)) { - return null; - } - - $i = 0; - $row = new TableRow(); - foreach ($cells as $i => $cell) { - if (!array_key_exists($i, $columns)) { - return $row; - } - - $row->appendChild(new TableCell(trim($cell), $type, $columns[$i])); - } - - for ($j = count($columns) - 1; $j > $i; --$j) { - $row->appendChild(new TableCell('', $type, null)); - } - - return $row; - } - - /** - * @param Cursor $cursor - * - * @return array<int, string> - */ - private function split(Cursor $cursor): array - { - if ($cursor->getCharacter() === '|') { - $cursor->advanceBy(1); - } - - $cells = []; - $sb = ''; - - while (!$cursor->isAtEnd()) { - switch ($c = $cursor->getCharacter()) { - case '\\': - if ($cursor->peek() === '|') { - // Pipe is special for table parsing. An escaped pipe doesn't result in a new cell, but is - // passed down to inline parsing as an unescaped pipe. Note that that applies even for the `\|` - // in an input like `\\|` - in other words, table parsing doesn't support escaping backslashes. - $sb .= '|'; - $cursor->advanceBy(1); - } else { - // Preserve backslash before other characters or at end of line. - $sb .= '\\'; - } - break; - case '|': - $cells[] = $sb; - $sb = ''; - break; - default: - $sb .= $c; - } - $cursor->advanceBy(1); - } - - if ($sb !== '') { - $cells[] = $sb; - } - - return $cells; - } - - /** - * @param Cursor $cursor - * - * @return array<int, string> - */ - private function parseColumns(Cursor $cursor): array - { - $columns = []; - $pipes = 0; - $valid = false; - - while (!$cursor->isAtEnd()) { - switch ($c = $cursor->getCharacter()) { - case '|': - $cursor->advanceBy(1); - $pipes++; - if ($pipes > 1) { - // More than one adjacent pipe not allowed - return []; - } - - // Need at least one pipe, even for a one-column table - $valid = true; - break; - case '-': - case ':': - if ($pipes === 0 && !empty($columns)) { - // Need a pipe after the first column (first column doesn't need to start with one) - return []; - } - $left = false; - $right = false; - if ($c === ':') { - $left = true; - $cursor->advanceBy(1); - } - if ($cursor->match('/^-+/') === null) { - // Need at least one dash - return []; - } - if ($cursor->getCharacter() === ':') { - $right = true; - $cursor->advanceBy(1); - } - $columns[] = $this->getAlignment($left, $right); - // Next, need another pipe - $pipes = 0; - break; - case ' ': - case "\t": - // White space is allowed between pipes and columns - $cursor->advanceToNextNonSpaceOrTab(); - break; - default: - // Any other character is invalid - return []; - } - } - - if (!$valid) { - return []; - } - - return $columns; - } - - private static function getAlignment(bool $left, bool $right): ?string - { - if ($left && $right) { - return TableCell::ALIGN_CENTER; - } elseif ($left) { - return TableCell::ALIGN_LEFT; - } elseif ($right) { - return TableCell::ALIGN_RIGHT; - } - - return null; - } - - public function setEnvironment(EnvironmentInterface $environment) - { - $this->environment = $environment; - } - - private static function isANewBlock(EnvironmentInterface $environment, string $line): bool - { - $context = new Context(new Document(), $environment); - $context->setNextLine($line); - $cursor = new Cursor($line); - - /** @var BlockParserInterface $parser */ - foreach ($environment->getBlockParsers() as $parser) { - if ($parser->parse($context, $cursor)) { - return true; - } - } - - return false; - } -} diff --git a/vendor/league/commonmark/src/Extension/Table/TableRenderer.php b/vendor/league/commonmark/src/Extension/Table/TableRenderer.php deleted file mode 100644 index 1d414c6162..0000000000 --- a/vendor/league/commonmark/src/Extension/Table/TableRenderer.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This is part of the league/commonmark package. - * - * (c) Martin Hasoň <martin.hason@gmail.com> - * (c) Webuni s.r.o. <info@webuni.cz> - * (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\Extension\Table; - -use League\CommonMark\Block\Element\AbstractBlock; -use League\CommonMark\Block\Renderer\BlockRendererInterface; -use League\CommonMark\ElementRendererInterface; -use League\CommonMark\HtmlElement; - -final class TableRenderer implements BlockRendererInterface -{ - public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, bool $inTightList = false) - { - if (!$block instanceof Table) { - throw new \InvalidArgumentException('Incompatible block type: ' . get_class($block)); - } - - $attrs = $block->getData('attributes', []); - - $separator = $htmlRenderer->getOption('inner_separator', "\n"); - - $children = $htmlRenderer->renderBlocks($block->children()); - - return new HtmlElement('table', $attrs, $separator . \trim($children) . $separator); - } -} diff --git a/vendor/league/commonmark/src/Extension/Table/TableRow.php b/vendor/league/commonmark/src/Extension/Table/TableRow.php deleted file mode 100644 index 1447725949..0000000000 --- a/vendor/league/commonmark/src/Extension/Table/TableRow.php +++ /dev/null @@ -1,48 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This is part of the league/commonmark package. - * - * (c) Martin Hasoň <martin.hason@gmail.com> - * (c) Webuni s.r.o. <info@webuni.cz> - * (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\Extension\Table; - -use League\CommonMark\Block\Element\AbstractBlock; -use League\CommonMark\Cursor; -use League\CommonMark\Node\Node; - -final class TableRow extends AbstractBlock -{ - public function canContain(AbstractBlock $block): bool - { - return $block instanceof TableCell; - } - - public function isCode(): bool - { - return false; - } - - public function matchesNextLine(Cursor $cursor): bool - { - return false; - } - - /** - * @return AbstractBlock[] - */ - public function children(): iterable - { - return array_filter((array) parent::children(), static function (Node $child): bool { - return $child instanceof AbstractBlock; - }); - } -} diff --git a/vendor/league/commonmark/src/Extension/Table/TableRowRenderer.php b/vendor/league/commonmark/src/Extension/Table/TableRowRenderer.php deleted file mode 100644 index dbbcd13238..0000000000 --- a/vendor/league/commonmark/src/Extension/Table/TableRowRenderer.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This is part of the league/commonmark package. - * - * (c) Martin Hasoň <martin.hason@gmail.com> - * (c) Webuni s.r.o. <info@webuni.cz> - * (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\Extension\Table; - -use League\CommonMark\Block\Element\AbstractBlock; -use League\CommonMark\Block\Renderer\BlockRendererInterface; -use League\CommonMark\ElementRendererInterface; -use League\CommonMark\HtmlElement; - -final class TableRowRenderer implements BlockRendererInterface -{ - public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, bool $inTightList = false) - { - if (!$block instanceof TableRow) { - throw new \InvalidArgumentException('Incompatible block type: ' . get_class($block)); - } - - $attrs = $block->getData('attributes', []); - - $separator = $htmlRenderer->getOption('inner_separator', "\n"); - - return new HtmlElement('tr', $attrs, $separator . $htmlRenderer->renderBlocks($block->children()) . $separator); - } -} diff --git a/vendor/league/commonmark/src/Extension/Table/TableSection.php b/vendor/league/commonmark/src/Extension/Table/TableSection.php deleted file mode 100644 index 2df09157d9..0000000000 --- a/vendor/league/commonmark/src/Extension/Table/TableSection.php +++ /dev/null @@ -1,66 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This is part of the league/commonmark package. - * - * (c) Martin Hasoň <martin.hason@gmail.com> - * (c) Webuni s.r.o. <info@webuni.cz> - * (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\Extension\Table; - -use League\CommonMark\Block\Element\AbstractBlock; -use League\CommonMark\Block\Element\AbstractStringContainerBlock; -use League\CommonMark\Block\Element\InlineContainerInterface; -use League\CommonMark\ContextInterface; -use League\CommonMark\Cursor; - -final class TableSection extends AbstractStringContainerBlock implements InlineContainerInterface -{ - const TYPE_HEAD = 'thead'; - const TYPE_BODY = 'tbody'; - - /** @var string */ - public $type = self::TYPE_BODY; - - public function __construct(string $type = self::TYPE_BODY) - { - parent::__construct(); - $this->type = $type; - } - - public function isHead(): bool - { - return self::TYPE_HEAD === $this->type; - } - - public function isBody(): bool - { - return self::TYPE_BODY === $this->type; - } - - public function canContain(AbstractBlock $block): bool - { - return $block instanceof TableRow; - } - - public function isCode(): bool - { - return false; - } - - public function matchesNextLine(Cursor $cursor): bool - { - return false; - } - - public function handleRemainingContents(ContextInterface $context, Cursor $cursor): void - { - } -} diff --git a/vendor/league/commonmark/src/Extension/Table/TableSectionRenderer.php b/vendor/league/commonmark/src/Extension/Table/TableSectionRenderer.php deleted file mode 100644 index 02e17d3caa..0000000000 --- a/vendor/league/commonmark/src/Extension/Table/TableSectionRenderer.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This is part of the league/commonmark package. - * - * (c) Martin Hasoň <martin.hason@gmail.com> - * (c) Webuni s.r.o. <info@webuni.cz> - * (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\Extension\Table; - -use League\CommonMark\Block\Element\AbstractBlock; -use League\CommonMark\Block\Renderer\BlockRendererInterface; -use League\CommonMark\ElementRendererInterface; -use League\CommonMark\HtmlElement; - -final class TableSectionRenderer implements BlockRendererInterface -{ - public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, bool $inTightList = false) - { - if (!$block instanceof TableSection) { - throw new \InvalidArgumentException('Incompatible block type: ' . get_class($block)); - } - - if (!$block->hasChildren()) { - return ''; - } - - $attrs = $block->getData('attributes', []); - - $separator = $htmlRenderer->getOption('inner_separator', "\n"); - - return new HtmlElement($block->type, $attrs, $separator . $htmlRenderer->renderBlocks($block->children()) . $separator); - } -} diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/Node/TableOfContents.php b/vendor/league/commonmark/src/Extension/TableOfContents/Node/TableOfContents.php deleted file mode 100644 index dbcaf3b638..0000000000 --- a/vendor/league/commonmark/src/Extension/TableOfContents/Node/TableOfContents.php +++ /dev/null @@ -1,21 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension\TableOfContents\Node; - -use League\CommonMark\Block\Element\ListBlock; -use League\CommonMark\Extension\TableOfContents\TableOfContents as DeprecatedTableOfContents; - -final class TableOfContents extends ListBlock -{ -} - -\class_exists(DeprecatedTableOfContents::class); diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/Node/TableOfContentsPlaceholder.php b/vendor/league/commonmark/src/Extension/TableOfContents/Node/TableOfContentsPlaceholder.php deleted file mode 100644 index 7edafe779b..0000000000 --- a/vendor/league/commonmark/src/Extension/TableOfContents/Node/TableOfContentsPlaceholder.php +++ /dev/null @@ -1,33 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension\TableOfContents\Node; - -use League\CommonMark\Block\Element\AbstractBlock; -use League\CommonMark\Cursor; - -final class TableOfContentsPlaceholder extends AbstractBlock -{ - public function canContain(AbstractBlock $block): bool - { - return false; - } - - public function isCode(): bool - { - return false; - } - - public function matchesNextLine(Cursor $cursor): bool - { - return false; - } -} diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/AsIsNormalizerStrategy.php b/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/AsIsNormalizerStrategy.php deleted file mode 100644 index c9e524bded..0000000000 --- a/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/AsIsNormalizerStrategy.php +++ /dev/null @@ -1,70 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension\TableOfContents\Normalizer; - -use League\CommonMark\Block\Element\ListBlock; -use League\CommonMark\Block\Element\ListItem; -use League\CommonMark\Extension\TableOfContents\Node\TableOfContents; - -final class AsIsNormalizerStrategy implements NormalizerStrategyInterface -{ - /** @var ListBlock */ - private $parentListBlock; - /** @var int */ - private $parentLevel = 1; - /** @var ListItem|null */ - private $lastListItem; - - public function __construct(TableOfContents $toc) - { - $this->parentListBlock = $toc; - } - - public function addItem(int $level, ListItem $listItemToAdd): void - { - while ($level > $this->parentLevel) { - // Descend downwards, creating new ListBlocks if needed, until we reach the correct depth - if ($this->lastListItem === null) { - $this->lastListItem = new ListItem($this->parentListBlock->getListData()); - $this->parentListBlock->appendChild($this->lastListItem); - } - - $newListBlock = new ListBlock($this->parentListBlock->getListData()); - $newListBlock->setStartLine($listItemToAdd->getStartLine()); - $newListBlock->setEndLine($listItemToAdd->getEndLine()); - $this->lastListItem->appendChild($newListBlock); - $this->parentListBlock = $newListBlock; - $this->lastListItem = null; - - $this->parentLevel++; - } - - while ($level < $this->parentLevel) { - // Search upwards for the previous parent list block - while (true) { - $this->parentListBlock = $this->parentListBlock->parent(); - if ($this->parentListBlock instanceof ListBlock) { - break; - } - } - - $this->parentLevel--; - } - - $this->parentListBlock->appendChild($listItemToAdd); - - $this->lastListItem = $listItemToAdd; - } -} - -// Trigger autoload without causing a deprecated error -\class_exists(TableOfContents::class); diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/FlatNormalizerStrategy.php b/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/FlatNormalizerStrategy.php deleted file mode 100644 index 87ed7a7ebd..0000000000 --- a/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/FlatNormalizerStrategy.php +++ /dev/null @@ -1,34 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension\TableOfContents\Normalizer; - -use League\CommonMark\Block\Element\ListItem; -use League\CommonMark\Extension\TableOfContents\Node\TableOfContents; - -final class FlatNormalizerStrategy implements NormalizerStrategyInterface -{ - /** @var TableOfContents */ - private $toc; - - public function __construct(TableOfContents $toc) - { - $this->toc = $toc; - } - - public function addItem(int $level, ListItem $listItemToAdd): void - { - $this->toc->appendChild($listItemToAdd); - } -} - -// Trigger autoload without causing a deprecated error -\class_exists(TableOfContents::class); diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/NormalizerStrategyInterface.php b/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/NormalizerStrategyInterface.php deleted file mode 100644 index b69c415102..0000000000 --- a/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/NormalizerStrategyInterface.php +++ /dev/null @@ -1,19 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension\TableOfContents\Normalizer; - -use League\CommonMark\Block\Element\ListItem; - -interface NormalizerStrategyInterface -{ - public function addItem(int $level, ListItem $listItemToAdd): void; -} diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/RelativeNormalizerStrategy.php b/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/RelativeNormalizerStrategy.php deleted file mode 100644 index 3043d80e8b..0000000000 --- a/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/RelativeNormalizerStrategy.php +++ /dev/null @@ -1,67 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension\TableOfContents\Normalizer; - -use League\CommonMark\Block\Element\ListBlock; -use League\CommonMark\Block\Element\ListItem; -use League\CommonMark\Extension\TableOfContents\Node\TableOfContents; - -final class RelativeNormalizerStrategy implements NormalizerStrategyInterface -{ - /** @var TableOfContents */ - private $toc; - - /** @var array<int, ListItem> */ - private $listItemStack = []; - - public function __construct(TableOfContents $toc) - { - $this->toc = $toc; - } - - public function addItem(int $level, ListItem $listItemToAdd): void - { - \end($this->listItemStack); - $previousLevel = \key($this->listItemStack); - - // Pop the stack if we're too deep - while ($previousLevel !== null && $level < $previousLevel) { - array_pop($this->listItemStack); - \end($this->listItemStack); - $previousLevel = \key($this->listItemStack); - } - - /** @var ListItem|false $lastListItem */ - $lastListItem = \current($this->listItemStack); - - // Need to go one level deeper? Add that level - if ($lastListItem !== false && $level > $previousLevel) { - $targetListBlock = new ListBlock($lastListItem->getListData()); - $targetListBlock->setStartLine($listItemToAdd->getStartLine()); - $targetListBlock->setEndLine($listItemToAdd->getEndLine()); - $lastListItem->appendChild($targetListBlock); - // Otherwise we're at the right level - // If there's no stack we're adding this item directly to the TOC element - } elseif ($lastListItem === false) { - $targetListBlock = $this->toc; - // Otherwise add it to the last list item - } else { - $targetListBlock = $lastListItem->parent(); - } - - $targetListBlock->appendChild($listItemToAdd); - $this->listItemStack[$level] = $listItemToAdd; - } -} - -// Trigger autoload without causing a deprecated error -\class_exists(TableOfContents::class); diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContents.php b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContents.php deleted file mode 100644 index ef01d2ed7d..0000000000 --- a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContents.php +++ /dev/null @@ -1,30 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension\TableOfContents; - -use League\CommonMark\Block\Element\ListBlock; -use League\CommonMark\Extension\TableOfContents\Node\TableOfContents as NewTableOfContents; - -if (!class_exists(NewTableOfContents::class)) { - @trigger_error(sprintf('TableOfContents has moved to a new namespace; use %s instead', NewTableOfContents::class), \E_USER_DEPRECATED); -} - -\class_alias(NewTableOfContents::class, TableOfContents::class); - -if (false) { - /** - * @deprecated This class has moved to the Node sub-namespace; use that instead - */ - final class TableOfContents extends ListBlock - { - } -} diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsBuilder.php b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsBuilder.php deleted file mode 100644 index 8ff06afc7b..0000000000 --- a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsBuilder.php +++ /dev/null @@ -1,127 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension\TableOfContents; - -use League\CommonMark\Block\Element\Document; -use League\CommonMark\Block\Element\Heading; -use League\CommonMark\Event\DocumentParsedEvent; -use League\CommonMark\Exception\InvalidOptionException; -use League\CommonMark\Extension\HeadingPermalink\HeadingPermalink; -use League\CommonMark\Extension\TableOfContents\Node\TableOfContents; -use League\CommonMark\Extension\TableOfContents\Node\TableOfContentsPlaceholder; -use League\CommonMark\Util\ConfigurationAwareInterface; -use League\CommonMark\Util\ConfigurationInterface; - -final class TableOfContentsBuilder implements ConfigurationAwareInterface -{ - /** - * @deprecated Use TableOfContentsGenerator::STYLE_BULLET instead - */ - public const STYLE_BULLET = TableOfContentsGenerator::STYLE_BULLET; - - /** - * @deprecated Use TableOfContentsGenerator::STYLE_ORDERED instead - */ - public const STYLE_ORDERED = TableOfContentsGenerator::STYLE_ORDERED; - - /** - * @deprecated Use TableOfContentsGenerator::NORMALIZE_DISABLED instead - */ - public const NORMALIZE_DISABLED = TableOfContentsGenerator::NORMALIZE_DISABLED; - - /** - * @deprecated Use TableOfContentsGenerator::NORMALIZE_RELATIVE instead - */ - public const NORMALIZE_RELATIVE = TableOfContentsGenerator::NORMALIZE_RELATIVE; - - /** - * @deprecated Use TableOfContentsGenerator::NORMALIZE_FLAT instead - */ - public const NORMALIZE_FLAT = TableOfContentsGenerator::NORMALIZE_FLAT; - - public const POSITION_TOP = 'top'; - public const POSITION_BEFORE_HEADINGS = 'before-headings'; - public const POSITION_PLACEHOLDER = 'placeholder'; - - /** @var ConfigurationInterface */ - private $config; - - public function onDocumentParsed(DocumentParsedEvent $event): void - { - $document = $event->getDocument(); - - $generator = new TableOfContentsGenerator( - $this->config->get('table_of_contents/style', TableOfContentsGenerator::STYLE_BULLET), - $this->config->get('table_of_contents/normalize', TableOfContentsGenerator::NORMALIZE_RELATIVE), - (int) $this->config->get('table_of_contents/min_heading_level', 1), - (int) $this->config->get('table_of_contents/max_heading_level', 6) - ); - - $toc = $generator->generate($document); - if ($toc === null) { - // No linkable headers exist, so no TOC could be generated - return; - } - - // Add custom CSS class(es), if defined - $class = $this->config->get('table_of_contents/html_class', 'table-of-contents'); - if (!empty($class)) { - $toc->data['attributes']['class'] = $class; - } - - // Add the TOC to the Document - $position = $this->config->get('table_of_contents/position', self::POSITION_TOP); - if ($position === self::POSITION_TOP) { - $document->prependChild($toc); - } elseif ($position === self::POSITION_BEFORE_HEADINGS) { - $this->insertBeforeFirstLinkedHeading($document, $toc); - } elseif ($position === self::POSITION_PLACEHOLDER) { - $this->replacePlaceholders($document, $toc); - } else { - throw new InvalidOptionException(\sprintf('Invalid config option "%s" for "table_of_contents/position"', $position)); - } - } - - private function insertBeforeFirstLinkedHeading(Document $document, TableOfContents $toc): void - { - $walker = $document->walker(); - while ($event = $walker->next()) { - if ($event->isEntering() && ($node = $event->getNode()) instanceof HeadingPermalink && ($parent = $node->parent()) instanceof Heading) { - $parent->insertBefore($toc); - - return; - } - } - } - - private function replacePlaceholders(Document $document, TableOfContents $toc): void - { - $walker = $document->walker(); - while ($event = $walker->next()) { - // Add the block once we find a placeholder (and we're about to leave it) - if (!$event->getNode() instanceof TableOfContentsPlaceholder) { - continue; - } - - if ($event->isEntering()) { - continue; - } - - $event->getNode()->replaceWith(clone $toc); - } - } - - public function setConfiguration(ConfigurationInterface $config) - { - $this->config = $config; - } -} diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsExtension.php b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsExtension.php deleted file mode 100644 index 287ced77d8..0000000000 --- a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsExtension.php +++ /dev/null @@ -1,31 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension\TableOfContents; - -use League\CommonMark\ConfigurableEnvironmentInterface; -use League\CommonMark\Event\DocumentParsedEvent; -use League\CommonMark\Extension\ExtensionInterface; -use League\CommonMark\Extension\TableOfContents\Node\TableOfContentsPlaceholder; - -final class TableOfContentsExtension implements ExtensionInterface -{ - public function register(ConfigurableEnvironmentInterface $environment): void - { - $environment->addEventListener(DocumentParsedEvent::class, [new TableOfContentsBuilder(), 'onDocumentParsed'], -150); - - if ($environment->getConfig('table_of_contents/position') === TableOfContentsBuilder::POSITION_PLACEHOLDER) { - $environment->addBlockParser(new TableOfContentsPlaceholderParser(), 200); - // If a placeholder cannot be replaced with a TOC element this renderer will ensure the parser won't error out - $environment->addBlockRenderer(TableOfContentsPlaceholder::class, new TableOfContentsPlaceholderRenderer()); - } - } -} diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsGenerator.php b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsGenerator.php deleted file mode 100644 index 98f8efa2dd..0000000000 --- a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsGenerator.php +++ /dev/null @@ -1,154 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension\TableOfContents; - -use League\CommonMark\Block\Element\Document; -use League\CommonMark\Block\Element\Heading; -use League\CommonMark\Block\Element\ListBlock; -use League\CommonMark\Block\Element\ListData; -use League\CommonMark\Block\Element\ListItem; -use League\CommonMark\Block\Element\Paragraph; -use League\CommonMark\Exception\InvalidOptionException; -use League\CommonMark\Extension\HeadingPermalink\HeadingPermalink; -use League\CommonMark\Extension\TableOfContents\Node\TableOfContents; -use League\CommonMark\Extension\TableOfContents\Normalizer\AsIsNormalizerStrategy; -use League\CommonMark\Extension\TableOfContents\Normalizer\FlatNormalizerStrategy; -use League\CommonMark\Extension\TableOfContents\Normalizer\NormalizerStrategyInterface; -use League\CommonMark\Extension\TableOfContents\Normalizer\RelativeNormalizerStrategy; -use League\CommonMark\Inline\Element\Link; - -final class TableOfContentsGenerator implements TableOfContentsGeneratorInterface -{ - public const STYLE_BULLET = ListBlock::TYPE_BULLET; - public const STYLE_ORDERED = ListBlock::TYPE_ORDERED; - - public const NORMALIZE_DISABLED = 'as-is'; - public const NORMALIZE_RELATIVE = 'relative'; - public const NORMALIZE_FLAT = 'flat'; - - /** @var string */ - private $style; - /** @var string */ - private $normalizationStrategy; - /** @var int */ - private $minHeadingLevel; - /** @var int */ - private $maxHeadingLevel; - - public function __construct(string $style, string $normalizationStrategy, int $minHeadingLevel, int $maxHeadingLevel) - { - $this->style = $style; - $this->normalizationStrategy = $normalizationStrategy; - $this->minHeadingLevel = $minHeadingLevel; - $this->maxHeadingLevel = $maxHeadingLevel; - } - - public function generate(Document $document): ?TableOfContents - { - $toc = $this->createToc($document); - - $normalizer = $this->getNormalizer($toc); - - $firstHeading = null; - - foreach ($this->getHeadingLinks($document) as $headingLink) { - $heading = $headingLink->parent(); - // Make sure this is actually tied to a heading - if (!$heading instanceof Heading) { - continue; - } - - // Skip any headings outside the configured min/max levels - if ($heading->getLevel() < $this->minHeadingLevel || $heading->getLevel() > $this->maxHeadingLevel) { - continue; - } - - // Keep track of the first heading we see - we might need this later - $firstHeading = $firstHeading ?? $heading; - - // Keep track of the start and end lines - $toc->setStartLine($firstHeading->getStartLine()); - $toc->setEndLine($heading->getEndLine()); - - // Create the new link - $link = new Link('#' . $headingLink->getSlug(), $heading->getStringContent()); - $paragraph = new Paragraph(); - $paragraph->setStartLine($heading->getStartLine()); - $paragraph->setEndLine($heading->getEndLine()); - $paragraph->appendChild($link); - - $listItem = new ListItem($toc->getListData()); - $listItem->setStartLine($heading->getStartLine()); - $listItem->setEndLine($heading->getEndLine()); - $listItem->appendChild($paragraph); - - // Add it to the correct place - $normalizer->addItem($heading->getLevel(), $listItem); - } - - // Don't add the TOC if no headings were present - if (!$toc->hasChildren() || $firstHeading === null) { - return null; - } - - return $toc; - } - - private function createToc(Document $document): TableOfContents - { - $listData = new ListData(); - - if ($this->style === self::STYLE_BULLET) { - $listData->type = ListBlock::TYPE_BULLET; - } elseif ($this->style === self::STYLE_ORDERED) { - $listData->type = ListBlock::TYPE_ORDERED; - } else { - throw new InvalidOptionException(\sprintf('Invalid table of contents list style "%s"', $this->style)); - } - - $toc = new TableOfContents($listData); - - $toc->setStartLine($document->getStartLine()); - $toc->setEndLine($document->getEndLine()); - - return $toc; - } - - /** - * @param Document $document - * - * @return iterable<HeadingPermalink> - */ - private function getHeadingLinks(Document $document) - { - $walker = $document->walker(); - while ($event = $walker->next()) { - if ($event->isEntering() && ($node = $event->getNode()) instanceof HeadingPermalink) { - yield $node; - } - } - } - - private function getNormalizer(TableOfContents $toc): NormalizerStrategyInterface - { - switch ($this->normalizationStrategy) { - case self::NORMALIZE_DISABLED: - return new AsIsNormalizerStrategy($toc); - case self::NORMALIZE_RELATIVE: - return new RelativeNormalizerStrategy($toc); - case self::NORMALIZE_FLAT: - return new FlatNormalizerStrategy($toc); - default: - throw new InvalidOptionException(\sprintf('Invalid table of contents normalization strategy "%s"', $this->normalizationStrategy)); - } - } -} diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsGeneratorInterface.php b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsGeneratorInterface.php deleted file mode 100644 index f0f491a3db..0000000000 --- a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsGeneratorInterface.php +++ /dev/null @@ -1,23 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension\TableOfContents; - -use League\CommonMark\Block\Element\Document; -use League\CommonMark\Extension\TableOfContents\Node\TableOfContents; - -interface TableOfContentsGeneratorInterface -{ - public function generate(Document $document): ?TableOfContents; -} - -// Trigger autoload without causing a deprecated error -\class_exists(TableOfContents::class); diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsPlaceholderParser.php b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsPlaceholderParser.php deleted file mode 100644 index bae6787207..0000000000 --- a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsPlaceholderParser.php +++ /dev/null @@ -1,47 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension\TableOfContents; - -use League\CommonMark\Block\Parser\BlockParserInterface; -use League\CommonMark\ContextInterface; -use League\CommonMark\Cursor; -use League\CommonMark\Extension\TableOfContents\Node\TableOfContentsPlaceholder; -use League\CommonMark\Util\ConfigurationAwareInterface; -use League\CommonMark\Util\ConfigurationInterface; - -final class TableOfContentsPlaceholderParser implements BlockParserInterface, ConfigurationAwareInterface -{ - /** @var ConfigurationInterface */ - private $config; - - public function parse(ContextInterface $context, Cursor $cursor): bool - { - $placeholder = $this->config->get('table_of_contents/placeholder'); - if ($placeholder === null) { - return false; - } - - // The placeholder must be the only thing on the line - if ($cursor->match('/^' . \preg_quote($placeholder, '/') . '$/') === null) { - return false; - } - - $context->addBlock(new TableOfContentsPlaceholder()); - - return true; - } - - public function setConfiguration(ConfigurationInterface $configuration) - { - $this->config = $configuration; - } -} diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsPlaceholderRenderer.php b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsPlaceholderRenderer.php deleted file mode 100644 index e63058d091..0000000000 --- a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsPlaceholderRenderer.php +++ /dev/null @@ -1,24 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension\TableOfContents; - -use League\CommonMark\Block\Element\AbstractBlock; -use League\CommonMark\Block\Renderer\BlockRendererInterface; -use League\CommonMark\ElementRendererInterface; - -final class TableOfContentsPlaceholderRenderer implements BlockRendererInterface -{ - public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, bool $inTightList = false) - { - return '<!-- table of contents -->'; - } -} diff --git a/vendor/league/commonmark/src/Extension/TaskList/TaskListExtension.php b/vendor/league/commonmark/src/Extension/TaskList/TaskListExtension.php deleted file mode 100644 index 11611d315d..0000000000 --- a/vendor/league/commonmark/src/Extension/TaskList/TaskListExtension.php +++ /dev/null @@ -1,24 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension\TaskList; - -use League\CommonMark\ConfigurableEnvironmentInterface; -use League\CommonMark\Extension\ExtensionInterface; - -final class TaskListExtension implements ExtensionInterface -{ - public function register(ConfigurableEnvironmentInterface $environment) - { - $environment->addInlineParser(new TaskListItemMarkerParser(), 35); - $environment->addInlineRenderer(TaskListItemMarker::class, new TaskListItemMarkerRenderer()); - } -} diff --git a/vendor/league/commonmark/src/Extension/TaskList/TaskListItemMarker.php b/vendor/league/commonmark/src/Extension/TaskList/TaskListItemMarker.php deleted file mode 100644 index d9a3a05a8c..0000000000 --- a/vendor/league/commonmark/src/Extension/TaskList/TaskListItemMarker.php +++ /dev/null @@ -1,37 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension\TaskList; - -use League\CommonMark\Inline\Element\AbstractInline; - -final class TaskListItemMarker extends AbstractInline -{ - /** @var bool */ - protected $checked = false; - - public function __construct(bool $isCompleted) - { - $this->checked = $isCompleted; - } - - public function isChecked(): bool - { - return $this->checked; - } - - public function setChecked(bool $checked): self - { - $this->checked = $checked; - - return $this; - } -} diff --git a/vendor/league/commonmark/src/Extension/TaskList/TaskListItemMarkerParser.php b/vendor/league/commonmark/src/Extension/TaskList/TaskListItemMarkerParser.php deleted file mode 100644 index 1c19c5d1d5..0000000000 --- a/vendor/league/commonmark/src/Extension/TaskList/TaskListItemMarkerParser.php +++ /dev/null @@ -1,55 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension\TaskList; - -use League\CommonMark\Block\Element\ListItem; -use League\CommonMark\Block\Element\Paragraph; -use League\CommonMark\Inline\Parser\InlineParserInterface; -use League\CommonMark\InlineParserContext; - -final class TaskListItemMarkerParser implements InlineParserInterface -{ - public function getCharacters(): array - { - return ['[']; - } - - public function parse(InlineParserContext $inlineContext): bool - { - $container = $inlineContext->getContainer(); - - // Checkbox must come at the beginning of the first paragraph of the list item - if ($container->hasChildren() || !($container instanceof Paragraph && $container->parent() && $container->parent() instanceof ListItem)) { - return false; - } - - $cursor = $inlineContext->getCursor(); - $oldState = $cursor->saveState(); - - $m = $cursor->match('/\[[ xX]\]/'); - if ($m === null) { - return false; - } - - if ($cursor->getNextNonSpaceCharacter() === null) { - $cursor->restoreState($oldState); - - return false; - } - - $isChecked = $m !== '[ ]'; - - $container->appendChild(new TaskListItemMarker($isChecked)); - - return true; - } -} diff --git a/vendor/league/commonmark/src/Extension/TaskList/TaskListItemMarkerRenderer.php b/vendor/league/commonmark/src/Extension/TaskList/TaskListItemMarkerRenderer.php deleted file mode 100644 index 89a85cdd4f..0000000000 --- a/vendor/league/commonmark/src/Extension/TaskList/TaskListItemMarkerRenderer.php +++ /dev/null @@ -1,44 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Extension\TaskList; - -use League\CommonMark\ElementRendererInterface; -use League\CommonMark\HtmlElement; -use League\CommonMark\Inline\Element\AbstractInline; -use League\CommonMark\Inline\Renderer\InlineRendererInterface; - -final class TaskListItemMarkerRenderer implements InlineRendererInterface -{ - /** - * @param TaskListItemMarker $inline - * @param ElementRendererInterface $htmlRenderer - * - * @return HtmlElement|string|null - */ - public function render(AbstractInline $inline, ElementRendererInterface $htmlRenderer) - { - if (!($inline instanceof TaskListItemMarker)) { - throw new \InvalidArgumentException('Incompatible inline type: ' . \get_class($inline)); - } - - $checkbox = new HtmlElement('input', [], '', true); - - if ($inline->isChecked()) { - $checkbox->setAttribute('checked', ''); - } - - $checkbox->setAttribute('disabled', ''); - $checkbox->setAttribute('type', 'checkbox'); - - return $checkbox; - } -} diff --git a/vendor/league/commonmark/src/GithubFlavoredMarkdownConverter.php b/vendor/league/commonmark/src/GithubFlavoredMarkdownConverter.php deleted file mode 100644 index a8ed5ae4bd..0000000000 --- a/vendor/league/commonmark/src/GithubFlavoredMarkdownConverter.php +++ /dev/null @@ -1,33 +0,0 @@ -<?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. - */ - -namespace League\CommonMark; - -/** - * Converts Github Flavored Markdown to HTML. - */ -class GithubFlavoredMarkdownConverter extends CommonMarkConverter -{ - /** - * Create a new commonmark converter instance. - * - * @param array<string, mixed> $config - * @param EnvironmentInterface|null $environment - */ - public function __construct(array $config = [], EnvironmentInterface $environment = null) - { - if ($environment === null) { - $environment = Environment::createGFMEnvironment(); - } - - parent::__construct($config, $environment); - } -} diff --git a/vendor/league/commonmark/src/HtmlElement.php b/vendor/league/commonmark/src/HtmlElement.php deleted file mode 100644 index 38057f0265..0000000000 --- a/vendor/league/commonmark/src/HtmlElement.php +++ /dev/null @@ -1,146 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark; - -use League\CommonMark\Util\Xml; - -class HtmlElement -{ - /** - * @var string - */ - protected $tagName; - - /** - * @var string[] - */ - protected $attributes = []; - - /** - * @var HtmlElement|HtmlElement[]|string - */ - protected $contents; - - /** - * @var bool - */ - protected $selfClosing = false; - - /** - * @param string $tagName Name of the HTML tag - * @param string[] $attributes Array of attributes (values should be unescaped) - * @param HtmlElement|HtmlElement[]|string|null $contents Inner contents, pre-escaped if needed - * @param bool $selfClosing Whether the tag is self-closing - */ - public function __construct(string $tagName, array $attributes = [], $contents = '', bool $selfClosing = false) - { - $this->tagName = $tagName; - $this->attributes = $attributes; - $this->selfClosing = $selfClosing; - - $this->setContents($contents ?? ''); - } - - public function getTagName(): string - { - return $this->tagName; - } - - /** - * @return string[] - */ - public function getAllAttributes(): array - { - return $this->attributes; - } - - public function getAttribute(string $key): ?string - { - if (!isset($this->attributes[$key])) { - return null; - } - - return $this->attributes[$key]; - } - - public function setAttribute(string $key, string $value): self - { - $this->attributes[$key] = $value; - - return $this; - } - - /** - * @param bool $asString - * - * @return HtmlElement|HtmlElement[]|string - */ - public function getContents(bool $asString = true) - { - if (!$asString) { - return $this->contents; - } - - return $this->getContentsAsString(); - } - - /** - * Sets the inner contents of the tag (must be pre-escaped if needed) - * - * @param HtmlElement|HtmlElement[]|string $contents - * - * @return $this - */ - public function setContents($contents): self - { - $this->contents = $contents ?? ''; - - return $this; - } - - public function __toString(): string - { - $result = '<' . $this->tagName; - - foreach ($this->attributes as $key => $value) { - $result .= ' ' . $key . '="' . Xml::escape($value) . '"'; - } - - if ($this->contents !== '') { - $result .= '>' . $this->getContentsAsString() . '</' . $this->tagName . '>'; - } elseif ($this->selfClosing && $this->tagName === 'input') { - $result .= '>'; - } elseif ($this->selfClosing) { - $result .= ' />'; - } else { - $result .= '></' . $this->tagName . '>'; - } - - return $result; - } - - private function getContentsAsString(): string - { - if (\is_string($this->contents)) { - return $this->contents; - } - - if (\is_array($this->contents)) { - return \implode('', $this->contents); - } - - return (string) $this->contents; - } -} diff --git a/vendor/league/commonmark/src/HtmlRenderer.php b/vendor/league/commonmark/src/HtmlRenderer.php deleted file mode 100644 index c9fb2d940d..0000000000 --- a/vendor/league/commonmark/src/HtmlRenderer.php +++ /dev/null @@ -1,126 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark; - -use League\CommonMark\Block\Element\AbstractBlock; -use League\CommonMark\Block\Renderer\BlockRendererInterface; -use League\CommonMark\Inline\Element\AbstractInline; -use League\CommonMark\Inline\Renderer\InlineRendererInterface; - -/** - * Renders a parsed AST to HTML - */ -final class HtmlRenderer implements ElementRendererInterface -{ - /** - * @var EnvironmentInterface - */ - protected $environment; - - /** - * @param EnvironmentInterface $environment - */ - public function __construct(EnvironmentInterface $environment) - { - $this->environment = $environment; - } - - /** - * @param string $option - * @param mixed $default - * - * @return mixed|null - */ - public function getOption(string $option, $default = null) - { - return $this->environment->getConfig('renderer/' . $option, $default); - } - - /** - * @param AbstractInline $inline - * - * @throws \RuntimeException - * - * @return string - */ - public function renderInline(AbstractInline $inline): string - { - $renderers = $this->environment->getInlineRenderersForClass(\get_class($inline)); - - /** @var InlineRendererInterface $renderer */ - foreach ($renderers as $renderer) { - if (($result = $renderer->render($inline, $this)) !== null) { - return $result; - } - } - - throw new \RuntimeException('Unable to find corresponding renderer for inline type ' . \get_class($inline)); - } - - /** - * @param AbstractInline[] $inlines - * - * @return string - */ - public function renderInlines(iterable $inlines): string - { - $result = []; - foreach ($inlines as $inline) { - $result[] = $this->renderInline($inline); - } - - return \implode('', $result); - } - - /** - * @param AbstractBlock $block - * @param bool $inTightList - * - * @throws \RuntimeException - * - * @return string - */ - public function renderBlock(AbstractBlock $block, bool $inTightList = false): string - { - $renderers = $this->environment->getBlockRenderersForClass(\get_class($block)); - - /** @var BlockRendererInterface $renderer */ - foreach ($renderers as $renderer) { - if (($result = $renderer->render($block, $this, $inTightList)) !== null) { - return $result; - } - } - - throw new \RuntimeException('Unable to find corresponding renderer for block type ' . \get_class($block)); - } - - /** - * @param AbstractBlock[] $blocks - * @param bool $inTightList - * - * @return string - */ - public function renderBlocks(iterable $blocks, bool $inTightList = false): string - { - $result = []; - foreach ($blocks as $block) { - $result[] = $this->renderBlock($block, $inTightList); - } - - $separator = $this->getOption('block_separator', "\n"); - - return \implode($separator, $result); - } -} diff --git a/vendor/league/commonmark/src/Inline/AdjacentTextMerger.php b/vendor/league/commonmark/src/Inline/AdjacentTextMerger.php deleted file mode 100644 index d6ddca3985..0000000000 --- a/vendor/league/commonmark/src/Inline/AdjacentTextMerger.php +++ /dev/null @@ -1,91 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Additional emphasis processing code based on commonmark-java (https://github.com/atlassian/commonmark-java) - * - (c) Atlassian Pty Ltd - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Inline; - -use League\CommonMark\Inline\Element\Text; -use League\CommonMark\Node\Node; - -/** - * @internal - */ -final class AdjacentTextMerger -{ - public static function mergeChildNodes(Node $node): void - { - // No children or just one child node, no need for merging - if ($node->firstChild() === $node->lastChild() || $node->firstChild() === null || $node->lastChild() === null) { - return; - } - - self::mergeTextNodesInclusive($node->firstChild(), $node->lastChild()); - } - - public static function mergeTextNodesBetweenExclusive(Node $fromNode, Node $toNode): void - { - // No nodes between them - if ($fromNode === $toNode || $fromNode->next() === $toNode || $fromNode->next() === null || $toNode->previous() === null) { - return; - } - - self::mergeTextNodesInclusive($fromNode->next(), $toNode->previous()); - } - - private static function mergeTextNodesInclusive(Node $fromNode, Node $toNode): void - { - $first = null; - $last = null; - - $node = $fromNode; - while ($node !== null) { - if ($node instanceof Text) { - if ($first === null) { - $first = $node; - } - $last = $node; - } else { - self::mergeIfNeeded($first, $last); - $first = null; - $last = null; - } - if ($node === $toNode) { - break; - } - $node = $node->next(); - } - - self::mergeIfNeeded($first, $last); - } - - private static function mergeIfNeeded(?Text $first, ?Text $last): void - { - if ($first === null || $last === null || $first === $last) { - // No merging needed - return; - } - - $s = $first->getContent(); - - $node = $first->next(); - $stop = $last->next(); - while ($node !== $stop && $node instanceof Text) { - $s .= $node->getContent(); - $unlink = $node; - $node = $node->next(); - $unlink->detach(); - } - - $first->setContent($s); - } -} diff --git a/vendor/league/commonmark/src/Inline/Element/AbstractInline.php b/vendor/league/commonmark/src/Inline/Element/AbstractInline.php deleted file mode 100644 index d41489592e..0000000000 --- a/vendor/league/commonmark/src/Inline/Element/AbstractInline.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Inline\Element; - -use League\CommonMark\Node\Node; - -/** - * @method children() AbstractInline[] - */ -abstract class AbstractInline extends Node -{ - /** - * @var array<string, mixed> - * - * Used for storage of arbitrary data - */ - public $data = []; - - public function isContainer(): bool - { - return false; - } - - /** - * @param string $key - * @param mixed $default - * - * @return mixed - */ - public function getData(string $key, $default = null) - { - return isset($this->data[$key]) ? $this->data[$key] : $default; - } -} diff --git a/vendor/league/commonmark/src/Inline/Element/AbstractStringContainer.php b/vendor/league/commonmark/src/Inline/Element/AbstractStringContainer.php deleted file mode 100644 index 4a9c4b16c4..0000000000 --- a/vendor/league/commonmark/src/Inline/Element/AbstractStringContainer.php +++ /dev/null @@ -1,53 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Inline\Element; - -class AbstractStringContainer extends AbstractInline -{ - /** - * @var string - */ - protected $content = ''; - - /** - * @param string $contents - * @param array<string, mixed> $data - */ - public function __construct(string $contents = '', array $data = []) - { - $this->content = $contents; - $this->data = $data; - } - - /** - * @return string - */ - public function getContent(): string - { - return $this->content; - } - - /** - * @param string $contents - * - * @return $this - */ - public function setContent(string $contents) - { - $this->content = $contents; - - return $this; - } -} diff --git a/vendor/league/commonmark/src/Inline/Element/AbstractWebResource.php b/vendor/league/commonmark/src/Inline/Element/AbstractWebResource.php deleted file mode 100644 index 22ff07d007..0000000000 --- a/vendor/league/commonmark/src/Inline/Element/AbstractWebResource.php +++ /dev/null @@ -1,53 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Inline\Element; - -abstract class AbstractWebResource extends AbstractInline -{ - /** - * @var string - */ - protected $url; - - public function __construct(string $url) - { - $this->url = $url; - } - - /** - * @return string - */ - public function getUrl(): string - { - return $this->url; - } - - /** - * @param string $url - * - * @return $this - */ - public function setUrl(string $url) - { - $this->url = $url; - - return $this; - } - - public function isContainer(): bool - { - return true; - } -} diff --git a/vendor/league/commonmark/src/Inline/Element/Code.php b/vendor/league/commonmark/src/Inline/Element/Code.php deleted file mode 100644 index 352a798ee4..0000000000 --- a/vendor/league/commonmark/src/Inline/Element/Code.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Inline\Element; - -class Code extends AbstractStringContainer -{ -} diff --git a/vendor/league/commonmark/src/Inline/Element/Emphasis.php b/vendor/league/commonmark/src/Inline/Element/Emphasis.php deleted file mode 100644 index 536b41625a..0000000000 --- a/vendor/league/commonmark/src/Inline/Element/Emphasis.php +++ /dev/null @@ -1,23 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Inline\Element; - -class Emphasis extends AbstractInline -{ - public function isContainer(): bool - { - return true; - } -} diff --git a/vendor/league/commonmark/src/Inline/Element/HtmlInline.php b/vendor/league/commonmark/src/Inline/Element/HtmlInline.php deleted file mode 100644 index 0a3301c326..0000000000 --- a/vendor/league/commonmark/src/Inline/Element/HtmlInline.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Inline\Element; - -class HtmlInline extends AbstractStringContainer -{ -} diff --git a/vendor/league/commonmark/src/Inline/Element/Image.php b/vendor/league/commonmark/src/Inline/Element/Image.php deleted file mode 100644 index 7f122e70af..0000000000 --- a/vendor/league/commonmark/src/Inline/Element/Image.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Inline\Element; - -class Image extends AbstractWebResource -{ - public function __construct(string $url, ?string $label = null, ?string $title = null) - { - parent::__construct($url); - - if (!empty($label)) { - $this->appendChild(new Text($label)); - } - - if (!empty($title)) { - $this->data['title'] = $title; - } - } -} diff --git a/vendor/league/commonmark/src/Inline/Element/Link.php b/vendor/league/commonmark/src/Inline/Element/Link.php deleted file mode 100644 index 8580cf545d..0000000000 --- a/vendor/league/commonmark/src/Inline/Element/Link.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Inline\Element; - -class Link extends AbstractWebResource -{ - public function __construct(string $url, ?string $label = null, ?string $title = null) - { - parent::__construct($url); - - if (!empty($label)) { - $this->appendChild(new Text($label)); - } - - if (!empty($title)) { - $this->data['title'] = $title; - } - } -} diff --git a/vendor/league/commonmark/src/Inline/Element/Newline.php b/vendor/league/commonmark/src/Inline/Element/Newline.php deleted file mode 100644 index 4431d47f40..0000000000 --- a/vendor/league/commonmark/src/Inline/Element/Newline.php +++ /dev/null @@ -1,35 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Inline\Element; - -class Newline extends AbstractInline -{ - // Any changes to these constants should be reflected in .phpstorm.meta.php - const HARDBREAK = 0; - const SOFTBREAK = 1; - - /** @var int */ - protected $type; - - public function __construct(int $breakType = self::HARDBREAK) - { - $this->type = $breakType; - } - - public function getType(): int - { - return $this->type; - } -} diff --git a/vendor/league/commonmark/src/Inline/Element/Strong.php b/vendor/league/commonmark/src/Inline/Element/Strong.php deleted file mode 100644 index e687c1811c..0000000000 --- a/vendor/league/commonmark/src/Inline/Element/Strong.php +++ /dev/null @@ -1,23 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Inline\Element; - -class Strong extends AbstractInline -{ - public function isContainer(): bool - { - return true; - } -} diff --git a/vendor/league/commonmark/src/Inline/Element/Text.php b/vendor/league/commonmark/src/Inline/Element/Text.php deleted file mode 100644 index 93e5e2a512..0000000000 --- a/vendor/league/commonmark/src/Inline/Element/Text.php +++ /dev/null @@ -1,28 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Inline\Element; - -class Text extends AbstractStringContainer -{ - /** - * @param string $character - * - * @return void - */ - public function append(string $character) - { - $this->content .= $character; - } -} diff --git a/vendor/league/commonmark/src/Inline/Parser/AutolinkParser.php b/vendor/league/commonmark/src/Inline/Parser/AutolinkParser.php deleted file mode 100644 index 1a485fce11..0000000000 --- a/vendor/league/commonmark/src/Inline/Parser/AutolinkParser.php +++ /dev/null @@ -1,48 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Inline\Parser; - -use League\CommonMark\Inline\Element\Link; -use League\CommonMark\InlineParserContext; -use League\CommonMark\Util\UrlEncoder; - -final class AutolinkParser implements InlineParserInterface -{ - const EMAIL_REGEX = '/^<([a-zA-Z0-9.!#$%&\'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>/'; - const OTHER_LINK_REGEX = '/^<[A-Za-z][A-Za-z0-9.+-]{1,31}:[^<>\x00-\x20]*>/i'; - - public function getCharacters(): array - { - return ['<']; - } - - public function parse(InlineParserContext $inlineContext): bool - { - $cursor = $inlineContext->getCursor(); - if ($m = $cursor->match(self::EMAIL_REGEX)) { - $email = \substr($m, 1, -1); - $inlineContext->getContainer()->appendChild(new Link('mailto:' . UrlEncoder::unescapeAndEncode($email), $email)); - - return true; - } elseif ($m = $cursor->match(self::OTHER_LINK_REGEX)) { - $dest = \substr($m, 1, -1); - $inlineContext->getContainer()->appendChild(new Link(UrlEncoder::unescapeAndEncode($dest), $dest)); - - return true; - } - - return false; - } -} diff --git a/vendor/league/commonmark/src/Inline/Parser/BacktickParser.php b/vendor/league/commonmark/src/Inline/Parser/BacktickParser.php deleted file mode 100644 index 1f32217ff7..0000000000 --- a/vendor/league/commonmark/src/Inline/Parser/BacktickParser.php +++ /dev/null @@ -1,64 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Inline\Parser; - -use League\CommonMark\Inline\Element\Code; -use League\CommonMark\Inline\Element\Text; -use League\CommonMark\InlineParserContext; - -final class BacktickParser implements InlineParserInterface -{ - public function getCharacters(): array - { - return ['`']; - } - - public function parse(InlineParserContext $inlineContext): bool - { - $cursor = $inlineContext->getCursor(); - - $ticks = $cursor->match('/^`+/'); - - $currentPosition = $cursor->getPosition(); - $previousState = $cursor->saveState(); - - while ($matchingTicks = $cursor->match('/`+/m')) { - if ($matchingTicks === $ticks) { - $code = $cursor->getSubstring($currentPosition, $cursor->getPosition() - $currentPosition - \strlen($ticks)); - - $c = \preg_replace('/\n/m', ' ', $code); - - if ( - !empty($c) && - $c[0] === ' ' && - \substr($c, -1, 1) === ' ' && - \preg_match('/[^ ]/', $c) - ) { - $c = \substr($c, 1, -1); - } - - $inlineContext->getContainer()->appendChild(new Code($c)); - - return true; - } - } - - // If we got here, we didn't match a closing backtick sequence - $cursor->restoreState($previousState); - $inlineContext->getContainer()->appendChild(new Text($ticks)); - - return true; - } -} diff --git a/vendor/league/commonmark/src/Inline/Parser/BangParser.php b/vendor/league/commonmark/src/Inline/Parser/BangParser.php deleted file mode 100644 index a6c6c33848..0000000000 --- a/vendor/league/commonmark/src/Inline/Parser/BangParser.php +++ /dev/null @@ -1,45 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Inline\Parser; - -use League\CommonMark\Delimiter\Delimiter; -use League\CommonMark\Inline\Element\Text; -use League\CommonMark\InlineParserContext; - -final class BangParser implements InlineParserInterface -{ - public function getCharacters(): array - { - return ['!']; - } - - public function parse(InlineParserContext $inlineContext): bool - { - $cursor = $inlineContext->getCursor(); - if ($cursor->peek() === '[') { - $cursor->advanceBy(2); - $node = new Text('![', ['delim' => true]); - $inlineContext->getContainer()->appendChild($node); - - // Add entry to stack for this opener - $delimiter = new Delimiter('!', 1, $node, true, false, $cursor->getPosition()); - $inlineContext->getDelimiterStack()->push($delimiter); - - return true; - } - - return false; - } -} diff --git a/vendor/league/commonmark/src/Inline/Parser/CloseBracketParser.php b/vendor/league/commonmark/src/Inline/Parser/CloseBracketParser.php deleted file mode 100644 index 018fe07fd4..0000000000 --- a/vendor/league/commonmark/src/Inline/Parser/CloseBracketParser.php +++ /dev/null @@ -1,205 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Inline\Parser; - -use League\CommonMark\Cursor; -use League\CommonMark\Delimiter\DelimiterInterface; -use League\CommonMark\EnvironmentAwareInterface; -use League\CommonMark\EnvironmentInterface; -use League\CommonMark\Inline\AdjacentTextMerger; -use League\CommonMark\Inline\Element\AbstractWebResource; -use League\CommonMark\Inline\Element\Image; -use League\CommonMark\Inline\Element\Link; -use League\CommonMark\InlineParserContext; -use League\CommonMark\Reference\ReferenceInterface; -use League\CommonMark\Reference\ReferenceMapInterface; -use League\CommonMark\Util\LinkParserHelper; -use League\CommonMark\Util\RegexHelper; - -final class CloseBracketParser implements InlineParserInterface, EnvironmentAwareInterface -{ - /** - * @var EnvironmentInterface - */ - private $environment; - - public function getCharacters(): array - { - return [']']; - } - - public function parse(InlineParserContext $inlineContext): bool - { - // Look through stack of delimiters for a [ or ! - $opener = $inlineContext->getDelimiterStack()->searchByCharacter(['[', '!']); - if ($opener === null) { - return false; - } - - if (!$opener->isActive()) { - // no matched opener; remove from emphasis stack - $inlineContext->getDelimiterStack()->removeDelimiter($opener); - - return false; - } - - $cursor = $inlineContext->getCursor(); - - $startPos = $cursor->getPosition(); - $previousState = $cursor->saveState(); - - $cursor->advanceBy(1); - - // Check to see if we have a link/image - if (!($link = $this->tryParseLink($cursor, $inlineContext->getReferenceMap(), $opener, $startPos))) { - // No match - $inlineContext->getDelimiterStack()->removeDelimiter($opener); // Remove this opener from stack - $cursor->restoreState($previousState); - - return false; - } - - $isImage = $opener->getChar() === '!'; - - $inline = $this->createInline($link['url'], $link['title'], $isImage); - $opener->getInlineNode()->replaceWith($inline); - while (($label = $inline->next()) !== null) { - $inline->appendChild($label); - } - - // Process delimiters such as emphasis inside link/image - $delimiterStack = $inlineContext->getDelimiterStack(); - $stackBottom = $opener->getPrevious(); - $delimiterStack->processDelimiters($stackBottom, $this->environment->getDelimiterProcessors()); - $delimiterStack->removeAll($stackBottom); - - // Merge any adjacent Text nodes together - AdjacentTextMerger::mergeChildNodes($inline); - - // processEmphasis will remove this and later delimiters. - // Now, for a link, we also remove earlier link openers (no links in links) - if (!$isImage) { - $inlineContext->getDelimiterStack()->removeEarlierMatches('['); - } - - return true; - } - - public function setEnvironment(EnvironmentInterface $environment) - { - $this->environment = $environment; - } - - /** - * @param Cursor $cursor - * @param ReferenceMapInterface $referenceMap - * @param DelimiterInterface $opener - * @param int $startPos - * - * @return array<string, string>|false - */ - private function tryParseLink(Cursor $cursor, ReferenceMapInterface $referenceMap, DelimiterInterface $opener, int $startPos) - { - // Check to see if we have a link/image - // Inline link? - if ($result = $this->tryParseInlineLinkAndTitle($cursor)) { - return $result; - } - - if ($link = $this->tryParseReference($cursor, $referenceMap, $opener, $startPos)) { - return ['url' => $link->getDestination(), 'title' => $link->getTitle()]; - } - - return false; - } - - /** - * @param Cursor $cursor - * - * @return array<string, string>|false - */ - private function tryParseInlineLinkAndTitle(Cursor $cursor) - { - if ($cursor->getCharacter() !== '(') { - return false; - } - - $previousState = $cursor->saveState(); - - $cursor->advanceBy(1); - $cursor->advanceToNextNonSpaceOrNewline(); - if (($dest = LinkParserHelper::parseLinkDestination($cursor)) === null) { - $cursor->restoreState($previousState); - - return false; - } - - $cursor->advanceToNextNonSpaceOrNewline(); - - $title = ''; - // make sure there's a space before the title: - if (\preg_match(RegexHelper::REGEX_WHITESPACE_CHAR, $cursor->peek(-1))) { - $title = LinkParserHelper::parseLinkTitle($cursor) ?? ''; - } - - $cursor->advanceToNextNonSpaceOrNewline(); - - if ($cursor->getCharacter() !== ')') { - $cursor->restoreState($previousState); - - return false; - } - - $cursor->advanceBy(1); - - return ['url' => $dest, 'title' => $title]; - } - - private function tryParseReference(Cursor $cursor, ReferenceMapInterface $referenceMap, DelimiterInterface $opener, int $startPos): ?ReferenceInterface - { - if ($opener->getIndex() === null) { - return null; - } - - $savePos = $cursor->saveState(); - $beforeLabel = $cursor->getPosition(); - $n = LinkParserHelper::parseLinkLabel($cursor); - if ($n === 0 || $n === 2) { - $start = $opener->getIndex(); - $length = $startPos - $opener->getIndex(); - } else { - $start = $beforeLabel + 1; - $length = $n - 2; - } - - $referenceLabel = $cursor->getSubstring($start, $length); - - if ($n === 0) { - // If shortcut reference link, rewind before spaces we skipped - $cursor->restoreState($savePos); - } - - return $referenceMap->getReference($referenceLabel); - } - - private function createInline(string $url, string $title, bool $isImage): AbstractWebResource - { - if ($isImage) { - return new Image($url, null, $title); - } - - return new Link($url, null, $title); - } -} diff --git a/vendor/league/commonmark/src/Inline/Parser/EntityParser.php b/vendor/league/commonmark/src/Inline/Parser/EntityParser.php deleted file mode 100644 index 616d6fbb13..0000000000 --- a/vendor/league/commonmark/src/Inline/Parser/EntityParser.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Inline\Parser; - -use League\CommonMark\Inline\Element\Text; -use League\CommonMark\InlineParserContext; -use League\CommonMark\Util\Html5EntityDecoder; -use League\CommonMark\Util\RegexHelper; - -final class EntityParser implements InlineParserInterface -{ - public function getCharacters(): array - { - return ['&']; - } - - public function parse(InlineParserContext $inlineContext): bool - { - if ($m = $inlineContext->getCursor()->match('/^' . RegexHelper::PARTIAL_ENTITY . '/i')) { - $inlineContext->getContainer()->appendChild(new Text(Html5EntityDecoder::decode($m))); - - return true; - } - - return false; - } -} diff --git a/vendor/league/commonmark/src/Inline/Parser/EscapableParser.php b/vendor/league/commonmark/src/Inline/Parser/EscapableParser.php deleted file mode 100644 index 77b7fd3b7a..0000000000 --- a/vendor/league/commonmark/src/Inline/Parser/EscapableParser.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Inline\Parser; - -use League\CommonMark\Inline\Element\Newline; -use League\CommonMark\Inline\Element\Text; -use League\CommonMark\InlineParserContext; -use League\CommonMark\Util\RegexHelper; - -final class EscapableParser implements InlineParserInterface -{ - public function getCharacters(): array - { - return ['\\']; - } - - public function parse(InlineParserContext $inlineContext): bool - { - $cursor = $inlineContext->getCursor(); - $nextChar = $cursor->peek(); - - if ($nextChar === "\n") { - $cursor->advanceBy(2); - $inlineContext->getContainer()->appendChild(new Newline(Newline::HARDBREAK)); - - return true; - } elseif ($nextChar !== null && RegexHelper::isEscapable($nextChar)) { - $cursor->advanceBy(2); - $inlineContext->getContainer()->appendChild(new Text($nextChar)); - - return true; - } - - $cursor->advanceBy(1); - $inlineContext->getContainer()->appendChild(new Text('\\')); - - return true; - } -} diff --git a/vendor/league/commonmark/src/Inline/Parser/HtmlInlineParser.php b/vendor/league/commonmark/src/Inline/Parser/HtmlInlineParser.php deleted file mode 100644 index 1377e39e7d..0000000000 --- a/vendor/league/commonmark/src/Inline/Parser/HtmlInlineParser.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Inline\Parser; - -use League\CommonMark\Inline\Element\HtmlInline; -use League\CommonMark\InlineParserContext; -use League\CommonMark\Util\RegexHelper; - -final class HtmlInlineParser implements InlineParserInterface -{ - public function getCharacters(): array - { - return ['<']; - } - - public function parse(InlineParserContext $inlineContext): bool - { - if ($m = $inlineContext->getCursor()->match('/^' . RegexHelper::PARTIAL_HTMLTAG . '/i')) { - $inlineContext->getContainer()->appendChild(new HtmlInline($m)); - - return true; - } - - return false; - } -} diff --git a/vendor/league/commonmark/src/Inline/Parser/InlineParserInterface.php b/vendor/league/commonmark/src/Inline/Parser/InlineParserInterface.php deleted file mode 100644 index 4971ec3d2d..0000000000 --- a/vendor/league/commonmark/src/Inline/Parser/InlineParserInterface.php +++ /dev/null @@ -1,29 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Inline\Parser; - -use League\CommonMark\InlineParserContext; - -interface InlineParserInterface -{ - /** - * @return string[] - */ - public function getCharacters(): array; - - /** - * @param InlineParserContext $inlineContext - * - * @return bool - */ - public function parse(InlineParserContext $inlineContext): bool; -} diff --git a/vendor/league/commonmark/src/Inline/Parser/NewlineParser.php b/vendor/league/commonmark/src/Inline/Parser/NewlineParser.php deleted file mode 100644 index a346ef1921..0000000000 --- a/vendor/league/commonmark/src/Inline/Parser/NewlineParser.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Inline\Parser; - -use League\CommonMark\Inline\Element\Newline; -use League\CommonMark\Inline\Element\Text; -use League\CommonMark\InlineParserContext; - -final class NewlineParser implements InlineParserInterface -{ - public function getCharacters(): array - { - return ["\n"]; - } - - public function parse(InlineParserContext $inlineContext): bool - { - $inlineContext->getCursor()->advanceBy(1); - - // Check previous inline for trailing spaces - $spaces = 0; - $lastInline = $inlineContext->getContainer()->lastChild(); - if ($lastInline instanceof Text) { - $trimmed = \rtrim($lastInline->getContent(), ' '); - $spaces = \strlen($lastInline->getContent()) - \strlen($trimmed); - if ($spaces) { - $lastInline->setContent($trimmed); - } - } - - if ($spaces >= 2) { - $inlineContext->getContainer()->appendChild(new Newline(Newline::HARDBREAK)); - } else { - $inlineContext->getContainer()->appendChild(new Newline(Newline::SOFTBREAK)); - } - - return true; - } -} diff --git a/vendor/league/commonmark/src/Inline/Parser/OpenBracketParser.php b/vendor/league/commonmark/src/Inline/Parser/OpenBracketParser.php deleted file mode 100644 index 03f3c1bbfb..0000000000 --- a/vendor/league/commonmark/src/Inline/Parser/OpenBracketParser.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Inline\Parser; - -use League\CommonMark\Delimiter\Delimiter; -use League\CommonMark\Inline\Element\Text; -use League\CommonMark\InlineParserContext; - -final class OpenBracketParser implements InlineParserInterface -{ - public function getCharacters(): array - { - return ['[']; - } - - public function parse(InlineParserContext $inlineContext): bool - { - $inlineContext->getCursor()->advanceBy(1); - $node = new Text('[', ['delim' => true]); - $inlineContext->getContainer()->appendChild($node); - - // Add entry to stack for this opener - $delimiter = new Delimiter('[', 1, $node, true, false, $inlineContext->getCursor()->getPosition()); - $inlineContext->getDelimiterStack()->push($delimiter); - - return true; - } -} diff --git a/vendor/league/commonmark/src/Inline/Renderer/CodeRenderer.php b/vendor/league/commonmark/src/Inline/Renderer/CodeRenderer.php deleted file mode 100644 index 63fa095b47..0000000000 --- a/vendor/league/commonmark/src/Inline/Renderer/CodeRenderer.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Inline\Renderer; - -use League\CommonMark\ElementRendererInterface; -use League\CommonMark\HtmlElement; -use League\CommonMark\Inline\Element\AbstractInline; -use League\CommonMark\Inline\Element\Code; -use League\CommonMark\Util\Xml; - -final class CodeRenderer implements InlineRendererInterface -{ - /** - * @param Code $inline - * @param ElementRendererInterface $htmlRenderer - * - * @return HtmlElement - */ - public function render(AbstractInline $inline, ElementRendererInterface $htmlRenderer) - { - if (!($inline instanceof Code)) { - throw new \InvalidArgumentException('Incompatible inline type: ' . \get_class($inline)); - } - - $attrs = $inline->getData('attributes', []); - - return new HtmlElement('code', $attrs, Xml::escape($inline->getContent())); - } -} diff --git a/vendor/league/commonmark/src/Inline/Renderer/EmphasisRenderer.php b/vendor/league/commonmark/src/Inline/Renderer/EmphasisRenderer.php deleted file mode 100644 index d2df5dfd81..0000000000 --- a/vendor/league/commonmark/src/Inline/Renderer/EmphasisRenderer.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Inline\Renderer; - -use League\CommonMark\ElementRendererInterface; -use League\CommonMark\HtmlElement; -use League\CommonMark\Inline\Element\AbstractInline; -use League\CommonMark\Inline\Element\Emphasis; - -final class EmphasisRenderer implements InlineRendererInterface -{ - /** - * @param Emphasis $inline - * @param ElementRendererInterface $htmlRenderer - * - * @return HtmlElement - */ - public function render(AbstractInline $inline, ElementRendererInterface $htmlRenderer) - { - if (!($inline instanceof Emphasis)) { - throw new \InvalidArgumentException('Incompatible inline type: ' . \get_class($inline)); - } - - $attrs = $inline->getData('attributes', []); - - return new HtmlElement('em', $attrs, $htmlRenderer->renderInlines($inline->children())); - } -} diff --git a/vendor/league/commonmark/src/Inline/Renderer/HtmlInlineRenderer.php b/vendor/league/commonmark/src/Inline/Renderer/HtmlInlineRenderer.php deleted file mode 100644 index 5a9816953a..0000000000 --- a/vendor/league/commonmark/src/Inline/Renderer/HtmlInlineRenderer.php +++ /dev/null @@ -1,58 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Inline\Renderer; - -use League\CommonMark\ElementRendererInterface; -use League\CommonMark\EnvironmentInterface; -use League\CommonMark\Inline\Element\AbstractInline; -use League\CommonMark\Inline\Element\HtmlInline; -use League\CommonMark\Util\ConfigurationAwareInterface; -use League\CommonMark\Util\ConfigurationInterface; - -final class HtmlInlineRenderer implements InlineRendererInterface, ConfigurationAwareInterface -{ - /** - * @var ConfigurationInterface - */ - protected $config; - - /** - * @param HtmlInline $inline - * @param ElementRendererInterface $htmlRenderer - * - * @return string - */ - public function render(AbstractInline $inline, ElementRendererInterface $htmlRenderer) - { - if (!($inline instanceof HtmlInline)) { - throw new \InvalidArgumentException('Incompatible inline type: ' . \get_class($inline)); - } - - if ($this->config->get('html_input') === EnvironmentInterface::HTML_INPUT_STRIP) { - return ''; - } - - if ($this->config->get('html_input') === EnvironmentInterface::HTML_INPUT_ESCAPE) { - return \htmlspecialchars($inline->getContent(), \ENT_NOQUOTES); - } - - return $inline->getContent(); - } - - public function setConfiguration(ConfigurationInterface $configuration) - { - $this->config = $configuration; - } -} diff --git a/vendor/league/commonmark/src/Inline/Renderer/ImageRenderer.php b/vendor/league/commonmark/src/Inline/Renderer/ImageRenderer.php deleted file mode 100644 index 8161812b14..0000000000 --- a/vendor/league/commonmark/src/Inline/Renderer/ImageRenderer.php +++ /dev/null @@ -1,68 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Inline\Renderer; - -use League\CommonMark\ElementRendererInterface; -use League\CommonMark\HtmlElement; -use League\CommonMark\Inline\Element\AbstractInline; -use League\CommonMark\Inline\Element\Image; -use League\CommonMark\Util\ConfigurationAwareInterface; -use League\CommonMark\Util\ConfigurationInterface; -use League\CommonMark\Util\RegexHelper; - -final class ImageRenderer implements InlineRendererInterface, ConfigurationAwareInterface -{ - /** - * @var ConfigurationInterface - */ - protected $config; - - /** - * @param Image $inline - * @param ElementRendererInterface $htmlRenderer - * - * @return HtmlElement - */ - public function render(AbstractInline $inline, ElementRendererInterface $htmlRenderer) - { - if (!($inline instanceof Image)) { - throw new \InvalidArgumentException('Incompatible inline type: ' . \get_class($inline)); - } - - $attrs = $inline->getData('attributes', []); - - $forbidUnsafeLinks = !$this->config->get('allow_unsafe_links'); - if ($forbidUnsafeLinks && RegexHelper::isLinkPotentiallyUnsafe($inline->getUrl())) { - $attrs['src'] = ''; - } else { - $attrs['src'] = $inline->getUrl(); - } - - $alt = $htmlRenderer->renderInlines($inline->children()); - $alt = \preg_replace('/\<[^>]*alt="([^"]*)"[^>]*\>/', '$1', $alt); - $attrs['alt'] = \preg_replace('/\<[^>]*\>/', '', $alt); - - if (isset($inline->data['title'])) { - $attrs['title'] = $inline->data['title']; - } - - return new HtmlElement('img', $attrs, '', true); - } - - public function setConfiguration(ConfigurationInterface $configuration) - { - $this->config = $configuration; - } -} diff --git a/vendor/league/commonmark/src/Inline/Renderer/InlineRendererInterface.php b/vendor/league/commonmark/src/Inline/Renderer/InlineRendererInterface.php deleted file mode 100644 index 1407f9717d..0000000000 --- a/vendor/league/commonmark/src/Inline/Renderer/InlineRendererInterface.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Inline\Renderer; - -use League\CommonMark\ElementRendererInterface; -use League\CommonMark\HtmlElement; -use League\CommonMark\Inline\Element\AbstractInline; - -interface InlineRendererInterface -{ - /** - * @param AbstractInline $inline - * @param ElementRendererInterface $htmlRenderer - * - * @return HtmlElement|string|null - */ - public function render(AbstractInline $inline, ElementRendererInterface $htmlRenderer); -} diff --git a/vendor/league/commonmark/src/Inline/Renderer/LinkRenderer.php b/vendor/league/commonmark/src/Inline/Renderer/LinkRenderer.php deleted file mode 100644 index 8c2ce27e38..0000000000 --- a/vendor/league/commonmark/src/Inline/Renderer/LinkRenderer.php +++ /dev/null @@ -1,66 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Inline\Renderer; - -use League\CommonMark\ElementRendererInterface; -use League\CommonMark\HtmlElement; -use League\CommonMark\Inline\Element\AbstractInline; -use League\CommonMark\Inline\Element\Link; -use League\CommonMark\Util\ConfigurationAwareInterface; -use League\CommonMark\Util\ConfigurationInterface; -use League\CommonMark\Util\RegexHelper; - -final class LinkRenderer implements InlineRendererInterface, ConfigurationAwareInterface -{ - /** - * @var ConfigurationInterface - */ - protected $config; - - /** - * @param Link $inline - * @param ElementRendererInterface $htmlRenderer - * - * @return HtmlElement - */ - public function render(AbstractInline $inline, ElementRendererInterface $htmlRenderer) - { - if (!($inline instanceof Link)) { - throw new \InvalidArgumentException('Incompatible inline type: ' . \get_class($inline)); - } - - $attrs = $inline->getData('attributes', []); - - $forbidUnsafeLinks = !$this->config->get('allow_unsafe_links'); - if (!($forbidUnsafeLinks && RegexHelper::isLinkPotentiallyUnsafe($inline->getUrl()))) { - $attrs['href'] = $inline->getUrl(); - } - - if (isset($inline->data['title'])) { - $attrs['title'] = $inline->data['title']; - } - - if (isset($attrs['target']) && $attrs['target'] === '_blank' && !isset($attrs['rel'])) { - $attrs['rel'] = 'noopener noreferrer'; - } - - return new HtmlElement('a', $attrs, $htmlRenderer->renderInlines($inline->children())); - } - - public function setConfiguration(ConfigurationInterface $configuration) - { - $this->config = $configuration; - } -} diff --git a/vendor/league/commonmark/src/Inline/Renderer/NewlineRenderer.php b/vendor/league/commonmark/src/Inline/Renderer/NewlineRenderer.php deleted file mode 100644 index 2314b22cea..0000000000 --- a/vendor/league/commonmark/src/Inline/Renderer/NewlineRenderer.php +++ /dev/null @@ -1,42 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Inline\Renderer; - -use League\CommonMark\ElementRendererInterface; -use League\CommonMark\HtmlElement; -use League\CommonMark\Inline\Element\AbstractInline; -use League\CommonMark\Inline\Element\Newline; - -final class NewlineRenderer implements InlineRendererInterface -{ - /** - * @param Newline $inline - * @param ElementRendererInterface $htmlRenderer - * - * @return HtmlElement|string - */ - public function render(AbstractInline $inline, ElementRendererInterface $htmlRenderer) - { - if (!($inline instanceof Newline)) { - throw new \InvalidArgumentException('Incompatible inline type: ' . \get_class($inline)); - } - - if ($inline->getType() === Newline::HARDBREAK) { - return new HtmlElement('br', [], '', true) . "\n"; - } - - return $htmlRenderer->getOption('soft_break', "\n"); - } -} diff --git a/vendor/league/commonmark/src/Inline/Renderer/StrongRenderer.php b/vendor/league/commonmark/src/Inline/Renderer/StrongRenderer.php deleted file mode 100644 index 1862433027..0000000000 --- a/vendor/league/commonmark/src/Inline/Renderer/StrongRenderer.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Inline\Renderer; - -use League\CommonMark\ElementRendererInterface; -use League\CommonMark\HtmlElement; -use League\CommonMark\Inline\Element\AbstractInline; -use League\CommonMark\Inline\Element\Strong; - -final class StrongRenderer implements InlineRendererInterface -{ - /** - * @param Strong $inline - * @param ElementRendererInterface $htmlRenderer - * - * @return HtmlElement - */ - public function render(AbstractInline $inline, ElementRendererInterface $htmlRenderer) - { - if (!($inline instanceof Strong)) { - throw new \InvalidArgumentException('Incompatible inline type: ' . \get_class($inline)); - } - - $attrs = $inline->getData('attributes', []); - - return new HtmlElement('strong', $attrs, $htmlRenderer->renderInlines($inline->children())); - } -} diff --git a/vendor/league/commonmark/src/Inline/Renderer/TextRenderer.php b/vendor/league/commonmark/src/Inline/Renderer/TextRenderer.php deleted file mode 100644 index fd7bb9bca7..0000000000 --- a/vendor/league/commonmark/src/Inline/Renderer/TextRenderer.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Inline\Renderer; - -use League\CommonMark\ElementRendererInterface; -use League\CommonMark\Inline\Element\AbstractInline; -use League\CommonMark\Inline\Element\Text; -use League\CommonMark\Util\Xml; - -final class TextRenderer implements InlineRendererInterface -{ - /** - * @param Text $inline - * @param ElementRendererInterface $htmlRenderer - * - * @return string - */ - public function render(AbstractInline $inline, ElementRendererInterface $htmlRenderer) - { - if (!($inline instanceof Text)) { - throw new \InvalidArgumentException('Incompatible inline type: ' . \get_class($inline)); - } - - return Xml::escape($inline->getContent()); - } -} diff --git a/vendor/league/commonmark/src/InlineParserContext.php b/vendor/league/commonmark/src/InlineParserContext.php deleted file mode 100644 index b38808bbce..0000000000 --- a/vendor/league/commonmark/src/InlineParserContext.php +++ /dev/null @@ -1,60 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark; - -use League\CommonMark\Block\Element\AbstractBlock; -use League\CommonMark\Block\Element\AbstractStringContainerBlock; -use League\CommonMark\Delimiter\DelimiterStack; -use League\CommonMark\Reference\ReferenceMapInterface; - -class InlineParserContext -{ - /** @var AbstractStringContainerBlock */ - private $container; - /** @var ReferenceMapInterface */ - private $referenceMap; - /** @var Cursor */ - private $cursor; - /** @var DelimiterStack */ - private $delimiterStack; - - public function __construct(AbstractStringContainerBlock $container, ReferenceMapInterface $referenceMap) - { - $this->referenceMap = $referenceMap; - $this->container = $container; - $this->cursor = new Cursor(\trim($container->getStringContent())); - $this->delimiterStack = new DelimiterStack(); - } - - public function getContainer(): AbstractBlock - { - return $this->container; - } - - public function getReferenceMap(): ReferenceMapInterface - { - return $this->referenceMap; - } - - public function getCursor(): Cursor - { - return $this->cursor; - } - - public function getDelimiterStack(): DelimiterStack - { - return $this->delimiterStack; - } -} diff --git a/vendor/league/commonmark/src/InlineParserEngine.php b/vendor/league/commonmark/src/InlineParserEngine.php deleted file mode 100644 index 3d6a8a9103..0000000000 --- a/vendor/league/commonmark/src/InlineParserEngine.php +++ /dev/null @@ -1,191 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark; - -use League\CommonMark\Block\Element\AbstractStringContainerBlock; -use League\CommonMark\Delimiter\Delimiter; -use League\CommonMark\Delimiter\Processor\DelimiterProcessorInterface; -use League\CommonMark\Inline\AdjacentTextMerger; -use League\CommonMark\Inline\Element\Text; -use League\CommonMark\Node\Node; -use League\CommonMark\Reference\ReferenceMapInterface; -use League\CommonMark\Util\RegexHelper; - -/** - * @internal - */ -final class InlineParserEngine -{ - /** @var EnvironmentInterface */ - protected $environment; - - public function __construct(EnvironmentInterface $environment) - { - $this->environment = $environment; - } - - /** - * @param AbstractStringContainerBlock $container - * @param ReferenceMapInterface $referenceMap - * - * @return void - */ - public function parse(AbstractStringContainerBlock $container, ReferenceMapInterface $referenceMap) - { - $inlineParserContext = new InlineParserContext($container, $referenceMap); - $cursor = $inlineParserContext->getCursor(); - while (($character = $cursor->getCharacter()) !== null) { - if (!$this->parseCharacter($character, $inlineParserContext)) { - $this->addPlainText($character, $container, $inlineParserContext); - } - } - - $this->processInlines($inlineParserContext); - - AdjacentTextMerger::mergeChildNodes($container); - } - - /** - * @param string $character - * @param InlineParserContext $inlineParserContext - * - * @return bool Whether we successfully parsed a character at that position - */ - private function parseCharacter(string $character, InlineParserContext $inlineParserContext): bool - { - foreach ($this->environment->getInlineParsersForCharacter($character) as $parser) { - if ($parser->parse($inlineParserContext)) { - return true; - } - } - - if ($delimiterProcessor = $this->environment->getDelimiterProcessors()->getDelimiterProcessor($character)) { - return $this->parseDelimiters($delimiterProcessor, $inlineParserContext); - } - - return false; - } - - private function parseDelimiters(DelimiterProcessorInterface $delimiterProcessor, InlineParserContext $inlineContext): bool - { - $cursor = $inlineContext->getCursor(); - $character = $cursor->getCharacter(); - $numDelims = 0; - - $charBefore = $cursor->peek(-1); - if ($charBefore === null) { - $charBefore = "\n"; - } - - while ($cursor->peek($numDelims) === $character) { - ++$numDelims; - } - - if ($numDelims < $delimiterProcessor->getMinLength()) { - return false; - } - - $cursor->advanceBy($numDelims); - - $charAfter = $cursor->getCharacter(); - if ($charAfter === null) { - $charAfter = "\n"; - } - - list($canOpen, $canClose) = self::determineCanOpenOrClose($charBefore, $charAfter, $character, $delimiterProcessor); - - $node = new Text(\str_repeat($character, $numDelims), [ - 'delim' => true, - ]); - $inlineContext->getContainer()->appendChild($node); - - // Add entry to stack to this opener - if ($canOpen || $canClose) { - $delimiter = new Delimiter($character, $numDelims, $node, $canOpen, $canClose); - $inlineContext->getDelimiterStack()->push($delimiter); - } - - return true; - } - - /** - * @param InlineParserContext $inlineParserContext - * - * @return void - */ - private function processInlines(InlineParserContext $inlineParserContext) - { - $delimiterStack = $inlineParserContext->getDelimiterStack(); - $delimiterStack->processDelimiters(null, $this->environment->getDelimiterProcessors()); - - // Remove all delimiters - $delimiterStack->removeAll(); - } - - /** - * @param string $character - * @param Node $container - * @param InlineParserContext $inlineParserContext - * - * @return void - */ - private function addPlainText(string $character, Node $container, InlineParserContext $inlineParserContext) - { - // We reach here if none of the parsers can handle the input - // Attempt to match multiple non-special characters at once - $text = $inlineParserContext->getCursor()->match($this->environment->getInlineParserCharacterRegex()); - // This might fail if we're currently at a special character which wasn't parsed; if so, just add that character - if ($text === null) { - $inlineParserContext->getCursor()->advanceBy(1); - $text = $character; - } - - $lastInline = $container->lastChild(); - if ($lastInline instanceof Text && !isset($lastInline->data['delim'])) { - $lastInline->append($text); - } else { - $container->appendChild(new Text($text)); - } - } - - /** - * @param string $charBefore - * @param string $charAfter - * @param string $character - * @param DelimiterProcessorInterface $delimiterProcessor - * - * @return bool[] - */ - private static function determineCanOpenOrClose(string $charBefore, string $charAfter, string $character, DelimiterProcessorInterface $delimiterProcessor) - { - $afterIsWhitespace = \preg_match(RegexHelper::REGEX_UNICODE_WHITESPACE_CHAR, $charAfter); - $afterIsPunctuation = \preg_match(RegexHelper::REGEX_PUNCTUATION, $charAfter); - $beforeIsWhitespace = \preg_match(RegexHelper::REGEX_UNICODE_WHITESPACE_CHAR, $charBefore); - $beforeIsPunctuation = \preg_match(RegexHelper::REGEX_PUNCTUATION, $charBefore); - - $leftFlanking = !$afterIsWhitespace && (!$afterIsPunctuation || $beforeIsWhitespace || $beforeIsPunctuation); - $rightFlanking = !$beforeIsWhitespace && (!$beforeIsPunctuation || $afterIsWhitespace || $afterIsPunctuation); - - if ($character === '_') { - $canOpen = $leftFlanking && (!$rightFlanking || $beforeIsPunctuation); - $canClose = $rightFlanking && (!$leftFlanking || $afterIsPunctuation); - } else { - $canOpen = $leftFlanking && $character === $delimiterProcessor->getOpeningCharacter(); - $canClose = $rightFlanking && $character === $delimiterProcessor->getClosingCharacter(); - } - - return [$canOpen, $canClose]; - } -} diff --git a/vendor/league/commonmark/src/Input/MarkdownInput.php b/vendor/league/commonmark/src/Input/MarkdownInput.php deleted file mode 100644 index ff21e8ddd1..0000000000 --- a/vendor/league/commonmark/src/Input/MarkdownInput.php +++ /dev/null @@ -1,82 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Input; - -use League\CommonMark\Exception\UnexpectedEncodingException; - -final class MarkdownInput implements MarkdownInputInterface -{ - /** @var array<int, string>|null */ - private $lines; - - /** @var string */ - private $content; - - /** @var int|null */ - private $lineCount; - - public function __construct(string $content) - { - if (!\mb_check_encoding($content, 'UTF-8')) { - throw new UnexpectedEncodingException('Unexpected encoding - UTF-8 or ASCII was expected'); - } - - $this->content = $content; - } - - public function getContent(): string - { - return $this->content; - } - - /** - * @return \Traversable<int, string> - */ - public function getLines(): \Traversable - { - $this->splitLinesIfNeeded(); - - foreach ($this->lines as $lineNumber => $line) { - yield $lineNumber => $line; - } - } - - public function getLineCount(): int - { - $this->splitLinesIfNeeded(); - - return $this->lineCount; - } - - private function splitLinesIfNeeded(): void - { - if ($this->lines !== null) { - return; - } - - $lines = \preg_split('/\r\n|\n|\r/', $this->content); - if ($lines === false) { - throw new UnexpectedEncodingException('Failed to split Markdown content by line'); - } - - $this->lines = $lines; - - // Remove any newline which appears at the very end of the string. - // We've already split the document by newlines, so we can simply drop - // any empty element which appears on the end. - if (\end($this->lines) === '') { - \array_pop($this->lines); - } - - $this->lineCount = \count($this->lines); - } -} diff --git a/vendor/league/commonmark/src/Input/MarkdownInputInterface.php b/vendor/league/commonmark/src/Input/MarkdownInputInterface.php deleted file mode 100644 index cc15bdb846..0000000000 --- a/vendor/league/commonmark/src/Input/MarkdownInputInterface.php +++ /dev/null @@ -1,24 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Input; - -interface MarkdownInputInterface -{ - public function getContent(): string; - - /** - * @return iterable<int, string> - */ - public function getLines(): iterable; - - public function getLineCount(): int; -} diff --git a/vendor/league/commonmark/src/MarkdownConverterInterface.php b/vendor/league/commonmark/src/MarkdownConverterInterface.php deleted file mode 100644 index ffe630c8bb..0000000000 --- a/vendor/league/commonmark/src/MarkdownConverterInterface.php +++ /dev/null @@ -1,31 +0,0 @@ -<?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. - */ - -namespace League\CommonMark; - -/** - * Interface for a service which converts Markdown to HTML. - */ -interface MarkdownConverterInterface -{ - /** - * Converts Markdown to HTML. - * - * @param string $markdown - * - * @throws \RuntimeException - * - * @return string HTML - * - * @api - */ - public function convertToHtml(string $markdown): string; -} diff --git a/vendor/league/commonmark/src/Node/Node.php b/vendor/league/commonmark/src/Node/Node.php deleted file mode 100644 index 96644b7cdc..0000000000 --- a/vendor/league/commonmark/src/Node/Node.php +++ /dev/null @@ -1,279 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Node; - -abstract class Node -{ - /** - * @var int - */ - protected $depth = 0; - - /** - * @var Node|null - */ - protected $parent; - - /** - * @var Node|null - */ - protected $previous; - - /** - * @var Node|null - */ - protected $next; - - /** - * @var Node|null - */ - protected $firstChild; - - /** - * @var Node|null - */ - protected $lastChild; - - public function previous(): ?Node - { - return $this->previous; - } - - public function next(): ?Node - { - return $this->next; - } - - public function parent(): ?Node - { - return $this->parent; - } - - /** - * @param Node|null $node - * - * @return void - */ - protected function setParent(Node $node = null) - { - $this->parent = $node; - $this->depth = ($node === null) ? 0 : $node->depth + 1; - } - - /** - * Inserts the $sibling node after $this - * - * @param Node $sibling - * - * @return void - */ - public function insertAfter(Node $sibling) - { - $sibling->detach(); - $sibling->next = $this->next; - - if ($sibling->next) { - $sibling->next->previous = $sibling; - } - - $sibling->previous = $this; - $this->next = $sibling; - $sibling->setParent($this->parent); - - if (!$sibling->next && $sibling->parent) { - $sibling->parent->lastChild = $sibling; - } - } - - /** - * Inserts the $sibling node before $this - * - * @param Node $sibling - * - * @return void - */ - public function insertBefore(Node $sibling) - { - $sibling->detach(); - $sibling->previous = $this->previous; - - if ($sibling->previous) { - $sibling->previous->next = $sibling; - } - - $sibling->next = $this; - $this->previous = $sibling; - $sibling->setParent($this->parent); - - if (!$sibling->previous && $sibling->parent) { - $sibling->parent->firstChild = $sibling; - } - } - - /** - * @param Node $replacement - * - * @return void - */ - public function replaceWith(Node $replacement) - { - $replacement->detach(); - $this->insertAfter($replacement); - $this->detach(); - } - - /** - * @return void - */ - public function detach() - { - if ($this->previous) { - $this->previous->next = $this->next; - } elseif ($this->parent) { - $this->parent->firstChild = $this->next; - } - - if ($this->next) { - $this->next->previous = $this->previous; - } elseif ($this->parent) { - $this->parent->lastChild = $this->previous; - } - - $this->parent = null; - $this->next = null; - $this->previous = null; - $this->depth = 0; - } - - abstract public function isContainer(): bool; - - public function firstChild(): ?Node - { - return $this->firstChild; - } - - public function lastChild(): ?Node - { - return $this->lastChild; - } - - /** - * @return Node[] - */ - public function children(): iterable - { - $children = []; - for ($current = $this->firstChild; null !== $current; $current = $current->next) { - $children[] = $current; - } - - return $children; - } - - /** - * @param Node $child - * - * @return void - */ - public function appendChild(Node $child) - { - if ($this->lastChild) { - $this->lastChild->insertAfter($child); - } else { - $child->detach(); - $child->setParent($this); - $this->lastChild = $this->firstChild = $child; - } - } - - /** - * Adds $child as the very first child of $this - * - * @param Node $child - * - * @return void - */ - public function prependChild(Node $child) - { - if ($this->firstChild) { - $this->firstChild->insertBefore($child); - } else { - $child->detach(); - $child->setParent($this); - $this->lastChild = $this->firstChild = $child; - } - } - - /** - * Detaches all child nodes of given node - * - * @return void - */ - public function detachChildren() - { - foreach ($this->children() as $children) { - $children->setParent(null); - } - $this->firstChild = $this->lastChild = null; - } - - /** - * Replace all children of given node with collection of another - * - * @param iterable<Node> $children - * - * @return $this - */ - public function replaceChildren(iterable $children) - { - $this->detachChildren(); - foreach ($children as $item) { - $this->appendChild($item); - } - - return $this; - } - - public function getDepth(): int - { - return $this->depth; - } - - public function walker(): NodeWalker - { - return new NodeWalker($this); - } - - /** - * Clone the current node and its children - * - * WARNING: This is a recursive function and should not be called on deeply-nested node trees! - */ - public function __clone() - { - // Cloned nodes are detached from their parents, siblings, and children - $this->parent = null; - $this->previous = null; - $this->next = null; - // But save a copy of the children since we'll need that in a moment - $children = $this->children(); - $this->detachChildren(); - - // The original children get cloned and re-added - foreach ($children as $child) { - $this->appendChild(clone $child); - } - } -} diff --git a/vendor/league/commonmark/src/Node/NodeWalker.php b/vendor/league/commonmark/src/Node/NodeWalker.php deleted file mode 100644 index a238f34676..0000000000 --- a/vendor/league/commonmark/src/Node/NodeWalker.php +++ /dev/null @@ -1,89 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Node; - -final class NodeWalker -{ - /** - * @var Node - */ - private $root; - - /** - * @var Node|null - */ - private $current; - - /** - * @var bool - */ - private $entering; - - public function __construct(Node $root) - { - $this->root = $root; - $this->current = $this->root; - $this->entering = true; - } - - /** - * Returns an event which contains node and entering flag - * (entering is true when we enter a Node from a parent or sibling, - * and false when we reenter it from child) - * - * @return NodeWalkerEvent|null - */ - public function next(): ?NodeWalkerEvent - { - $current = $this->current; - $entering = $this->entering; - if (null === $current) { - return null; - } - - if ($entering && $current->isContainer()) { - if ($current->firstChild()) { - $this->current = $current->firstChild(); - $this->entering = true; - } else { - $this->entering = false; - } - } elseif ($current === $this->root) { - $this->current = null; - } elseif (null === $current->next()) { - $this->current = $current->parent(); - $this->entering = false; - } else { - $this->current = $current->next(); - $this->entering = true; - } - - return new NodeWalkerEvent($current, $entering); - } - - /** - * Resets the iterator to resume at the specified node - * - * @param Node $node - * @param bool $entering - * - * @return void - */ - public function resumeAt(Node $node, bool $entering = true) - { - $this->current = $node; - $this->entering = $entering; - } -} diff --git a/vendor/league/commonmark/src/Node/NodeWalkerEvent.php b/vendor/league/commonmark/src/Node/NodeWalkerEvent.php deleted file mode 100644 index a911b4044a..0000000000 --- a/vendor/league/commonmark/src/Node/NodeWalkerEvent.php +++ /dev/null @@ -1,48 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Node; - -final class NodeWalkerEvent -{ - /** - * @var Node - */ - private $node; - - /** - * @var bool - */ - private $isEntering; - - /** - * @param Node $node - * @param bool $isEntering - */ - public function __construct(Node $node, $isEntering = true) - { - $this->node = $node; - $this->isEntering = $isEntering; - } - - public function getNode(): Node - { - return $this->node; - } - - public function isEntering(): bool - { - return $this->isEntering; - } -} diff --git a/vendor/league/commonmark/src/Normalizer/SlugNormalizer.php b/vendor/league/commonmark/src/Normalizer/SlugNormalizer.php deleted file mode 100644 index 3b6a06a64c..0000000000 --- a/vendor/league/commonmark/src/Normalizer/SlugNormalizer.php +++ /dev/null @@ -1,37 +0,0 @@ -<?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\Normalizer; - -/** - * Creates URL-friendly strings based on the given string input - */ -final class SlugNormalizer implements TextNormalizerInterface -{ - /** - * {@inheritdoc} - */ - public function normalize(string $text, $context = null): string - { - // Trim whitespace - $slug = \trim($text); - // Convert to lowercase - $slug = \mb_strtolower($slug); - // Try replacing whitespace with a dash - $slug = \preg_replace('/\s+/u', '-', $slug) ?? $slug; - // Try removing characters other than letters, numbers, and marks. - $slug = \preg_replace('/[^\p{L}\p{Nd}\p{Nl}\p{M}-]+/u', '', $slug) ?? $slug; - - return $slug; - } -} diff --git a/vendor/league/commonmark/src/Normalizer/TextNormalizer.php b/vendor/league/commonmark/src/Normalizer/TextNormalizer.php deleted file mode 100644 index e662600faa..0000000000 --- a/vendor/league/commonmark/src/Normalizer/TextNormalizer.php +++ /dev/null @@ -1,51 +0,0 @@ -<?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\Normalizer; - -/*** - * Normalize text input using the steps given by the CommonMark spec to normalize labels - * - * @see https://spec.commonmark.org/0.29/#matches - */ -final class TextNormalizer implements TextNormalizerInterface -{ - /** - * @var array<int, array<int, string>> - * - * Source: https://github.com/symfony/polyfill-mbstring/blob/master/Mbstring.php - */ - private const CASE_FOLD = [ - ['µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE", "\xC3\x9F", "\xE1\xBA\x9E"], - ['μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', "\xE1\xB9\xA1", 'ι', 'ss', 'ss'], - ]; - - /** - * {@inheritdoc} - */ - public function normalize(string $text, $context = null): string - { - // Collapse internal whitespace to single space and remove - // leading/trailing whitespace - $text = \preg_replace('/\s+/', ' ', \trim($text)); - - if (!\defined('MB_CASE_FOLD')) { - // We're not on a version of PHP (7.3+) which has this feature - $text = \str_replace(self::CASE_FOLD[0], self::CASE_FOLD[1], $text); - - return \mb_strtolower($text, 'UTF-8'); - } - - return \mb_convert_case($text, \MB_CASE_FOLD, 'UTF-8'); - } -} diff --git a/vendor/league/commonmark/src/Normalizer/TextNormalizerInterface.php b/vendor/league/commonmark/src/Normalizer/TextNormalizerInterface.php deleted file mode 100644 index c1a9eb12c4..0000000000 --- a/vendor/league/commonmark/src/Normalizer/TextNormalizerInterface.php +++ /dev/null @@ -1,26 +0,0 @@ -<?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\Normalizer; - -/** - * Creates a normalized version of the given input text - */ -interface TextNormalizerInterface -{ - /** - * @param string $text The text to normalize - * @param mixed $context Additional context about the text being normalized (optional) - */ - public function normalize(string $text, $context = null): string; -} diff --git a/vendor/league/commonmark/src/Reference/Reference.php b/vendor/league/commonmark/src/Reference/Reference.php deleted file mode 100644 index ebe57aa8bf..0000000000 --- a/vendor/league/commonmark/src/Reference/Reference.php +++ /dev/null @@ -1,76 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Reference; - -use League\CommonMark\Normalizer\TextNormalizer; - -final class Reference implements ReferenceInterface -{ - /** - * @var string - */ - protected $label; - - /** - * @var string - */ - protected $destination; - - /** - * @var string - */ - protected $title; - - public function __construct(string $label, string $destination, string $title) - { - $this->label = $label; - $this->destination = $destination; - $this->title = $title; - } - - public function getLabel(): string - { - return $this->label; - } - - public function getDestination(): string - { - return $this->destination; - } - - public function getTitle(): string - { - return $this->title; - } - - /** - * Normalize reference label - * - * This enables case-insensitive label matching - * - * @param string $string - * - * @return string - * - * @deprecated Use TextNormalizer::normalize() instead - * @group legacy - */ - public static function normalizeReference(string $string): string - { - @trigger_error(sprintf('%s::normlizeReference() is deprecated; use %s::normalize() instead', self::class, TextNormalizer::class), E_USER_DEPRECATED); - - return (new TextNormalizer())->normalize($string); - } -} diff --git a/vendor/league/commonmark/src/Reference/ReferenceInterface.php b/vendor/league/commonmark/src/Reference/ReferenceInterface.php deleted file mode 100644 index 9193b2f688..0000000000 --- a/vendor/league/commonmark/src/Reference/ReferenceInterface.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Reference; - -/** - * Link reference - */ -interface ReferenceInterface -{ - public function getLabel(): string; - - public function getDestination(): string; - - public function getTitle(): string; -} diff --git a/vendor/league/commonmark/src/Reference/ReferenceMap.php b/vendor/league/commonmark/src/Reference/ReferenceMap.php deleted file mode 100644 index e016c14a95..0000000000 --- a/vendor/league/commonmark/src/Reference/ReferenceMap.php +++ /dev/null @@ -1,66 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Reference; - -use League\CommonMark\Normalizer\TextNormalizer; - -/** - * A collection of references, indexed by label - */ -final class ReferenceMap implements ReferenceMapInterface -{ - /** @var TextNormalizer */ - private $normalizer; - - /** - * @var ReferenceInterface[] - */ - private $references = []; - - public function __construct() - { - $this->normalizer = new TextNormalizer(); - } - - public function addReference(ReferenceInterface $reference): void - { - $key = $this->normalizer->normalize($reference->getLabel()); - - $this->references[$key] = $reference; - } - - public function contains(string $label): bool - { - $label = $this->normalizer->normalize($label); - - return isset($this->references[$label]); - } - - public function getReference(string $label): ?ReferenceInterface - { - $label = $this->normalizer->normalize($label); - - if (!isset($this->references[$label])) { - return null; - } - - return $this->references[$label]; - } - - public function listReferences(): iterable - { - return \array_values($this->references); - } -} diff --git a/vendor/league/commonmark/src/Reference/ReferenceMapInterface.php b/vendor/league/commonmark/src/Reference/ReferenceMapInterface.php deleted file mode 100644 index 69b6d5c89e..0000000000 --- a/vendor/league/commonmark/src/Reference/ReferenceMapInterface.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Reference; - -/** - * A collection of references - */ -interface ReferenceMapInterface -{ - /** - * @param ReferenceInterface $reference - * - * @return void - */ - public function addReference(ReferenceInterface $reference): void; - - /** - * @param string $label - * - * @return bool - */ - public function contains(string $label): bool; - - /** - * @param string $label - * - * @return ReferenceInterface|null - */ - public function getReference(string $label): ?ReferenceInterface; - - /** - * Lists all registered references. - * - * @return ReferenceInterface[] - */ - public function listReferences(): iterable; -} diff --git a/vendor/league/commonmark/src/Reference/ReferenceParser.php b/vendor/league/commonmark/src/Reference/ReferenceParser.php deleted file mode 100644 index fb250e2a86..0000000000 --- a/vendor/league/commonmark/src/Reference/ReferenceParser.php +++ /dev/null @@ -1,123 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Reference; - -use League\CommonMark\Cursor; -use League\CommonMark\Util\LinkParserHelper; - -final class ReferenceParser -{ - /** - * @var ReferenceMapInterface - */ - private $referenceMap; - - public function __construct(ReferenceMapInterface $referenceMap) - { - $this->referenceMap = $referenceMap; - } - - /** - * Attempt to parse a link reference, modifying the refmap. - * - * @param Cursor $cursor - * - * @return bool - */ - public function parse(Cursor $cursor) - { - if ($cursor->isAtEnd()) { - return false; - } - - $initialState = $cursor->saveState(); - - $matchChars = LinkParserHelper::parseLinkLabel($cursor); - if ($matchChars === 0) { - $cursor->restoreState($initialState); - - return false; - } - - // We need to trim the opening and closing brackets from the previously-matched text - $label = \substr($cursor->getPreviousText(), 1, -1); - - if (\preg_match('/[^\s]/', $label) === 0) { - $cursor->restoreState($initialState); - - return false; - } - - if ($cursor->getCharacter() !== ':') { - $cursor->restoreState($initialState); - - return false; - } - - // Advance past the colon - $cursor->advanceBy(1); - - // Link URL - $cursor->advanceToNextNonSpaceOrNewline(); - - $destination = LinkParserHelper::parseLinkDestination($cursor); - if ($destination === null) { - $cursor->restoreState($initialState); - - return false; - } - - $previousState = $cursor->saveState(); - - if ($cursor->advanceToNextNonSpaceOrNewline() > 0) { - $title = LinkParserHelper::parseLinkTitle($cursor); - } - - if (!isset($title)) { - $title = ''; - $cursor->restoreState($previousState); - } - - // Make sure we're at line end: - $atLineEnd = true; - if ($cursor->match('/^ *(?:\n|$)/') === null) { - if ($title === '') { - $atLineEnd = false; - } else { - // The potential title we found is not at the line end, - // but it could still be a legal link reference if we - // discard the title - $title = ''; - // rewind before spaces - $cursor->restoreState($previousState); - // and instead check if the link URL is at the line end - $atLineEnd = $cursor->match('/^ *(?:\n|$)/') !== null; - } - } - - if (!$atLineEnd) { - $cursor->restoreState($initialState); - - return false; - } - - if (!$this->referenceMap->contains($label)) { - $reference = new Reference($label, $destination, $title); - $this->referenceMap->addReference($reference); - } - - return true; - } -} diff --git a/vendor/league/commonmark/src/UnmatchedBlockCloser.php b/vendor/league/commonmark/src/UnmatchedBlockCloser.php deleted file mode 100644 index f33e2ae049..0000000000 --- a/vendor/league/commonmark/src/UnmatchedBlockCloser.php +++ /dev/null @@ -1,90 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark; - -use League\CommonMark\Block\Element\AbstractBlock; - -/** - * @internal - */ -class UnmatchedBlockCloser -{ - /** - * @var ContextInterface - */ - private $context; - - /** - * @var AbstractBlock - */ - private $oldTip; - - /** - * @var AbstractBlock - */ - private $lastMatchedContainer; - - /** - * @param ContextInterface $context - */ - public function __construct(ContextInterface $context) - { - $this->context = $context; - - $this->resetTip(); - } - - /** - * @param AbstractBlock $block - * - * @return void - */ - public function setLastMatchedContainer(AbstractBlock $block) - { - $this->lastMatchedContainer = $block; - } - - /** - * @return void - */ - public function closeUnmatchedBlocks() - { - $endLine = $this->context->getLineNumber() - 1; - - while ($this->oldTip !== $this->lastMatchedContainer) { - /** @var AbstractBlock $oldTip */ - $oldTip = $this->oldTip->parent(); - $this->oldTip->finalize($this->context, $endLine); - $this->oldTip = $oldTip; - } - } - - /** - * @return void - */ - public function resetTip() - { - if ($this->context->getTip() === null) { - throw new \RuntimeException('No tip to reset to'); - } - - $this->oldTip = $this->context->getTip(); - } - - public function areAllClosed(): bool - { - return $this->context->getTip() === $this->lastMatchedContainer; - } -} diff --git a/vendor/league/commonmark/src/Util/ArrayCollection.php b/vendor/league/commonmark/src/Util/ArrayCollection.php deleted file mode 100644 index 89ce23f678..0000000000 --- a/vendor/league/commonmark/src/Util/ArrayCollection.php +++ /dev/null @@ -1,349 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Util; - -/** - * Array collection - * - * Provides a wrapper around a standard PHP array. - * - * @internal - * - * @phpstan-template TKey - * @phpstan-template TValue - * @phpstan-implements \IteratorAggregate<TKey, TValue> - * @phpstan-implements \ArrayAccess<TKey, TValue> - */ -class ArrayCollection implements \IteratorAggregate, \Countable, \ArrayAccess -{ - /** - * @var array<int|string, mixed> - * @phpstan-var array<TKey, TValue> - */ - private $elements; - - /** - * Constructor - * - * @param array<int|string, mixed> $elements - * - * @phpstan-param array<TKey, TValue> $elements - */ - public function __construct(array $elements = []) - { - $this->elements = $elements; - } - - /** - * @return mixed|false - * - * @phpstan-return TValue|false - */ - public function first() - { - return \reset($this->elements); - } - - /** - * @return mixed|false - * - * @phpstan-return TValue|false - */ - public function last() - { - return \end($this->elements); - } - - /** - * Retrieve an external iterator - * - * @return \ArrayIterator<int|string, mixed> - * - * @phpstan-return \ArrayIterator<TKey, TValue> - */ - public function getIterator() - { - return new \ArrayIterator($this->elements); - } - - /** - * @param mixed $element - * - * @return bool - * - * @phpstan-param TValue $element - * - * @deprecated - */ - public function add($element): bool - { - @trigger_error(sprintf('The "%s:%s" method is deprecated since league/commonmark 1.4, use "%s" instead.', self::class, 'add()', '$collection[] = $value'), E_USER_DEPRECATED); - - $this->elements[] = $element; - - return true; - } - - /** - * @param int|string $key - * @param mixed $value - * - * @return void - * - * @phpstan-param TKey $key - * @phpstan-param TValue $value - * - * @deprecated - */ - public function set($key, $value) - { - @trigger_error(sprintf('The "%s:%s" method is deprecated since league/commonmark 1.4, use "%s" instead.', self::class, 'set()', '$collection[$key] = $value'), E_USER_DEPRECATED); - - $this->offsetSet($key, $value); - } - - /** - * @param int|string $key - * - * @return mixed - * - * @phpstan-param TKey $key - * - * @phpstan-return TValue|null - * - * @deprecated - */ - public function get($key) - { - @trigger_error(sprintf('The "%s:%s" method is deprecated since league/commonmark 1.4, use "%s" instead.', self::class, 'get()', '$collection[$key]'), E_USER_DEPRECATED); - - return $this->offsetGet($key); - } - - /** - * @param int|string $key - * - * @return mixed - * - * @phpstan-param TKey $key - * - * @phpstan-return TValue|null - * - * @deprecated - */ - public function remove($key) - { - @trigger_error(sprintf('The "%s:%s" method is deprecated since league/commonmark 1.4, use "%s" instead.', self::class, 'remove()', 'unset($collection[$key])'), E_USER_DEPRECATED); - - if (!\array_key_exists($key, $this->elements)) { - return; - } - - $removed = $this->elements[$key]; - unset($this->elements[$key]); - - return $removed; - } - - /** - * @return bool - * - * @deprecated - */ - public function isEmpty(): bool - { - @trigger_error(sprintf('The "%s:%s" method is deprecated since league/commonmark 1.4, use "%s" instead.', self::class, 'isEmpty()', 'count($collection) === 0'), E_USER_DEPRECATED); - - return empty($this->elements); - } - - /** - * @param mixed $element - * - * @return bool - * - * @phpstan-param TValue $element - * - * @deprecated - */ - public function contains($element): bool - { - @trigger_error(sprintf('The "%s:%s" method is deprecated since league/commonmark 1.4, use "%s" instead.', self::class, 'contains()', 'in_array($value, $collection->toArray(), true)'), E_USER_DEPRECATED); - - return \in_array($element, $this->elements, true); - } - - /** - * @param mixed $element - * - * @return mixed|false - * - * @phpstan-param TValue $element - * - * @deprecated - */ - public function indexOf($element) - { - @trigger_error(sprintf('The "%s:%s" method is deprecated since league/commonmark 1.4, use "%s" instead.', self::class, 'indexOf()', 'array_search($value, $collection->toArray(), true)'), E_USER_DEPRECATED); - - return \array_search($element, $this->elements, true); - } - - /** - * @param int|string $key - * - * @return bool - * - * @phpstan-param TKey $key - * - * @deprecated - */ - public function containsKey($key): bool - { - @trigger_error(sprintf('The "%s:%s" method is deprecated since league/commonmark 1.4, use "%s" instead.', self::class, 'containsKey()', 'isset($collection[$key])'), E_USER_DEPRECATED); - - return \array_key_exists($key, $this->elements); - } - - /** - * Count elements of an object - * - * @return int The count as an integer. - */ - public function count(): int - { - return \count($this->elements); - } - - /** - * Whether an offset exists - * - * @param int|string $offset An offset to check for. - * - * @return bool true on success or false on failure. - * - * @phpstan-param TKey $offset - */ - public function offsetExists($offset): bool - { - return \array_key_exists($offset, $this->elements); - } - - /** - * Offset to retrieve - * - * @param int|string $offset - * - * @return mixed|null - * - * @phpstan-param TKey $offset - * - * @phpstan-return TValue|null - */ - public function offsetGet($offset) - { - return $this->elements[$offset] ?? null; - } - - /** - * Offset to set - * - * @param int|string|null $offset The offset to assign the value to. - * @param mixed $value The value to set. - * - * @return void - * - * @phpstan-param TKey|null $offset - * @phpstan-param TValue $value - */ - public function offsetSet($offset, $value) - { - if ($offset === null) { - $this->elements[] = $value; - } else { - $this->elements[$offset] = $value; - } - } - - /** - * Offset to unset - * - * @param int|string $offset The offset to unset. - * - * @return void - * - * @phpstan-param TKey $offset - */ - public function offsetUnset($offset) - { - if (!\array_key_exists($offset, $this->elements)) { - return; - } - - unset($this->elements[$offset]); - } - - /** - * Returns a subset of the array - * - * @param int $offset - * @param int|null $length - * - * @return array<int|string, mixed> - * - * @phpstan-return array<TKey, TValue> - */ - public function slice(int $offset, ?int $length = null): array - { - return \array_slice($this->elements, $offset, $length, true); - } - - /** - * @return array<int|string, mixed> - * - * @phpstan-return array<TKey, TValue> - */ - public function toArray(): array - { - return $this->elements; - } - - /** - * @param array<int|string, mixed> $elements - * - * @return $this - * - * @phpstan-param array<TKey, TValue> $elements - * - * @deprecated - */ - public function replaceWith(array $elements) - { - @trigger_error(sprintf('The "%s:%s" method is deprecated since league/commonmark 1.4.', self::class, 'replaceWith()'), E_USER_DEPRECATED); - - $this->elements = $elements; - - return $this; - } - - /** - * @deprecated - * - * @return void - */ - public function removeGaps() - { - @trigger_error(sprintf('The "%s:%s" method is deprecated since league/commonmark 1.4.', self::class, 'removeGaps()'), E_USER_DEPRECATED); - - $this->elements = \array_filter($this->elements); - } -} diff --git a/vendor/league/commonmark/src/Util/Configuration.php b/vendor/league/commonmark/src/Util/Configuration.php deleted file mode 100644 index 6d8ffaabfd..0000000000 --- a/vendor/league/commonmark/src/Util/Configuration.php +++ /dev/null @@ -1,111 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Util; - -final class Configuration implements ConfigurationInterface -{ - /** @var array<string, mixed> */ - private $config; - - /** - * @param array<string, mixed> $config - */ - public function __construct(array $config = []) - { - $this->config = $config; - } - - public function merge(array $config = []) - { - $this->config = \array_replace_recursive($this->config, $config); - } - - public function replace(array $config = []) - { - $this->config = $config; - } - - public function get(?string $key = null, $default = null) - { - if ($key === null) { - return $this->config; - } - - // accept a/b/c as ['a']['b']['c'] - if (\strpos($key, '/')) { - return $this->getConfigByPath($key, $default); - } - - if (!isset($this->config[$key])) { - return $default; - } - - return $this->config[$key]; - } - - public function set(string $key, $value = null) - { - // accept a/b/c as ['a']['b']['c'] - if (\strpos($key, '/')) { - $this->setByPath($key, $value); - } - - $this->config[$key] = $value; - } - - /** - * @param string $keyPath - * @param string|null $default - * - * @return mixed|null - */ - private function getConfigByPath(string $keyPath, $default = null) - { - $keyArr = \explode('/', $keyPath); - $data = $this->config; - foreach ($keyArr as $k) { - if (!\is_array($data) || !isset($data[$k])) { - return $default; - } - - $data = $data[$k]; - } - - return $data; - } - - /** - * @param string $keyPath - * @param string|null $value - */ - private function setByPath(string $keyPath, $value = null): void - { - $keyArr = \explode('/', $keyPath); - $pointer = &$this->config; - while (($k = \array_shift($keyArr)) !== null) { - if (!\is_array($pointer)) { - $pointer = []; - } - - if (!isset($pointer[$k])) { - $pointer[$k] = null; - } - - $pointer = &$pointer[$k]; - } - - $pointer = $value; - } -} diff --git a/vendor/league/commonmark/src/Util/ConfigurationAwareInterface.php b/vendor/league/commonmark/src/Util/ConfigurationAwareInterface.php deleted file mode 100644 index 1a66f78ba0..0000000000 --- a/vendor/league/commonmark/src/Util/ConfigurationAwareInterface.php +++ /dev/null @@ -1,25 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Util; - -/** - * Implement this class to inject the configuration where needed - */ -interface ConfigurationAwareInterface -{ - /** - * @param ConfigurationInterface $configuration - * - * @return void - */ - public function setConfiguration(ConfigurationInterface $configuration); -} diff --git a/vendor/league/commonmark/src/Util/ConfigurationInterface.php b/vendor/league/commonmark/src/Util/ConfigurationInterface.php deleted file mode 100644 index d5c167ed54..0000000000 --- a/vendor/league/commonmark/src/Util/ConfigurationInterface.php +++ /dev/null @@ -1,57 +0,0 @@ -<?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. - */ - -namespace League\CommonMark\Util; - -interface ConfigurationInterface -{ - /** - * Merge an existing array into the current configuration - * - * @param array<string, mixed> $config - * - * @return void - */ - public function merge(array $config = []); - - /** - * Replace the entire array with something else - * - * @param array<string, mixed> $config - * - * @return void - */ - public function replace(array $config = []); - - /** - * Return the configuration value at the given key, or $default if no such config exists - * - * The key can be a string or a slash-delimited path to a nested value - * - * @param string|null $key - * @param mixed|null $default - * - * @return mixed|null - */ - public function get(?string $key = null, $default = null); - - /** - * Set the configuration value at the given key - * - * The key can be a string or a slash-delimited path to a nested value - * - * @param string $key - * @param mixed|null $value - * - * @return void - */ - public function set(string $key, $value = null); -} diff --git a/vendor/league/commonmark/src/Util/Html5Entities.php b/vendor/league/commonmark/src/Util/Html5Entities.php deleted file mode 100644 index 68dcb35919..0000000000 --- a/vendor/league/commonmark/src/Util/Html5Entities.php +++ /dev/null @@ -1,2303 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Util; - -@trigger_error(sprintf('The "%s" class is deprecated since league/commonmark 1.1, use "%s" instead.', Html5Entities::class, Html5EntityDecoder::class), E_USER_DEPRECATED); - -/** - * @deprecated Use Html5EntityDecoder instead - */ -final class Html5Entities -{ - /** - * @deprecated - * - * @var array<string, string> - */ - public static $entitiesByName = [ - 'Aacute' => 'Á', - 'Aacut' => 'Á', - 'aacute' => 'á', - 'aacut' => 'á', - 'Abreve' => 'Ă', - 'abreve' => 'ă', - 'ac' => '∾', - 'acd' => '∿', - 'acE' => '∾̳', - 'Acirc' => 'Â', - 'Acir' => 'Â', - 'acirc' => 'â', - 'acir' => 'â', - 'acute' => '´', - 'acut' => '´', - 'Acy' => 'А', - 'acy' => 'а', - 'AElig' => 'Æ', - 'AEli' => 'Æ', - 'aelig' => 'æ', - 'aeli' => 'æ', - 'af' => '', - 'Afr' => '𝔄', - 'afr' => '𝔞', - 'Agrave' => 'À', - 'Agrav' => 'À', - 'agrave' => 'à', - 'agrav' => 'à', - 'alefsym' => 'ℵ', - 'aleph' => 'ℵ', - 'Alpha' => 'Α', - 'alpha' => 'α', - 'Amacr' => 'Ā', - 'amacr' => 'ā', - 'amalg' => '⨿', - 'AMP' => '&', - 'AM' => '&', - 'amp' => '&', - 'am' => '&', - 'And' => '⩓', - 'and' => '∧', - 'andand' => '⩕', - 'andd' => '⩜', - 'andslope' => '⩘', - 'andv' => '⩚', - 'ang' => '∠', - 'ange' => '⦤', - 'angle' => '∠', - 'angmsd' => '∡', - 'angmsdaa' => '⦨', - 'angmsdab' => '⦩', - 'angmsdac' => '⦪', - 'angmsdad' => '⦫', - 'angmsdae' => '⦬', - 'angmsdaf' => '⦭', - 'angmsdag' => '⦮', - 'angmsdah' => '⦯', - 'angrt' => '∟', - 'angrtvb' => '⊾', - 'angrtvbd' => '⦝', - 'angsph' => '∢', - 'angst' => 'Å', - 'angzarr' => '⍼', - 'Aogon' => 'Ą', - 'aogon' => 'ą', - 'Aopf' => '𝔸', - 'aopf' => '𝕒', - 'ap' => '≈', - 'apacir' => '⩯', - 'apE' => '⩰', - 'ape' => '≊', - 'apid' => '≋', - 'apos' => '\'', - 'ApplyFunction' => '', - 'approx' => '≈', - 'approxeq' => '≊', - 'Aring' => 'Å', - 'Arin' => 'Å', - 'aring' => 'å', - 'arin' => 'å', - 'Ascr' => '𝒜', - 'ascr' => '𝒶', - 'Assign' => '≔', - 'ast' => '*', - 'asymp' => '≈', - 'asympeq' => '≍', - 'Atilde' => 'Ã', - 'Atild' => 'Ã', - 'atilde' => 'ã', - 'atild' => 'ã', - 'Auml' => 'Ä', - 'Aum' => 'Ä', - 'auml' => 'ä', - 'aum' => 'ä', - 'awconint' => '∳', - 'awint' => '⨑', - 'backcong' => '≌', - 'backepsilon' => '϶', - 'backprime' => '‵', - 'backsim' => '∽', - 'backsimeq' => '⋍', - 'Backslash' => '∖', - 'Barv' => '⫧', - 'barvee' => '⊽', - 'Barwed' => '⌆', - 'barwed' => '⌅', - 'barwedge' => '⌅', - 'bbrk' => '⎵', - 'bbrktbrk' => '⎶', - 'bcong' => '≌', - 'Bcy' => 'Б', - 'bcy' => 'б', - 'bdquo' => '„', - 'becaus' => '∵', - 'Because' => '∵', - 'because' => '∵', - 'bemptyv' => '⦰', - 'bepsi' => '϶', - 'bernou' => 'ℬ', - 'Bernoullis' => 'ℬ', - 'Beta' => 'Β', - 'beta' => 'β', - 'beth' => 'ℶ', - 'between' => '≬', - 'Bfr' => '𝔅', - 'bfr' => '𝔟', - 'bigcap' => '⋂', - 'bigcirc' => '◯', - 'bigcup' => '⋃', - 'bigodot' => '⨀', - 'bigoplus' => '⨁', - 'bigotimes' => '⨂', - 'bigsqcup' => '⨆', - 'bigstar' => '★', - 'bigtriangledown' => '▽', - 'bigtriangleup' => '△', - 'biguplus' => '⨄', - 'bigvee' => '⋁', - 'bigwedge' => '⋀', - 'bkarow' => '⤍', - 'blacklozenge' => '⧫', - 'blacksquare' => '▪', - 'blacktriangle' => '▴', - 'blacktriangledown' => '▾', - 'blacktriangleleft' => '◂', - 'blacktriangleright' => '▸', - 'blank' => '␣', - 'blk12' => '▒', - 'blk14' => '░', - 'blk34' => '▓', - 'block' => '█', - 'bne' => '=⃥', - 'bnequiv' => '≡⃥', - 'bNot' => '⫭', - 'bnot' => '⌐', - 'Bopf' => '𝔹', - 'bopf' => '𝕓', - 'bot' => '⊥', - 'bottom' => '⊥', - 'bowtie' => '⋈', - 'boxbox' => '⧉', - 'boxDL' => '╗', - 'boxDl' => '╖', - 'boxdL' => '╕', - 'boxdl' => '┐', - 'boxDR' => '╔', - 'boxDr' => '╓', - 'boxdR' => '╒', - 'boxdr' => '┌', - 'boxH' => '═', - 'boxh' => '─', - 'boxHD' => '╦', - 'boxHd' => '╤', - 'boxhD' => '╥', - 'boxhd' => '┬', - 'boxHU' => '╩', - 'boxHu' => '╧', - 'boxhU' => '╨', - 'boxhu' => '┴', - 'boxminus' => '⊟', - 'boxplus' => '⊞', - 'boxtimes' => '⊠', - 'boxUL' => '╝', - 'boxUl' => '╜', - 'boxuL' => '╛', - 'boxul' => '┘', - 'boxUR' => '╚', - 'boxUr' => '╙', - 'boxuR' => '╘', - 'boxur' => '└', - 'boxV' => '║', - 'boxv' => '│', - 'boxVH' => '╬', - 'boxVh' => '╫', - 'boxvH' => '╪', - 'boxvh' => '┼', - 'boxVL' => '╣', - 'boxVl' => '╢', - 'boxvL' => '╡', - 'boxvl' => '┤', - 'boxVR' => '╠', - 'boxVr' => '╟', - 'boxvR' => '╞', - 'boxvr' => '├', - 'bprime' => '‵', - 'Breve' => '˘', - 'breve' => '˘', - 'brvbar' => '¦', - 'brvba' => '¦', - 'Bscr' => 'ℬ', - 'bscr' => '𝒷', - 'bsemi' => '⁏', - 'bsim' => '∽', - 'bsime' => '⋍', - 'bsol' => '\\', - 'bsolb' => '⧅', - 'bsolhsub' => '⟈', - 'bull' => '•', - 'bullet' => '•', - 'bump' => '≎', - 'bumpE' => '⪮', - 'bumpe' => '≏', - 'Bumpeq' => '≎', - 'bumpeq' => '≏', - 'Cacute' => 'Ć', - 'cacute' => 'ć', - 'Cap' => '⋒', - 'cap' => '∩', - 'capand' => '⩄', - 'capbrcup' => '⩉', - 'capcap' => '⩋', - 'capcup' => '⩇', - 'capdot' => '⩀', - 'CapitalDifferentialD' => 'ⅅ', - 'caps' => '∩︀', - 'caret' => '⁁', - 'caron' => 'ˇ', - 'Cayleys' => 'ℭ', - 'ccaps' => '⩍', - 'Ccaron' => 'Č', - 'ccaron' => 'č', - 'Ccedil' => 'Ç', - 'Ccedi' => 'Ç', - 'ccedil' => 'ç', - 'ccedi' => 'ç', - 'Ccirc' => 'Ĉ', - 'ccirc' => 'ĉ', - 'Cconint' => '∰', - 'ccups' => '⩌', - 'ccupssm' => '⩐', - 'Cdot' => 'Ċ', - 'cdot' => 'ċ', - 'cedil' => '¸', - 'cedi' => '¸', - 'Cedilla' => '¸', - 'cemptyv' => '⦲', - 'cent' => '¢', - 'cen' => '¢', - 'CenterDot' => '·', - 'centerdot' => '·', - 'Cfr' => 'ℭ', - 'cfr' => '𝔠', - 'CHcy' => 'Ч', - 'chcy' => 'ч', - 'check' => '✓', - 'checkmark' => '✓', - 'Chi' => 'Χ', - 'chi' => 'χ', - 'cir' => '○', - 'circ' => 'ˆ', - 'circeq' => '≗', - 'circlearrowleft' => '↺', - 'circlearrowright' => '↻', - 'circledast' => '⊛', - 'circledcirc' => '⊚', - 'circleddash' => '⊝', - 'CircleDot' => '⊙', - 'circledR' => '®', - 'circledS' => 'Ⓢ', - 'CircleMinus' => '⊖', - 'CirclePlus' => '⊕', - 'CircleTimes' => '⊗', - 'cirE' => '⧃', - 'cire' => '≗', - 'cirfnint' => '⨐', - 'cirmid' => '⫯', - 'cirscir' => '⧂', - 'ClockwiseContourIntegral' => '∲', - 'CloseCurlyDoubleQuote' => '”', - 'CloseCurlyQuote' => '’', - 'clubs' => '♣', - 'clubsuit' => '♣', - 'Colon' => '∷', - 'colon' => ':', - 'Colone' => '⩴', - 'colone' => '≔', - 'coloneq' => '≔', - 'comma' => ',', - 'commat' => '@', - 'comp' => '∁', - 'compfn' => '∘', - 'complement' => '∁', - 'complexes' => 'ℂ', - 'cong' => '≅', - 'congdot' => '⩭', - 'Congruent' => '≡', - 'Conint' => '∯', - 'conint' => '∮', - 'ContourIntegral' => '∮', - 'Copf' => 'ℂ', - 'copf' => '𝕔', - 'coprod' => '∐', - 'Coproduct' => '∐', - 'COPY' => '©', - 'COP' => '©', - 'copy' => '©', - 'cop' => '©', - 'copysr' => '℗', - 'CounterClockwiseContourIntegral' => '∳', - 'crarr' => '↵', - 'Cross' => '⨯', - 'cross' => '✗', - 'Cscr' => '𝒞', - 'cscr' => '𝒸', - 'csub' => '⫏', - 'csube' => '⫑', - 'csup' => '⫐', - 'csupe' => '⫒', - 'ctdot' => '⋯', - 'cudarrl' => '⤸', - 'cudarrr' => '⤵', - 'cuepr' => '⋞', - 'cuesc' => '⋟', - 'cularr' => '↶', - 'cularrp' => '⤽', - 'Cup' => '⋓', - 'cup' => '∪', - 'cupbrcap' => '⩈', - 'CupCap' => '≍', - 'cupcap' => '⩆', - 'cupcup' => '⩊', - 'cupdot' => '⊍', - 'cupor' => '⩅', - 'cups' => '∪︀', - 'curarr' => '↷', - 'curarrm' => '⤼', - 'curlyeqprec' => '⋞', - 'curlyeqsucc' => '⋟', - 'curlyvee' => '⋎', - 'curlywedge' => '⋏', - 'curren' => '¤', - 'curre' => '¤', - 'curvearrowleft' => '↶', - 'curvearrowright' => '↷', - 'cuvee' => '⋎', - 'cuwed' => '⋏', - 'cwconint' => '∲', - 'cwint' => '∱', - 'cylcty' => '⌭', - 'Dagger' => '‡', - 'dagger' => '†', - 'daleth' => 'ℸ', - 'Darr' => '↡', - 'dArr' => '⇓', - 'darr' => '↓', - 'dash' => '‐', - 'Dashv' => '⫤', - 'dashv' => '⊣', - 'dbkarow' => '⤏', - 'dblac' => '˝', - 'Dcaron' => 'Ď', - 'dcaron' => 'ď', - 'Dcy' => 'Д', - 'dcy' => 'д', - 'DD' => 'ⅅ', - 'dd' => 'ⅆ', - 'ddagger' => '‡', - 'ddarr' => '⇊', - 'DDotrahd' => '⤑', - 'ddotseq' => '⩷', - 'deg' => '°', - 'de' => '°', - 'Del' => '∇', - 'Delta' => 'Δ', - 'delta' => 'δ', - 'demptyv' => '⦱', - 'dfisht' => '⥿', - 'Dfr' => '𝔇', - 'dfr' => '𝔡', - 'dHar' => '⥥', - 'dharl' => '⇃', - 'dharr' => '⇂', - 'DiacriticalAcute' => '´', - 'DiacriticalDot' => '˙', - 'DiacriticalDoubleAcute' => '˝', - 'DiacriticalGrave' => '`', - 'DiacriticalTilde' => '˜', - 'diam' => '⋄', - 'Diamond' => '⋄', - 'diamond' => '⋄', - 'diamondsuit' => '♦', - 'diams' => '♦', - 'die' => '¨', - 'DifferentialD' => 'ⅆ', - 'digamma' => 'ϝ', - 'disin' => '⋲', - 'div' => '÷', - 'divide' => '÷', - 'divid' => '÷', - 'divideontimes' => '⋇', - 'divonx' => '⋇', - 'DJcy' => 'Ђ', - 'djcy' => 'ђ', - 'dlcorn' => '⌞', - 'dlcrop' => '⌍', - 'dollar' => '$', - 'Dopf' => '𝔻', - 'dopf' => '𝕕', - 'Dot' => '¨', - 'dot' => '˙', - 'DotDot' => '⃜', - 'doteq' => '≐', - 'doteqdot' => '≑', - 'DotEqual' => '≐', - 'dotminus' => '∸', - 'dotplus' => '∔', - 'dotsquare' => '⊡', - 'doublebarwedge' => '⌆', - 'DoubleContourIntegral' => '∯', - 'DoubleDot' => '¨', - 'DoubleDownArrow' => '⇓', - 'DoubleLeftArrow' => '⇐', - 'DoubleLeftRightArrow' => '⇔', - 'DoubleLeftTee' => '⫤', - 'DoubleLongLeftArrow' => '⟸', - 'DoubleLongLeftRightArrow' => '⟺', - 'DoubleLongRightArrow' => '⟹', - 'DoubleRightArrow' => '⇒', - 'DoubleRightTee' => '⊨', - 'DoubleUpArrow' => '⇑', - 'DoubleUpDownArrow' => '⇕', - 'DoubleVerticalBar' => '∥', - 'DownArrow' => '↓', - 'Downarrow' => '⇓', - 'downarrow' => '↓', - 'DownArrowBar' => '⤓', - 'DownArrowUpArrow' => '⇵', - 'DownBreve' => '̑', - 'downdownarrows' => '⇊', - 'downharpoonleft' => '⇃', - 'downharpoonright' => '⇂', - 'DownLeftRightVector' => '⥐', - 'DownLeftTeeVector' => '⥞', - 'DownLeftVector' => '↽', - 'DownLeftVectorBar' => '⥖', - 'DownRightTeeVector' => '⥟', - 'DownRightVector' => '⇁', - 'DownRightVectorBar' => '⥗', - 'DownTee' => '⊤', - 'DownTeeArrow' => '↧', - 'drbkarow' => '⤐', - 'drcorn' => '⌟', - 'drcrop' => '⌌', - 'Dscr' => '𝒟', - 'dscr' => '𝒹', - 'DScy' => 'Ѕ', - 'dscy' => 'ѕ', - 'dsol' => '⧶', - 'Dstrok' => 'Đ', - 'dstrok' => 'đ', - 'dtdot' => '⋱', - 'dtri' => '▿', - 'dtrif' => '▾', - 'duarr' => '⇵', - 'duhar' => '⥯', - 'dwangle' => '⦦', - 'DZcy' => 'Џ', - 'dzcy' => 'џ', - 'dzigrarr' => '⟿', - 'Eacute' => 'É', - 'Eacut' => 'É', - 'eacute' => 'é', - 'eacut' => 'é', - 'easter' => '⩮', - 'Ecaron' => 'Ě', - 'ecaron' => 'ě', - 'ecir' => 'ê', - 'Ecirc' => 'Ê', - 'Ecir' => 'Ê', - 'ecirc' => 'ê', - 'ecolon' => '≕', - 'Ecy' => 'Э', - 'ecy' => 'э', - 'eDDot' => '⩷', - 'Edot' => 'Ė', - 'eDot' => '≑', - 'edot' => 'ė', - 'ee' => 'ⅇ', - 'efDot' => '≒', - 'Efr' => '𝔈', - 'efr' => '𝔢', - 'eg' => '⪚', - 'Egrave' => 'È', - 'Egrav' => 'È', - 'egrave' => 'è', - 'egrav' => 'è', - 'egs' => '⪖', - 'egsdot' => '⪘', - 'el' => '⪙', - 'Element' => '∈', - 'elinters' => '⏧', - 'ell' => 'ℓ', - 'els' => '⪕', - 'elsdot' => '⪗', - 'Emacr' => 'Ē', - 'emacr' => 'ē', - 'empty' => '∅', - 'emptyset' => '∅', - 'EmptySmallSquare' => '◻', - 'emptyv' => '∅', - 'EmptyVerySmallSquare' => '▫', - 'emsp' => ' ', - 'emsp13' => ' ', - 'emsp14' => ' ', - 'ENG' => 'Ŋ', - 'eng' => 'ŋ', - 'ensp' => ' ', - 'Eogon' => 'Ę', - 'eogon' => 'ę', - 'Eopf' => '𝔼', - 'eopf' => '𝕖', - 'epar' => '⋕', - 'eparsl' => '⧣', - 'eplus' => '⩱', - 'epsi' => 'ε', - 'Epsilon' => 'Ε', - 'epsilon' => 'ε', - 'epsiv' => 'ϵ', - 'eqcirc' => '≖', - 'eqcolon' => '≕', - 'eqsim' => '≂', - 'eqslantgtr' => '⪖', - 'eqslantless' => '⪕', - 'Equal' => '⩵', - 'equals' => '=', - 'EqualTilde' => '≂', - 'equest' => '≟', - 'Equilibrium' => '⇌', - 'equiv' => '≡', - 'equivDD' => '⩸', - 'eqvparsl' => '⧥', - 'erarr' => '⥱', - 'erDot' => '≓', - 'Escr' => 'ℰ', - 'escr' => 'ℯ', - 'esdot' => '≐', - 'Esim' => '⩳', - 'esim' => '≂', - 'Eta' => 'Η', - 'eta' => 'η', - 'ETH' => 'Ð', - 'ET' => 'Ð', - 'eth' => 'ð', - 'et' => 'ð', - 'Euml' => 'Ë', - 'Eum' => 'Ë', - 'euml' => 'ë', - 'eum' => 'ë', - 'euro' => '€', - 'excl' => '!', - 'exist' => '∃', - 'Exists' => '∃', - 'expectation' => 'ℰ', - 'ExponentialE' => 'ⅇ', - 'exponentiale' => 'ⅇ', - 'fallingdotseq' => '≒', - 'Fcy' => 'Ф', - 'fcy' => 'ф', - 'female' => '♀', - 'ffilig' => 'ffi', - 'fflig' => 'ff', - 'ffllig' => 'ffl', - 'Ffr' => '𝔉', - 'ffr' => '𝔣', - 'filig' => 'fi', - 'FilledSmallSquare' => '◼', - 'FilledVerySmallSquare' => '▪', - 'fjlig' => 'fj', - 'flat' => '♭', - 'fllig' => 'fl', - 'fltns' => '▱', - 'fnof' => 'ƒ', - 'Fopf' => '𝔽', - 'fopf' => '𝕗', - 'ForAll' => '∀', - 'forall' => '∀', - 'fork' => '⋔', - 'forkv' => '⫙', - 'Fouriertrf' => 'ℱ', - 'fpartint' => '⨍', - 'frac12' => '½', - 'frac1' => '¼', - 'frac13' => '⅓', - 'frac14' => '¼', - 'frac15' => '⅕', - 'frac16' => '⅙', - 'frac18' => '⅛', - 'frac23' => '⅔', - 'frac25' => '⅖', - 'frac34' => '¾', - 'frac3' => '¾', - 'frac35' => '⅗', - 'frac38' => '⅜', - 'frac45' => '⅘', - 'frac56' => '⅚', - 'frac58' => '⅝', - 'frac78' => '⅞', - 'frasl' => '⁄', - 'frown' => '⌢', - 'Fscr' => 'ℱ', - 'fscr' => '𝒻', - 'gacute' => 'ǵ', - 'Gamma' => 'Γ', - 'gamma' => 'γ', - 'Gammad' => 'Ϝ', - 'gammad' => 'ϝ', - 'gap' => '⪆', - 'Gbreve' => 'Ğ', - 'gbreve' => 'ğ', - 'Gcedil' => 'Ģ', - 'Gcirc' => 'Ĝ', - 'gcirc' => 'ĝ', - 'Gcy' => 'Г', - 'gcy' => 'г', - 'Gdot' => 'Ġ', - 'gdot' => 'ġ', - 'gE' => '≧', - 'ge' => '≥', - 'gEl' => '⪌', - 'gel' => '⋛', - 'geq' => '≥', - 'geqq' => '≧', - 'geqslant' => '⩾', - 'ges' => '⩾', - 'gescc' => '⪩', - 'gesdot' => '⪀', - 'gesdoto' => '⪂', - 'gesdotol' => '⪄', - 'gesl' => '⋛︀', - 'gesles' => '⪔', - 'Gfr' => '𝔊', - 'gfr' => '𝔤', - 'Gg' => '⋙', - 'gg' => '≫', - 'ggg' => '⋙', - 'gimel' => 'ℷ', - 'GJcy' => 'Ѓ', - 'gjcy' => 'ѓ', - 'gl' => '≷', - 'gla' => '⪥', - 'glE' => '⪒', - 'glj' => '⪤', - 'gnap' => '⪊', - 'gnapprox' => '⪊', - 'gnE' => '≩', - 'gne' => '⪈', - 'gneq' => '⪈', - 'gneqq' => '≩', - 'gnsim' => '⋧', - 'Gopf' => '𝔾', - 'gopf' => '𝕘', - 'grave' => '`', - 'GreaterEqual' => '≥', - 'GreaterEqualLess' => '⋛', - 'GreaterFullEqual' => '≧', - 'GreaterGreater' => '⪢', - 'GreaterLess' => '≷', - 'GreaterSlantEqual' => '⩾', - 'GreaterTilde' => '≳', - 'Gscr' => '𝒢', - 'gscr' => 'ℊ', - 'gsim' => '≳', - 'gsime' => '⪎', - 'gsiml' => '⪐', - 'GT' => '>', - 'G' => '>', - 'Gt' => '≫', - 'gt' => '>', - 'g' => '>', - 'gtcc' => '⪧', - 'gtcir' => '⩺', - 'gtdot' => '⋗', - 'gtlPar' => '⦕', - 'gtquest' => '⩼', - 'gtrapprox' => '⪆', - 'gtrarr' => '⥸', - 'gtrdot' => '⋗', - 'gtreqless' => '⋛', - 'gtreqqless' => '⪌', - 'gtrless' => '≷', - 'gtrsim' => '≳', - 'gvertneqq' => '≩︀', - 'gvnE' => '≩︀', - 'Hacek' => 'ˇ', - 'hairsp' => ' ', - 'half' => '½', - 'hamilt' => 'ℋ', - 'HARDcy' => 'Ъ', - 'hardcy' => 'ъ', - 'hArr' => '⇔', - 'harr' => '↔', - 'harrcir' => '⥈', - 'harrw' => '↭', - 'Hat' => '^', - 'hbar' => 'ℏ', - 'Hcirc' => 'Ĥ', - 'hcirc' => 'ĥ', - 'hearts' => '♥', - 'heartsuit' => '♥', - 'hellip' => '…', - 'hercon' => '⊹', - 'Hfr' => 'ℌ', - 'hfr' => '𝔥', - 'HilbertSpace' => 'ℋ', - 'hksearow' => '⤥', - 'hkswarow' => '⤦', - 'hoarr' => '⇿', - 'homtht' => '∻', - 'hookleftarrow' => '↩', - 'hookrightarrow' => '↪', - 'Hopf' => 'ℍ', - 'hopf' => '𝕙', - 'horbar' => '―', - 'HorizontalLine' => '─', - 'Hscr' => 'ℋ', - 'hscr' => '𝒽', - 'hslash' => 'ℏ', - 'Hstrok' => 'Ħ', - 'hstrok' => 'ħ', - 'HumpDownHump' => '≎', - 'HumpEqual' => '≏', - 'hybull' => '⁃', - 'hyphen' => '‐', - 'Iacute' => 'Í', - 'Iacut' => 'Í', - 'iacute' => 'í', - 'iacut' => 'í', - 'ic' => '', - 'Icirc' => 'Î', - 'Icir' => 'Î', - 'icirc' => 'î', - 'icir' => 'î', - 'Icy' => 'И', - 'icy' => 'и', - 'Idot' => 'İ', - 'IEcy' => 'Е', - 'iecy' => 'е', - 'iexcl' => '¡', - 'iexc' => '¡', - 'iff' => '⇔', - 'Ifr' => 'ℑ', - 'ifr' => '𝔦', - 'Igrave' => 'Ì', - 'Igrav' => 'Ì', - 'igrave' => 'ì', - 'igrav' => 'ì', - 'ii' => 'ⅈ', - 'iiiint' => '⨌', - 'iiint' => '∭', - 'iinfin' => '⧜', - 'iiota' => '℩', - 'IJlig' => 'IJ', - 'ijlig' => 'ij', - 'Im' => 'ℑ', - 'Imacr' => 'Ī', - 'imacr' => 'ī', - 'image' => 'ℑ', - 'ImaginaryI' => 'ⅈ', - 'imagline' => 'ℐ', - 'imagpart' => 'ℑ', - 'imath' => 'ı', - 'imof' => '⊷', - 'imped' => 'Ƶ', - 'Implies' => '⇒', - 'in' => '∈', - 'incare' => '℅', - 'infin' => '∞', - 'infintie' => '⧝', - 'inodot' => 'ı', - 'Int' => '∬', - 'int' => '∫', - 'intcal' => '⊺', - 'integers' => 'ℤ', - 'Integral' => '∫', - 'intercal' => '⊺', - 'Intersection' => '⋂', - 'intlarhk' => '⨗', - 'intprod' => '⨼', - 'InvisibleComma' => '', - 'InvisibleTimes' => '', - 'IOcy' => 'Ё', - 'iocy' => 'ё', - 'Iogon' => 'Į', - 'iogon' => 'į', - 'Iopf' => '𝕀', - 'iopf' => '𝕚', - 'Iota' => 'Ι', - 'iota' => 'ι', - 'iprod' => '⨼', - 'iquest' => '¿', - 'iques' => '¿', - 'Iscr' => 'ℐ', - 'iscr' => '𝒾', - 'isin' => '∈', - 'isindot' => '⋵', - 'isinE' => '⋹', - 'isins' => '⋴', - 'isinsv' => '⋳', - 'isinv' => '∈', - 'it' => '', - 'Itilde' => 'Ĩ', - 'itilde' => 'ĩ', - 'Iukcy' => 'І', - 'iukcy' => 'і', - 'Iuml' => 'Ï', - 'Ium' => 'Ï', - 'iuml' => 'ï', - 'ium' => 'ï', - 'Jcirc' => 'Ĵ', - 'jcirc' => 'ĵ', - 'Jcy' => 'Й', - 'jcy' => 'й', - 'Jfr' => '𝔍', - 'jfr' => '𝔧', - 'jmath' => 'ȷ', - 'Jopf' => '𝕁', - 'jopf' => '𝕛', - 'Jscr' => '𝒥', - 'jscr' => '𝒿', - 'Jsercy' => 'Ј', - 'jsercy' => 'ј', - 'Jukcy' => 'Є', - 'jukcy' => 'є', - 'Kappa' => 'Κ', - 'kappa' => 'κ', - 'kappav' => 'ϰ', - 'Kcedil' => 'Ķ', - 'kcedil' => 'ķ', - 'Kcy' => 'К', - 'kcy' => 'к', - 'Kfr' => '𝔎', - 'kfr' => '𝔨', - 'kgreen' => 'ĸ', - 'KHcy' => 'Х', - 'khcy' => 'х', - 'KJcy' => 'Ќ', - 'kjcy' => 'ќ', - 'Kopf' => '𝕂', - 'kopf' => '𝕜', - 'Kscr' => '𝒦', - 'kscr' => '𝓀', - 'lAarr' => '⇚', - 'Lacute' => 'Ĺ', - 'lacute' => 'ĺ', - 'laemptyv' => '⦴', - 'lagran' => 'ℒ', - 'Lambda' => 'Λ', - 'lambda' => 'λ', - 'Lang' => '⟪', - 'lang' => '⟨', - 'langd' => '⦑', - 'langle' => '⟨', - 'lap' => '⪅', - 'Laplacetrf' => 'ℒ', - 'laquo' => '«', - 'laqu' => '«', - 'Larr' => '↞', - 'lArr' => '⇐', - 'larr' => '←', - 'larrb' => '⇤', - 'larrbfs' => '⤟', - 'larrfs' => '⤝', - 'larrhk' => '↩', - 'larrlp' => '↫', - 'larrpl' => '⤹', - 'larrsim' => '⥳', - 'larrtl' => '↢', - 'lat' => '⪫', - 'lAtail' => '⤛', - 'latail' => '⤙', - 'late' => '⪭', - 'lates' => '⪭︀', - 'lBarr' => '⤎', - 'lbarr' => '⤌', - 'lbbrk' => '❲', - 'lbrace' => '{', - 'lbrack' => '[', - 'lbrke' => '⦋', - 'lbrksld' => '⦏', - 'lbrkslu' => '⦍', - 'Lcaron' => 'Ľ', - 'lcaron' => 'ľ', - 'Lcedil' => 'Ļ', - 'lcedil' => 'ļ', - 'lceil' => '⌈', - 'lcub' => '{', - 'Lcy' => 'Л', - 'lcy' => 'л', - 'ldca' => '⤶', - 'ldquo' => '“', - 'ldquor' => '„', - 'ldrdhar' => '⥧', - 'ldrushar' => '⥋', - 'ldsh' => '↲', - 'lE' => '≦', - 'le' => '≤', - 'LeftAngleBracket' => '⟨', - 'LeftArrow' => '←', - 'Leftarrow' => '⇐', - 'leftarrow' => '←', - 'LeftArrowBar' => '⇤', - 'LeftArrowRightArrow' => '⇆', - 'leftarrowtail' => '↢', - 'LeftCeiling' => '⌈', - 'LeftDoubleBracket' => '⟦', - 'LeftDownTeeVector' => '⥡', - 'LeftDownVector' => '⇃', - 'LeftDownVectorBar' => '⥙', - 'LeftFloor' => '⌊', - 'leftharpoondown' => '↽', - 'leftharpoonup' => '↼', - 'leftleftarrows' => '⇇', - 'LeftRightArrow' => '↔', - 'Leftrightarrow' => '⇔', - 'leftrightarrow' => '↔', - 'leftrightarrows' => '⇆', - 'leftrightharpoons' => '⇋', - 'leftrightsquigarrow' => '↭', - 'LeftRightVector' => '⥎', - 'LeftTee' => '⊣', - 'LeftTeeArrow' => '↤', - 'LeftTeeVector' => '⥚', - 'leftthreetimes' => '⋋', - 'LeftTriangle' => '⊲', - 'LeftTriangleBar' => '⧏', - 'LeftTriangleEqual' => '⊴', - 'LeftUpDownVector' => '⥑', - 'LeftUpTeeVector' => '⥠', - 'LeftUpVector' => '↿', - 'LeftUpVectorBar' => '⥘', - 'LeftVector' => '↼', - 'LeftVectorBar' => '⥒', - 'lEg' => '⪋', - 'leg' => '⋚', - 'leq' => '≤', - 'leqq' => '≦', - 'leqslant' => '⩽', - 'les' => '⩽', - 'lescc' => '⪨', - 'lesdot' => '⩿', - 'lesdoto' => '⪁', - 'lesdotor' => '⪃', - 'lesg' => '⋚︀', - 'lesges' => '⪓', - 'lessapprox' => '⪅', - 'lessdot' => '⋖', - 'lesseqgtr' => '⋚', - 'lesseqqgtr' => '⪋', - 'LessEqualGreater' => '⋚', - 'LessFullEqual' => '≦', - 'LessGreater' => '≶', - 'lessgtr' => '≶', - 'LessLess' => '⪡', - 'lesssim' => '≲', - 'LessSlantEqual' => '⩽', - 'LessTilde' => '≲', - 'lfisht' => '⥼', - 'lfloor' => '⌊', - 'Lfr' => '𝔏', - 'lfr' => '𝔩', - 'lg' => '≶', - 'lgE' => '⪑', - 'lHar' => '⥢', - 'lhard' => '↽', - 'lharu' => '↼', - 'lharul' => '⥪', - 'lhblk' => '▄', - 'LJcy' => 'Љ', - 'ljcy' => 'љ', - 'Ll' => '⋘', - 'll' => '≪', - 'llarr' => '⇇', - 'llcorner' => '⌞', - 'Lleftarrow' => '⇚', - 'llhard' => '⥫', - 'lltri' => '◺', - 'Lmidot' => 'Ŀ', - 'lmidot' => 'ŀ', - 'lmoust' => '⎰', - 'lmoustache' => '⎰', - 'lnap' => '⪉', - 'lnapprox' => '⪉', - 'lnE' => '≨', - 'lne' => '⪇', - 'lneq' => '⪇', - 'lneqq' => '≨', - 'lnsim' => '⋦', - 'loang' => '⟬', - 'loarr' => '⇽', - 'lobrk' => '⟦', - 'LongLeftArrow' => '⟵', - 'Longleftarrow' => '⟸', - 'longleftarrow' => '⟵', - 'LongLeftRightArrow' => '⟷', - 'Longleftrightarrow' => '⟺', - 'longleftrightarrow' => '⟷', - 'longmapsto' => '⟼', - 'LongRightArrow' => '⟶', - 'Longrightarrow' => '⟹', - 'longrightarrow' => '⟶', - 'looparrowleft' => '↫', - 'looparrowright' => '↬', - 'lopar' => '⦅', - 'Lopf' => '𝕃', - 'lopf' => '𝕝', - 'loplus' => '⨭', - 'lotimes' => '⨴', - 'lowast' => '∗', - 'lowbar' => '_', - 'LowerLeftArrow' => '↙', - 'LowerRightArrow' => '↘', - 'loz' => '◊', - 'lozenge' => '◊', - 'lozf' => '⧫', - 'lpar' => '(', - 'lparlt' => '⦓', - 'lrarr' => '⇆', - 'lrcorner' => '⌟', - 'lrhar' => '⇋', - 'lrhard' => '⥭', - 'lrm' => '', - 'lrtri' => '⊿', - 'lsaquo' => '‹', - 'Lscr' => 'ℒ', - 'lscr' => '𝓁', - 'Lsh' => '↰', - 'lsh' => '↰', - 'lsim' => '≲', - 'lsime' => '⪍', - 'lsimg' => '⪏', - 'lsqb' => '[', - 'lsquo' => '‘', - 'lsquor' => '‚', - 'Lstrok' => 'Ł', - 'lstrok' => 'ł', - 'LT' => '<', - 'L' => '<', - 'Lt' => '≪', - 'lt' => '<', - 'l' => '<', - 'ltcc' => '⪦', - 'ltcir' => '⩹', - 'ltdot' => '⋖', - 'lthree' => '⋋', - 'ltimes' => '⋉', - 'ltlarr' => '⥶', - 'ltquest' => '⩻', - 'ltri' => '◃', - 'ltrie' => '⊴', - 'ltrif' => '◂', - 'ltrPar' => '⦖', - 'lurdshar' => '⥊', - 'luruhar' => '⥦', - 'lvertneqq' => '≨︀', - 'lvnE' => '≨︀', - 'macr' => '¯', - 'mac' => '¯', - 'male' => '♂', - 'malt' => '✠', - 'maltese' => '✠', - 'Map' => '⤅', - 'map' => '↦', - 'mapsto' => '↦', - 'mapstodown' => '↧', - 'mapstoleft' => '↤', - 'mapstoup' => '↥', - 'marker' => '▮', - 'mcomma' => '⨩', - 'Mcy' => 'М', - 'mcy' => 'м', - 'mdash' => '—', - 'mDDot' => '∺', - 'measuredangle' => '∡', - 'MediumSpace' => ' ', - 'Mellintrf' => 'ℳ', - 'Mfr' => '𝔐', - 'mfr' => '𝔪', - 'mho' => '℧', - 'micro' => 'µ', - 'micr' => 'µ', - 'mid' => '∣', - 'midast' => '*', - 'midcir' => '⫰', - 'middot' => '·', - 'middo' => '·', - 'minus' => '−', - 'minusb' => '⊟', - 'minusd' => '∸', - 'minusdu' => '⨪', - 'MinusPlus' => '∓', - 'mlcp' => '⫛', - 'mldr' => '…', - 'mnplus' => '∓', - 'models' => '⊧', - 'Mopf' => '𝕄', - 'mopf' => '𝕞', - 'mp' => '∓', - 'Mscr' => 'ℳ', - 'mscr' => '𝓂', - 'mstpos' => '∾', - 'Mu' => 'Μ', - 'mu' => 'μ', - 'multimap' => '⊸', - 'mumap' => '⊸', - 'nabla' => '∇', - 'Nacute' => 'Ń', - 'nacute' => 'ń', - 'nang' => '∠⃒', - 'nap' => '≉', - 'napE' => '⩰̸', - 'napid' => '≋̸', - 'napos' => 'ʼn', - 'napprox' => '≉', - 'natur' => '♮', - 'natural' => '♮', - 'naturals' => 'ℕ', - 'nbsp' => ' ', - 'nbs' => ' ', - 'nbump' => '≎̸', - 'nbumpe' => '≏̸', - 'ncap' => '⩃', - 'Ncaron' => 'Ň', - 'ncaron' => 'ň', - 'Ncedil' => 'Ņ', - 'ncedil' => 'ņ', - 'ncong' => '≇', - 'ncongdot' => '⩭̸', - 'ncup' => '⩂', - 'Ncy' => 'Н', - 'ncy' => 'н', - 'ndash' => '–', - 'ne' => '≠', - 'nearhk' => '⤤', - 'neArr' => '⇗', - 'nearr' => '↗', - 'nearrow' => '↗', - 'nedot' => '≐̸', - 'NegativeMediumSpace' => '', - 'NegativeThickSpace' => '', - 'NegativeThinSpace' => '', - 'NegativeVeryThinSpace' => '', - 'nequiv' => '≢', - 'nesear' => '⤨', - 'nesim' => '≂̸', - 'NestedGreaterGreater' => '≫', - 'NestedLessLess' => '≪', - 'NewLine' => ' -', - 'nexist' => '∄', - 'nexists' => '∄', - 'Nfr' => '𝔑', - 'nfr' => '𝔫', - 'ngE' => '≧̸', - 'nge' => '≱', - 'ngeq' => '≱', - 'ngeqq' => '≧̸', - 'ngeqslant' => '⩾̸', - 'nges' => '⩾̸', - 'nGg' => '⋙̸', - 'ngsim' => '≵', - 'nGt' => '≫⃒', - 'ngt' => '≯', - 'ngtr' => '≯', - 'nGtv' => '≫̸', - 'nhArr' => '⇎', - 'nharr' => '↮', - 'nhpar' => '⫲', - 'ni' => '∋', - 'nis' => '⋼', - 'nisd' => '⋺', - 'niv' => '∋', - 'NJcy' => 'Њ', - 'njcy' => 'њ', - 'nlArr' => '⇍', - 'nlarr' => '↚', - 'nldr' => '‥', - 'nlE' => '≦̸', - 'nle' => '≰', - 'nLeftarrow' => '⇍', - 'nleftarrow' => '↚', - 'nLeftrightarrow' => '⇎', - 'nleftrightarrow' => '↮', - 'nleq' => '≰', - 'nleqq' => '≦̸', - 'nleqslant' => '⩽̸', - 'nles' => '⩽̸', - 'nless' => '≮', - 'nLl' => '⋘̸', - 'nlsim' => '≴', - 'nLt' => '≪⃒', - 'nlt' => '≮', - 'nltri' => '⋪', - 'nltrie' => '⋬', - 'nLtv' => '≪̸', - 'nmid' => '∤', - 'NoBreak' => '', - 'NonBreakingSpace' => ' ', - 'Nopf' => 'ℕ', - 'nopf' => '𝕟', - 'Not' => '⫬', - 'not' => '¬', - 'no' => '¬', - 'NotCongruent' => '≢', - 'NotCupCap' => '≭', - 'NotDoubleVerticalBar' => '∦', - 'NotElement' => '∉', - 'NotEqual' => '≠', - 'NotEqualTilde' => '≂̸', - 'NotExists' => '∄', - 'NotGreater' => '≯', - 'NotGreaterEqual' => '≱', - 'NotGreaterFullEqual' => '≧̸', - 'NotGreaterGreater' => '≫̸', - 'NotGreaterLess' => '≹', - 'NotGreaterSlantEqual' => '⩾̸', - 'NotGreaterTilde' => '≵', - 'NotHumpDownHump' => '≎̸', - 'NotHumpEqual' => '≏̸', - 'notin' => '∉', - 'notindot' => '⋵̸', - 'notinE' => '⋹̸', - 'notinva' => '∉', - 'notinvb' => '⋷', - 'notinvc' => '⋶', - 'NotLeftTriangle' => '⋪', - 'NotLeftTriangleBar' => '⧏̸', - 'NotLeftTriangleEqual' => '⋬', - 'NotLess' => '≮', - 'NotLessEqual' => '≰', - 'NotLessGreater' => '≸', - 'NotLessLess' => '≪̸', - 'NotLessSlantEqual' => '⩽̸', - 'NotLessTilde' => '≴', - 'NotNestedGreaterGreater' => '⪢̸', - 'NotNestedLessLess' => '⪡̸', - 'notni' => '∌', - 'notniva' => '∌', - 'notnivb' => '⋾', - 'notnivc' => '⋽', - 'NotPrecedes' => '⊀', - 'NotPrecedesEqual' => '⪯̸', - 'NotPrecedesSlantEqual' => '⋠', - 'NotReverseElement' => '∌', - 'NotRightTriangle' => '⋫', - 'NotRightTriangleBar' => '⧐̸', - 'NotRightTriangleEqual' => '⋭', - 'NotSquareSubset' => '⊏̸', - 'NotSquareSubsetEqual' => '⋢', - 'NotSquareSuperset' => '⊐̸', - 'NotSquareSupersetEqual' => '⋣', - 'NotSubset' => '⊂⃒', - 'NotSubsetEqual' => '⊈', - 'NotSucceeds' => '⊁', - 'NotSucceedsEqual' => '⪰̸', - 'NotSucceedsSlantEqual' => '⋡', - 'NotSucceedsTilde' => '≿̸', - 'NotSuperset' => '⊃⃒', - 'NotSupersetEqual' => '⊉', - 'NotTilde' => '≁', - 'NotTildeEqual' => '≄', - 'NotTildeFullEqual' => '≇', - 'NotTildeTilde' => '≉', - 'NotVerticalBar' => '∤', - 'npar' => '∦', - 'nparallel' => '∦', - 'nparsl' => '⫽⃥', - 'npart' => '∂̸', - 'npolint' => '⨔', - 'npr' => '⊀', - 'nprcue' => '⋠', - 'npre' => '⪯̸', - 'nprec' => '⊀', - 'npreceq' => '⪯̸', - 'nrArr' => '⇏', - 'nrarr' => '↛', - 'nrarrc' => '⤳̸', - 'nrarrw' => '↝̸', - 'nRightarrow' => '⇏', - 'nrightarrow' => '↛', - 'nrtri' => '⋫', - 'nrtrie' => '⋭', - 'nsc' => '⊁', - 'nsccue' => '⋡', - 'nsce' => '⪰̸', - 'Nscr' => '𝒩', - 'nscr' => '𝓃', - 'nshortmid' => '∤', - 'nshortparallel' => '∦', - 'nsim' => '≁', - 'nsime' => '≄', - 'nsimeq' => '≄', - 'nsmid' => '∤', - 'nspar' => '∦', - 'nsqsube' => '⋢', - 'nsqsupe' => '⋣', - 'nsub' => '⊄', - 'nsubE' => '⫅̸', - 'nsube' => '⊈', - 'nsubset' => '⊂⃒', - 'nsubseteq' => '⊈', - 'nsubseteqq' => '⫅̸', - 'nsucc' => '⊁', - 'nsucceq' => '⪰̸', - 'nsup' => '⊅', - 'nsupE' => '⫆̸', - 'nsupe' => '⊉', - 'nsupset' => '⊃⃒', - 'nsupseteq' => '⊉', - 'nsupseteqq' => '⫆̸', - 'ntgl' => '≹', - 'Ntilde' => 'Ñ', - 'Ntild' => 'Ñ', - 'ntilde' => 'ñ', - 'ntild' => 'ñ', - 'ntlg' => '≸', - 'ntriangleleft' => '⋪', - 'ntrianglelefteq' => '⋬', - 'ntriangleright' => '⋫', - 'ntrianglerighteq' => '⋭', - 'Nu' => 'Ν', - 'nu' => 'ν', - 'num' => '#', - 'numero' => '№', - 'numsp' => ' ', - 'nvap' => '≍⃒', - 'nVDash' => '⊯', - 'nVdash' => '⊮', - 'nvDash' => '⊭', - 'nvdash' => '⊬', - 'nvge' => '≥⃒', - 'nvgt' => '>⃒', - 'nvHarr' => '⤄', - 'nvinfin' => '⧞', - 'nvlArr' => '⤂', - 'nvle' => '≤⃒', - 'nvlt' => '<⃒', - 'nvltrie' => '⊴⃒', - 'nvrArr' => '⤃', - 'nvrtrie' => '⊵⃒', - 'nvsim' => '∼⃒', - 'nwarhk' => '⤣', - 'nwArr' => '⇖', - 'nwarr' => '↖', - 'nwarrow' => '↖', - 'nwnear' => '⤧', - 'Oacute' => 'Ó', - 'Oacut' => 'Ó', - 'oacute' => 'ó', - 'oacut' => 'ó', - 'oast' => '⊛', - 'ocir' => 'ô', - 'Ocirc' => 'Ô', - 'Ocir' => 'Ô', - 'ocirc' => 'ô', - 'Ocy' => 'О', - 'ocy' => 'о', - 'odash' => '⊝', - 'Odblac' => 'Ő', - 'odblac' => 'ő', - 'odiv' => '⨸', - 'odot' => '⊙', - 'odsold' => '⦼', - 'OElig' => 'Œ', - 'oelig' => 'œ', - 'ofcir' => '⦿', - 'Ofr' => '𝔒', - 'ofr' => '𝔬', - 'ogon' => '˛', - 'Ograve' => 'Ò', - 'Ograv' => 'Ò', - 'ograve' => 'ò', - 'ograv' => 'ò', - 'ogt' => '⧁', - 'ohbar' => '⦵', - 'ohm' => 'Ω', - 'oint' => '∮', - 'olarr' => '↺', - 'olcir' => '⦾', - 'olcross' => '⦻', - 'oline' => '‾', - 'olt' => '⧀', - 'Omacr' => 'Ō', - 'omacr' => 'ō', - 'Omega' => 'Ω', - 'omega' => 'ω', - 'Omicron' => 'Ο', - 'omicron' => 'ο', - 'omid' => '⦶', - 'ominus' => '⊖', - 'Oopf' => '𝕆', - 'oopf' => '𝕠', - 'opar' => '⦷', - 'OpenCurlyDoubleQuote' => '“', - 'OpenCurlyQuote' => '‘', - 'operp' => '⦹', - 'oplus' => '⊕', - 'Or' => '⩔', - 'or' => '∨', - 'orarr' => '↻', - 'ord' => 'º', - 'order' => 'ℴ', - 'orderof' => 'ℴ', - 'ordf' => 'ª', - 'ordm' => 'º', - 'origof' => '⊶', - 'oror' => '⩖', - 'orslope' => '⩗', - 'orv' => '⩛', - 'oS' => 'Ⓢ', - 'Oscr' => '𝒪', - 'oscr' => 'ℴ', - 'Oslash' => 'Ø', - 'Oslas' => 'Ø', - 'oslash' => 'ø', - 'oslas' => 'ø', - 'osol' => '⊘', - 'Otilde' => 'Õ', - 'Otild' => 'Õ', - 'otilde' => 'õ', - 'otild' => 'õ', - 'Otimes' => '⨷', - 'otimes' => '⊗', - 'otimesas' => '⨶', - 'Ouml' => 'Ö', - 'Oum' => 'Ö', - 'ouml' => 'ö', - 'oum' => 'ö', - 'ovbar' => '⌽', - 'OverBar' => '‾', - 'OverBrace' => '⏞', - 'OverBracket' => '⎴', - 'OverParenthesis' => '⏜', - 'par' => '¶', - 'para' => '¶', - 'parallel' => '∥', - 'parsim' => '⫳', - 'parsl' => '⫽', - 'part' => '∂', - 'PartialD' => '∂', - 'Pcy' => 'П', - 'pcy' => 'п', - 'percnt' => '%', - 'period' => '.', - 'permil' => '‰', - 'perp' => '⊥', - 'pertenk' => '‱', - 'Pfr' => '𝔓', - 'pfr' => '𝔭', - 'Phi' => 'Φ', - 'phi' => 'φ', - 'phiv' => 'ϕ', - 'phmmat' => 'ℳ', - 'phone' => '☎', - 'Pi' => 'Π', - 'pi' => 'π', - 'pitchfork' => '⋔', - 'piv' => 'ϖ', - 'planck' => 'ℏ', - 'planckh' => 'ℎ', - 'plankv' => 'ℏ', - 'plus' => '+', - 'plusacir' => '⨣', - 'plusb' => '⊞', - 'pluscir' => '⨢', - 'plusdo' => '∔', - 'plusdu' => '⨥', - 'pluse' => '⩲', - 'PlusMinus' => '±', - 'plusmn' => '±', - 'plusm' => '±', - 'plussim' => '⨦', - 'plustwo' => '⨧', - 'pm' => '±', - 'Poincareplane' => 'ℌ', - 'pointint' => '⨕', - 'Popf' => 'ℙ', - 'popf' => '𝕡', - 'pound' => '£', - 'poun' => '£', - 'Pr' => '⪻', - 'pr' => '≺', - 'prap' => '⪷', - 'prcue' => '≼', - 'prE' => '⪳', - 'pre' => '⪯', - 'prec' => '≺', - 'precapprox' => '⪷', - 'preccurlyeq' => '≼', - 'Precedes' => '≺', - 'PrecedesEqual' => '⪯', - 'PrecedesSlantEqual' => '≼', - 'PrecedesTilde' => '≾', - 'preceq' => '⪯', - 'precnapprox' => '⪹', - 'precneqq' => '⪵', - 'precnsim' => '⋨', - 'precsim' => '≾', - 'Prime' => '″', - 'prime' => '′', - 'primes' => 'ℙ', - 'prnap' => '⪹', - 'prnE' => '⪵', - 'prnsim' => '⋨', - 'prod' => '∏', - 'Product' => '∏', - 'profalar' => '⌮', - 'profline' => '⌒', - 'profsurf' => '⌓', - 'prop' => '∝', - 'Proportion' => '∷', - 'Proportional' => '∝', - 'propto' => '∝', - 'prsim' => '≾', - 'prurel' => '⊰', - 'Pscr' => '𝒫', - 'pscr' => '𝓅', - 'Psi' => 'Ψ', - 'psi' => 'ψ', - 'puncsp' => ' ', - 'Qfr' => '𝔔', - 'qfr' => '𝔮', - 'qint' => '⨌', - 'Qopf' => 'ℚ', - 'qopf' => '𝕢', - 'qprime' => '⁗', - 'Qscr' => '𝒬', - 'qscr' => '𝓆', - 'quaternions' => 'ℍ', - 'quatint' => '⨖', - 'quest' => '?', - 'questeq' => '≟', - 'QUOT' => '"', - 'QUO' => '"', - 'quot' => '"', - 'quo' => '"', - 'rAarr' => '⇛', - 'race' => '∽̱', - 'Racute' => 'Ŕ', - 'racute' => 'ŕ', - 'radic' => '√', - 'raemptyv' => '⦳', - 'Rang' => '⟫', - 'rang' => '⟩', - 'rangd' => '⦒', - 'range' => '⦥', - 'rangle' => '⟩', - 'raquo' => '»', - 'raqu' => '»', - 'Rarr' => '↠', - 'rArr' => '⇒', - 'rarr' => '→', - 'rarrap' => '⥵', - 'rarrb' => '⇥', - 'rarrbfs' => '⤠', - 'rarrc' => '⤳', - 'rarrfs' => '⤞', - 'rarrhk' => '↪', - 'rarrlp' => '↬', - 'rarrpl' => '⥅', - 'rarrsim' => '⥴', - 'Rarrtl' => '⤖', - 'rarrtl' => '↣', - 'rarrw' => '↝', - 'rAtail' => '⤜', - 'ratail' => '⤚', - 'ratio' => '∶', - 'rationals' => 'ℚ', - 'RBarr' => '⤐', - 'rBarr' => '⤏', - 'rbarr' => '⤍', - 'rbbrk' => '❳', - 'rbrace' => '}', - 'rbrack' => ']', - 'rbrke' => '⦌', - 'rbrksld' => '⦎', - 'rbrkslu' => '⦐', - 'Rcaron' => 'Ř', - 'rcaron' => 'ř', - 'Rcedil' => 'Ŗ', - 'rcedil' => 'ŗ', - 'rceil' => '⌉', - 'rcub' => '}', - 'Rcy' => 'Р', - 'rcy' => 'р', - 'rdca' => '⤷', - 'rdldhar' => '⥩', - 'rdquo' => '”', - 'rdquor' => '”', - 'rdsh' => '↳', - 'Re' => 'ℜ', - 'real' => 'ℜ', - 'realine' => 'ℛ', - 'realpart' => 'ℜ', - 'reals' => 'ℝ', - 'rect' => '▭', - 'REG' => '®', - 'RE' => '®', - 'reg' => '®', - 're' => '®', - 'ReverseElement' => '∋', - 'ReverseEquilibrium' => '⇋', - 'ReverseUpEquilibrium' => '⥯', - 'rfisht' => '⥽', - 'rfloor' => '⌋', - 'Rfr' => 'ℜ', - 'rfr' => '𝔯', - 'rHar' => '⥤', - 'rhard' => '⇁', - 'rharu' => '⇀', - 'rharul' => '⥬', - 'Rho' => 'Ρ', - 'rho' => 'ρ', - 'rhov' => 'ϱ', - 'RightAngleBracket' => '⟩', - 'RightArrow' => '→', - 'Rightarrow' => '⇒', - 'rightarrow' => '→', - 'RightArrowBar' => '⇥', - 'RightArrowLeftArrow' => '⇄', - 'rightarrowtail' => '↣', - 'RightCeiling' => '⌉', - 'RightDoubleBracket' => '⟧', - 'RightDownTeeVector' => '⥝', - 'RightDownVector' => '⇂', - 'RightDownVectorBar' => '⥕', - 'RightFloor' => '⌋', - 'rightharpoondown' => '⇁', - 'rightharpoonup' => '⇀', - 'rightleftarrows' => '⇄', - 'rightleftharpoons' => '⇌', - 'rightrightarrows' => '⇉', - 'rightsquigarrow' => '↝', - 'RightTee' => '⊢', - 'RightTeeArrow' => '↦', - 'RightTeeVector' => '⥛', - 'rightthreetimes' => '⋌', - 'RightTriangle' => '⊳', - 'RightTriangleBar' => '⧐', - 'RightTriangleEqual' => '⊵', - 'RightUpDownVector' => '⥏', - 'RightUpTeeVector' => '⥜', - 'RightUpVector' => '↾', - 'RightUpVectorBar' => '⥔', - 'RightVector' => '⇀', - 'RightVectorBar' => '⥓', - 'ring' => '˚', - 'risingdotseq' => '≓', - 'rlarr' => '⇄', - 'rlhar' => '⇌', - 'rlm' => '', - 'rmoust' => '⎱', - 'rmoustache' => '⎱', - 'rnmid' => '⫮', - 'roang' => '⟭', - 'roarr' => '⇾', - 'robrk' => '⟧', - 'ropar' => '⦆', - 'Ropf' => 'ℝ', - 'ropf' => '𝕣', - 'roplus' => '⨮', - 'rotimes' => '⨵', - 'RoundImplies' => '⥰', - 'rpar' => ')', - 'rpargt' => '⦔', - 'rppolint' => '⨒', - 'rrarr' => '⇉', - 'Rrightarrow' => '⇛', - 'rsaquo' => '›', - 'Rscr' => 'ℛ', - 'rscr' => '𝓇', - 'Rsh' => '↱', - 'rsh' => '↱', - 'rsqb' => ']', - 'rsquo' => '’', - 'rsquor' => '’', - 'rthree' => '⋌', - 'rtimes' => '⋊', - 'rtri' => '▹', - 'rtrie' => '⊵', - 'rtrif' => '▸', - 'rtriltri' => '⧎', - 'RuleDelayed' => '⧴', - 'ruluhar' => '⥨', - 'rx' => '℞', - 'Sacute' => 'Ś', - 'sacute' => 'ś', - 'sbquo' => '‚', - 'Sc' => '⪼', - 'sc' => '≻', - 'scap' => '⪸', - 'Scaron' => 'Š', - 'scaron' => 'š', - 'sccue' => '≽', - 'scE' => '⪴', - 'sce' => '⪰', - 'Scedil' => 'Ş', - 'scedil' => 'ş', - 'Scirc' => 'Ŝ', - 'scirc' => 'ŝ', - 'scnap' => '⪺', - 'scnE' => '⪶', - 'scnsim' => '⋩', - 'scpolint' => '⨓', - 'scsim' => '≿', - 'Scy' => 'С', - 'scy' => 'с', - 'sdot' => '⋅', - 'sdotb' => '⊡', - 'sdote' => '⩦', - 'searhk' => '⤥', - 'seArr' => '⇘', - 'searr' => '↘', - 'searrow' => '↘', - 'sect' => '§', - 'sec' => '§', - 'semi' => ';', - 'seswar' => '⤩', - 'setminus' => '∖', - 'setmn' => '∖', - 'sext' => '✶', - 'Sfr' => '𝔖', - 'sfr' => '𝔰', - 'sfrown' => '⌢', - 'sharp' => '♯', - 'SHCHcy' => 'Щ', - 'shchcy' => 'щ', - 'SHcy' => 'Ш', - 'shcy' => 'ш', - 'ShortDownArrow' => '↓', - 'ShortLeftArrow' => '←', - 'shortmid' => '∣', - 'shortparallel' => '∥', - 'ShortRightArrow' => '→', - 'ShortUpArrow' => '↑', - 'shy' => '', - 'sh' => '', - 'Sigma' => 'Σ', - 'sigma' => 'σ', - 'sigmaf' => 'ς', - 'sigmav' => 'ς', - 'sim' => '∼', - 'simdot' => '⩪', - 'sime' => '≃', - 'simeq' => '≃', - 'simg' => '⪞', - 'simgE' => '⪠', - 'siml' => '⪝', - 'simlE' => '⪟', - 'simne' => '≆', - 'simplus' => '⨤', - 'simrarr' => '⥲', - 'slarr' => '←', - 'SmallCircle' => '∘', - 'smallsetminus' => '∖', - 'smashp' => '⨳', - 'smeparsl' => '⧤', - 'smid' => '∣', - 'smile' => '⌣', - 'smt' => '⪪', - 'smte' => '⪬', - 'smtes' => '⪬︀', - 'SOFTcy' => 'Ь', - 'softcy' => 'ь', - 'sol' => '/', - 'solb' => '⧄', - 'solbar' => '⌿', - 'Sopf' => '𝕊', - 'sopf' => '𝕤', - 'spades' => '♠', - 'spadesuit' => '♠', - 'spar' => '∥', - 'sqcap' => '⊓', - 'sqcaps' => '⊓︀', - 'sqcup' => '⊔', - 'sqcups' => '⊔︀', - 'Sqrt' => '√', - 'sqsub' => '⊏', - 'sqsube' => '⊑', - 'sqsubset' => '⊏', - 'sqsubseteq' => '⊑', - 'sqsup' => '⊐', - 'sqsupe' => '⊒', - 'sqsupset' => '⊐', - 'sqsupseteq' => '⊒', - 'squ' => '□', - 'Square' => '□', - 'square' => '□', - 'SquareIntersection' => '⊓', - 'SquareSubset' => '⊏', - 'SquareSubsetEqual' => '⊑', - 'SquareSuperset' => '⊐', - 'SquareSupersetEqual' => '⊒', - 'SquareUnion' => '⊔', - 'squarf' => '▪', - 'squf' => '▪', - 'srarr' => '→', - 'Sscr' => '𝒮', - 'sscr' => '𝓈', - 'ssetmn' => '∖', - 'ssmile' => '⌣', - 'sstarf' => '⋆', - 'Star' => '⋆', - 'star' => '☆', - 'starf' => '★', - 'straightepsilon' => 'ϵ', - 'straightphi' => 'ϕ', - 'strns' => '¯', - 'Sub' => '⋐', - 'sub' => '⊂', - 'subdot' => '⪽', - 'subE' => '⫅', - 'sube' => '⊆', - 'subedot' => '⫃', - 'submult' => '⫁', - 'subnE' => '⫋', - 'subne' => '⊊', - 'subplus' => '⪿', - 'subrarr' => '⥹', - 'Subset' => '⋐', - 'subset' => '⊂', - 'subseteq' => '⊆', - 'subseteqq' => '⫅', - 'SubsetEqual' => '⊆', - 'subsetneq' => '⊊', - 'subsetneqq' => '⫋', - 'subsim' => '⫇', - 'subsub' => '⫕', - 'subsup' => '⫓', - 'succ' => '≻', - 'succapprox' => '⪸', - 'succcurlyeq' => '≽', - 'Succeeds' => '≻', - 'SucceedsEqual' => '⪰', - 'SucceedsSlantEqual' => '≽', - 'SucceedsTilde' => '≿', - 'succeq' => '⪰', - 'succnapprox' => '⪺', - 'succneqq' => '⪶', - 'succnsim' => '⋩', - 'succsim' => '≿', - 'SuchThat' => '∋', - 'Sum' => '∑', - 'sum' => '∑', - 'sung' => '♪', - 'Sup' => '⋑', - 'sup' => '³', - 'sup1' => '¹', - 'sup2' => '²', - 'sup3' => '³', - 'supdot' => '⪾', - 'supdsub' => '⫘', - 'supE' => '⫆', - 'supe' => '⊇', - 'supedot' => '⫄', - 'Superset' => '⊃', - 'SupersetEqual' => '⊇', - 'suphsol' => '⟉', - 'suphsub' => '⫗', - 'suplarr' => '⥻', - 'supmult' => '⫂', - 'supnE' => '⫌', - 'supne' => '⊋', - 'supplus' => '⫀', - 'Supset' => '⋑', - 'supset' => '⊃', - 'supseteq' => '⊇', - 'supseteqq' => '⫆', - 'supsetneq' => '⊋', - 'supsetneqq' => '⫌', - 'supsim' => '⫈', - 'supsub' => '⫔', - 'supsup' => '⫖', - 'swarhk' => '⤦', - 'swArr' => '⇙', - 'swarr' => '↙', - 'swarrow' => '↙', - 'swnwar' => '⤪', - 'szlig' => 'ß', - 'szli' => 'ß', - 'Tab' => ' ', - 'target' => '⌖', - 'Tau' => 'Τ', - 'tau' => 'τ', - 'tbrk' => '⎴', - 'Tcaron' => 'Ť', - 'tcaron' => 'ť', - 'Tcedil' => 'Ţ', - 'tcedil' => 'ţ', - 'Tcy' => 'Т', - 'tcy' => 'т', - 'tdot' => '⃛', - 'telrec' => '⌕', - 'Tfr' => '𝔗', - 'tfr' => '𝔱', - 'there4' => '∴', - 'Therefore' => '∴', - 'therefore' => '∴', - 'Theta' => 'Θ', - 'theta' => 'θ', - 'thetasym' => 'ϑ', - 'thetav' => 'ϑ', - 'thickapprox' => '≈', - 'thicksim' => '∼', - 'ThickSpace' => ' ', - 'thinsp' => ' ', - 'ThinSpace' => ' ', - 'thkap' => '≈', - 'thksim' => '∼', - 'THORN' => 'Þ', - 'THOR' => 'Þ', - 'thorn' => 'þ', - 'thor' => 'þ', - 'Tilde' => '∼', - 'tilde' => '˜', - 'TildeEqual' => '≃', - 'TildeFullEqual' => '≅', - 'TildeTilde' => '≈', - 'times' => '×', - 'time' => '×', - 'timesb' => '⊠', - 'timesbar' => '⨱', - 'timesd' => '⨰', - 'tint' => '∭', - 'toea' => '⤨', - 'top' => '⊤', - 'topbot' => '⌶', - 'topcir' => '⫱', - 'Topf' => '𝕋', - 'topf' => '𝕥', - 'topfork' => '⫚', - 'tosa' => '⤩', - 'tprime' => '‴', - 'TRADE' => '™', - 'trade' => '™', - 'triangle' => '▵', - 'triangledown' => '▿', - 'triangleleft' => '◃', - 'trianglelefteq' => '⊴', - 'triangleq' => '≜', - 'triangleright' => '▹', - 'trianglerighteq' => '⊵', - 'tridot' => '◬', - 'trie' => '≜', - 'triminus' => '⨺', - 'TripleDot' => '⃛', - 'triplus' => '⨹', - 'trisb' => '⧍', - 'tritime' => '⨻', - 'trpezium' => '⏢', - 'Tscr' => '𝒯', - 'tscr' => '𝓉', - 'TScy' => 'Ц', - 'tscy' => 'ц', - 'TSHcy' => 'Ћ', - 'tshcy' => 'ћ', - 'Tstrok' => 'Ŧ', - 'tstrok' => 'ŧ', - 'twixt' => '≬', - 'twoheadleftarrow' => '↞', - 'twoheadrightarrow' => '↠', - 'Uacute' => 'Ú', - 'Uacut' => 'Ú', - 'uacute' => 'ú', - 'uacut' => 'ú', - 'Uarr' => '↟', - 'uArr' => '⇑', - 'uarr' => '↑', - 'Uarrocir' => '⥉', - 'Ubrcy' => 'Ў', - 'ubrcy' => 'ў', - 'Ubreve' => 'Ŭ', - 'ubreve' => 'ŭ', - 'Ucirc' => 'Û', - 'Ucir' => 'Û', - 'ucirc' => 'û', - 'ucir' => 'û', - 'Ucy' => 'У', - 'ucy' => 'у', - 'udarr' => '⇅', - 'Udblac' => 'Ű', - 'udblac' => 'ű', - 'udhar' => '⥮', - 'ufisht' => '⥾', - 'Ufr' => '𝔘', - 'ufr' => '𝔲', - 'Ugrave' => 'Ù', - 'Ugrav' => 'Ù', - 'ugrave' => 'ù', - 'ugrav' => 'ù', - 'uHar' => '⥣', - 'uharl' => '↿', - 'uharr' => '↾', - 'uhblk' => '▀', - 'ulcorn' => '⌜', - 'ulcorner' => '⌜', - 'ulcrop' => '⌏', - 'ultri' => '◸', - 'Umacr' => 'Ū', - 'umacr' => 'ū', - 'uml' => '¨', - 'um' => '¨', - 'UnderBar' => '_', - 'UnderBrace' => '⏟', - 'UnderBracket' => '⎵', - 'UnderParenthesis' => '⏝', - 'Union' => '⋃', - 'UnionPlus' => '⊎', - 'Uogon' => 'Ų', - 'uogon' => 'ų', - 'Uopf' => '𝕌', - 'uopf' => '𝕦', - 'UpArrow' => '↑', - 'Uparrow' => '⇑', - 'uparrow' => '↑', - 'UpArrowBar' => '⤒', - 'UpArrowDownArrow' => '⇅', - 'UpDownArrow' => '↕', - 'Updownarrow' => '⇕', - 'updownarrow' => '↕', - 'UpEquilibrium' => '⥮', - 'upharpoonleft' => '↿', - 'upharpoonright' => '↾', - 'uplus' => '⊎', - 'UpperLeftArrow' => '↖', - 'UpperRightArrow' => '↗', - 'Upsi' => 'ϒ', - 'upsi' => 'υ', - 'upsih' => 'ϒ', - 'Upsilon' => 'Υ', - 'upsilon' => 'υ', - 'UpTee' => '⊥', - 'UpTeeArrow' => '↥', - 'upuparrows' => '⇈', - 'urcorn' => '⌝', - 'urcorner' => '⌝', - 'urcrop' => '⌎', - 'Uring' => 'Ů', - 'uring' => 'ů', - 'urtri' => '◹', - 'Uscr' => '𝒰', - 'uscr' => '𝓊', - 'utdot' => '⋰', - 'Utilde' => 'Ũ', - 'utilde' => 'ũ', - 'utri' => '▵', - 'utrif' => '▴', - 'uuarr' => '⇈', - 'Uuml' => 'Ü', - 'Uum' => 'Ü', - 'uuml' => 'ü', - 'uum' => 'ü', - 'uwangle' => '⦧', - 'vangrt' => '⦜', - 'varepsilon' => 'ϵ', - 'varkappa' => 'ϰ', - 'varnothing' => '∅', - 'varphi' => 'ϕ', - 'varpi' => 'ϖ', - 'varpropto' => '∝', - 'vArr' => '⇕', - 'varr' => '↕', - 'varrho' => 'ϱ', - 'varsigma' => 'ς', - 'varsubsetneq' => '⊊︀', - 'varsubsetneqq' => '⫋︀', - 'varsupsetneq' => '⊋︀', - 'varsupsetneqq' => '⫌︀', - 'vartheta' => 'ϑ', - 'vartriangleleft' => '⊲', - 'vartriangleright' => '⊳', - 'Vbar' => '⫫', - 'vBar' => '⫨', - 'vBarv' => '⫩', - 'Vcy' => 'В', - 'vcy' => 'в', - 'VDash' => '⊫', - 'Vdash' => '⊩', - 'vDash' => '⊨', - 'vdash' => '⊢', - 'Vdashl' => '⫦', - 'Vee' => '⋁', - 'vee' => '∨', - 'veebar' => '⊻', - 'veeeq' => '≚', - 'vellip' => '⋮', - 'Verbar' => '‖', - 'verbar' => '|', - 'Vert' => '‖', - 'vert' => '|', - 'VerticalBar' => '∣', - 'VerticalLine' => '|', - 'VerticalSeparator' => '❘', - 'VerticalTilde' => '≀', - 'VeryThinSpace' => ' ', - 'Vfr' => '𝔙', - 'vfr' => '𝔳', - 'vltri' => '⊲', - 'vnsub' => '⊂⃒', - 'vnsup' => '⊃⃒', - 'Vopf' => '𝕍', - 'vopf' => '𝕧', - 'vprop' => '∝', - 'vrtri' => '⊳', - 'Vscr' => '𝒱', - 'vscr' => '𝓋', - 'vsubnE' => '⫋︀', - 'vsubne' => '⊊︀', - 'vsupnE' => '⫌︀', - 'vsupne' => '⊋︀', - 'Vvdash' => '⊪', - 'vzigzag' => '⦚', - 'Wcirc' => 'Ŵ', - 'wcirc' => 'ŵ', - 'wedbar' => '⩟', - 'Wedge' => '⋀', - 'wedge' => '∧', - 'wedgeq' => '≙', - 'weierp' => '℘', - 'Wfr' => '𝔚', - 'wfr' => '𝔴', - 'Wopf' => '𝕎', - 'wopf' => '𝕨', - 'wp' => '℘', - 'wr' => '≀', - 'wreath' => '≀', - 'Wscr' => '𝒲', - 'wscr' => '𝓌', - 'xcap' => '⋂', - 'xcirc' => '◯', - 'xcup' => '⋃', - 'xdtri' => '▽', - 'Xfr' => '𝔛', - 'xfr' => '𝔵', - 'xhArr' => '⟺', - 'xharr' => '⟷', - 'Xi' => 'Ξ', - 'xi' => 'ξ', - 'xlArr' => '⟸', - 'xlarr' => '⟵', - 'xmap' => '⟼', - 'xnis' => '⋻', - 'xodot' => '⨀', - 'Xopf' => '𝕏', - 'xopf' => '𝕩', - 'xoplus' => '⨁', - 'xotime' => '⨂', - 'xrArr' => '⟹', - 'xrarr' => '⟶', - 'Xscr' => '𝒳', - 'xscr' => '𝓍', - 'xsqcup' => '⨆', - 'xuplus' => '⨄', - 'xutri' => '△', - 'xvee' => '⋁', - 'xwedge' => '⋀', - 'Yacute' => 'Ý', - 'Yacut' => 'Ý', - 'yacute' => 'ý', - 'yacut' => 'ý', - 'YAcy' => 'Я', - 'yacy' => 'я', - 'Ycirc' => 'Ŷ', - 'ycirc' => 'ŷ', - 'Ycy' => 'Ы', - 'ycy' => 'ы', - 'yen' => '¥', - 'ye' => '¥', - 'Yfr' => '𝔜', - 'yfr' => '𝔶', - 'YIcy' => 'Ї', - 'yicy' => 'ї', - 'Yopf' => '𝕐', - 'yopf' => '𝕪', - 'Yscr' => '𝒴', - 'yscr' => '𝓎', - 'YUcy' => 'Ю', - 'yucy' => 'ю', - 'Yuml' => 'Ÿ', - 'yuml' => 'ÿ', - 'yum' => 'ÿ', - 'Zacute' => 'Ź', - 'zacute' => 'ź', - 'Zcaron' => 'Ž', - 'zcaron' => 'ž', - 'Zcy' => 'З', - 'zcy' => 'з', - 'Zdot' => 'Ż', - 'zdot' => 'ż', - 'zeetrf' => 'ℨ', - 'ZeroWidthSpace' => '', - 'Zeta' => 'Ζ', - 'zeta' => 'ζ', - 'Zfr' => 'ℨ', - 'zfr' => '𝔷', - 'ZHcy' => 'Ж', - 'zhcy' => 'ж', - 'zigrarr' => '⇝', - 'Zopf' => 'ℤ', - 'zopf' => '𝕫', - 'Zscr' => '𝒵', - 'zscr' => '𝓏', - 'zwj' => '', - 'zwnj' => '', - ]; - - /** - * @param string $entity - * - * @return string - * - * @deprecated Use Html5EntityDecoder::decode() instead - */ - public static function decodeEntity(string $entity): string - { - return Html5EntityDecoder::decode($entity); - } - - /** - * @param mixed $number - * - * @return string - * - * @deprecated This method will be removed in v2.0.0 - */ - public static function fromDecimal($number): string - { - // Only convert code points within planes 0-2, excluding NULL - if (empty($number) || $number > 0x2FFFF) { - return self::fromHex('fffd'); - } - - $entity = '&#' . $number . ';'; - - $converted = \mb_decode_numericentity($entity, [0x0, 0x2FFFF, 0, 0xFFFF], 'UTF-8'); - - if ($converted === $entity) { - return self::fromHex('fffd'); - } - - return $converted; - } - - /** - * @param string $hexChars - * - * @return string - * - * @deprecated This method will be removed in v2.0.0 - */ - public static function fromHex(string $hexChars): string - { - return self::fromDecimal(\hexdec($hexChars)); - } -} diff --git a/vendor/league/commonmark/src/Util/Html5EntityDecoder.php b/vendor/league/commonmark/src/Util/Html5EntityDecoder.php deleted file mode 100644 index 2f49d95445..0000000000 --- a/vendor/league/commonmark/src/Util/Html5EntityDecoder.php +++ /dev/null @@ -1,63 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Util; - -final class Html5EntityDecoder -{ - public static function decode(string $entity): string - { - if (\substr($entity, -1) !== ';') { - return $entity; - } - - if (\substr($entity, 0, 2) === '&#') { - if (\strtolower(\substr($entity, 2, 1)) === 'x') { - return self::fromHex(\substr($entity, 3, -1)); - } - - return self::fromDecimal(\substr($entity, 2, -1)); - } - - return \html_entity_decode($entity, \ENT_QUOTES | \ENT_HTML5, 'UTF-8'); - } - - /** - * @param mixed $number - * - * @return string - */ - private static function fromDecimal($number): string - { - // Only convert code points within planes 0-2, excluding NULL - if (empty($number) || $number > 0x2FFFF) { - return self::fromHex('fffd'); - } - - $entity = '&#' . $number . ';'; - - $converted = \mb_decode_numericentity($entity, [0x0, 0x2FFFF, 0, 0xFFFF], 'UTF-8'); - - if ($converted === $entity) { - return self::fromHex('fffd'); - } - - return $converted; - } - - private static function fromHex(string $hexChars): string - { - return self::fromDecimal(\hexdec($hexChars)); - } -} diff --git a/vendor/league/commonmark/src/Util/LinkParserHelper.php b/vendor/league/commonmark/src/Util/LinkParserHelper.php deleted file mode 100644 index 76baf3adcb..0000000000 --- a/vendor/league/commonmark/src/Util/LinkParserHelper.php +++ /dev/null @@ -1,125 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Util; - -use League\CommonMark\Cursor; - -final class LinkParserHelper -{ - /** - * Attempt to parse link destination - * - * @param Cursor $cursor - * - * @return null|string The string, or null if no match - */ - public static function parseLinkDestination(Cursor $cursor): ?string - { - if ($res = $cursor->match(RegexHelper::REGEX_LINK_DESTINATION_BRACES)) { - // Chop off surrounding <..>: - return UrlEncoder::unescapeAndEncode( - RegexHelper::unescape(\substr($res, 1, -1)) - ); - } - - if ($cursor->getCharacter() === '<') { - return null; - } - - $destination = self::manuallyParseLinkDestination($cursor); - if ($destination === null) { - return null; - } - - return UrlEncoder::unescapeAndEncode( - RegexHelper::unescape($destination) - ); - } - - public static function parseLinkLabel(Cursor $cursor): int - { - $match = $cursor->match('/^\[(?:[^\\\\\[\]]|\\\\.){0,1000}\]/'); - if ($match === null) { - return 0; - } - - $length = \mb_strlen($match, 'utf-8'); - - if ($length > 1001) { - return 0; - } - - return $length; - } - - /** - * Attempt to parse link title (sans quotes) - * - * @param Cursor $cursor - * - * @return null|string The string, or null if no match - */ - public static function parseLinkTitle(Cursor $cursor): ?string - { - if ($title = $cursor->match('/' . RegexHelper::PARTIAL_LINK_TITLE . '/')) { - // Chop off quotes from title and unescape - return RegexHelper::unescape(\substr($title, 1, -1)); - } - - return null; - } - - private static function manuallyParseLinkDestination(Cursor $cursor): ?string - { - $oldPosition = $cursor->getPosition(); - $oldState = $cursor->saveState(); - - $openParens = 0; - while (($c = $cursor->getCharacter()) !== null) { - if ($c === '\\' && $cursor->peek() !== null && RegexHelper::isEscapable($cursor->peek())) { - $cursor->advanceBy(2); - } elseif ($c === '(') { - $cursor->advanceBy(1); - $openParens++; - } elseif ($c === ')') { - if ($openParens < 1) { - break; - } - - $cursor->advanceBy(1); - $openParens--; - } elseif (\preg_match(RegexHelper::REGEX_WHITESPACE_CHAR, $c)) { - break; - } else { - $cursor->advanceBy(1); - } - } - - if ($openParens !== 0) { - return null; - } - - if ($cursor->getPosition() === $oldPosition && $c !== ')') { - return null; - } - - $newPos = $cursor->getPosition(); - $cursor->restoreState($oldState); - - $cursor->advanceBy($newPos - $cursor->getPosition()); - - return $cursor->getPreviousText(); - } -} diff --git a/vendor/league/commonmark/src/Util/PrioritizedList.php b/vendor/league/commonmark/src/Util/PrioritizedList.php deleted file mode 100644 index d90bcdc942..0000000000 --- a/vendor/league/commonmark/src/Util/PrioritizedList.php +++ /dev/null @@ -1,70 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Util; - -/** - * @internal - * @phpstan-template T - * @phpstan-implements \IteratorAggregate<T> - */ -final class PrioritizedList implements \IteratorAggregate -{ - /** - * @var array<int, array<mixed>> - * @phpstan-var array<int, array<T>> - */ - private $list = []; - - /** - * @var iterable<mixed>|null - * @phpstan-var iterable<T>|null - */ - private $optimized; - - /** - * @param mixed $item - * @param int $priority - * - * @phpstan-param T $item - */ - public function add($item, int $priority): void - { - $this->list[$priority][] = $item; - $this->optimized = null; - } - - /** - * @return iterable<int, mixed> - * - * @phpstan-return iterable<int, T> - */ - public function getIterator(): iterable - { - if ($this->optimized === null) { - \krsort($this->list); - - $sorted = []; - foreach ($this->list as $group) { - foreach ($group as $item) { - $sorted[] = $item; - } - } - - $this->optimized = new \ArrayIterator($sorted); - } - - return $this->optimized; - } -} diff --git a/vendor/league/commonmark/src/Util/RegexHelper.php b/vendor/league/commonmark/src/Util/RegexHelper.php deleted file mode 100644 index 1dc1d05c8b..0000000000 --- a/vendor/league/commonmark/src/Util/RegexHelper.php +++ /dev/null @@ -1,208 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Util; - -use League\CommonMark\Block\Element\HtmlBlock; - -/** - * Provides regular expressions and utilities for parsing Markdown - */ -final class RegexHelper -{ - // Partial regular expressions (wrap with `/` on each side before use) - public const PARTIAL_ENTITY = '&(?:#x[a-f0-9]{1,6}|#[0-9]{1,7}|[a-z][a-z0-9]{1,31});'; - public const PARTIAL_ESCAPABLE = '[!"#$%&\'()*+,.\/:;<=>?@[\\\\\]^_`{|}~-]'; - public const PARTIAL_ESCAPED_CHAR = '\\\\' . self::PARTIAL_ESCAPABLE; - public const PARTIAL_IN_DOUBLE_QUOTES = '"(' . self::PARTIAL_ESCAPED_CHAR . '|[^"\x00])*"'; - public const PARTIAL_IN_SINGLE_QUOTES = '\'(' . self::PARTIAL_ESCAPED_CHAR . '|[^\'\x00])*\''; - public const PARTIAL_IN_PARENS = '\\((' . self::PARTIAL_ESCAPED_CHAR . '|[^)\x00])*\\)'; - public const PARTIAL_REG_CHAR = '[^\\\\()\x00-\x20]'; - public const PARTIAL_IN_PARENS_NOSP = '\((' . self::PARTIAL_REG_CHAR . '|' . self::PARTIAL_ESCAPED_CHAR . '|\\\\)*\)'; - public const PARTIAL_TAGNAME = '[A-Za-z][A-Za-z0-9-]*'; - public const PARTIAL_BLOCKTAGNAME = '(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)'; - public const PARTIAL_ATTRIBUTENAME = '[a-zA-Z_:][a-zA-Z0-9:._-]*'; - public const PARTIAL_UNQUOTEDVALUE = '[^"\'=<>`\x00-\x20]+'; - public const PARTIAL_SINGLEQUOTEDVALUE = '\'[^\']*\''; - public const PARTIAL_DOUBLEQUOTEDVALUE = '"[^"]*"'; - public const PARTIAL_ATTRIBUTEVALUE = '(?:' . self::PARTIAL_UNQUOTEDVALUE . '|' . self::PARTIAL_SINGLEQUOTEDVALUE . '|' . self::PARTIAL_DOUBLEQUOTEDVALUE . ')'; - public const PARTIAL_ATTRIBUTEVALUESPEC = '(?:' . '\s*=' . '\s*' . self::PARTIAL_ATTRIBUTEVALUE . ')'; - public const PARTIAL_ATTRIBUTE = '(?:' . '\s+' . self::PARTIAL_ATTRIBUTENAME . self::PARTIAL_ATTRIBUTEVALUESPEC . '?)'; - public const PARTIAL_OPENTAG = '<' . self::PARTIAL_TAGNAME . self::PARTIAL_ATTRIBUTE . '*' . '\s*\/?>'; - public const PARTIAL_CLOSETAG = '<\/' . self::PARTIAL_TAGNAME . '\s*[>]'; - public const PARTIAL_OPENBLOCKTAG = '<' . self::PARTIAL_BLOCKTAGNAME . self::PARTIAL_ATTRIBUTE . '*' . '\s*\/?>'; - public const PARTIAL_CLOSEBLOCKTAG = '<\/' . self::PARTIAL_BLOCKTAGNAME . '\s*[>]'; - public const PARTIAL_HTMLCOMMENT = '<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->'; - public const PARTIAL_PROCESSINGINSTRUCTION = '[<][?].*?[?][>]'; - public const PARTIAL_DECLARATION = '<![A-Z]+' . '\s+[^>]*>'; - public const PARTIAL_CDATA = '<!\[CDATA\[[\s\S]*?]\]>'; - public const PARTIAL_HTMLTAG = '(?:' . self::PARTIAL_OPENTAG . '|' . self::PARTIAL_CLOSETAG . '|' . self::PARTIAL_HTMLCOMMENT . '|' . - self::PARTIAL_PROCESSINGINSTRUCTION . '|' . self::PARTIAL_DECLARATION . '|' . self::PARTIAL_CDATA . ')'; - public const PARTIAL_HTMLBLOCKOPEN = '<(?:' . self::PARTIAL_BLOCKTAGNAME . '(?:[\s\/>]|$)' . '|' . - '\/' . self::PARTIAL_BLOCKTAGNAME . '(?:[\s>]|$)' . '|' . '[?!])'; - public const PARTIAL_LINK_TITLE = '^(?:"(' . self::PARTIAL_ESCAPED_CHAR . '|[^"\x00])*"' . - '|' . '\'(' . self::PARTIAL_ESCAPED_CHAR . '|[^\'\x00])*\'' . - '|' . '\((' . self::PARTIAL_ESCAPED_CHAR . '|[^()\x00])*\))'; - - public const REGEX_PUNCTUATION = '/^[\x{2000}-\x{206F}\x{2E00}-\x{2E7F}\p{Pc}\p{Pd}\p{Pe}\p{Pf}\p{Pi}\p{Po}\p{Ps}\\\\\'!"#\$%&\(\)\*\+,\-\.\\/:;<=>\?@\[\]\^_`\{\|\}~]/u'; - public const REGEX_UNSAFE_PROTOCOL = '/^javascript:|vbscript:|file:|data:/i'; - public const REGEX_SAFE_DATA_PROTOCOL = '/^data:image\/(?:png|gif|jpeg|webp)/i'; - public const REGEX_NON_SPACE = '/[^ \t\f\v\r\n]/'; - - public const REGEX_WHITESPACE_CHAR = '/^[ \t\n\x0b\x0c\x0d]/'; - public const REGEX_WHITESPACE = '/[ \t\n\x0b\x0c\x0d]+/'; - public const REGEX_UNICODE_WHITESPACE_CHAR = '/^\pZ|\s/u'; - public const REGEX_THEMATIC_BREAK = '/^(?:(?:\*[ \t]*){3,}|(?:_[ \t]*){3,}|(?:-[ \t]*){3,})[ \t]*$/'; - public const REGEX_LINK_DESTINATION_BRACES = '/^(?:<(?:[^<>\\n\\\\\\x00]|\\\\.)*>)/'; - - public static function isEscapable(string $character): bool - { - return \preg_match('/' . self::PARTIAL_ESCAPABLE . '/', $character) === 1; - } - - /** - * Attempt to match a regex in string s at offset offset - * - * @param string $regex - * @param string $string - * @param int $offset - * - * @return int|null Index of match, or null - */ - public static function matchAt(string $regex, string $string, int $offset = 0): ?int - { - $matches = []; - $string = \mb_substr($string, $offset, null, 'utf-8'); - if (!\preg_match($regex, $string, $matches, \PREG_OFFSET_CAPTURE)) { - return null; - } - - // PREG_OFFSET_CAPTURE always returns the byte offset, not the char offset, which is annoying - $charPos = \mb_strlen(\mb_strcut($string, 0, $matches[0][1], 'utf-8'), 'utf-8'); - - return $offset + $charPos; - } - - /** - * Functional wrapper around preg_match_all - * - * @param string $pattern - * @param string $subject - * @param int $offset - * - * @return array<string>|null - */ - public static function matchAll(string $pattern, string $subject, int $offset = 0): ?array - { - if ($offset !== 0) { - $subject = \substr($subject, $offset); - } - - \preg_match_all($pattern, $subject, $matches, \PREG_PATTERN_ORDER); - - $fullMatches = \reset($matches); - if (empty($fullMatches)) { - return null; - } - - if (\count($fullMatches) === 1) { - foreach ($matches as &$match) { - $match = \reset($match); - } - } - - return $matches ?: null; - } - - /** - * Replace backslash escapes with literal characters - * - * @param string $string - * - * @return string - */ - public static function unescape(string $string): string - { - $allEscapedChar = '/\\\\(' . self::PARTIAL_ESCAPABLE . ')/'; - - /** @var string $escaped */ - $escaped = \preg_replace($allEscapedChar, '$1', $string); - - /** @var string $replaced */ - $replaced = \preg_replace_callback('/' . self::PARTIAL_ENTITY . '/i', function ($e) { - return Html5EntityDecoder::decode($e[0]); - }, $escaped); - - return $replaced; - } - - /** - * @param int $type HTML block type - * - * @return string - * - * @internal - */ - public static function getHtmlBlockOpenRegex(int $type): string - { - switch ($type) { - case HtmlBlock::TYPE_1_CODE_CONTAINER: - return '/^<(?:script|pre|textarea|style)(?:\s|>|$)/i'; - case HtmlBlock::TYPE_2_COMMENT: - return '/^<!--/'; - case HtmlBlock::TYPE_3: - return '/^<[?]/'; - case HtmlBlock::TYPE_4: - return '/^<![A-Z]/'; - case HtmlBlock::TYPE_5_CDATA: - return '/^<!\[CDATA\[/'; - case HtmlBlock::TYPE_6_BLOCK_ELEMENT: - return '%^<[/]?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[123456]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|[/]?[>]|$)%i'; - case HtmlBlock::TYPE_7_MISC_ELEMENT: - return '/^(?:' . self::PARTIAL_OPENTAG . '|' . self::PARTIAL_CLOSETAG . ')\\s*$/i'; - } - - throw new \InvalidArgumentException('Invalid HTML block type'); - } - - /** - * @param int $type HTML block type - * - * @return string - * - * @internal - */ - public static function getHtmlBlockCloseRegex(int $type): string - { - switch ($type) { - case HtmlBlock::TYPE_1_CODE_CONTAINER: - return '%<\/(?:script|pre|textarea|style)>%i'; - case HtmlBlock::TYPE_2_COMMENT: - return '/-->/'; - case HtmlBlock::TYPE_3: - return '/\?>/'; - case HtmlBlock::TYPE_4: - return '/>/'; - case HtmlBlock::TYPE_5_CDATA: - return '/\]\]>/'; - } - - throw new \InvalidArgumentException('Invalid HTML block type'); - } - - public static function isLinkPotentiallyUnsafe(string $url): bool - { - return \preg_match(self::REGEX_UNSAFE_PROTOCOL, $url) !== 0 && \preg_match(self::REGEX_SAFE_DATA_PROTOCOL, $url) === 0; - } -} diff --git a/vendor/league/commonmark/src/Util/UrlEncoder.php b/vendor/league/commonmark/src/Util/UrlEncoder.php deleted file mode 100644 index 9951bb8cc6..0000000000 --- a/vendor/league/commonmark/src/Util/UrlEncoder.php +++ /dev/null @@ -1,60 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Util; - -use League\CommonMark\Exception\UnexpectedEncodingException; - -final class UrlEncoder -{ - /** @var string[] */ - private static $encodeCache = ['%00', '%01', '%02', '%03', '%04', '%05', '%06', '%07', '%08', '%09', '%0A', '%0B', '%0C', '%0D', '%0E', '%0F', '%10', '%11', '%12', '%13', '%14', '%15', '%16', '%17', '%18', '%19', '%1A', '%1B', '%1C', '%1D', '%1E', '%1F', '%20', '!', '%22', '#', '$', '%25', '&', "'", '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '%3C', '=', '%3E', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '%5B', '%5C', '%5D', '%5E', '_', '%60', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '%7B', '%7C', '%7D', '~', '%7F']; - - public static function unescapeAndEncode(string $uri): string - { - // Optimization: if the URL only includes characters we know will be kept as-is, then just return the URL as-is. - if (\preg_match('/^[A-Za-z0-9~!@#$&*()\-_=+;:,.\/?]+$/', $uri)) { - return $uri; - } - - $result = ''; - - $chars = \preg_split('//u', $uri, -1, \PREG_SPLIT_NO_EMPTY); - - if (!\is_array($chars) || !\mb_check_encoding($uri, 'UTF-8')) { - throw new UnexpectedEncodingException('Unexpected encoding - UTF-8 or ASCII was expected'); - } - - $l = \count($chars); - for ($i = 0; $i < $l; $i++) { - $code = $chars[$i]; - if ($code === '%' && $i + 2 < $l) { - if (\preg_match('/^[0-9a-f]{2}$/i', $chars[$i + 1] . $chars[$i + 2]) === 1) { - $result .= '%' . $chars[$i + 1] . $chars[$i + 2]; - $i += 2; - continue; - } - } - - if (\ord($code) < 128) { - $result .= self::$encodeCache[\ord($code)]; - continue; - } - - $result .= \rawurlencode($code); - } - - return $result; - } -} diff --git a/vendor/league/commonmark/src/Util/Xml.php b/vendor/league/commonmark/src/Util/Xml.php deleted file mode 100644 index 1d8e3b76c8..0000000000 --- a/vendor/league/commonmark/src/Util/Xml.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Util; - -/** - * Utility class for handling/generating XML and HTML - */ -final class Xml -{ - /** - * @param string $string - * - * @return string - */ - public static function escape($string) - { - return \str_replace(['&', '<', '>', '"'], ['&', '<', '>', '"'], $string); - } -} diff --git a/vendor/league/flysystem-cached-adapter/.editorconfig b/vendor/league/flysystem-cached-adapter/.editorconfig deleted file mode 100644 index 153cf3ef5b..0000000000 --- a/vendor/league/flysystem-cached-adapter/.editorconfig +++ /dev/null @@ -1,10 +0,0 @@ -; top-most EditorConfig file -root = true - -; Unix-style newlines -[*] -end_of_line = LF - -[*.php] -indent_style = space -indent_size = 4 diff --git a/vendor/league/flysystem-cached-adapter/.gitignore b/vendor/league/flysystem-cached-adapter/.gitignore deleted file mode 100644 index 7aea75f4fa..0000000000 --- a/vendor/league/flysystem-cached-adapter/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -coverage -coverage.xml -composer.lock -vendor
\ No newline at end of file diff --git a/vendor/league/flysystem-cached-adapter/.php_cs b/vendor/league/flysystem-cached-adapter/.php_cs deleted file mode 100644 index 6643a32cfa..0000000000 --- a/vendor/league/flysystem-cached-adapter/.php_cs +++ /dev/null @@ -1,7 +0,0 @@ -<?php - -return Symfony\CS\Config\Config::create() - ->level(Symfony\CS\FixerInterface::PSR2_LEVEL) - ->fixers(['-yoda_conditions', 'ordered_use', 'short_array_syntax']) - ->finder(Symfony\CS\Finder\DefaultFinder::create() - ->in(__DIR__.'/src/'));
\ No newline at end of file diff --git a/vendor/league/flysystem-cached-adapter/.scrutinizer.yml b/vendor/league/flysystem-cached-adapter/.scrutinizer.yml deleted file mode 100644 index fa39b52b36..0000000000 --- a/vendor/league/flysystem-cached-adapter/.scrutinizer.yml +++ /dev/null @@ -1,34 +0,0 @@ -filter: - paths: [src/*] -checks: - php: - code_rating: true - remove_extra_empty_lines: true - remove_php_closing_tag: true - remove_trailing_whitespace: true - fix_use_statements: - remove_unused: true - preserve_multiple: false - preserve_blanklines: true - order_alphabetically: true - fix_php_opening_tag: true - fix_linefeed: true - fix_line_ending: true - fix_identation_4spaces: true - fix_doc_comments: true -tools: - external_code_coverage: - timeout: 900 - runs: 6 - php_code_coverage: false - php_code_sniffer: - config: - standard: PSR2 - filter: - paths: ['src'] - php_loc: - enabled: true - excluded_dirs: [vendor, spec, stubs] - php_cpd: - enabled: true - excluded_dirs: [vendor, spec, stubs]
\ No newline at end of file diff --git a/vendor/league/flysystem-cached-adapter/.travis.yml b/vendor/league/flysystem-cached-adapter/.travis.yml deleted file mode 100644 index 6706449fde..0000000000 --- a/vendor/league/flysystem-cached-adapter/.travis.yml +++ /dev/null @@ -1,29 +0,0 @@ -language: php - -php: - - 5.5 - - 5.6 - - 7.0 - - 7.1 - - 7.2 - -matrix: - allow_failures: - - php: 5.5 - -env: - - COMPOSER_OPTS="" - - COMPOSER_OPTS="--prefer-lowest" - -install: - - if [[ "${TRAVIS_PHP_VERSION}" == "5.5" ]]; then composer require phpunit/phpunit:^4.8.36 phpspec/phpspec:^2 --prefer-dist --update-with-dependencies; fi - - if [[ "${TRAVIS_PHP_VERSION}" == "7.2" ]]; then composer require phpunit/phpunit:^6.0 --prefer-dist --update-with-dependencies; fi - - travis_retry composer update --prefer-dist $COMPOSER_OPTS - -script: - - vendor/bin/phpspec run - - vendor/bin/phpunit - -after_script: - - wget https://scrutinizer-ci.com/ocular.phar' - - php ocular.phar code-coverage:upload --format=php-clover ./clover/phpunit.xml' diff --git a/vendor/league/flysystem-cached-adapter/LICENSE b/vendor/league/flysystem-cached-adapter/LICENSE deleted file mode 100644 index 666f6c826b..0000000000 --- a/vendor/league/flysystem-cached-adapter/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2015 Frank de Jonge - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/league/flysystem-cached-adapter/clover/.gitignore b/vendor/league/flysystem-cached-adapter/clover/.gitignore deleted file mode 100644 index d6b7ef32c8..0000000000 --- a/vendor/league/flysystem-cached-adapter/clover/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore diff --git a/vendor/league/flysystem-cached-adapter/composer.json b/vendor/league/flysystem-cached-adapter/composer.json deleted file mode 100644 index df7fb7fd9b..0000000000 --- a/vendor/league/flysystem-cached-adapter/composer.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "league/flysystem-cached-adapter", - "description": "An adapter decorator to enable meta-data caching.", - "autoload": { - "psr-4": { - "League\\Flysystem\\Cached\\": "src/" - } - }, - "require": { - "league/flysystem": "~1.0", - "psr/cache": "^1.0.0" - }, - "require-dev": { - "phpspec/phpspec": "^3.4", - "phpunit/phpunit": "^5.7", - "mockery/mockery": "~0.9", - "predis/predis": "~1.0", - "tedivm/stash": "~0.12" - }, - "suggest": { - "ext-phpredis": "Pure C implemented extension for PHP" - }, - "license": "MIT", - "authors": [ - { - "name": "frankdejonge", - "email": "info@frenky.net" - } - ] -} diff --git a/vendor/league/flysystem-cached-adapter/phpspec.yml b/vendor/league/flysystem-cached-adapter/phpspec.yml deleted file mode 100644 index 5eabcb21b9..0000000000 --- a/vendor/league/flysystem-cached-adapter/phpspec.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -suites: - cached_adapter_suite: - namespace: League\Flysystem\Cached - psr4_prefix: League\Flysystem\Cached -formatter.name: pretty diff --git a/vendor/league/flysystem-cached-adapter/phpunit.php b/vendor/league/flysystem-cached-adapter/phpunit.php deleted file mode 100644 index d109587967..0000000000 --- a/vendor/league/flysystem-cached-adapter/phpunit.php +++ /dev/null @@ -1,3 +0,0 @@ -<?php - -include __DIR__.'/vendor/autoload.php'; diff --git a/vendor/league/flysystem-cached-adapter/phpunit.xml b/vendor/league/flysystem-cached-adapter/phpunit.xml deleted file mode 100644 index 660dd3bfdc..0000000000 --- a/vendor/league/flysystem-cached-adapter/phpunit.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<phpunit backupGlobals="false" - backupStaticAttributes="false" - bootstrap="./phpunit.php" - colors="true" - convertErrorsToExceptions="true" - convertNoticesToExceptions="true" - convertWarningsToExceptions="true" - processIsolation="false" - stopOnFailure="false" - syntaxCheck="true" - verbose="true" -> - <testsuites> - <testsuite name="flysystem/tests"> - <directory suffix=".php">./tests/</directory> - </testsuite> - </testsuites> - <filter> - <whitelist> - <directory suffix=".php">./src/</directory> - </whitelist> - </filter> - <logging> - <log type="coverage-text" target="php://stdout" showUncoveredFiles="true"/> - <log type="coverage-html" target="coverage" showUncoveredFiles="true"/> - <log type="coverage-clover" target="clover/phpunit.xml" showUncoveredFiles="true"/> - </logging> -</phpunit> diff --git a/vendor/league/flysystem-cached-adapter/readme.md b/vendor/league/flysystem-cached-adapter/readme.md deleted file mode 100644 index dd1433d98e..0000000000 --- a/vendor/league/flysystem-cached-adapter/readme.md +++ /dev/null @@ -1,20 +0,0 @@ -# Flysystem Cached CachedAdapter - -[](https://twitter.com/frankdejonge) -[](https://travis-ci.org/thephpleague/flysystem-cached-adapter) -[](https://scrutinizer-ci.com/g/thephpleague/flysystem-cached-adapter/code-structure) -[](https://scrutinizer-ci.com/g/thephpleague/flysystem-cached-adapter) -[](LICENSE) -[](https://packagist.org/packages/league/flysystem-cached-adapter) -[](https://packagist.org/packages/league/flysystem-cached-adapter) - - -The adapter decorator caches metadata and directory listings. - -```bash -composer require league/flysystem-cached-adapter -``` - -## Usage - -[Check out the docs.](https://flysystem.thephpleague.com/docs/advanced/caching/) diff --git a/vendor/league/flysystem-cached-adapter/spec/CachedAdapterSpec.php b/vendor/league/flysystem-cached-adapter/spec/CachedAdapterSpec.php deleted file mode 100644 index 69428d990e..0000000000 --- a/vendor/league/flysystem-cached-adapter/spec/CachedAdapterSpec.php +++ /dev/null @@ -1,435 +0,0 @@ -<?php - -namespace spec\League\Flysystem\Cached; - -use League\Flysystem\AdapterInterface; -use League\Flysystem\Cached\CacheInterface; -use League\Flysystem\Config; -use PhpSpec\ObjectBehavior; - -class CachedAdapterSpec extends ObjectBehavior -{ - /** - * @var AdapterInterface - */ - private $adapter; - - /** - * @var CacheInterface - */ - private $cache; - - public function let(AdapterInterface $adapter, CacheInterface $cache) - { - $this->adapter = $adapter; - $this->cache = $cache; - $this->cache->load()->shouldBeCalled(); - $this->beConstructedWith($adapter, $cache); - } - - public function it_is_initializable() - { - $this->shouldHaveType('League\Flysystem\Cached\CachedAdapter'); - $this->shouldHaveType('League\Flysystem\AdapterInterface'); - } - - public function it_should_forward_read_streams() - { - $path = 'path.txt'; - $response = ['path' => $path]; - $this->adapter->readStream($path)->willReturn($response); - $this->readStream($path)->shouldbe($response); - } - - public function it_should_cache_writes() - { - $type = 'file'; - $path = 'path.txt'; - $contents = 'contents'; - $config = new Config(); - $response = compact('path', 'contents', 'type'); - $this->adapter->write($path, $contents, $config)->willReturn($response); - $this->cache->updateObject($path, $response, true)->shouldBeCalled(); - $this->write($path, $contents, $config)->shouldBe($response); - } - - public function it_should_cache_streamed_writes() - { - $type = 'file'; - $path = 'path.txt'; - $stream = tmpfile(); - $config = new Config(); - $response = compact('path', 'stream', 'type'); - $this->adapter->writeStream($path, $stream, $config)->willReturn($response); - $this->cache->updateObject($path, ['contents' => false] + $response, true)->shouldBeCalled(); - $this->writeStream($path, $stream, $config)->shouldBe($response); - fclose($stream); - } - - public function it_should_cache_streamed_updates() - { - $type = 'file'; - $path = 'path.txt'; - $stream = tmpfile(); - $config = new Config(); - $response = compact('path', 'stream', 'type'); - $this->adapter->updateStream($path, $stream, $config)->willReturn($response); - $this->cache->updateObject($path, ['contents' => false] + $response, true)->shouldBeCalled(); - $this->updateStream($path, $stream, $config)->shouldBe($response); - fclose($stream); - } - - public function it_should_ignore_failed_writes() - { - $path = 'path.txt'; - $contents = 'contents'; - $config = new Config(); - $this->adapter->write($path, $contents, $config)->willReturn(false); - $this->write($path, $contents, $config)->shouldBe(false); - } - - public function it_should_ignore_failed_streamed_writes() - { - $path = 'path.txt'; - $contents = tmpfile(); - $config = new Config(); - $this->adapter->writeStream($path, $contents, $config)->willReturn(false); - $this->writeStream($path, $contents, $config)->shouldBe(false); - fclose($contents); - } - - public function it_should_cache_updated() - { - $type = 'file'; - $path = 'path.txt'; - $contents = 'contents'; - $config = new Config(); - $response = compact('path', 'contents', 'type'); - $this->adapter->update($path, $contents, $config)->willReturn($response); - $this->cache->updateObject($path, $response, true)->shouldBeCalled(); - $this->update($path, $contents, $config)->shouldBe($response); - } - - public function it_should_ignore_failed_updates() - { - $path = 'path.txt'; - $contents = 'contents'; - $config = new Config(); - $this->adapter->update($path, $contents, $config)->willReturn(false); - $this->update($path, $contents, $config)->shouldBe(false); - } - - public function it_should_ignore_failed_streamed_updates() - { - $path = 'path.txt'; - $contents = tmpfile(); - $config = new Config(); - $this->adapter->updateStream($path, $contents, $config)->willReturn(false); - $this->updateStream($path, $contents, $config)->shouldBe(false); - fclose($contents); - } - - public function it_should_cache_renames() - { - $old = 'old.txt'; - $new = 'new.txt'; - $this->adapter->rename($old, $new)->willReturn(true); - $this->cache->rename($old, $new)->shouldBeCalled(); - $this->rename($old, $new)->shouldBe(true); - } - - public function it_should_ignore_rename_fails() - { - $old = 'old.txt'; - $new = 'new.txt'; - $this->adapter->rename($old, $new)->willReturn(false); - $this->rename($old, $new)->shouldBe(false); - } - - public function it_should_cache_copies() - { - $old = 'old.txt'; - $new = 'new.txt'; - $this->adapter->copy($old, $new)->willReturn(true); - $this->cache->copy($old, $new)->shouldBeCalled(); - $this->copy($old, $new)->shouldBe(true); - } - - public function it_should_ignore_copy_fails() - { - $old = 'old.txt'; - $new = 'new.txt'; - $this->adapter->copy($old, $new)->willReturn(false); - $this->copy($old, $new)->shouldBe(false); - } - - public function it_should_cache_deletes() - { - $delete = 'delete.txt'; - $this->adapter->delete($delete)->willReturn(true); - $this->cache->delete($delete)->shouldBeCalled(); - $this->delete($delete)->shouldBe(true); - } - - public function it_should_ignore_delete_fails() - { - $delete = 'delete.txt'; - $this->adapter->delete($delete)->willReturn(false); - $this->delete($delete)->shouldBe(false); - } - - public function it_should_cache_dir_deletes() - { - $delete = 'delete'; - $this->adapter->deleteDir($delete)->willReturn(true); - $this->cache->deleteDir($delete)->shouldBeCalled(); - $this->deleteDir($delete)->shouldBe(true); - } - - public function it_should_ignore_delete_dir_fails() - { - $delete = 'delete'; - $this->adapter->deleteDir($delete)->willReturn(false); - $this->deleteDir($delete)->shouldBe(false); - } - - public function it_should_cache_dir_creates() - { - $dirname = 'dirname'; - $config = new Config(); - $response = ['path' => $dirname, 'type' => 'dir']; - $this->adapter->createDir($dirname, $config)->willReturn($response); - $this->cache->updateObject($dirname, $response, true)->shouldBeCalled(); - $this->createDir($dirname, $config)->shouldBe($response); - } - - public function it_should_ignore_create_dir_fails() - { - $dirname = 'dirname'; - $config = new Config(); - $this->adapter->createDir($dirname, $config)->willReturn(false); - $this->createDir($dirname, $config)->shouldBe(false); - } - - public function it_should_cache_set_visibility() - { - $path = 'path.txt'; - $visibility = AdapterInterface::VISIBILITY_PUBLIC; - $this->adapter->setVisibility($path, $visibility)->willReturn(true); - $this->cache->updateObject($path, ['path' => $path, 'visibility' => $visibility], true)->shouldBeCalled(); - $this->setVisibility($path, $visibility)->shouldBe(true); - } - - public function it_should_ignore_set_visibility_fails() - { - $dirname = 'delete'; - $visibility = AdapterInterface::VISIBILITY_PUBLIC; - $this->adapter->setVisibility($dirname, $visibility)->willReturn(false); - $this->setVisibility($dirname, $visibility)->shouldBe(false); - } - - public function it_should_indicate_missing_files() - { - $this->cache->has($path = 'path.txt')->willReturn(false); - $this->has($path)->shouldBe(false); - } - - public function it_should_indicate_file_existance() - { - $this->cache->has($path = 'path.txt')->willReturn(true); - $this->has($path)->shouldBe(true); - } - - public function it_should_cache_missing_files() - { - $this->cache->has($path = 'path.txt')->willReturn(null); - $this->adapter->has($path)->willReturn(false); - $this->cache->storeMiss($path)->shouldBeCalled(); - $this->has($path)->shouldBe(false); - } - - public function it_should_delete_when_metadata_is_missing() - { - $path = 'path.txt'; - $this->cache->has($path)->willReturn(true); - $this->cache->getSize($path)->willReturn(['path' => $path]); - $this->adapter->getSize($path)->willReturn($response = ['path' => $path, 'size' => 1024]); - $this->cache->updateObject($path, $response, true)->shouldBeCalled(); - $this->getSize($path)->shouldBe($response); - } - - public function it_should_cache_has() - { - $this->cache->has($path = 'path.txt')->willReturn(null); - $this->adapter->has($path)->willReturn(true); - $this->cache->updateObject($path, compact('path'), true)->shouldBeCalled(); - $this->has($path)->shouldBe(true); - } - - public function it_should_list_cached_contents() - { - $this->cache->isComplete($dirname = 'dirname', $recursive = true)->willReturn(true); - $response = [['path' => 'path.txt']]; - $this->cache->listContents($dirname, $recursive)->willReturn($response); - $this->listContents($dirname, $recursive)->shouldBe($response); - } - - public function it_should_ignore_failed_list_contents() - { - $this->cache->isComplete($dirname = 'dirname', $recursive = true)->willReturn(false); - $this->adapter->listContents($dirname, $recursive)->willReturn(false); - $this->listContents($dirname, $recursive)->shouldBe(false); - } - - public function it_should_cache_contents_listings() - { - $this->cache->isComplete($dirname = 'dirname', $recursive = true)->willReturn(false); - $response = [['path' => 'path.txt']]; - $this->adapter->listContents($dirname, $recursive)->willReturn($response); - $this->cache->storeContents($dirname, $response, $recursive)->shouldBeCalled(); - $this->listContents($dirname, $recursive)->shouldBe($response); - } - - public function it_should_use_cached_visibility() - { - $this->make_it_use_getter_cache('getVisibility', 'path.txt', [ - 'path' => 'path.txt', - 'visibility' => AdapterInterface::VISIBILITY_PUBLIC, - ]); - } - - public function it_should_cache_get_visibility() - { - $path = 'path.txt'; - $response = ['visibility' => AdapterInterface::VISIBILITY_PUBLIC, 'path' => $path]; - $this->make_it_cache_getter('getVisibility', $path, $response); - } - - public function it_should_ignore_failed_get_visibility() - { - $path = 'path.txt'; - $this->make_it_ignore_failed_getter('getVisibility', $path); - } - - public function it_should_use_cached_timestamp() - { - $this->make_it_use_getter_cache('getTimestamp', 'path.txt', [ - 'path' => 'path.txt', - 'timestamp' => 1234, - ]); - } - - public function it_should_cache_timestamps() - { - $this->make_it_cache_getter('getTimestamp', 'path.txt', [ - 'path' => 'path.txt', - 'timestamp' => 1234, - ]); - } - - public function it_should_ignore_failed_get_timestamps() - { - $this->make_it_ignore_failed_getter('getTimestamp', 'path.txt'); - } - - public function it_should_cache_get_metadata() - { - $path = 'path.txt'; - $response = ['visibility' => AdapterInterface::VISIBILITY_PUBLIC, 'path' => $path]; - $this->make_it_cache_getter('getMetadata', $path, $response); - } - - public function it_should_use_cached_metadata() - { - $this->make_it_use_getter_cache('getMetadata', 'path.txt', [ - 'path' => 'path.txt', - 'timestamp' => 1234, - ]); - } - - public function it_should_ignore_failed_get_metadata() - { - $this->make_it_ignore_failed_getter('getMetadata', 'path.txt'); - } - - public function it_should_cache_get_size() - { - $path = 'path.txt'; - $response = ['size' => 1234, 'path' => $path]; - $this->make_it_cache_getter('getSize', $path, $response); - } - - public function it_should_use_cached_size() - { - $this->make_it_use_getter_cache('getSize', 'path.txt', [ - 'path' => 'path.txt', - 'size' => 1234, - ]); - } - - public function it_should_ignore_failed_get_size() - { - $this->make_it_ignore_failed_getter('getSize', 'path.txt'); - } - - public function it_should_cache_get_mimetype() - { - $path = 'path.txt'; - $response = ['mimetype' => 'text/plain', 'path' => $path]; - $this->make_it_cache_getter('getMimetype', $path, $response); - } - - public function it_should_use_cached_mimetype() - { - $this->make_it_use_getter_cache('getMimetype', 'path.txt', [ - 'path' => 'path.txt', - 'mimetype' => 'text/plain', - ]); - } - - public function it_should_ignore_failed_get_mimetype() - { - $this->make_it_ignore_failed_getter('getMimetype', 'path.txt'); - } - - public function it_should_cache_reads() - { - $path = 'path.txt'; - $response = ['path' => $path, 'contents' => 'contents']; - $this->make_it_cache_getter('read', $path, $response); - } - - public function it_should_use_cached_file_contents() - { - $this->make_it_use_getter_cache('read', 'path.txt', [ - 'path' => 'path.txt', - 'contents' => 'contents' - ]); - } - - public function it_should_ignore_failed_reads() - { - $this->make_it_ignore_failed_getter('read', 'path.txt'); - } - - protected function make_it_use_getter_cache($method, $path, $response) - { - $this->cache->{$method}($path)->willReturn($response); - $this->{$method}($path)->shouldBe($response); - } - - protected function make_it_cache_getter($method, $path, $response) - { - $this->cache->{$method}($path)->willReturn(false); - $this->adapter->{$method}($path)->willReturn($response); - $this->cache->updateObject($path, $response, true)->shouldBeCalled(); - $this->{$method}($path)->shouldBe($response); - } - - protected function make_it_ignore_failed_getter($method, $path) - { - $this->cache->{$method}($path)->willReturn(false); - $this->adapter->{$method}($path)->willReturn(false); - $this->{$method}($path)->shouldBe(false); - } -} diff --git a/vendor/league/flysystem-cached-adapter/src/CacheInterface.php b/vendor/league/flysystem-cached-adapter/src/CacheInterface.php deleted file mode 100644 index de3ab3d90e..0000000000 --- a/vendor/league/flysystem-cached-adapter/src/CacheInterface.php +++ /dev/null @@ -1,101 +0,0 @@ -<?php - -namespace League\Flysystem\Cached; - -use League\Flysystem\ReadInterface; - -interface CacheInterface extends ReadInterface -{ - /** - * Check whether the directory listing of a given directory is complete. - * - * @param string $dirname - * @param bool $recursive - * - * @return bool - */ - public function isComplete($dirname, $recursive); - - /** - * Set a directory to completely listed. - * - * @param string $dirname - * @param bool $recursive - */ - public function setComplete($dirname, $recursive); - - /** - * Store the contents of a directory. - * - * @param string $directory - * @param array $contents - * @param bool $recursive - */ - public function storeContents($directory, array $contents, $recursive); - - /** - * Flush the cache. - */ - public function flush(); - - /** - * Autosave trigger. - */ - public function autosave(); - - /** - * Store the cache. - */ - public function save(); - - /** - * Load the cache. - */ - public function load(); - - /** - * Rename a file. - * - * @param string $path - * @param string $newpath - */ - public function rename($path, $newpath); - - /** - * Copy a file. - * - * @param string $path - * @param string $newpath - */ - public function copy($path, $newpath); - - /** - * Delete an object from cache. - * - * @param string $path object path - */ - public function delete($path); - - /** - * Delete all objects from from a directory. - * - * @param string $dirname directory path - */ - public function deleteDir($dirname); - - /** - * Update the metadata for an object. - * - * @param string $path object path - * @param array $object object metadata - * @param bool $autosave whether to trigger the autosave routine - */ - public function updateObject($path, array $object, $autosave = false); - - /** - * Store object hit miss. - * - * @param string $path - */ - public function storeMiss($path); -} diff --git a/vendor/league/flysystem-cached-adapter/src/CachedAdapter.php b/vendor/league/flysystem-cached-adapter/src/CachedAdapter.php deleted file mode 100644 index dcdae9ebc7..0000000000 --- a/vendor/league/flysystem-cached-adapter/src/CachedAdapter.php +++ /dev/null @@ -1,346 +0,0 @@ -<?php - -namespace League\Flysystem\Cached; - -use League\Flysystem\AdapterInterface; -use League\Flysystem\Config; - -class CachedAdapter implements AdapterInterface -{ - /** - * @var AdapterInterface - */ - private $adapter; - - /** - * @var CacheInterface - */ - private $cache; - - /** - * Constructor. - * - * @param AdapterInterface $adapter - * @param CacheInterface $cache - */ - public function __construct(AdapterInterface $adapter, CacheInterface $cache) - { - $this->adapter = $adapter; - $this->cache = $cache; - $this->cache->load(); - } - - /** - * Get the underlying Adapter implementation. - * - * @return AdapterInterface - */ - public function getAdapter() - { - return $this->adapter; - } - - /** - * Get the used Cache implementation. - * - * @return CacheInterface - */ - public function getCache() - { - return $this->cache; - } - - /** - * {@inheritdoc} - */ - public function write($path, $contents, Config $config) - { - $result = $this->adapter->write($path, $contents, $config); - - if ($result !== false) { - $result['type'] = 'file'; - $this->cache->updateObject($path, $result + compact('path', 'contents'), true); - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function writeStream($path, $resource, Config $config) - { - $result = $this->adapter->writeStream($path, $resource, $config); - - if ($result !== false) { - $result['type'] = 'file'; - $contents = false; - $this->cache->updateObject($path, $result + compact('path', 'contents'), true); - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function update($path, $contents, Config $config) - { - $result = $this->adapter->update($path, $contents, $config); - - if ($result !== false) { - $result['type'] = 'file'; - $this->cache->updateObject($path, $result + compact('path', 'contents'), true); - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function updateStream($path, $resource, Config $config) - { - $result = $this->adapter->updateStream($path, $resource, $config); - - if ($result !== false) { - $result['type'] = 'file'; - $contents = false; - $this->cache->updateObject($path, $result + compact('path', 'contents'), true); - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function rename($path, $newPath) - { - $result = $this->adapter->rename($path, $newPath); - - if ($result !== false) { - $this->cache->rename($path, $newPath); - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function copy($path, $newpath) - { - $result = $this->adapter->copy($path, $newpath); - - if ($result !== false) { - $this->cache->copy($path, $newpath); - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function delete($path) - { - $result = $this->adapter->delete($path); - - if ($result !== false) { - $this->cache->delete($path); - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function deleteDir($dirname) - { - $result = $this->adapter->deleteDir($dirname); - - if ($result !== false) { - $this->cache->deleteDir($dirname); - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function createDir($dirname, Config $config) - { - $result = $this->adapter->createDir($dirname, $config); - - if ($result !== false) { - $type = 'dir'; - $path = $dirname; - $this->cache->updateObject($dirname, compact('path', 'type'), true); - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function setVisibility($path, $visibility) - { - $result = $this->adapter->setVisibility($path, $visibility); - - if ($result !== false) { - $this->cache->updateObject($path, compact('path', 'visibility'), true); - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function has($path) - { - $cacheHas = $this->cache->has($path); - - if ($cacheHas !== null) { - return $cacheHas; - } - - $adapterResponse = $this->adapter->has($path); - - if (! $adapterResponse) { - $this->cache->storeMiss($path); - } else { - $cacheEntry = is_array($adapterResponse) ? $adapterResponse : compact('path'); - $this->cache->updateObject($path, $cacheEntry, true); - } - - return $adapterResponse; - } - - /** - * {@inheritdoc} - */ - public function read($path) - { - return $this->callWithFallback('contents', $path, 'read'); - } - - /** - * {@inheritdoc} - */ - public function readStream($path) - { - return $this->adapter->readStream($path); - } - - /** - * Get the path prefix. - * - * @return string|null path prefix or null if pathPrefix is empty - */ - public function getPathPrefix() - { - return $this->adapter->getPathPrefix(); - } - - /** - * Prefix a path. - * - * @param string $path - * - * @return string prefixed path - */ - public function applyPathPrefix($path) - { - return $this->adapter->applyPathPrefix($path); - } - - /** - * {@inheritdoc} - */ - public function listContents($directory = '', $recursive = false) - { - if ($this->cache->isComplete($directory, $recursive)) { - return $this->cache->listContents($directory, $recursive); - } - - $result = $this->adapter->listContents($directory, $recursive); - - if ($result !== false) { - $this->cache->storeContents($directory, $result, $recursive); - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function getMetadata($path) - { - return $this->callWithFallback(null, $path, 'getMetadata'); - } - - /** - * {@inheritdoc} - */ - public function getSize($path) - { - return $this->callWithFallback('size', $path, 'getSize'); - } - - /** - * {@inheritdoc} - */ - public function getMimetype($path) - { - return $this->callWithFallback('mimetype', $path, 'getMimetype'); - } - - /** - * {@inheritdoc} - */ - public function getTimestamp($path) - { - return $this->callWithFallback('timestamp', $path, 'getTimestamp'); - } - - /** - * {@inheritdoc} - */ - public function getVisibility($path) - { - return $this->callWithFallback('visibility', $path, 'getVisibility'); - } - - /** - * Call a method and cache the response. - * - * @param string $property - * @param string $path - * @param string $method - * - * @return mixed - */ - protected function callWithFallback($property, $path, $method) - { - $result = $this->cache->{$method}($path); - - if ($result !== false && ($property === null || array_key_exists($property, $result))) { - return $result; - } - - $result = $this->adapter->{$method}($path); - - if ($result) { - $object = $result + compact('path'); - $this->cache->updateObject($path, $object, true); - } - - return $result; - } -} diff --git a/vendor/league/flysystem-cached-adapter/src/Storage/AbstractCache.php b/vendor/league/flysystem-cached-adapter/src/Storage/AbstractCache.php deleted file mode 100644 index 141b468222..0000000000 --- a/vendor/league/flysystem-cached-adapter/src/Storage/AbstractCache.php +++ /dev/null @@ -1,418 +0,0 @@ -<?php - -namespace League\Flysystem\Cached\Storage; - -use League\Flysystem\Cached\CacheInterface; -use League\Flysystem\Util; - -abstract class AbstractCache implements CacheInterface -{ - /** - * @var bool - */ - protected $autosave = true; - - /** - * @var array - */ - protected $cache = []; - - /** - * @var array - */ - protected $complete = []; - - /** - * Destructor. - */ - public function __destruct() - { - if (! $this->autosave) { - $this->save(); - } - } - - /** - * Get the autosave setting. - * - * @return bool autosave - */ - public function getAutosave() - { - return $this->autosave; - } - - /** - * Get the autosave setting. - * - * @param bool $autosave - */ - public function setAutosave($autosave) - { - $this->autosave = $autosave; - } - - /** - * Store the contents listing. - * - * @param string $directory - * @param array $contents - * @param bool $recursive - * - * @return array contents listing - */ - public function storeContents($directory, array $contents, $recursive = false) - { - $directories = [$directory]; - - foreach ($contents as $object) { - $this->updateObject($object['path'], $object); - $object = $this->cache[$object['path']]; - - if ($recursive && $this->pathIsInDirectory($directory, $object['path'])) { - $directories[] = $object['dirname']; - } - } - - foreach (array_unique($directories) as $directory) { - $this->setComplete($directory, $recursive); - } - - $this->autosave(); - } - - /** - * Update the metadata for an object. - * - * @param string $path object path - * @param array $object object metadata - * @param bool $autosave whether to trigger the autosave routine - */ - public function updateObject($path, array $object, $autosave = false) - { - if (! $this->has($path)) { - $this->cache[$path] = Util::pathinfo($path); - } - - $this->cache[$path] = array_merge($this->cache[$path], $object); - - if ($autosave) { - $this->autosave(); - } - - $this->ensureParentDirectories($path); - } - - /** - * Store object hit miss. - * - * @param string $path - */ - public function storeMiss($path) - { - $this->cache[$path] = false; - $this->autosave(); - } - - /** - * Get the contents listing. - * - * @param string $dirname - * @param bool $recursive - * - * @return array contents listing - */ - public function listContents($dirname = '', $recursive = false) - { - $result = []; - - foreach ($this->cache as $object) { - if ($object === false) { - continue; - } - if ($object['dirname'] === $dirname) { - $result[] = $object; - } elseif ($recursive && $this->pathIsInDirectory($dirname, $object['path'])) { - $result[] = $object; - } - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function has($path) - { - if ($path !== false && array_key_exists($path, $this->cache)) { - return $this->cache[$path] !== false; - } - - if ($this->isComplete(Util::dirname($path), false)) { - return false; - } - } - - /** - * {@inheritdoc} - */ - public function read($path) - { - if (isset($this->cache[$path]['contents']) && $this->cache[$path]['contents'] !== false) { - return $this->cache[$path]; - } - - return false; - } - - /** - * {@inheritdoc} - */ - public function readStream($path) - { - return false; - } - - /** - * {@inheritdoc} - */ - public function rename($path, $newpath) - { - if ($this->has($path)) { - $object = $this->cache[$path]; - unset($this->cache[$path]); - $object['path'] = $newpath; - $object = array_merge($object, Util::pathinfo($newpath)); - $this->cache[$newpath] = $object; - $this->autosave(); - } - } - - /** - * {@inheritdoc} - */ - public function copy($path, $newpath) - { - if ($this->has($path)) { - $object = $this->cache[$path]; - $object = array_merge($object, Util::pathinfo($newpath)); - $this->updateObject($newpath, $object, true); - } - } - - /** - * {@inheritdoc} - */ - public function delete($path) - { - $this->storeMiss($path); - } - - /** - * {@inheritdoc} - */ - public function deleteDir($dirname) - { - foreach ($this->cache as $path => $object) { - if ($this->pathIsInDirectory($dirname, $path) || $path === $dirname) { - unset($this->cache[$path]); - } - } - - unset($this->complete[$dirname]); - - $this->autosave(); - } - - /** - * {@inheritdoc} - */ - public function getMimetype($path) - { - if (isset($this->cache[$path]['mimetype'])) { - return $this->cache[$path]; - } - - if (! $result = $this->read($path)) { - return false; - } - - $mimetype = Util::guessMimeType($path, $result['contents']); - $this->cache[$path]['mimetype'] = $mimetype; - - return $this->cache[$path]; - } - - /** - * {@inheritdoc} - */ - public function getSize($path) - { - if (isset($this->cache[$path]['size'])) { - return $this->cache[$path]; - } - - return false; - } - - /** - * {@inheritdoc} - */ - public function getTimestamp($path) - { - if (isset($this->cache[$path]['timestamp'])) { - return $this->cache[$path]; - } - - return false; - } - - /** - * {@inheritdoc} - */ - public function getVisibility($path) - { - if (isset($this->cache[$path]['visibility'])) { - return $this->cache[$path]; - } - - return false; - } - - /** - * {@inheritdoc} - */ - public function getMetadata($path) - { - if (isset($this->cache[$path]['type'])) { - return $this->cache[$path]; - } - - return false; - } - - /** - * {@inheritdoc} - */ - public function isComplete($dirname, $recursive) - { - if (! array_key_exists($dirname, $this->complete)) { - return false; - } - - if ($recursive && $this->complete[$dirname] !== 'recursive') { - return false; - } - - return true; - } - - /** - * {@inheritdoc} - */ - public function setComplete($dirname, $recursive) - { - $this->complete[$dirname] = $recursive ? 'recursive' : true; - } - - /** - * Filter the contents from a listing. - * - * @param array $contents object listing - * - * @return array filtered contents - */ - public function cleanContents(array $contents) - { - $cachedProperties = array_flip([ - 'path', 'dirname', 'basename', 'extension', 'filename', - 'size', 'mimetype', 'visibility', 'timestamp', 'type', - 'md5', - ]); - - foreach ($contents as $path => $object) { - if (is_array($object)) { - $contents[$path] = array_intersect_key($object, $cachedProperties); - } - } - - return $contents; - } - - /** - * {@inheritdoc} - */ - public function flush() - { - $this->cache = []; - $this->complete = []; - $this->autosave(); - } - - /** - * {@inheritdoc} - */ - public function autosave() - { - if ($this->autosave) { - $this->save(); - } - } - - /** - * Retrieve serialized cache data. - * - * @return string serialized data - */ - public function getForStorage() - { - $cleaned = $this->cleanContents($this->cache); - - return json_encode([$cleaned, $this->complete]); - } - - /** - * Load from serialized cache data. - * - * @param string $json - */ - public function setFromStorage($json) - { - list($cache, $complete) = json_decode($json, true); - - if (json_last_error() === JSON_ERROR_NONE && is_array($cache) && is_array($complete)) { - $this->cache = $cache; - $this->complete = $complete; - } - } - - /** - * Ensure parent directories of an object. - * - * @param string $path object path - */ - public function ensureParentDirectories($path) - { - $object = $this->cache[$path]; - - while ($object['dirname'] !== '' && ! isset($this->cache[$object['dirname']])) { - $object = Util::pathinfo($object['dirname']); - $object['type'] = 'dir'; - $this->cache[$object['path']] = $object; - } - } - - /** - * Determines if the path is inside the directory. - * - * @param string $directory - * @param string $path - * - * @return bool - */ - protected function pathIsInDirectory($directory, $path) - { - return $directory === '' || strpos($path, $directory . '/') === 0; - } -} diff --git a/vendor/league/flysystem-cached-adapter/src/Storage/Adapter.php b/vendor/league/flysystem-cached-adapter/src/Storage/Adapter.php deleted file mode 100644 index 649a60e3b8..0000000000 --- a/vendor/league/flysystem-cached-adapter/src/Storage/Adapter.php +++ /dev/null @@ -1,115 +0,0 @@ -<?php - -namespace League\Flysystem\Cached\Storage; - -use League\Flysystem\AdapterInterface; -use League\Flysystem\Config; - -class Adapter extends AbstractCache -{ - /** - * @var AdapterInterface An adapter - */ - protected $adapter; - - /** - * @var string the file to cache to - */ - protected $file; - - /** - * @var int|null seconds until cache expiration - */ - protected $expire = null; - - /** - * Constructor. - * - * @param AdapterInterface $adapter adapter - * @param string $file the file to cache to - * @param int|null $expire seconds until cache expiration - */ - public function __construct(AdapterInterface $adapter, $file, $expire = null) - { - $this->adapter = $adapter; - $this->file = $file; - $this->setExpire($expire); - } - - /** - * Set the expiration time in seconds. - * - * @param int $expire relative expiration time - */ - protected function setExpire($expire) - { - if ($expire) { - $this->expire = $this->getTime($expire); - } - } - - /** - * Get expiration time in seconds. - * - * @param int $time relative expiration time - * - * @return int actual expiration time - */ - protected function getTime($time = 0) - { - return intval(microtime(true)) + $time; - } - - /** - * {@inheritdoc} - */ - public function setFromStorage($json) - { - list($cache, $complete, $expire) = json_decode($json, true); - - if (! $expire || $expire > $this->getTime()) { - $this->cache = is_array($cache) ? $cache : []; - $this->complete = is_array($complete) ? $complete : []; - } else { - $this->adapter->delete($this->file); - } - } - - /** - * {@inheritdoc} - */ - public function load() - { - if ($this->adapter->has($this->file)) { - $file = $this->adapter->read($this->file); - if ($file && !empty($file['contents'])) { - $this->setFromStorage($file['contents']); - } - } - } - - /** - * {@inheritdoc} - */ - public function getForStorage() - { - $cleaned = $this->cleanContents($this->cache); - - return json_encode([$cleaned, $this->complete, $this->expire]); - } - - /** - * {@inheritdoc} - */ - public function save() - { - $config = new Config(); - $contents = $this->getForStorage(); - - if ($this->adapter->has($this->file)) { - $this->adapter->update($this->file, $contents, $config); - } else { - $this->adapter->write($this->file, $contents, $config); - } - } -} diff --git a/vendor/league/flysystem-cached-adapter/src/Storage/Memcached.php b/vendor/league/flysystem-cached-adapter/src/Storage/Memcached.php deleted file mode 100644 index f67d2717a0..0000000000 --- a/vendor/league/flysystem-cached-adapter/src/Storage/Memcached.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php - -namespace League\Flysystem\Cached\Storage; - -use Memcached as NativeMemcached; - -class Memcached extends AbstractCache -{ - /** - * @var string storage key - */ - protected $key; - - /** - * @var int|null seconds until cache expiration - */ - protected $expire; - - /** - * @var \Memcached Memcached instance - */ - protected $memcached; - - /** - * Constructor. - * - * @param \Memcached $memcached - * @param string $key storage key - * @param int|null $expire seconds until cache expiration - */ - public function __construct(NativeMemcached $memcached, $key = 'flysystem', $expire = null) - { - $this->key = $key; - $this->expire = $expire; - $this->memcached = $memcached; - } - - /** - * {@inheritdoc} - */ - public function load() - { - $contents = $this->memcached->get($this->key); - - if ($contents !== false) { - $this->setFromStorage($contents); - } - } - - /** - * {@inheritdoc} - */ - public function save() - { - $contents = $this->getForStorage(); - $expiration = $this->expire === null ? 0 : time() + $this->expire; - $this->memcached->set($this->key, $contents, $expiration); - } -} diff --git a/vendor/league/flysystem-cached-adapter/src/Storage/Memory.php b/vendor/league/flysystem-cached-adapter/src/Storage/Memory.php deleted file mode 100644 index d0914fabd9..0000000000 --- a/vendor/league/flysystem-cached-adapter/src/Storage/Memory.php +++ /dev/null @@ -1,22 +0,0 @@ -<?php - -namespace League\Flysystem\Cached\Storage; - -class Memory extends AbstractCache -{ - /** - * {@inheritdoc} - */ - public function save() - { - // There is nothing to save - } - - /** - * {@inheritdoc} - */ - public function load() - { - // There is nothing to load - } -} diff --git a/vendor/league/flysystem-cached-adapter/src/Storage/Noop.php b/vendor/league/flysystem-cached-adapter/src/Storage/Noop.php deleted file mode 100644 index ff996e070c..0000000000 --- a/vendor/league/flysystem-cached-adapter/src/Storage/Noop.php +++ /dev/null @@ -1,171 +0,0 @@ -<?php - -namespace League\Flysystem\Cached\Storage; - -class Noop extends AbstractCache -{ - /** - * {@inheritdoc} - */ - protected $autosave = false; - - /** - * {@inheritdoc} - */ - public function updateObject($path, array $object, $autosave = false) - { - return $object; - } - - /** - * {@inheritdoc} - */ - public function isComplete($dirname, $recursive) - { - return false; - } - - /** - * {@inheritdoc} - */ - public function setComplete($dirname, $recursive) - { - // - } - - /** - * {@inheritdoc} - */ - public function copy($path, $newpath) - { - return false; - } - - /** - * {@inheritdoc} - */ - public function rename($path, $newpath) - { - return false; - } - - /** - * {@inheritdoc} - */ - public function storeContents($directory, array $contents, $recursive = false) - { - return $contents; - } - - /** - * {@inheritdoc} - */ - public function storeMiss($path) - { - return $this; - } - - /** - * {@inheritdoc} - */ - public function flush() - { - // - } - - /** - * {@inheritdoc} - */ - public function autosave() - { - // - } - - /** - * {@inheritdoc} - */ - public function save() - { - // - } - - /** - * {@inheritdoc} - */ - public function load() - { - // - } - - /** - * {@inheritdoc} - */ - public function has($path) - { - return; - } - - /** - * {@inheritdoc} - */ - public function read($path) - { - return false; - } - - /** - * {@inheritdoc} - */ - public function readStream($path) - { - return false; - } - - /** - * {@inheritdoc} - */ - public function listContents($directory = '', $recursive = false) - { - return []; - } - - /** - * {@inheritdoc} - */ - public function getMetadata($path) - { - return false; - } - - /** - * {@inheritdoc} - */ - public function getSize($path) - { - return false; - } - - /** - * {@inheritdoc} - */ - public function getMimetype($path) - { - return false; - } - - /** - * {@inheritdoc} - */ - public function getTimestamp($path) - { - return false; - } - - /** - * {@inheritdoc} - */ - public function getVisibility($path) - { - return false; - } -} diff --git a/vendor/league/flysystem-cached-adapter/src/Storage/PhpRedis.php b/vendor/league/flysystem-cached-adapter/src/Storage/PhpRedis.php deleted file mode 100644 index 4530b141e7..0000000000 --- a/vendor/league/flysystem-cached-adapter/src/Storage/PhpRedis.php +++ /dev/null @@ -1,62 +0,0 @@ -<?php - -namespace League\Flysystem\Cached\Storage; - -use Redis; - -class PhpRedis extends AbstractCache -{ - /** - * @var Redis PhpRedis Client - */ - protected $client; - - /** - * @var string storage key - */ - protected $key; - - /** - * @var int|null seconds until cache expiration - */ - protected $expire; - - /** - * Constructor. - * - * @param Redis|null $client phpredis client - * @param string $key storage key - * @param int|null $expire seconds until cache expiration - */ - public function __construct(Redis $client = null, $key = 'flysystem', $expire = null) - { - $this->client = $client ?: new Redis(); - $this->key = $key; - $this->expire = $expire; - } - - /** - * {@inheritdoc} - */ - public function load() - { - $contents = $this->client->get($this->key); - - if ($contents !== false) { - $this->setFromStorage($contents); - } - } - - /** - * {@inheritdoc} - */ - public function save() - { - $contents = $this->getForStorage(); - $this->client->set($this->key, $contents); - - if ($this->expire !== null) { - $this->client->expire($this->key, $this->expire); - } - } -} diff --git a/vendor/league/flysystem-cached-adapter/src/Storage/Predis.php b/vendor/league/flysystem-cached-adapter/src/Storage/Predis.php deleted file mode 100644 index 8a295744bf..0000000000 --- a/vendor/league/flysystem-cached-adapter/src/Storage/Predis.php +++ /dev/null @@ -1,75 +0,0 @@ -<?php - -namespace League\Flysystem\Cached\Storage; - -use Predis\Client; - -class Predis extends AbstractCache -{ - /** - * @var \Predis\Client Predis Client - */ - protected $client; - - /** - * @var string storage key - */ - protected $key; - - /** - * @var int|null seconds until cache expiration - */ - protected $expire; - - /** - * Constructor. - * - * @param \Predis\Client $client predis client - * @param string $key storage key - * @param int|null $expire seconds until cache expiration - */ - public function __construct(Client $client = null, $key = 'flysystem', $expire = null) - { - $this->client = $client ?: new Client(); - $this->key = $key; - $this->expire = $expire; - } - - /** - * {@inheritdoc} - */ - public function load() - { - if (($contents = $this->executeCommand('get', [$this->key])) !== null) { - $this->setFromStorage($contents); - } - } - - /** - * {@inheritdoc} - */ - public function save() - { - $contents = $this->getForStorage(); - $this->executeCommand('set', [$this->key, $contents]); - - if ($this->expire !== null) { - $this->executeCommand('expire', [$this->key, $this->expire]); - } - } - - /** - * Execute a Predis command. - * - * @param string $name - * @param array $arguments - * - * @return string - */ - protected function executeCommand($name, array $arguments) - { - $command = $this->client->createCommand($name, $arguments); - - return $this->client->executeCommand($command); - } -} diff --git a/vendor/league/flysystem-cached-adapter/src/Storage/Psr6Cache.php b/vendor/league/flysystem-cached-adapter/src/Storage/Psr6Cache.php deleted file mode 100644 index 43be87e539..0000000000 --- a/vendor/league/flysystem-cached-adapter/src/Storage/Psr6Cache.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php - -namespace League\Flysystem\Cached\Storage; - -use Psr\Cache\CacheItemPoolInterface; - -class Psr6Cache extends AbstractCache -{ - /** - * @var CacheItemPoolInterface - */ - private $pool; - - /** - * @var string storage key - */ - protected $key; - - /** - * @var int|null seconds until cache expiration - */ - protected $expire; - - /** - * Constructor. - * - * @param CacheItemPoolInterface $pool - * @param string $key storage key - * @param int|null $expire seconds until cache expiration - */ - public function __construct(CacheItemPoolInterface $pool, $key = 'flysystem', $expire = null) - { - $this->pool = $pool; - $this->key = $key; - $this->expire = $expire; - } - - /** - * {@inheritdoc} - */ - public function save() - { - $item = $this->pool->getItem($this->key); - $item->set($this->getForStorage()); - $item->expiresAfter($this->expire); - $this->pool->save($item); - } - - /** - * {@inheritdoc} - */ - public function load() - { - $item = $this->pool->getItem($this->key); - if ($item->isHit()) { - $this->setFromStorage($item->get()); - } - } -}
\ No newline at end of file diff --git a/vendor/league/flysystem-cached-adapter/src/Storage/Stash.php b/vendor/league/flysystem-cached-adapter/src/Storage/Stash.php deleted file mode 100644 index e05b832281..0000000000 --- a/vendor/league/flysystem-cached-adapter/src/Storage/Stash.php +++ /dev/null @@ -1,60 +0,0 @@ -<?php - -namespace League\Flysystem\Cached\Storage; - -use Stash\Pool; - -class Stash extends AbstractCache -{ - /** - * @var string storage key - */ - protected $key; - - /** - * @var int|null seconds until cache expiration - */ - protected $expire; - - /** - * @var \Stash\Pool Stash pool instance - */ - protected $pool; - - /** - * Constructor. - * - * @param \Stash\Pool $pool - * @param string $key storage key - * @param int|null $expire seconds until cache expiration - */ - public function __construct(Pool $pool, $key = 'flysystem', $expire = null) - { - $this->key = $key; - $this->expire = $expire; - $this->pool = $pool; - } - - /** - * {@inheritdoc} - */ - public function load() - { - $item = $this->pool->getItem($this->key); - $contents = $item->get(); - - if ($item->isMiss() === false) { - $this->setFromStorage($contents); - } - } - - /** - * {@inheritdoc} - */ - public function save() - { - $contents = $this->getForStorage(); - $item = $this->pool->getItem($this->key); - $item->set($contents, $this->expire); - } -} diff --git a/vendor/league/flysystem-cached-adapter/tests/AdapterCacheTests.php b/vendor/league/flysystem-cached-adapter/tests/AdapterCacheTests.php deleted file mode 100644 index b63cba788c..0000000000 --- a/vendor/league/flysystem-cached-adapter/tests/AdapterCacheTests.php +++ /dev/null @@ -1,104 +0,0 @@ -<?php - -use League\Flysystem\Cached\Storage\Adapter; -use PHPUnit\Framework\TestCase; - -class AdapterCacheTests extends TestCase -{ - public function testLoadFail() - { - $adapter = Mockery::mock('League\Flysystem\AdapterInterface'); - $adapter->shouldReceive('has')->once()->with('file.json')->andReturn(false); - $cache = new Adapter($adapter, 'file.json', 10); - $cache->load(); - $this->assertFalse($cache->isComplete('', false)); - } - - public function testLoadExpired() - { - $response = ['contents' => json_encode([[], ['' => true], 1234567890]), 'path' => 'file.json']; - $adapter = Mockery::mock('League\Flysystem\AdapterInterface'); - $adapter->shouldReceive('has')->once()->with('file.json')->andReturn(true); - $adapter->shouldReceive('read')->once()->with('file.json')->andReturn($response); - $adapter->shouldReceive('delete')->once()->with('file.json'); - $cache = new Adapter($adapter, 'file.json', 10); - $cache->load(); - $this->assertFalse($cache->isComplete('', false)); - } - - public function testLoadSuccess() - { - $response = ['contents' => json_encode([[], ['' => true], 9876543210]), 'path' => 'file.json']; - $adapter = Mockery::mock('League\Flysystem\AdapterInterface'); - $adapter->shouldReceive('has')->once()->with('file.json')->andReturn(true); - $adapter->shouldReceive('read')->once()->with('file.json')->andReturn($response); - $cache = new Adapter($adapter, 'file.json', 10); - $cache->load(); - $this->assertTrue($cache->isComplete('', false)); - } - - public function testSaveExists() - { - $response = json_encode([[], [], null]); - $adapter = Mockery::mock('League\Flysystem\AdapterInterface'); - $adapter->shouldReceive('has')->once()->with('file.json')->andReturn(true); - $adapter->shouldReceive('update')->once()->with('file.json', $response, Mockery::any()); - $cache = new Adapter($adapter, 'file.json', null); - $cache->save(); - } - - public function testSaveNew() - { - $response = json_encode([[], [], null]); - $adapter = Mockery::mock('League\Flysystem\AdapterInterface'); - $adapter->shouldReceive('has')->once()->with('file.json')->andReturn(false); - $adapter->shouldReceive('write')->once()->with('file.json', $response, Mockery::any()); - $cache = new Adapter($adapter, 'file.json', null); - $cache->save(); - } - - public function testStoreContentsRecursive() - { - $adapter = Mockery::mock('League\Flysystem\AdapterInterface'); - $adapter->shouldReceive('has')->once()->with('file.json')->andReturn(false); - $adapter->shouldReceive('write')->once()->with('file.json', Mockery::any(), Mockery::any()); - - $cache = new Adapter($adapter, 'file.json', null); - - $contents = [ - ['path' => 'foo/bar', 'dirname' => 'foo'], - ['path' => 'afoo/bang', 'dirname' => 'afoo'], - ]; - - $cache->storeContents('foo', $contents, true); - - $this->assertTrue($cache->isComplete('foo', true)); - $this->assertFalse($cache->isComplete('afoo', true)); - } - - public function testDeleteDir() - { - $cache_data = [ - 'foo' => ['path' => 'foo', 'type' => 'dir', 'dirname' => ''], - 'foo/bar' => ['path' => 'foo/bar', 'type' => 'file', 'dirname' => 'foo'], - 'foobaz' => ['path' => 'foobaz', 'type' => 'file', 'dirname' => ''], - ]; - - $response = [ - 'contents' => json_encode([$cache_data, [], null]), - 'path' => 'file.json', - ]; - - $adapter = Mockery::mock('League\Flysystem\AdapterInterface'); - $adapter->shouldReceive('has')->zeroOrMoreTimes()->with('file.json')->andReturn(true); - $adapter->shouldReceive('read')->once()->with('file.json')->andReturn($response); - $adapter->shouldReceive('update')->once()->with('file.json', Mockery::any(), Mockery::any())->andReturn(true); - - $cache = new Adapter($adapter, 'file.json', null); - $cache->load(); - - $cache->deleteDir('foo', true); - - $this->assertSame(1, count($cache->listContents('', true))); - } -} diff --git a/vendor/league/flysystem-cached-adapter/tests/InspectionTests.php b/vendor/league/flysystem-cached-adapter/tests/InspectionTests.php deleted file mode 100644 index 40d4c915ee..0000000000 --- a/vendor/league/flysystem-cached-adapter/tests/InspectionTests.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -use League\Flysystem\Cached\CachedAdapter; -use PHPUnit\Framework\TestCase; - -class InspectionTests extends TestCase { - - public function testGetAdapter() - { - $adapter = Mockery::mock('League\Flysystem\AdapterInterface'); - $cache = Mockery::mock('League\Flysystem\Cached\CacheInterface'); - $cache->shouldReceive('load')->once(); - $cached_adapter = new CachedAdapter($adapter, $cache); - $this->assertInstanceOf('League\Flysystem\AdapterInterface', $cached_adapter->getAdapter()); - } -} diff --git a/vendor/league/flysystem-cached-adapter/tests/MemcachedTests.php b/vendor/league/flysystem-cached-adapter/tests/MemcachedTests.php deleted file mode 100644 index e3d9ad939b..0000000000 --- a/vendor/league/flysystem-cached-adapter/tests/MemcachedTests.php +++ /dev/null @@ -1,35 +0,0 @@ -<?php - -use League\Flysystem\Cached\Storage\Memcached; -use PHPUnit\Framework\TestCase; - -class MemcachedTests extends TestCase -{ - public function testLoadFail() - { - $client = Mockery::mock('Memcached'); - $client->shouldReceive('get')->once()->andReturn(false); - $cache = new Memcached($client); - $cache->load(); - $this->assertFalse($cache->isComplete('', false)); - } - - public function testLoadSuccess() - { - $response = json_encode([[], ['' => true]]); - $client = Mockery::mock('Memcached'); - $client->shouldReceive('get')->once()->andReturn($response); - $cache = new Memcached($client); - $cache->load(); - $this->assertTrue($cache->isComplete('', false)); - } - - public function testSave() - { - $response = json_encode([[], []]); - $client = Mockery::mock('Memcached'); - $client->shouldReceive('set')->once()->andReturn($response); - $cache = new Memcached($client); - $cache->save(); - } -} diff --git a/vendor/league/flysystem-cached-adapter/tests/MemoryCacheTests.php b/vendor/league/flysystem-cached-adapter/tests/MemoryCacheTests.php deleted file mode 100644 index 3ac58fd08c..0000000000 --- a/vendor/league/flysystem-cached-adapter/tests/MemoryCacheTests.php +++ /dev/null @@ -1,255 +0,0 @@ -<?php - -use League\Flysystem\Cached\Storage\Memory; -use League\Flysystem\Util; -use PHPUnit\Framework\TestCase; - -class MemoryCacheTests extends TestCase -{ - public function testAutosave() - { - $cache = new Memory(); - $cache->setAutosave(true); - $this->assertTrue($cache->getAutosave()); - $cache->setAutosave(false); - $this->assertFalse($cache->getAutosave()); - } - - public function testCacheMiss() - { - $cache = new Memory(); - $cache->storeMiss('path.txt'); - $this->assertFalse($cache->has('path.txt')); - } - - public function testIsComplete() - { - $cache = new Memory(); - $this->assertFalse($cache->isComplete('dirname', false)); - $cache->setComplete('dirname', false); - $this->assertFalse($cache->isComplete('dirname', true)); - $cache->setComplete('dirname', true); - $this->assertTrue($cache->isComplete('dirname', true)); - } - - public function testCleanContents() - { - $cache = new Memory(); - $input = [[ - 'path' => 'path.txt', - 'visibility' => 'public', - 'invalid' => 'thing', - ]]; - - $expected = [[ - 'path' => 'path.txt', - 'visibility' => 'public', - ]]; - - $output = $cache->cleanContents($input); - $this->assertEquals($expected, $output); - } - - public function testGetForStorage() - { - $cache = new Memory(); - $input = [[ - 'path' => 'path.txt', - 'visibility' => 'public', - 'type' => 'file', - ]]; - - $cache->storeContents('', $input, true); - $contents = $cache->listContents('', true); - $cached = []; - foreach ($contents as $item) { - $cached[$item['path']] = $item; - } - - $this->assertEquals(json_encode([$cached, ['' => 'recursive']]), $cache->getForStorage()); - } - - public function testParentCompleteIsUsedDuringHas() - { - $cache = new Memory(); - $cache->setComplete('dirname', false); - $this->assertFalse($cache->has('dirname/path.txt')); - } - - public function testFlush() - { - $cache = new Memory(); - $cache->setComplete('dirname', true); - $cache->updateObject('path.txt', [ - 'path' => 'path.txt', - 'visibility' => 'public', - ]); - $cache->flush(); - $this->assertFalse($cache->isComplete('dirname', true)); - $this->assertNull($cache->has('path.txt')); - } - - public function testSetFromStorage() - { - $cache = new Memory(); - $json = [[ - 'path.txt' => ['path' => 'path.txt', 'type' => 'file'], - ], ['dirname' => 'recursive']]; - $jsonString = json_encode($json); - $cache->setFromStorage($jsonString); - $this->assertTrue($cache->has('path.txt')); - $this->assertTrue($cache->isComplete('dirname', true)); - } - - public function testGetMetadataFail() - { - $cache = new Memory(); - $this->assertFalse($cache->getMetadata('path.txt')); - } - - public function metaGetterProvider() - { - return [ - ['getTimestamp', 'timestamp', 12344], - ['getMimetype', 'mimetype', 'text/plain'], - ['getSize', 'size', 12], - ['getVisibility', 'visibility', 'private'], - ['read', 'contents', '__contents__'], - ]; - } - - /** - * @dataProvider metaGetterProvider - * - * @param $method - * @param $key - * @param $value - */ - public function testMetaGetters($method, $key, $value) - { - $cache = new Memory(); - $this->assertFalse($cache->{$method}('path.txt')); - $cache->updateObject('path.txt', $object = [ - 'path' => 'path.txt', - 'type' => 'file', - $key => $value, - ] + Util::pathinfo('path.txt'), true); - $this->assertEquals($object, $cache->{$method}('path.txt')); - $this->assertEquals($object, $cache->getMetadata('path.txt')); - } - - public function testGetDerivedMimetype() - { - $cache = new Memory(); - $cache->updateObject('path.txt', [ - 'contents' => 'something', - ]); - $response = $cache->getMimetype('path.txt'); - $this->assertEquals('text/plain', $response['mimetype']); - } - - public function testCopyFail() - { - $cache = new Memory(); - $cache->copy('one', 'two'); - $this->assertNull($cache->has('two')); - $this->assertNull($cache->load()); - } - - public function testStoreContents() - { - $cache = new Memory(); - $cache->storeContents('dirname', [ - ['path' => 'dirname', 'type' => 'dir'], - ['path' => 'dirname/nested', 'type' => 'dir'], - ['path' => 'dirname/nested/deep', 'type' => 'dir'], - ['path' => 'other/nested/deep', 'type' => 'dir'], - ], true); - - $this->isTrue($cache->isComplete('other/nested', true)); - } - - public function testDelete() - { - $cache = new Memory(); - $cache->updateObject('path.txt', ['type' => 'file']); - $this->assertTrue($cache->has('path.txt')); - $cache->delete('path.txt'); - $this->assertFalse($cache->has('path.txt')); - } - - public function testDeleteDir() - { - $cache = new Memory(); - $cache->storeContents('dirname', [ - ['path' => 'dirname/path.txt', 'type' => 'file'], - ]); - $this->assertTrue($cache->isComplete('dirname', false)); - $this->assertTrue($cache->has('dirname/path.txt')); - $cache->deleteDir('dirname'); - $this->assertFalse($cache->isComplete('dirname', false)); - $this->assertNull($cache->has('dirname/path.txt')); - } - - public function testReadStream() - { - $cache = new Memory(); - $this->assertFalse($cache->readStream('path.txt')); - } - - public function testRename() - { - $cache = new Memory(); - $cache->updateObject('path.txt', ['type' => 'file']); - $cache->rename('path.txt', 'newpath.txt'); - $this->assertTrue($cache->has('newpath.txt')); - } - - public function testCopy() - { - $cache = new Memory(); - $cache->updateObject('path.txt', ['type' => 'file']); - $cache->copy('path.txt', 'newpath.txt'); - $this->assertTrue($cache->has('newpath.txt')); - } - - public function testComplextListContents() - { - $cache = new Memory(); - $cache->storeContents('', [ - ['path' => 'dirname', 'type' => 'dir'], - ['path' => 'dirname/file.txt', 'type' => 'file'], - ['path' => 'other', 'type' => 'dir'], - ['path' => 'other/file.txt', 'type' => 'file'], - ['path' => 'other/nested/file.txt', 'type' => 'file'], - ]); - - $this->assertCount(3, $cache->listContents('other', true)); - } - - public function testComplextListContentsWithDeletedFile() - { - $cache = new Memory(); - $cache->storeContents('', [ - ['path' => 'dirname', 'type' => 'dir'], - ['path' => 'dirname/file.txt', 'type' => 'file'], - ['path' => 'other', 'type' => 'dir'], - ['path' => 'other/file.txt', 'type' => 'file'], - ['path' => 'other/another_file.txt', 'type' => 'file'], - ]); - - $cache->delete('other/another_file.txt'); - $this->assertCount(4, $cache->listContents('', true)); - } - - public function testCacheMissIfContentsIsFalse() - { - $cache = new Memory(); - $cache->updateObject('path.txt', [ - 'path' => 'path.txt', - 'contents' => false, - ], true); - - $this->assertFalse($cache->read('path.txt')); - } -} diff --git a/vendor/league/flysystem-cached-adapter/tests/NoopCacheTests.php b/vendor/league/flysystem-cached-adapter/tests/NoopCacheTests.php deleted file mode 100644 index 148616ff12..0000000000 --- a/vendor/league/flysystem-cached-adapter/tests/NoopCacheTests.php +++ /dev/null @@ -1,35 +0,0 @@ -<?php - -use League\Flysystem\Cached\Storage\Noop; -use PHPUnit\Framework\TestCase; - -class NoopCacheTests extends TestCase -{ - public function testNoop() - { - $cache = new Noop(); - $this->assertEquals($cache, $cache->storeMiss('file.txt')); - $this->assertNull($cache->setComplete('', false)); - $this->assertNull($cache->load()); - $this->assertNull($cache->flush()); - $this->assertNull($cache->has('path.txt')); - $this->assertNull($cache->autosave()); - $this->assertFalse($cache->isComplete('', false)); - $this->assertFalse($cache->read('something')); - $this->assertFalse($cache->readStream('something')); - $this->assertFalse($cache->getMetadata('something')); - $this->assertFalse($cache->getMimetype('something')); - $this->assertFalse($cache->getSize('something')); - $this->assertFalse($cache->getTimestamp('something')); - $this->assertFalse($cache->getVisibility('something')); - $this->assertEmpty($cache->listContents('', false)); - $this->assertFalse($cache->rename('', '')); - $this->assertFalse($cache->copy('', '')); - $this->assertNull($cache->save()); - $object = ['path' => 'path.ext']; - $this->assertEquals($object, $cache->updateObject('path.txt', $object)); - $this->assertEquals([['path' => 'some/file.txt']], $cache->storeContents('unknwon', [ - ['path' => 'some/file.txt'], - ], false)); - } -} diff --git a/vendor/league/flysystem-cached-adapter/tests/PhpRedisTests.php b/vendor/league/flysystem-cached-adapter/tests/PhpRedisTests.php deleted file mode 100644 index d1ccb65452..0000000000 --- a/vendor/league/flysystem-cached-adapter/tests/PhpRedisTests.php +++ /dev/null @@ -1,45 +0,0 @@ -<?php - -use League\Flysystem\Cached\Storage\PhpRedis; -use PHPUnit\Framework\TestCase; - -class PhpRedisTests extends TestCase -{ - public function testLoadFail() - { - $client = Mockery::mock('Redis'); - $client->shouldReceive('get')->with('flysystem')->once()->andReturn(false); - $cache = new PhpRedis($client); - $cache->load(); - $this->assertFalse($cache->isComplete('', false)); - } - - public function testLoadSuccess() - { - $response = json_encode([[], ['' => true]]); - $client = Mockery::mock('Redis'); - $client->shouldReceive('get')->with('flysystem')->once()->andReturn($response); - $cache = new PhpRedis($client); - $cache->load(); - $this->assertTrue($cache->isComplete('', false)); - } - - public function testSave() - { - $data = json_encode([[], []]); - $client = Mockery::mock('Redis'); - $client->shouldReceive('set')->with('flysystem', $data)->once(); - $cache = new PhpRedis($client); - $cache->save(); - } - - public function testSaveWithExpire() - { - $data = json_encode([[], []]); - $client = Mockery::mock('Redis'); - $client->shouldReceive('set')->with('flysystem', $data)->once(); - $client->shouldReceive('expire')->with('flysystem', 20)->once(); - $cache = new PhpRedis($client, 'flysystem', 20); - $cache->save(); - } -} diff --git a/vendor/league/flysystem-cached-adapter/tests/PredisTests.php b/vendor/league/flysystem-cached-adapter/tests/PredisTests.php deleted file mode 100644 index e33e10468e..0000000000 --- a/vendor/league/flysystem-cached-adapter/tests/PredisTests.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php - -use League\Flysystem\Cached\Storage\Predis; -use PHPUnit\Framework\TestCase; - -class PredisTests extends TestCase -{ - public function testLoadFail() - { - $client = Mockery::mock('Predis\Client'); - $command = Mockery::mock('Predis\Command\CommandInterface'); - $client->shouldReceive('createCommand')->with('get', ['flysystem'])->once()->andReturn($command); - $client->shouldReceive('executeCommand')->with($command)->andReturn(null); - $cache = new Predis($client); - $cache->load(); - $this->assertFalse($cache->isComplete('', false)); - } - - public function testLoadSuccess() - { - $response = json_encode([[], ['' => true]]); - $client = Mockery::mock('Predis\Client'); - $command = Mockery::mock('Predis\Command\CommandInterface'); - $client->shouldReceive('createCommand')->with('get', ['flysystem'])->once()->andReturn($command); - $client->shouldReceive('executeCommand')->with($command)->andReturn($response); - $cache = new Predis($client); - $cache->load(); - $this->assertTrue($cache->isComplete('', false)); - } - - public function testSave() - { - $data = json_encode([[], []]); - $client = Mockery::mock('Predis\Client'); - $command = Mockery::mock('Predis\Command\CommandInterface'); - $client->shouldReceive('createCommand')->with('set', ['flysystem', $data])->once()->andReturn($command); - $client->shouldReceive('executeCommand')->with($command)->once(); - $cache = new Predis($client); - $cache->save(); - } - - public function testSaveWithExpire() - { - $data = json_encode([[], []]); - $client = Mockery::mock('Predis\Client'); - $command = Mockery::mock('Predis\Command\CommandInterface'); - $client->shouldReceive('createCommand')->with('set', ['flysystem', $data])->once()->andReturn($command); - $client->shouldReceive('executeCommand')->with($command)->once(); - $expireCommand = Mockery::mock('Predis\Command\CommandInterface'); - $client->shouldReceive('createCommand')->with('expire', ['flysystem', 20])->once()->andReturn($expireCommand); - $client->shouldReceive('executeCommand')->with($expireCommand)->once(); - $cache = new Predis($client, 'flysystem', 20); - $cache->save(); - } -} diff --git a/vendor/league/flysystem-cached-adapter/tests/Psr6CacheTest.php b/vendor/league/flysystem-cached-adapter/tests/Psr6CacheTest.php deleted file mode 100644 index d5e5700cfc..0000000000 --- a/vendor/league/flysystem-cached-adapter/tests/Psr6CacheTest.php +++ /dev/null @@ -1,45 +0,0 @@ -<?php - -use League\Flysystem\Cached\Storage\Psr6Cache; -use PHPUnit\Framework\TestCase; - -class Psr6CacheTests extends TestCase -{ - public function testLoadFail() - { - $pool = Mockery::mock('Psr\Cache\CacheItemPoolInterface'); - $item = Mockery::mock('Psr\Cache\CacheItemInterface'); - $item->shouldReceive('isHit')->once()->andReturn(false); - $pool->shouldReceive('getItem')->once()->andReturn($item); - $cache = new Psr6Cache($pool); - $cache->load(); - $this->assertFalse($cache->isComplete('', false)); - } - - public function testLoadSuccess() - { - $response = json_encode([[], ['' => true]]); - $pool = Mockery::mock('Psr\Cache\CacheItemPoolInterface'); - $item = Mockery::mock('Psr\Cache\CacheItemInterface'); - $item->shouldReceive('get')->once()->andReturn($response); - $item->shouldReceive('isHit')->once()->andReturn(true); - $pool->shouldReceive('getItem')->once()->andReturn($item); - $cache = new Psr6Cache($pool); - $cache->load(); - $this->assertTrue($cache->isComplete('', false)); - } - - public function testSave() - { - $response = json_encode([[], []]); - $ttl = 4711; - $pool = Mockery::mock('Psr\Cache\CacheItemPoolInterface'); - $item = Mockery::mock('Psr\Cache\CacheItemInterface'); - $item->shouldReceive('expiresAfter')->once()->with($ttl); - $item->shouldReceive('set')->once()->andReturn($response); - $pool->shouldReceive('getItem')->once()->andReturn($item); - $pool->shouldReceive('save')->once()->with($item); - $cache = new Psr6Cache($pool, 'foo', $ttl); - $cache->save(); - } -} diff --git a/vendor/league/flysystem-cached-adapter/tests/StashTest.php b/vendor/league/flysystem-cached-adapter/tests/StashTest.php deleted file mode 100644 index 29e142d790..0000000000 --- a/vendor/league/flysystem-cached-adapter/tests/StashTest.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php - -use League\Flysystem\Cached\Storage\Stash; -use PHPUnit\Framework\TestCase; - -class StashTests extends TestCase -{ - public function testLoadFail() - { - $pool = Mockery::mock('Stash\Pool'); - $item = Mockery::mock('Stash\Item'); - $item->shouldReceive('get')->once()->andReturn(null); - $item->shouldReceive('isMiss')->once()->andReturn(true); - $pool->shouldReceive('getItem')->once()->andReturn($item); - $cache = new Stash($pool); - $cache->load(); - $this->assertFalse($cache->isComplete('', false)); - } - - public function testLoadSuccess() - { - $response = json_encode([[], ['' => true]]); - $pool = Mockery::mock('Stash\Pool'); - $item = Mockery::mock('Stash\Item'); - $item->shouldReceive('get')->once()->andReturn($response); - $item->shouldReceive('isMiss')->once()->andReturn(false); - $pool->shouldReceive('getItem')->once()->andReturn($item); - $cache = new Stash($pool); - $cache->load(); - $this->assertTrue($cache->isComplete('', false)); - } - - public function testSave() - { - $response = json_encode([[], []]); - $pool = Mockery::mock('Stash\Pool'); - $item = Mockery::mock('Stash\Item'); - $item->shouldReceive('set')->once()->andReturn($response); - $pool->shouldReceive('getItem')->once()->andReturn($item); - $cache = new Stash($pool); - $cache->save(); - } -} diff --git a/vendor/league/flysystem-ziparchive/.gitignore b/vendor/league/flysystem-ziparchive/.gitignore deleted file mode 100644 index 0fbb3fb8e4..0000000000 --- a/vendor/league/flysystem-ziparchive/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -vendor -bin -composer.lock -coverage -coverage.xml -tests/files
\ No newline at end of file diff --git a/vendor/league/flysystem-ziparchive/.scrutinizer.yml b/vendor/league/flysystem-ziparchive/.scrutinizer.yml deleted file mode 100644 index 5501dba8da..0000000000 --- a/vendor/league/flysystem-ziparchive/.scrutinizer.yml +++ /dev/null @@ -1,34 +0,0 @@ -filter: - paths: [src/*] -checks: - php: - code_rating: true - remove_extra_empty_lines: true - remove_php_closing_tag: true - remove_trailing_whitespace: true - fix_use_statements: - remove_unused: true - preserve_multiple: false - preserve_blanklines: true - order_alphabetically: true - fix_php_opening_tag: true - fix_linefeed: true - fix_line_ending: true - fix_identation_4spaces: true - fix_doc_comments: true -tools: - external_code_coverage: - timeout: 600 - runs: 3 - php_code_coverage: false - php_code_sniffer: - config: - standard: PSR2 - filter: - paths: ['src'] - php_loc: - enabled: true - excluded_dirs: [vendor, spec, stubs] - php_cpd: - enabled: true - excluded_dirs: [vendor, spec, stubs]
\ No newline at end of file diff --git a/vendor/league/flysystem-ziparchive/.travis.yml b/vendor/league/flysystem-ziparchive/.travis.yml deleted file mode 100644 index 5c080d0328..0000000000 --- a/vendor/league/flysystem-ziparchive/.travis.yml +++ /dev/null @@ -1,21 +0,0 @@ -language: php - -php: - - 5.4 - - 5.5 - - 5.6 - - hhvm - -before_install: - - bash -c 'if [ "$TRAVIS_PHP_VERSION" == "hhvm" ]; then rm phpunit.xml; fi;' - - bash -c 'if [ "$TRAVIS_PHP_VERSION" == "hhvm" ]; then mv phpunit.hhvm.xml phpunit.xml; fi;' - -install: - - travis_retry composer install --no-interaction --prefer-source - -script: - - bin/phpunit - -after_script: - - wget https://scrutinizer-ci.com/ocular.phar - - bash -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then php ocular.phar code-coverage:upload --format=php-clover coverage.xml; fi;' diff --git a/vendor/league/flysystem-ziparchive/composer.json b/vendor/league/flysystem-ziparchive/composer.json deleted file mode 100644 index 690f6fc3a9..0000000000 --- a/vendor/league/flysystem-ziparchive/composer.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "league/flysystem-ziparchive", - "description": "Flysystem adapter for ZipArchive's", - "license": "MIT", - "authors": [ - { - "name": "Frank de Jonge", - "email": "info@frenky.net" - } - ], - "require": { - "php": ">=5.4.0", - "ext-zip": "*", - "league/flysystem": "~1.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.0", - "mockery/mockery": "0.9.*" - }, - "autoload": { - "psr-4": { - "League\\Flysystem\\ZipArchive\\": "src/" - } - }, - "config": { - "bin-dir": "bin" - }, - "min-stability": "dev", - "prefer-stable": true, - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - } -} diff --git a/vendor/league/flysystem-ziparchive/phpunit.hhvm.xml b/vendor/league/flysystem-ziparchive/phpunit.hhvm.xml deleted file mode 100644 index 73e5a6d3c1..0000000000 --- a/vendor/league/flysystem-ziparchive/phpunit.hhvm.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<phpunit backupGlobals="false" - backupStaticAttributes="false" - bootstrap="./phpunit.php" - colors="true" - convertErrorsToExceptions="true" - convertNoticesToExceptions="true" - convertWarningsToExceptions="true" - processIsolation="false" - stopOnFailure="false" - syntaxCheck="true" - verbose="true" -> - <testsuites> - <testsuite name="flysystem/tests"> - <directory suffix=".php">./tests/</directory> - </testsuite> - </testsuites> - <filter> - <whitelist> - <directory suffix=".php">./src/</directory> - </whitelist> - </filter> - <listeners> - <listener class="Mockery\Adapter\Phpunit\TestListener" file="./vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/TestListener.php"></listener> - </listeners> -</phpunit> diff --git a/vendor/league/flysystem-ziparchive/phpunit.php b/vendor/league/flysystem-ziparchive/phpunit.php deleted file mode 100644 index d109587967..0000000000 --- a/vendor/league/flysystem-ziparchive/phpunit.php +++ /dev/null @@ -1,3 +0,0 @@ -<?php - -include __DIR__.'/vendor/autoload.php'; diff --git a/vendor/league/flysystem-ziparchive/phpunit.xml b/vendor/league/flysystem-ziparchive/phpunit.xml deleted file mode 100644 index 2436ef05c6..0000000000 --- a/vendor/league/flysystem-ziparchive/phpunit.xml +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<phpunit backupGlobals="false" - backupStaticAttributes="false" - bootstrap="./phpunit.php" - colors="true" - convertErrorsToExceptions="true" - convertNoticesToExceptions="true" - convertWarningsToExceptions="true" - processIsolation="false" - stopOnFailure="false" - syntaxCheck="true" - verbose="true" -> - <testsuites> - <testsuite name="flysystem/tests"> - <directory suffix=".php">./tests/</directory> - </testsuite> - </testsuites> - <filter> - <whitelist> - <directory suffix=".php">./src/</directory> - </whitelist> - </filter> - <listeners> - <listener class="Mockery\Adapter\Phpunit\TestListener" file="./vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/TestListener.php"></listener> - </listeners> - <logging> - <log type="coverage-text" target="php://stdout" showUncoveredFiles="true"/> - <log type="coverage-html" target="coverage" showUncoveredFiles="true"/> - <log type="coverage-clover" target="coverage.xml" showUncoveredFiles="true"/> - </logging> -</phpunit> diff --git a/vendor/league/flysystem-ziparchive/readme.md b/vendor/league/flysystem-ziparchive/readme.md deleted file mode 100644 index ff3717bb60..0000000000 --- a/vendor/league/flysystem-ziparchive/readme.md +++ /dev/null @@ -1,25 +0,0 @@ -# Flysystem Adapter for ZipArchive - -[](https://twitter.com/frankdejonge) -[](https://travis-ci.org/thephpleague/flysystem-ziparchive) -[](https://scrutinizer-ci.com/g/thephpleague/flysystem-ziparchive/code-structure) -[](https://scrutinizer-ci.com/g/thephpleague/flysystem-ziparchive) -[](LICENSE) -[](https://packagist.org/packages/league/flysystem-ziparchive) -[](https://packagist.org/packages/league/flysystem-ziparchive) - - -## Installation - -```bash -composer require league/flysystem-ziparchive -``` - -## Usage - -```php -use League\Flysystem\Filesystem; -use League\Flysystem\ZipArchive\ZipArchiveAdapter as Adapter; - -$filesystem = new Filesystem(new Adapter(__DIR__.'/path/to/archive.zip')); -``` diff --git a/vendor/league/flysystem-ziparchive/src/ZipArchiveAdapter.php b/vendor/league/flysystem-ziparchive/src/ZipArchiveAdapter.php deleted file mode 100644 index e084f62178..0000000000 --- a/vendor/league/flysystem-ziparchive/src/ZipArchiveAdapter.php +++ /dev/null @@ -1,320 +0,0 @@ -<?php - -namespace League\Flysystem\ZipArchive; - -use League\Flysystem\Adapter\AbstractAdapter; -use League\Flysystem\Adapter\Polyfill\NotSupportingVisibilityTrait; -use League\Flysystem\Adapter\Polyfill\StreamedCopyTrait; -use League\Flysystem\Adapter\Polyfill\StreamedWritingTrait; -use League\Flysystem\Config; -use League\Flysystem\Util; -use LogicException; -use ZipArchive; - -class ZipArchiveAdapter extends AbstractAdapter -{ - use StreamedWritingTrait; - use StreamedCopyTrait; - use NotSupportingVisibilityTrait; - - /** - * @var array - */ - protected static $resultMap = [ - 'size' => 'size', - 'mtime' => 'timestamp', - 'name' => 'path', - ]; - - /** - * @var ZipArchive - */ - protected $archive; - - /** - * @param $location - * @param ZipArchive $archive - * @param string|null $prefix - */ - public function __construct($location, ZipArchive $archive = null, $prefix = null) - { - $this->setArchive($archive ?: new ZipArchive()); - $this->openArchive($location); - $this->setPathPrefix($prefix); - } - - /** - * Re-open an archive to ensure persistence. - */ - protected function reopenArchive() - { - $path = $this->archive->filename; - $this->archive->close(); - $this->openArchive($path); - } - - /** - * ZipArchive setter. - * - * @param ZipArchive $archive - */ - public function setArchive(ZipArchive $archive) - { - $this->archive = $archive; - } - - /** - * Get the used ZipArchive. - * - * @return ZipArchive - */ - public function getArchive() - { - return $this->archive; - } - - /** - * Open a zip file. - * - * @param $location - */ - public function openArchive($location) - { - $location = str_replace('/', DIRECTORY_SEPARATOR, $location); - - if (($response = $this->archive->open($location, ZipArchive::CREATE)) !== true) { - throw new LogicException('Could not open zip archive at:'.$location.', error: '.$response); - } - } - - /** - * {@inheritdoc} - */ - public function write($path, $contents, Config $config) - { - $location = $this->applyPathPrefix($path); - $dirname = Util::dirname($path); - - if (! empty($dirname) && ! $this->has($dirname)) { - $this->createDir($dirname, $config); - } - - if (! $this->archive->addFromString($location, $contents)) { - return false; - } - - $result = compact('path', 'contents'); - - if ($config && $config->get('visibility')) { - throw new LogicException(get_class($this).' does not support visibility settings.'); - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function update($path, $contents, Config $config) - { - $this->delete($path); - - return $this->write($path, $contents, $config); - } - - /** - * {@inheritdoc} - */ - public function rename($path, $newpath) - { - $source = $this->applyPathPrefix($path); - $destination = $this->applyPathPrefix($newpath); - - return $this->archive->renameName($source, $destination); - } - - /** - * {@inheritdoc} - */ - public function delete($path) - { - $location = $this->applyPathPrefix($path); - - return $this->archive->deleteName($location); - } - - /** - * {@inheritdoc} - */ - public function deleteDir($dirname) - { - // This is needed to ensure the right number of - // files are set to the $numFiles property. - $this->reopenArchive(); - - $location = $this->applyPathPrefix($dirname); - $path = Util::normalizePrefix($location, '/'); - $length = strlen($path); - - for ($i = 0; $i < $this->archive->numFiles; $i++) { - $info = $this->archive->statIndex($i); - - if (substr($info['name'], 0, $length) === $path) { - $this->archive->deleteIndex($i); - } - } - - return $this->archive->deleteName($dirname); - } - - /** - * {@inheritdoc} - */ - public function createDir($dirname, Config $config) - { - if (! $this->has($dirname)) { - $location = $this->applyPathPrefix($dirname); - $this->archive->addEmptyDir($location); - } - - return ['path' => $dirname]; - } - - /** - * {@inheritdoc} - */ - public function has($path) - { - return $this->getMetadata($path); - } - - /** - * {@inheritdoc} - */ - public function read($path) - { - $this->reopenArchive(); - $location = $this->applyPathPrefix($path); - - if (! $contents = $this->archive->getFromName($location)) { - return false; - } - - return compact('contents'); - } - - /** - * {@inheritdoc} - */ - public function readStream($path) - { - $this->reopenArchive(); - $location = $this->applyPathPrefix($path); - - if (! $stream = $this->archive->getStream($location)) { - return false; - } - - return compact('stream'); - } - - /** - * {@inheritdoc} - */ - public function listContents($dirname = '', $recursive = false) - { - $result = []; - - // This is needed to ensure the right number of - // files are set to the $numFiles property. - $this->reopenArchive(); - - for ($i = 0; $i < $this->archive->numFiles; $i++) { - if ($info = $this->archive->statIndex($i)) { - $result[] = $info; - } - } - - $pathPrefix = $this->getPathPrefix(); - $prefixLength = strlen($pathPrefix); - - return array_filter(array_map(function ($item) use ($pathPrefix, $prefixLength) { - if ($pathPrefix && (substr($item['name'], 0, $prefixLength) !== $pathPrefix || $item['name'] === $pathPrefix)) { - return false; - } - - return $this->normalizeObject($item); - }, $result)); - } - - /** - * {@inheritdoc} - */ - public function getMetadata($path) - { - $location = $this->applyPathPrefix($path); - - if (! $info = $this->archive->statName($location)) { - - // Check if $location is a directory. - if (! $info = $this->archive->statName($location . '/')) { - return false; - } - } - - return $this->normalizeObject($info); - } - - /** - * Normalize a zip response array. - * - * @param array $object - * - * @return array - */ - protected function normalizeObject(array $object) - { - if (substr($object['name'], -1) === '/') { - return [ - 'path' => $this->removePathPrefix(trim($object['name'], '/')), - 'type' => 'dir', - ]; - } - - $result = ['type' => 'file']; - $normalised = Util::map($object, static::$resultMap); - $normalised['path'] = $this->removePathPrefix($normalised['path']); - - return array_merge($result, $normalised); - } - - /** - * {@inheritdoc} - */ - public function getSize($path) - { - return $this->getMetadata($path); - } - - /** - * {@inheritdoc} - */ - public function getMimetype($path) - { - if (! $data = $this->read($path)) { - return false; - } - - $data['mimetype'] = Util::guessMimeType($path, $data['contents']); - - return $data; - } - - /** - * {@inheritdoc} - */ - public function getTimestamp($path) - { - return $this->getMetadata($path); - } -} diff --git a/vendor/league/flysystem-ziparchive/tests/ZipArchiveTests.php b/vendor/league/flysystem-ziparchive/tests/ZipArchiveTests.php deleted file mode 100644 index 634871c7d8..0000000000 --- a/vendor/league/flysystem-ziparchive/tests/ZipArchiveTests.php +++ /dev/null @@ -1,191 +0,0 @@ -<?php - -use League\Flysystem\Config; -use League\Flysystem\ZipArchive\ZipArchiveAdapter as Zip; - -class ZipArchiveTests extends PHPUnit_Framework_TestCase -{ - /** - * @return Zip[] - */ - public function zipProvider() - { - if (! is_dir($folder = __DIR__.'/files')) { - mkdir($folder, 0777); - } - - if (is_file($location = __DIR__.'/files/tester.zip')) { - unlink($location); - } - - return [ - [new Zip($location, new ZipArchive())], - ]; - } - - public function testInstance() - { - $adapter = new Zip(__DIR__.'/files/tester.zip', new ZipArchive()); - $this->assertInstanceOf('League\Flysystem\AdapterInterface', $adapter); - } - - /** - * @dataProvider zipProvider - */ - public function testGetArchive(Zip $zip) - { - $this->assertInstanceOf('ZipArchive', $zip->getArchive()); - } - - /** - * @dataProvider zipProvider - */ - public function testZip(Zip $zip) - { - $this->assertCount(0, $zip->listContents()); - $this->assertInternalType('array', $zip->write('file.txt', 'contents', new Config())); - $this->assertCount(1, $zip->listContents()); - $this->assertInternalType('array', $zip->write('nested/file.txt', 'contents', new Config())); - $this->assertCount(3, $zip->listContents()); - $zip->setPathPrefix('nested/'); - $this->assertCount(1, $zip->listContents()); - $zip->setPathPrefix(''); - $result = $zip->read('nested/file.txt'); - $this->assertEquals('contents', $result['contents']); - $zip->update('nested/file.txt', 'new contents', new Config()); - $result = $zip->read('nested/file.txt'); - $this->assertEquals('new contents', $result['contents']); - $result = $zip->readStream('nested/file.txt'); - $this->assertArrayHasKey('stream', $result); - $result = $zip->getSize('nested/file.txt'); - $this->assertEquals(12, $result['size']); - $result = $zip->getTimestamp('nested/file.txt'); - $this->assertInternalType('integer', $result['timestamp']); - $result = $zip->getMimetype('nested/file.txt'); - $this->assertEquals('text/plain', $result['mimetype']); - $zip->deleteDir('nested'); - $this->assertCount(1, $zip->listContents()); - $zip->rename('file.txt', 'renamed.txt'); - $this->assertFalse($zip->has('file.txt')); - - $zip->createDir('empty_dir', new Config()); - $this->assertInternalType('array', $zip->getMetadata('empty_dir')); - - $stream = tmpfile(); - fwrite($stream, 'something'); - rewind($stream); - $zip->writeStream('streamed.txt', $stream, new Config()); - fclose($stream); - $this->assertInternalType('array', $zip->has('streamed.txt')); - - $stream = tmpfile(); - fwrite($stream, 'something'); - rewind($stream); - $zip->updateStream('streamed-other.txt', $stream, new Config()); - fclose($stream); - $this->assertInternalType('array', $zip->has('streamed-other.txt')); - } - - /** - * @dataProvider zipProvider - * @expectedException LogicException - */ - public function testWriteStreamFail(Zip $zip) - { - $zip->writeStream('file.txt', tmpfile(), new Config(['visibility' => 'private'])); - } - - /** - * @expectedException LogicException - * @dataProvider zipProvider - */ - public function testGetVisibility($zip) - { - $zip->getVisibility('path'); - } - - /** - * @expectedException LogicException - * @dataProvider zipProvider - */ - public function testSetVisibility($zip) - { - $zip->setVisibility('path', 'public'); - } - - /** - * @expectedException LogicException - * @dataProvider zipProvider - */ - public function testSetVisibilityWrite($zip) - { - $zip->write('path', 'contents', new Config(['visibility' => 'private'])); - } - - /** - * @expectedException LogicException - */ - public function testZipOpenFails() - { - if (defined('HHVM_VERSION')) { - $this->markTestSkipped('This test results in a fatal error on HHVM'); - } - - $mock = Mockery::mock('ZipArchive'); - $mock->shouldReceive('open')->andReturn(false); - $zip = new Zip('location', $mock); - } - - public function testZipReadWriteFails() - { - if (defined('HHVM_VERSION')) { - $this->markTestSkipped('HHVM does not support mocking of ZipArchive'); - } - - $mock = Mockery::mock('ZipArchive'); - $mock->shouldReceive('open')->andReturn(true); - $mock->shouldReceive('close')->andReturn(true); - $mock->shouldReceive('addFromString')->andReturn(false); - $mock->shouldReceive('getFromName')->andReturn(false); - $mock->shouldReceive('getStream')->andReturn(false); - $zip = new Zip('location', $mock); - - $this->assertFalse($zip->write('file', 'contents', new Config())); - $this->assertFalse($zip->read('file')); - $this->assertFalse($zip->getMimetype('file')); - $this->assertFalse($zip->readStream('file')); - } - - public function testCopy() - { - if (defined('HHVM_VERSION')) { - $this->markTestSkipped('This test results in a fatal error on HHVM'); - } - - $resource = fopen(__DIR__.'/../readme.md', 'r+'); - $mock = Mockery::mock('ZipArchive'); - $mock->shouldReceive('open')->andReturn(true); - $mock->shouldReceive('close')->andReturn(true); - $mock->shouldReceive('addFromString')->andReturn(true); - $mock->shouldReceive('getStream')->andReturn($resource); - $zip = new Zip('location', $mock); - $this->assertTrue($zip->copy('old', 'new')); - - // Ensure the resource is closed internally - $this->assertFalse(is_resource($resource)); - } - - public function testCopyFailed() - { - if (defined('HHVM_VERSION')) { - $this->markTestSkipped('This test results in a fatal error on HHVM'); - } - - $mock = Mockery::mock('ZipArchive'); - $mock->shouldReceive('open')->andReturn(true); - $mock->shouldReceive('close')->andReturn(true); - $mock->shouldReceive('getStream')->andReturn(false); - $zip = new Zip('location', $mock); - $this->assertFalse($zip->copy('old', 'new')); - } -} diff --git a/vendor/league/flysystem/LICENSE b/vendor/league/flysystem/LICENSE deleted file mode 100644 index f2684c8417..0000000000 --- a/vendor/league/flysystem/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2013-2019 Frank de Jonge - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/league/flysystem/SECURITY.md b/vendor/league/flysystem/SECURITY.md deleted file mode 100644 index f5b205ed08..0000000000 --- a/vendor/league/flysystem/SECURITY.md +++ /dev/null @@ -1,16 +0,0 @@ -# Security Policy - -## Supported Versions - -| Version | Supported | -| ------- | ------------------ | -| 1.0.x | :white_check_mark: | -| 2.0.x | :x: | - -## Reporting a Vulnerability - -When you've encountered a security vulnerability, please disclose it securely. - -The security process is described at: -[https://flysystem.thephpleague.com/docs/security/](https://flysystem.thephpleague.com/docs/security/) - diff --git a/vendor/league/flysystem/composer.json b/vendor/league/flysystem/composer.json deleted file mode 100644 index b0a68ec4b9..0000000000 --- a/vendor/league/flysystem/composer.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name": "league/flysystem", - "type": "library", - "description": "Filesystem abstraction: Many filesystems, one API.", - "keywords": [ - "filesystem", "filesystems", "files", "storage", "dropbox", "aws", - "abstraction", "s3", "ftp", "sftp", "remote", "webdav", - "file systems", "cloud", "cloud files", "rackspace", "copy.com" - ], - "funding": [ - { - "type": "other", - "url": "https://offset.earth/frankdejonge" - } - ], - "license": "MIT", - "authors": [ - { - "name": "Frank de Jonge", - "email": "info@frenky.net" - } - ], - "require": { - "php": ">=5.5.9", - "ext-fileinfo": "*" - }, - "require-dev": { - "phpspec/phpspec": "^3.4 || ^4.0 || ^5.0 || ^6.0", - "phpunit/phpunit": "^5.7.26" - }, - "autoload": { - "psr-4": { - "League\\Flysystem\\": "src/" - } - }, - "autoload-dev": { - "psr-4": { - "League\\Flysystem\\Stub\\": "stub/" - }, - "files": [ - "tests/PHPUnitHacks.php" - ] - }, - "suggest": { - "ext-fileinfo": "Required for MimeType", - "league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem", - "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files", - "league/flysystem-azure": "Allows you to use Windows Azure Blob storage", - "league/flysystem-webdav": "Allows you to use WebDAV storage", - "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2", - "league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3", - "spatie/flysystem-dropbox": "Allows you to use Dropbox storage", - "srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications", - "league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching", - "ext-ftp": "Allows you to use FTP server storage", - "ext-openssl": "Allows you to use FTPS server storage", - "league/flysystem-sftp": "Allows you to use SFTP server storage via phpseclib", - "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter" - }, - "conflict": { - "league/flysystem-sftp": "<1.0.6" - }, - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "scripts": { - "phpstan": "php phpstan.php" - } -} diff --git a/vendor/league/flysystem/deprecations.md b/vendor/league/flysystem/deprecations.md deleted file mode 100644 index c336a425d8..0000000000 --- a/vendor/league/flysystem/deprecations.md +++ /dev/null @@ -1,19 +0,0 @@ -# Deprecations - -This document lists all the planned deprecations. - -## Handlers will be removed in 2.0 - -The `Handler` type and associated calls will be removed in version 2.0. - -### Upgrade path - -You should create your own implementation for handling OOP usage, -but it's recommended to move away from using an OOP-style wrapper entirely. - -The reason for this is that it's too easy for implementation details (for -your application this is Flysystem) to leak into the application. The most -important part for Flysystem is that it improves portability and creates a -solid boundary between your application core and the infrastructure you use. -The OOP-style handling breaks this principle, therefore I want to stop -promoting it. diff --git a/vendor/league/flysystem/src/Adapter/AbstractAdapter.php b/vendor/league/flysystem/src/Adapter/AbstractAdapter.php deleted file mode 100644 index e577ac4a74..0000000000 --- a/vendor/league/flysystem/src/Adapter/AbstractAdapter.php +++ /dev/null @@ -1,72 +0,0 @@ -<?php - -namespace League\Flysystem\Adapter; - -use League\Flysystem\AdapterInterface; - -abstract class AbstractAdapter implements AdapterInterface -{ - /** - * @var string|null path prefix - */ - protected $pathPrefix; - - /** - * @var string - */ - protected $pathSeparator = '/'; - - /** - * Set the path prefix. - * - * @param string $prefix - * - * @return void - */ - public function setPathPrefix($prefix) - { - $prefix = (string) $prefix; - - if ($prefix === '') { - $this->pathPrefix = null; - - return; - } - - $this->pathPrefix = rtrim($prefix, '\\/') . $this->pathSeparator; - } - - /** - * Get the path prefix. - * - * @return string|null path prefix or null if pathPrefix is empty - */ - public function getPathPrefix() - { - return $this->pathPrefix; - } - - /** - * Prefix a path. - * - * @param string $path - * - * @return string prefixed path - */ - public function applyPathPrefix($path) - { - return $this->getPathPrefix() . ltrim($path, '\\/'); - } - - /** - * Remove a path prefix. - * - * @param string $path - * - * @return string path without the prefix - */ - public function removePathPrefix($path) - { - return substr($path, strlen($this->getPathPrefix())); - } -} diff --git a/vendor/league/flysystem/src/Adapter/AbstractFtpAdapter.php b/vendor/league/flysystem/src/Adapter/AbstractFtpAdapter.php deleted file mode 100644 index 95a6b4d09e..0000000000 --- a/vendor/league/flysystem/src/Adapter/AbstractFtpAdapter.php +++ /dev/null @@ -1,697 +0,0 @@ -<?php - -namespace League\Flysystem\Adapter; - -use DateTime; -use League\Flysystem\AdapterInterface; -use League\Flysystem\Config; -use League\Flysystem\NotSupportedException; -use League\Flysystem\SafeStorage; -use RuntimeException; - -abstract class AbstractFtpAdapter extends AbstractAdapter -{ - /** - * @var mixed - */ - protected $connection; - - /** - * @var string - */ - protected $host; - - /** - * @var int - */ - protected $port = 21; - - /** - * @var bool - */ - protected $ssl = false; - - /** - * @var int - */ - protected $timeout = 90; - - /** - * @var bool - */ - protected $passive = true; - - /** - * @var string - */ - protected $separator = '/'; - - /** - * @var string|null - */ - protected $root; - - /** - * @var int - */ - protected $permPublic = 0744; - - /** - * @var int - */ - protected $permPrivate = 0700; - - /** - * @var array - */ - protected $configurable = []; - - /** - * @var string - */ - protected $systemType; - - /** - * @var SafeStorage - */ - protected $safeStorage; - - /** - * True to enable timestamps for FTP servers that return unix-style listings. - * - * @var bool - */ - protected $enableTimestampsOnUnixListings = false; - - /** - * Constructor. - * - * @param array $config - */ - public function __construct(array $config) - { - $this->safeStorage = new SafeStorage(); - $this->setConfig($config); - } - - /** - * Set the config. - * - * @param array $config - * - * @return $this - */ - public function setConfig(array $config) - { - foreach ($this->configurable as $setting) { - if ( ! isset($config[$setting])) { - continue; - } - - $method = 'set' . ucfirst($setting); - - if (method_exists($this, $method)) { - $this->$method($config[$setting]); - } - } - - return $this; - } - - /** - * Returns the host. - * - * @return string - */ - public function getHost() - { - return $this->host; - } - - /** - * Set the host. - * - * @param string $host - * - * @return $this - */ - public function setHost($host) - { - $this->host = $host; - - return $this; - } - - /** - * Set the public permission value. - * - * @param int $permPublic - * - * @return $this - */ - public function setPermPublic($permPublic) - { - $this->permPublic = $permPublic; - - return $this; - } - - /** - * Set the private permission value. - * - * @param int $permPrivate - * - * @return $this - */ - public function setPermPrivate($permPrivate) - { - $this->permPrivate = $permPrivate; - - return $this; - } - - /** - * Returns the ftp port. - * - * @return int - */ - public function getPort() - { - return $this->port; - } - - /** - * Returns the root folder to work from. - * - * @return string - */ - public function getRoot() - { - return $this->root; - } - - /** - * Set the ftp port. - * - * @param int|string $port - * - * @return $this - */ - public function setPort($port) - { - $this->port = (int) $port; - - return $this; - } - - /** - * Set the root folder to work from. - * - * @param string $root - * - * @return $this - */ - public function setRoot($root) - { - $this->root = rtrim($root, '\\/') . $this->separator; - - return $this; - } - - /** - * Returns the ftp username. - * - * @return string username - */ - public function getUsername() - { - $username = $this->safeStorage->retrieveSafely('username'); - - return $username !== null ? $username : 'anonymous'; - } - - /** - * Set ftp username. - * - * @param string $username - * - * @return $this - */ - public function setUsername($username) - { - $this->safeStorage->storeSafely('username', $username); - - return $this; - } - - /** - * Returns the password. - * - * @return string password - */ - public function getPassword() - { - return $this->safeStorage->retrieveSafely('password'); - } - - /** - * Set the ftp password. - * - * @param string $password - * - * @return $this - */ - public function setPassword($password) - { - $this->safeStorage->storeSafely('password', $password); - - return $this; - } - - /** - * Returns the amount of seconds before the connection will timeout. - * - * @return int - */ - public function getTimeout() - { - return $this->timeout; - } - - /** - * Set the amount of seconds before the connection should timeout. - * - * @param int $timeout - * - * @return $this - */ - public function setTimeout($timeout) - { - $this->timeout = (int) $timeout; - - return $this; - } - - /** - * Return the FTP system type. - * - * @return string - */ - public function getSystemType() - { - return $this->systemType; - } - - /** - * Set the FTP system type (windows or unix). - * - * @param string $systemType - * - * @return $this - */ - public function setSystemType($systemType) - { - $this->systemType = strtolower($systemType); - - return $this; - } - - /** - * True to enable timestamps for FTP servers that return unix-style listings. - * - * @param bool $bool - * - * @return $this - */ - public function setEnableTimestampsOnUnixListings($bool = false) - { - $this->enableTimestampsOnUnixListings = $bool; - - return $this; - } - - /** - * @inheritdoc - */ - public function listContents($directory = '', $recursive = false) - { - return $this->listDirectoryContents($directory, $recursive); - } - - abstract protected function listDirectoryContents($directory, $recursive = false); - - /** - * Normalize a directory listing. - * - * @param array $listing - * @param string $prefix - * - * @return array directory listing - */ - protected function normalizeListing(array $listing, $prefix = '') - { - $base = $prefix; - $result = []; - $listing = $this->removeDotDirectories($listing); - - while ($item = array_shift($listing)) { - if (preg_match('#^.*:$#', $item)) { - $base = preg_replace('~^\./*|:$~', '', $item); - continue; - } - - $result[] = $this->normalizeObject($item, $base); - } - - return $this->sortListing($result); - } - - /** - * Sort a directory listing. - * - * @param array $result - * - * @return array sorted listing - */ - protected function sortListing(array $result) - { - $compare = function ($one, $two) { - return strnatcmp($one['path'], $two['path']); - }; - - usort($result, $compare); - - return $result; - } - - /** - * Normalize a file entry. - * - * @param string $item - * @param string $base - * - * @return array normalized file array - * - * @throws NotSupportedException - */ - protected function normalizeObject($item, $base) - { - $systemType = $this->systemType ?: $this->detectSystemType($item); - - if ($systemType === 'unix') { - return $this->normalizeUnixObject($item, $base); - } elseif ($systemType === 'windows') { - return $this->normalizeWindowsObject($item, $base); - } - - throw NotSupportedException::forFtpSystemType($systemType); - } - - /** - * Normalize a Unix file entry. - * - * Given $item contains: - * '-rw-r--r-- 1 ftp ftp 409 Aug 19 09:01 file1.txt' - * - * This function will return: - * [ - * 'type' => 'file', - * 'path' => 'file1.txt', - * 'visibility' => 'public', - * 'size' => 409, - * 'timestamp' => 1566205260 - * ] - * - * @param string $item - * @param string $base - * - * @return array normalized file array - */ - protected function normalizeUnixObject($item, $base) - { - $item = preg_replace('#\s+#', ' ', trim($item), 7); - - if (count(explode(' ', $item, 9)) !== 9) { - throw new RuntimeException("Metadata can't be parsed from item '$item' , not enough parts."); - } - - list($permissions, /* $number */, /* $owner */, /* $group */, $size, $month, $day, $timeOrYear, $name) = explode(' ', $item, 9); - $type = $this->detectType($permissions); - $path = $base === '' ? $name : $base . $this->separator . $name; - - if ($type === 'dir') { - return compact('type', 'path'); - } - - $permissions = $this->normalizePermissions($permissions); - $visibility = $permissions & 0044 ? AdapterInterface::VISIBILITY_PUBLIC : AdapterInterface::VISIBILITY_PRIVATE; - $size = (int) $size; - - $result = compact('type', 'path', 'visibility', 'size'); - if ($this->enableTimestampsOnUnixListings) { - $timestamp = $this->normalizeUnixTimestamp($month, $day, $timeOrYear); - $result += compact('timestamp'); - } - - return $result; - } - - /** - * Only accurate to the minute (current year), or to the day. - * - * Inadequacies in timestamp accuracy are due to limitations of the FTP 'LIST' command - * - * Note: The 'MLSD' command is a machine-readable replacement for 'LIST' - * but many FTP servers do not support it :( - * - * @param string $month e.g. 'Aug' - * @param string $day e.g. '19' - * @param string $timeOrYear e.g. '09:01' OR '2015' - * - * @return int - */ - protected function normalizeUnixTimestamp($month, $day, $timeOrYear) - { - if (is_numeric($timeOrYear)) { - $year = $timeOrYear; - $hour = '00'; - $minute = '00'; - $seconds = '00'; - } else { - $year = date('Y'); - list($hour, $minute) = explode(':', $timeOrYear); - $seconds = '00'; - } - $dateTime = DateTime::createFromFormat('Y-M-j-G:i:s', "{$year}-{$month}-{$day}-{$hour}:{$minute}:{$seconds}"); - - return $dateTime->getTimestamp(); - } - - /** - * Normalize a Windows/DOS file entry. - * - * @param string $item - * @param string $base - * - * @return array normalized file array - */ - protected function normalizeWindowsObject($item, $base) - { - $item = preg_replace('#\s+#', ' ', trim($item), 3); - - if (count(explode(' ', $item, 4)) !== 4) { - throw new RuntimeException("Metadata can't be parsed from item '$item' , not enough parts."); - } - - list($date, $time, $size, $name) = explode(' ', $item, 4); - $path = $base === '' ? $name : $base . $this->separator . $name; - - // Check for the correct date/time format - $format = strlen($date) === 8 ? 'm-d-yH:iA' : 'Y-m-dH:i'; - $dt = DateTime::createFromFormat($format, $date . $time); - $timestamp = $dt ? $dt->getTimestamp() : (int) strtotime("$date $time"); - - if ($size === '<DIR>') { - $type = 'dir'; - - return compact('type', 'path', 'timestamp'); - } - - $type = 'file'; - $visibility = AdapterInterface::VISIBILITY_PUBLIC; - $size = (int) $size; - - return compact('type', 'path', 'visibility', 'size', 'timestamp'); - } - - /** - * Get the system type from a listing item. - * - * @param string $item - * - * @return string the system type - */ - protected function detectSystemType($item) - { - return preg_match('/^[0-9]{2,4}-[0-9]{2}-[0-9]{2}/', $item) ? 'windows' : 'unix'; - } - - /** - * Get the file type from the permissions. - * - * @param string $permissions - * - * @return string file type - */ - protected function detectType($permissions) - { - return substr($permissions, 0, 1) === 'd' ? 'dir' : 'file'; - } - - /** - * Normalize a permissions string. - * - * @param string $permissions - * - * @return int - */ - protected function normalizePermissions($permissions) - { - if (is_numeric($permissions)) { - return ((int) $permissions) & 0777; - } - - // remove the type identifier - $permissions = substr($permissions, 1); - - // map the string rights to the numeric counterparts - $map = ['-' => '0', 'r' => '4', 'w' => '2', 'x' => '1']; - $permissions = strtr($permissions, $map); - - // split up the permission groups - $parts = str_split($permissions, 3); - - // convert the groups - $mapper = function ($part) { - return array_sum(str_split($part)); - }; - - // converts to decimal number - return octdec(implode('', array_map($mapper, $parts))); - } - - /** - * Filter out dot-directories. - * - * @param array $list - * - * @return array - */ - public function removeDotDirectories(array $list) - { - $filter = function ($line) { - return $line !== '' && ! preg_match('#.* \.(\.)?$|^total#', $line); - }; - - return array_filter($list, $filter); - } - - /** - * @inheritdoc - */ - public function has($path) - { - return $this->getMetadata($path); - } - - /** - * @inheritdoc - */ - public function getSize($path) - { - return $this->getMetadata($path); - } - - /** - * @inheritdoc - */ - public function getVisibility($path) - { - return $this->getMetadata($path); - } - - /** - * Ensure a directory exists. - * - * @param string $dirname - */ - public function ensureDirectory($dirname) - { - $dirname = (string) $dirname; - - if ($dirname !== '' && ! $this->has($dirname)) { - $this->createDir($dirname, new Config()); - } - } - - /** - * @return mixed - */ - public function getConnection() - { - $tries = 0; - - while ( ! $this->isConnected() && $tries < 3) { - $tries++; - $this->disconnect(); - $this->connect(); - } - - return $this->connection; - } - - /** - * Get the public permission value. - * - * @return int - */ - public function getPermPublic() - { - return $this->permPublic; - } - - /** - * Get the private permission value. - * - * @return int - */ - public function getPermPrivate() - { - return $this->permPrivate; - } - - /** - * Disconnect on destruction. - */ - public function __destruct() - { - $this->disconnect(); - } - - /** - * Establish a connection. - */ - abstract public function connect(); - - /** - * Close the connection. - */ - abstract public function disconnect(); - - /** - * Check if a connection is active. - * - * @return bool - */ - abstract public function isConnected(); -} diff --git a/vendor/league/flysystem/src/Adapter/CanOverwriteFiles.php b/vendor/league/flysystem/src/Adapter/CanOverwriteFiles.php deleted file mode 100644 index fd8d2161ee..0000000000 --- a/vendor/league/flysystem/src/Adapter/CanOverwriteFiles.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - - -namespace League\Flysystem\Adapter; - -/** - * Adapters that implement this interface let the Filesystem know that files can be overwritten using the write - * functions and don't need the update function to be called. This can help improve performance when asserts are disabled. - */ -interface CanOverwriteFiles -{ -} diff --git a/vendor/league/flysystem/src/Adapter/Ftp.php b/vendor/league/flysystem/src/Adapter/Ftp.php deleted file mode 100644 index dc89e4318f..0000000000 --- a/vendor/league/flysystem/src/Adapter/Ftp.php +++ /dev/null @@ -1,574 +0,0 @@ -<?php - -namespace League\Flysystem\Adapter; - -use ErrorException; -use League\Flysystem\Adapter\Polyfill\StreamedCopyTrait; -use League\Flysystem\AdapterInterface; -use League\Flysystem\Config; -use League\Flysystem\ConnectionErrorException; -use League\Flysystem\ConnectionRuntimeException; -use League\Flysystem\InvalidRootException; -use League\Flysystem\Util; -use League\Flysystem\Util\MimeType; - -class Ftp extends AbstractFtpAdapter -{ - use StreamedCopyTrait; - - /** - * @var int - */ - protected $transferMode = FTP_BINARY; - - /** - * @var null|bool - */ - protected $ignorePassiveAddress = null; - - /** - * @var bool - */ - protected $recurseManually = false; - - /** - * @var bool - */ - protected $utf8 = false; - - /** - * @var array - */ - protected $configurable = [ - 'host', - 'port', - 'username', - 'password', - 'ssl', - 'timeout', - 'root', - 'permPrivate', - 'permPublic', - 'passive', - 'transferMode', - 'systemType', - 'ignorePassiveAddress', - 'recurseManually', - 'utf8', - 'enableTimestampsOnUnixListings', - ]; - - /** - * @var bool - */ - protected $isPureFtpd; - - /** - * Set the transfer mode. - * - * @param int $mode - * - * @return $this - */ - public function setTransferMode($mode) - { - $this->transferMode = $mode; - - return $this; - } - - /** - * Set if Ssl is enabled. - * - * @param bool $ssl - * - * @return $this - */ - public function setSsl($ssl) - { - $this->ssl = (bool) $ssl; - - return $this; - } - - /** - * Set if passive mode should be used. - * - * @param bool $passive - */ - public function setPassive($passive = true) - { - $this->passive = $passive; - } - - /** - * @param bool $ignorePassiveAddress - */ - public function setIgnorePassiveAddress($ignorePassiveAddress) - { - $this->ignorePassiveAddress = $ignorePassiveAddress; - } - - /** - * @param bool $recurseManually - */ - public function setRecurseManually($recurseManually) - { - $this->recurseManually = $recurseManually; - } - - /** - * @param bool $utf8 - */ - public function setUtf8($utf8) - { - $this->utf8 = (bool) $utf8; - } - - /** - * Connect to the FTP server. - */ - public function connect() - { - if ($this->ssl) { - $this->connection = @ftp_ssl_connect($this->getHost(), $this->getPort(), $this->getTimeout()); - } else { - $this->connection = @ftp_connect($this->getHost(), $this->getPort(), $this->getTimeout()); - } - - if ( ! $this->connection) { - throw new ConnectionRuntimeException('Could not connect to host: ' . $this->getHost() . ', port:' . $this->getPort()); - } - - $this->login(); - $this->setUtf8Mode(); - $this->setConnectionPassiveMode(); - $this->setConnectionRoot(); - $this->isPureFtpd = $this->isPureFtpdServer(); - } - - /** - * Set the connection to UTF-8 mode. - */ - protected function setUtf8Mode() - { - if ($this->utf8) { - $response = ftp_raw($this->connection, "OPTS UTF8 ON"); - if (substr($response[0], 0, 3) !== '200') { - throw new ConnectionRuntimeException( - 'Could not set UTF-8 mode for connection: ' . $this->getHost() . '::' . $this->getPort() - ); - } - } - } - - /** - * Set the connections to passive mode. - * - * @throws ConnectionRuntimeException - */ - protected function setConnectionPassiveMode() - { - if (is_bool($this->ignorePassiveAddress) && defined('FTP_USEPASVADDRESS')) { - ftp_set_option($this->connection, FTP_USEPASVADDRESS, ! $this->ignorePassiveAddress); - } - - if ( ! ftp_pasv($this->connection, $this->passive)) { - throw new ConnectionRuntimeException( - 'Could not set passive mode for connection: ' . $this->getHost() . '::' . $this->getPort() - ); - } - } - - /** - * Set the connection root. - */ - protected function setConnectionRoot() - { - $root = $this->getRoot(); - $connection = $this->connection; - - if ($root && ! ftp_chdir($connection, $root)) { - throw new InvalidRootException('Root is invalid or does not exist: ' . $this->getRoot()); - } - - // Store absolute path for further reference. - // This is needed when creating directories and - // initial root was a relative path, else the root - // would be relative to the chdir'd path. - $this->root = ftp_pwd($connection); - } - - /** - * Login. - * - * @throws ConnectionRuntimeException - */ - protected function login() - { - set_error_handler(function () { - }); - $isLoggedIn = ftp_login( - $this->connection, - $this->getUsername(), - $this->getPassword() - ); - restore_error_handler(); - - if ( ! $isLoggedIn) { - $this->disconnect(); - throw new ConnectionRuntimeException( - 'Could not login with connection: ' . $this->getHost() . '::' . $this->getPort( - ) . ', username: ' . $this->getUsername() - ); - } - } - - /** - * Disconnect from the FTP server. - */ - public function disconnect() - { - if (is_resource($this->connection)) { - @ftp_close($this->connection); - } - - $this->connection = null; - } - - /** - * @inheritdoc - */ - public function write($path, $contents, Config $config) - { - $stream = fopen('php://temp', 'w+b'); - fwrite($stream, $contents); - rewind($stream); - $result = $this->writeStream($path, $stream, $config); - fclose($stream); - - if ($result === false) { - return false; - } - - $result['contents'] = $contents; - $result['mimetype'] = $config->get('mimetype') ?: Util::guessMimeType($path, $contents); - - return $result; - } - - /** - * @inheritdoc - */ - public function writeStream($path, $resource, Config $config) - { - $this->ensureDirectory(Util::dirname($path)); - - if ( ! ftp_fput($this->getConnection(), $path, $resource, $this->transferMode)) { - return false; - } - - if ($visibility = $config->get('visibility')) { - $this->setVisibility($path, $visibility); - } - - $type = 'file'; - - return compact('type', 'path', 'visibility'); - } - - /** - * @inheritdoc - */ - public function update($path, $contents, Config $config) - { - return $this->write($path, $contents, $config); - } - - /** - * @inheritdoc - */ - public function updateStream($path, $resource, Config $config) - { - return $this->writeStream($path, $resource, $config); - } - - /** - * @inheritdoc - */ - public function rename($path, $newpath) - { - return ftp_rename($this->getConnection(), $path, $newpath); - } - - /** - * @inheritdoc - */ - public function delete($path) - { - return ftp_delete($this->getConnection(), $path); - } - - /** - * @inheritdoc - */ - public function deleteDir($dirname) - { - $connection = $this->getConnection(); - $contents = array_reverse($this->listDirectoryContents($dirname, false)); - - foreach ($contents as $object) { - if ($object['type'] === 'file') { - if ( ! ftp_delete($connection, $object['path'])) { - return false; - } - } elseif ( ! $this->deleteDir($object['path'])) { - return false; - } - } - - return ftp_rmdir($connection, $dirname); - } - - /** - * @inheritdoc - */ - public function createDir($dirname, Config $config) - { - $connection = $this->getConnection(); - $directories = explode('/', $dirname); - - foreach ($directories as $directory) { - if (false === $this->createActualDirectory($directory, $connection)) { - $this->setConnectionRoot(); - - return false; - } - - ftp_chdir($connection, $directory); - } - - $this->setConnectionRoot(); - - return ['type' => 'dir', 'path' => $dirname]; - } - - /** - * Create a directory. - * - * @param string $directory - * @param resource $connection - * - * @return bool - */ - protected function createActualDirectory($directory, $connection) - { - // List the current directory - $listing = ftp_nlist($connection, '.') ?: []; - - foreach ($listing as $key => $item) { - if (preg_match('~^\./.*~', $item)) { - $listing[$key] = substr($item, 2); - } - } - - if (in_array($directory, $listing, true)) { - return true; - } - - return (boolean) ftp_mkdir($connection, $directory); - } - - /** - * @inheritdoc - */ - public function getMetadata($path) - { - if ($path === '') { - return ['type' => 'dir', 'path' => '']; - } - - if (@ftp_chdir($this->getConnection(), $path) === true) { - $this->setConnectionRoot(); - - return ['type' => 'dir', 'path' => $path]; - } - - $listing = $this->ftpRawlist('-A', str_replace('*', '\\*', $path)); - - if (empty($listing) || in_array('total 0', $listing, true)) { - return false; - } - - if (preg_match('/.* not found/', $listing[0])) { - return false; - } - - if (preg_match('/^total [0-9]*$/', $listing[0])) { - array_shift($listing); - } - - return $this->normalizeObject($listing[0], ''); - } - - /** - * @inheritdoc - */ - public function getMimetype($path) - { - if ( ! $metadata = $this->getMetadata($path)) { - return false; - } - - $metadata['mimetype'] = MimeType::detectByFilename($path); - - return $metadata; - } - - /** - * @inheritdoc - */ - public function getTimestamp($path) - { - $timestamp = ftp_mdtm($this->getConnection(), $path); - - return ($timestamp !== -1) ? ['path' => $path, 'timestamp' => $timestamp] : false; - } - - /** - * @inheritdoc - */ - public function read($path) - { - if ( ! $object = $this->readStream($path)) { - return false; - } - - $object['contents'] = stream_get_contents($object['stream']); - fclose($object['stream']); - unset($object['stream']); - - return $object; - } - - /** - * @inheritdoc - */ - public function readStream($path) - { - $stream = fopen('php://temp', 'w+b'); - $result = ftp_fget($this->getConnection(), $stream, $path, $this->transferMode); - rewind($stream); - - if ( ! $result) { - fclose($stream); - - return false; - } - - return ['type' => 'file', 'path' => $path, 'stream' => $stream]; - } - - /** - * @inheritdoc - */ - public function setVisibility($path, $visibility) - { - $mode = $visibility === AdapterInterface::VISIBILITY_PUBLIC ? $this->getPermPublic() : $this->getPermPrivate(); - - if ( ! ftp_chmod($this->getConnection(), $mode, $path)) { - return false; - } - - return compact('path', 'visibility'); - } - - /** - * @inheritdoc - * - * @param string $directory - */ - protected function listDirectoryContents($directory, $recursive = true) - { - $directory = str_replace('*', '\\*', $directory); - - if ($recursive && $this->recurseManually) { - return $this->listDirectoryContentsRecursive($directory); - } - - $options = $recursive ? '-alnR' : '-aln'; - $listing = $this->ftpRawlist($options, $directory); - - return $listing ? $this->normalizeListing($listing, $directory) : []; - } - - /** - * @inheritdoc - * - * @param string $directory - */ - protected function listDirectoryContentsRecursive($directory) - { - $listing = $this->normalizeListing($this->ftpRawlist('-aln', $directory) ?: [], $directory); - $output = []; - - foreach ($listing as $item) { - $output[] = $item; - if ($item['type'] !== 'dir') { - continue; - } - $output = array_merge($output, $this->listDirectoryContentsRecursive($item['path'])); - } - - return $output; - } - - /** - * Check if the connection is open. - * - * @return bool - * - * @throws ConnectionErrorException - */ - public function isConnected() - { - return is_resource($this->connection) - && $this->getRawExecResponseCode('NOOP') === 200; - } - - /** - * @return bool - */ - protected function isPureFtpdServer() - { - $response = ftp_raw($this->connection, 'HELP'); - - return stripos(implode(' ', $response), 'Pure-FTPd') !== false; - } - - /** - * The ftp_rawlist function with optional escaping. - * - * @param string $options - * @param string $path - * - * @return array - */ - protected function ftpRawlist($options, $path) - { - $connection = $this->getConnection(); - - if ($this->isPureFtpd) { - $path = str_replace(' ', '\ ', $path); - } - - return ftp_rawlist($connection, $options . ' ' . $path); - } - - private function getRawExecResponseCode($command) - { - $response = @ftp_raw($this->connection, trim($command)); - - return (int) preg_replace('/\D/', '', implode(' ', $response)); - } -} diff --git a/vendor/league/flysystem/src/Adapter/Ftpd.php b/vendor/league/flysystem/src/Adapter/Ftpd.php deleted file mode 100644 index d5349e475b..0000000000 --- a/vendor/league/flysystem/src/Adapter/Ftpd.php +++ /dev/null @@ -1,45 +0,0 @@ -<?php - -namespace League\Flysystem\Adapter; - -class Ftpd extends Ftp -{ - /** - * @inheritdoc - */ - public function getMetadata($path) - { - if ($path === '') { - return ['type' => 'dir', 'path' => '']; - } - if (@ftp_chdir($this->getConnection(), $path) === true) { - $this->setConnectionRoot(); - - return ['type' => 'dir', 'path' => $path]; - } - - if ( ! ($object = ftp_raw($this->getConnection(), 'STAT ' . $path)) || count($object) < 3) { - return false; - } - - if (substr($object[1], 0, 5) === "ftpd:") { - return false; - } - - return $this->normalizeObject($object[1], ''); - } - - /** - * @inheritdoc - */ - protected function listDirectoryContents($directory, $recursive = true) - { - $listing = ftp_rawlist($this->getConnection(), $directory, $recursive); - - if ($listing === false || ( ! empty($listing) && substr($listing[0], 0, 5) === "ftpd:")) { - return []; - } - - return $this->normalizeListing($listing, $directory); - } -} diff --git a/vendor/league/flysystem/src/Adapter/Local.php b/vendor/league/flysystem/src/Adapter/Local.php deleted file mode 100644 index 747c463ecb..0000000000 --- a/vendor/league/flysystem/src/Adapter/Local.php +++ /dev/null @@ -1,533 +0,0 @@ -<?php - -namespace League\Flysystem\Adapter; - -use DirectoryIterator; -use FilesystemIterator; -use finfo as Finfo; -use League\Flysystem\Config; -use League\Flysystem\Exception; -use League\Flysystem\NotSupportedException; -use League\Flysystem\UnreadableFileException; -use League\Flysystem\Util; -use LogicException; -use RecursiveDirectoryIterator; -use RecursiveIteratorIterator; -use SplFileInfo; - -class Local extends AbstractAdapter -{ - /** - * @var int - */ - const SKIP_LINKS = 0001; - - /** - * @var int - */ - const DISALLOW_LINKS = 0002; - - /** - * @var array - */ - protected static $permissions = [ - 'file' => [ - 'public' => 0644, - 'private' => 0600, - ], - 'dir' => [ - 'public' => 0755, - 'private' => 0700, - ], - ]; - - /** - * @var string - */ - protected $pathSeparator = DIRECTORY_SEPARATOR; - - /** - * @var array - */ - protected $permissionMap; - - /** - * @var int - */ - protected $writeFlags; - - /** - * @var int - */ - private $linkHandling; - - /** - * Constructor. - * - * @param string $root - * @param int $writeFlags - * @param int $linkHandling - * @param array $permissions - * - * @throws LogicException - */ - public function __construct($root, $writeFlags = LOCK_EX, $linkHandling = self::DISALLOW_LINKS, array $permissions = []) - { - $root = is_link($root) ? realpath($root) : $root; - $this->permissionMap = array_replace_recursive(static::$permissions, $permissions); - $this->ensureDirectory($root); - - if ( ! is_dir($root) || ! is_readable($root)) { - throw new LogicException('The root path ' . $root . ' is not readable.'); - } - - $this->setPathPrefix($root); - $this->writeFlags = $writeFlags; - $this->linkHandling = $linkHandling; - } - - /** - * Ensure the root directory exists. - * - * @param string $root root directory path - * - * @return void - * - * @throws Exception in case the root directory can not be created - */ - protected function ensureDirectory($root) - { - if ( ! is_dir($root)) { - $umask = umask(0); - - if ( ! @mkdir($root, $this->permissionMap['dir']['public'], true)) { - $mkdirError = error_get_last(); - } - - umask($umask); - clearstatcache(false, $root); - - if ( ! is_dir($root)) { - $errorMessage = isset($mkdirError['message']) ? $mkdirError['message'] : ''; - throw new Exception(sprintf('Impossible to create the root directory "%s". %s', $root, $errorMessage)); - } - } - } - - /** - * @inheritdoc - */ - public function has($path) - { - $location = $this->applyPathPrefix($path); - - return file_exists($location); - } - - /** - * @inheritdoc - */ - public function write($path, $contents, Config $config) - { - $location = $this->applyPathPrefix($path); - $this->ensureDirectory(dirname($location)); - - if (($size = file_put_contents($location, $contents, $this->writeFlags)) === false) { - return false; - } - - $type = 'file'; - $result = compact('contents', 'type', 'size', 'path'); - - if ($visibility = $config->get('visibility')) { - $result['visibility'] = $visibility; - $this->setVisibility($path, $visibility); - } - - return $result; - } - - /** - * @inheritdoc - */ - public function writeStream($path, $resource, Config $config) - { - $location = $this->applyPathPrefix($path); - $this->ensureDirectory(dirname($location)); - $stream = fopen($location, 'w+b'); - - if ( ! $stream || stream_copy_to_stream($resource, $stream) === false || ! fclose($stream)) { - return false; - } - - $type = 'file'; - $result = compact('type', 'path'); - - if ($visibility = $config->get('visibility')) { - $this->setVisibility($path, $visibility); - $result['visibility'] = $visibility; - } - - return $result; - } - - /** - * @inheritdoc - */ - public function readStream($path) - { - $location = $this->applyPathPrefix($path); - $stream = fopen($location, 'rb'); - - return ['type' => 'file', 'path' => $path, 'stream' => $stream]; - } - - /** - * @inheritdoc - */ - public function updateStream($path, $resource, Config $config) - { - return $this->writeStream($path, $resource, $config); - } - - /** - * @inheritdoc - */ - public function update($path, $contents, Config $config) - { - $location = $this->applyPathPrefix($path); - $size = file_put_contents($location, $contents, $this->writeFlags); - - if ($size === false) { - return false; - } - - $type = 'file'; - - $result = compact('type', 'path', 'size', 'contents'); - - if ($visibility = $config->get('visibility')) { - $this->setVisibility($path, $visibility); - $result['visibility'] = $visibility; - } - - return $result; - } - - /** - * @inheritdoc - */ - public function read($path) - { - $location = $this->applyPathPrefix($path); - $contents = @file_get_contents($location); - - if ($contents === false) { - return false; - } - - return ['type' => 'file', 'path' => $path, 'contents' => $contents]; - } - - /** - * @inheritdoc - */ - public function rename($path, $newpath) - { - $location = $this->applyPathPrefix($path); - $destination = $this->applyPathPrefix($newpath); - $parentDirectory = $this->applyPathPrefix(Util::dirname($newpath)); - $this->ensureDirectory($parentDirectory); - - return rename($location, $destination); - } - - /** - * @inheritdoc - */ - public function copy($path, $newpath) - { - $location = $this->applyPathPrefix($path); - $destination = $this->applyPathPrefix($newpath); - $this->ensureDirectory(dirname($destination)); - - return copy($location, $destination); - } - - /** - * @inheritdoc - */ - public function delete($path) - { - $location = $this->applyPathPrefix($path); - - return @unlink($location); - } - - /** - * @inheritdoc - */ - public function listContents($directory = '', $recursive = false) - { - $result = []; - $location = $this->applyPathPrefix($directory); - - if ( ! is_dir($location)) { - return []; - } - - $iterator = $recursive ? $this->getRecursiveDirectoryIterator($location) : $this->getDirectoryIterator($location); - - foreach ($iterator as $file) { - $path = $this->getFilePath($file); - - if (preg_match('#(^|/|\\\\)\.{1,2}$#', $path)) { - continue; - } - - $result[] = $this->normalizeFileInfo($file); - } - - unset($iterator); - - return array_filter($result); - } - - /** - * @inheritdoc - */ - public function getMetadata($path) - { - $location = $this->applyPathPrefix($path); - clearstatcache(false, $location); - $info = new SplFileInfo($location); - - return $this->normalizeFileInfo($info); - } - - /** - * @inheritdoc - */ - public function getSize($path) - { - return $this->getMetadata($path); - } - - /** - * @inheritdoc - */ - public function getMimetype($path) - { - $location = $this->applyPathPrefix($path); - $finfo = new Finfo(FILEINFO_MIME_TYPE); - $mimetype = $finfo->file($location); - - if (in_array($mimetype, ['application/octet-stream', 'inode/x-empty', 'application/x-empty'])) { - $mimetype = Util\MimeType::detectByFilename($location); - } - - return ['path' => $path, 'type' => 'file', 'mimetype' => $mimetype]; - } - - /** - * @inheritdoc - */ - public function getTimestamp($path) - { - return $this->getMetadata($path); - } - - /** - * @inheritdoc - */ - public function getVisibility($path) - { - $location = $this->applyPathPrefix($path); - clearstatcache(false, $location); - $permissions = octdec(substr(sprintf('%o', fileperms($location)), -4)); - $type = is_dir($location) ? 'dir' : 'file'; - - foreach ($this->permissionMap[$type] as $visibility => $visibilityPermissions) { - if ($visibilityPermissions == $permissions) { - return compact('path', 'visibility'); - } - } - - $visibility = substr(sprintf('%o', fileperms($location)), -4); - - return compact('path', 'visibility'); - } - - /** - * @inheritdoc - */ - public function setVisibility($path, $visibility) - { - $location = $this->applyPathPrefix($path); - $type = is_dir($location) ? 'dir' : 'file'; - $success = chmod($location, $this->permissionMap[$type][$visibility]); - - if ($success === false) { - return false; - } - - return compact('path', 'visibility'); - } - - /** - * @inheritdoc - */ - public function createDir($dirname, Config $config) - { - $location = $this->applyPathPrefix($dirname); - $umask = umask(0); - $visibility = $config->get('visibility', 'public'); - $return = ['path' => $dirname, 'type' => 'dir']; - - if ( ! is_dir($location)) { - if (false === @mkdir($location, $this->permissionMap['dir'][$visibility], true) - || false === is_dir($location)) { - $return = false; - } - } - - umask($umask); - - return $return; - } - - /** - * @inheritdoc - */ - public function deleteDir($dirname) - { - $location = $this->applyPathPrefix($dirname); - - if ( ! is_dir($location)) { - return false; - } - - $contents = $this->getRecursiveDirectoryIterator($location, RecursiveIteratorIterator::CHILD_FIRST); - - /** @var SplFileInfo $file */ - foreach ($contents as $file) { - $this->guardAgainstUnreadableFileInfo($file); - $this->deleteFileInfoObject($file); - } - - unset($contents); - - return rmdir($location); - } - - /** - * @param SplFileInfo $file - */ - protected function deleteFileInfoObject(SplFileInfo $file) - { - switch ($file->getType()) { - case 'dir': - rmdir($file->getRealPath()); - break; - case 'link': - unlink($file->getPathname()); - break; - default: - unlink($file->getRealPath()); - } - } - - /** - * Normalize the file info. - * - * @param SplFileInfo $file - * - * @return array|void - * - * @throws NotSupportedException - */ - protected function normalizeFileInfo(SplFileInfo $file) - { - if ( ! $file->isLink()) { - return $this->mapFileInfo($file); - } - - if ($this->linkHandling & self::DISALLOW_LINKS) { - throw NotSupportedException::forLink($file); - } - } - - /** - * Get the normalized path from a SplFileInfo object. - * - * @param SplFileInfo $file - * - * @return string - */ - protected function getFilePath(SplFileInfo $file) - { - $location = $file->getPathname(); - $path = $this->removePathPrefix($location); - - return trim(str_replace('\\', '/', $path), '/'); - } - - /** - * @param string $path - * @param int $mode - * - * @return RecursiveIteratorIterator - */ - protected function getRecursiveDirectoryIterator($path, $mode = RecursiveIteratorIterator::SELF_FIRST) - { - return new RecursiveIteratorIterator( - new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS), - $mode - ); - } - - /** - * @param string $path - * - * @return DirectoryIterator - */ - protected function getDirectoryIterator($path) - { - $iterator = new DirectoryIterator($path); - - return $iterator; - } - - /** - * @param SplFileInfo $file - * - * @return array - */ - protected function mapFileInfo(SplFileInfo $file) - { - $normalized = [ - 'type' => $file->getType(), - 'path' => $this->getFilePath($file), - ]; - - $normalized['timestamp'] = $file->getMTime(); - - if ($normalized['type'] === 'file') { - $normalized['size'] = $file->getSize(); - } - - return $normalized; - } - - /** - * @param SplFileInfo $file - * - * @throws UnreadableFileException - */ - protected function guardAgainstUnreadableFileInfo(SplFileInfo $file) - { - if ( ! $file->isReadable()) { - throw UnreadableFileException::forFileInfo($file); - } - } -} diff --git a/vendor/league/flysystem/src/Adapter/NullAdapter.php b/vendor/league/flysystem/src/Adapter/NullAdapter.php deleted file mode 100644 index 2527087f7c..0000000000 --- a/vendor/league/flysystem/src/Adapter/NullAdapter.php +++ /dev/null @@ -1,144 +0,0 @@ -<?php - -namespace League\Flysystem\Adapter; - -use League\Flysystem\Adapter\Polyfill\StreamedCopyTrait; -use League\Flysystem\Adapter\Polyfill\StreamedTrait; -use League\Flysystem\Config; - -class NullAdapter extends AbstractAdapter -{ - use StreamedTrait; - use StreamedCopyTrait; - - /** - * Check whether a file is present. - * - * @param string $path - * - * @return bool - */ - public function has($path) - { - return false; - } - - /** - * @inheritdoc - */ - public function write($path, $contents, Config $config) - { - $type = 'file'; - $result = compact('contents', 'type', 'path'); - - if ($visibility = $config->get('visibility')) { - $result['visibility'] = $visibility; - } - - return $result; - } - - /** - * @inheritdoc - */ - public function update($path, $contents, Config $config) - { - return false; - } - - /** - * @inheritdoc - */ - public function read($path) - { - return false; - } - - /** - * @inheritdoc - */ - public function rename($path, $newpath) - { - return false; - } - - /** - * @inheritdoc - */ - public function delete($path) - { - return false; - } - - /** - * @inheritdoc - */ - public function listContents($directory = '', $recursive = false) - { - return []; - } - - /** - * @inheritdoc - */ - public function getMetadata($path) - { - return false; - } - - /** - * @inheritdoc - */ - public function getSize($path) - { - return false; - } - - /** - * @inheritdoc - */ - public function getMimetype($path) - { - return false; - } - - /** - * @inheritdoc - */ - public function getTimestamp($path) - { - return false; - } - - /** - * @inheritdoc - */ - public function getVisibility($path) - { - return false; - } - - /** - * @inheritdoc - */ - public function setVisibility($path, $visibility) - { - return compact('visibility'); - } - - /** - * @inheritdoc - */ - public function createDir($dirname, Config $config) - { - return ['path' => $dirname, 'type' => 'dir']; - } - - /** - * @inheritdoc - */ - public function deleteDir($dirname) - { - return false; - } -} diff --git a/vendor/league/flysystem/src/Adapter/Polyfill/NotSupportingVisibilityTrait.php b/vendor/league/flysystem/src/Adapter/Polyfill/NotSupportingVisibilityTrait.php deleted file mode 100644 index fc0a747acb..0000000000 --- a/vendor/league/flysystem/src/Adapter/Polyfill/NotSupportingVisibilityTrait.php +++ /dev/null @@ -1,33 +0,0 @@ -<?php - -namespace League\Flysystem\Adapter\Polyfill; - -use LogicException; - -trait NotSupportingVisibilityTrait -{ - /** - * Get the visibility of a file. - * - * @param string $path - * - * @throws LogicException - */ - public function getVisibility($path) - { - throw new LogicException(get_class($this) . ' does not support visibility. Path: ' . $path); - } - - /** - * Set the visibility for a file. - * - * @param string $path - * @param string $visibility - * - * @throws LogicException - */ - public function setVisibility($path, $visibility) - { - throw new LogicException(get_class($this) . ' does not support visibility. Path: ' . $path . ', visibility: ' . $visibility); - } -} diff --git a/vendor/league/flysystem/src/Adapter/Polyfill/StreamedCopyTrait.php b/vendor/league/flysystem/src/Adapter/Polyfill/StreamedCopyTrait.php deleted file mode 100644 index 1b491a4918..0000000000 --- a/vendor/league/flysystem/src/Adapter/Polyfill/StreamedCopyTrait.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php - -namespace League\Flysystem\Adapter\Polyfill; - -use League\Flysystem\Config; - -trait StreamedCopyTrait -{ - /** - * Copy a file. - * - * @param string $path - * @param string $newpath - * - * @return bool - */ - public function copy($path, $newpath) - { - $response = $this->readStream($path); - - if ($response === false || ! is_resource($response['stream'])) { - return false; - } - - $result = $this->writeStream($newpath, $response['stream'], new Config()); - - if ($result !== false && is_resource($response['stream'])) { - fclose($response['stream']); - } - - return $result !== false; - } - - // Required abstract method - - /** - * @param string $path - * - * @return resource - */ - abstract public function readStream($path); - - /** - * @param string $path - * @param resource $resource - * @param Config $config - * - * @return resource - */ - abstract public function writeStream($path, $resource, Config $config); -} diff --git a/vendor/league/flysystem/src/Adapter/Polyfill/StreamedReadingTrait.php b/vendor/league/flysystem/src/Adapter/Polyfill/StreamedReadingTrait.php deleted file mode 100644 index 2b31c01d69..0000000000 --- a/vendor/league/flysystem/src/Adapter/Polyfill/StreamedReadingTrait.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php - -namespace League\Flysystem\Adapter\Polyfill; - -/** - * A helper for adapters that only handle strings to provide read streams. - */ -trait StreamedReadingTrait -{ - /** - * Reads a file as a stream. - * - * @param string $path - * - * @return array|false - * - * @see League\Flysystem\ReadInterface::readStream() - */ - public function readStream($path) - { - if ( ! $data = $this->read($path)) { - return false; - } - - $stream = fopen('php://temp', 'w+b'); - fwrite($stream, $data['contents']); - rewind($stream); - $data['stream'] = $stream; - unset($data['contents']); - - return $data; - } - - /** - * Reads a file. - * - * @param string $path - * - * @return array|false - * - * @see League\Flysystem\ReadInterface::read() - */ - abstract public function read($path); -} diff --git a/vendor/league/flysystem/src/Adapter/Polyfill/StreamedTrait.php b/vendor/league/flysystem/src/Adapter/Polyfill/StreamedTrait.php deleted file mode 100644 index 80424960c1..0000000000 --- a/vendor/league/flysystem/src/Adapter/Polyfill/StreamedTrait.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -namespace League\Flysystem\Adapter\Polyfill; - -trait StreamedTrait -{ - use StreamedReadingTrait; - use StreamedWritingTrait; -} diff --git a/vendor/league/flysystem/src/Adapter/Polyfill/StreamedWritingTrait.php b/vendor/league/flysystem/src/Adapter/Polyfill/StreamedWritingTrait.php deleted file mode 100644 index 8c91e83fc8..0000000000 --- a/vendor/league/flysystem/src/Adapter/Polyfill/StreamedWritingTrait.php +++ /dev/null @@ -1,60 +0,0 @@ -<?php - -namespace League\Flysystem\Adapter\Polyfill; - -use League\Flysystem\Config; -use League\Flysystem\Util; - -trait StreamedWritingTrait -{ - /** - * Stream fallback delegator. - * - * @param string $path - * @param resource $resource - * @param Config $config - * @param string $fallback - * - * @return mixed fallback result - */ - protected function stream($path, $resource, Config $config, $fallback) - { - Util::rewindStream($resource); - $contents = stream_get_contents($resource); - $fallbackCall = [$this, $fallback]; - - return call_user_func($fallbackCall, $path, $contents, $config); - } - - /** - * Write using a stream. - * - * @param string $path - * @param resource $resource - * @param Config $config - * - * @return mixed false or file metadata - */ - public function writeStream($path, $resource, Config $config) - { - return $this->stream($path, $resource, $config, 'write'); - } - - /** - * Update a file using a stream. - * - * @param string $path - * @param resource $resource - * @param Config $config Config object or visibility setting - * - * @return mixed false of file metadata - */ - public function updateStream($path, $resource, Config $config) - { - return $this->stream($path, $resource, $config, 'update'); - } - - // Required abstract methods - abstract public function write($pash, $contents, Config $config); - abstract public function update($pash, $contents, Config $config); -} diff --git a/vendor/league/flysystem/src/Adapter/SynologyFtp.php b/vendor/league/flysystem/src/Adapter/SynologyFtp.php deleted file mode 100644 index fe0d344cfe..0000000000 --- a/vendor/league/flysystem/src/Adapter/SynologyFtp.php +++ /dev/null @@ -1,8 +0,0 @@ -<?php - -namespace League\Flysystem\Adapter; - -class SynologyFtp extends Ftpd -{ - // This class merely exists because of BC. -} diff --git a/vendor/league/flysystem/src/AdapterInterface.php b/vendor/league/flysystem/src/AdapterInterface.php deleted file mode 100644 index 567fc5a290..0000000000 --- a/vendor/league/flysystem/src/AdapterInterface.php +++ /dev/null @@ -1,118 +0,0 @@ -<?php - -namespace League\Flysystem; - -interface AdapterInterface extends ReadInterface -{ - /** - * @const VISIBILITY_PUBLIC public visibility - */ - const VISIBILITY_PUBLIC = 'public'; - - /** - * @const VISIBILITY_PRIVATE private visibility - */ - const VISIBILITY_PRIVATE = 'private'; - - /** - * Write a new file. - * - * @param string $path - * @param string $contents - * @param Config $config Config object - * - * @return array|false false on failure file meta data on success - */ - public function write($path, $contents, Config $config); - - /** - * Write a new file using a stream. - * - * @param string $path - * @param resource $resource - * @param Config $config Config object - * - * @return array|false false on failure file meta data on success - */ - public function writeStream($path, $resource, Config $config); - - /** - * Update a file. - * - * @param string $path - * @param string $contents - * @param Config $config Config object - * - * @return array|false false on failure file meta data on success - */ - public function update($path, $contents, Config $config); - - /** - * Update a file using a stream. - * - * @param string $path - * @param resource $resource - * @param Config $config Config object - * - * @return array|false false on failure file meta data on success - */ - public function updateStream($path, $resource, Config $config); - - /** - * Rename a file. - * - * @param string $path - * @param string $newpath - * - * @return bool - */ - public function rename($path, $newpath); - - /** - * Copy a file. - * - * @param string $path - * @param string $newpath - * - * @return bool - */ - public function copy($path, $newpath); - - /** - * Delete a file. - * - * @param string $path - * - * @return bool - */ - public function delete($path); - - /** - * Delete a directory. - * - * @param string $dirname - * - * @return bool - */ - public function deleteDir($dirname); - - /** - * Create a directory. - * - * @param string $dirname directory name - * @param Config $config - * - * @return array|false - */ - public function createDir($dirname, Config $config); - - /** - * Set the visibility for a file. - * - * @param string $path - * @param string $visibility - * - * @return array|false file meta data - */ - public function setVisibility($path, $visibility); -} diff --git a/vendor/league/flysystem/src/Config.php b/vendor/league/flysystem/src/Config.php deleted file mode 100644 index 639f43d153..0000000000 --- a/vendor/league/flysystem/src/Config.php +++ /dev/null @@ -1,107 +0,0 @@ -<?php - -namespace League\Flysystem; - -class Config -{ - /** - * @var array - */ - protected $settings = []; - - /** - * @var Config|null - */ - protected $fallback; - - /** - * Constructor. - * - * @param array $settings - */ - public function __construct(array $settings = []) - { - $this->settings = $settings; - } - - /** - * Get a setting. - * - * @param string $key - * @param mixed $default - * - * @return mixed config setting or default when not found - */ - public function get($key, $default = null) - { - if ( ! array_key_exists($key, $this->settings)) { - return $this->getDefault($key, $default); - } - - return $this->settings[$key]; - } - - /** - * Check if an item exists by key. - * - * @param string $key - * - * @return bool - */ - public function has($key) - { - if (array_key_exists($key, $this->settings)) { - return true; - } - - return $this->fallback instanceof Config - ? $this->fallback->has($key) - : false; - } - - /** - * Try to retrieve a default setting from a config fallback. - * - * @param string $key - * @param mixed $default - * - * @return mixed config setting or default when not found - */ - protected function getDefault($key, $default) - { - if ( ! $this->fallback) { - return $default; - } - - return $this->fallback->get($key, $default); - } - - /** - * Set a setting. - * - * @param string $key - * @param mixed $value - * - * @return $this - */ - public function set($key, $value) - { - $this->settings[$key] = $value; - - return $this; - } - - /** - * Set the fallback. - * - * @param Config $fallback - * - * @return $this - */ - public function setFallback(Config $fallback) - { - $this->fallback = $fallback; - - return $this; - } -} diff --git a/vendor/league/flysystem/src/ConfigAwareTrait.php b/vendor/league/flysystem/src/ConfigAwareTrait.php deleted file mode 100644 index 202d605dad..0000000000 --- a/vendor/league/flysystem/src/ConfigAwareTrait.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php - -namespace League\Flysystem; - -/** - * @internal - */ -trait ConfigAwareTrait -{ - /** - * @var Config - */ - protected $config; - - /** - * Set the config. - * - * @param Config|array|null $config - */ - protected function setConfig($config) - { - $this->config = $config ? Util::ensureConfig($config) : new Config; - } - - /** - * Get the Config. - * - * @return Config config object - */ - public function getConfig() - { - return $this->config; - } - - /** - * Convert a config array to a Config object with the correct fallback. - * - * @param array $config - * - * @return Config - */ - protected function prepareConfig(array $config) - { - $config = new Config($config); - $config->setFallback($this->getConfig()); - - return $config; - } -} diff --git a/vendor/league/flysystem/src/ConnectionErrorException.php b/vendor/league/flysystem/src/ConnectionErrorException.php deleted file mode 100644 index adb651d3db..0000000000 --- a/vendor/league/flysystem/src/ConnectionErrorException.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -namespace League\Flysystem; - -use ErrorException; - -class ConnectionErrorException extends ErrorException implements FilesystemException -{ -} diff --git a/vendor/league/flysystem/src/ConnectionRuntimeException.php b/vendor/league/flysystem/src/ConnectionRuntimeException.php deleted file mode 100644 index 8b893ef17a..0000000000 --- a/vendor/league/flysystem/src/ConnectionRuntimeException.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -namespace League\Flysystem; - -use RuntimeException; - -class ConnectionRuntimeException extends RuntimeException implements FilesystemException -{ -} diff --git a/vendor/league/flysystem/src/Directory.php b/vendor/league/flysystem/src/Directory.php deleted file mode 100644 index d4f90a8804..0000000000 --- a/vendor/league/flysystem/src/Directory.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php - -namespace League\Flysystem; - -/** - * @deprecated - */ -class Directory extends Handler -{ - /** - * Delete the directory. - * - * @return bool - */ - public function delete() - { - return $this->filesystem->deleteDir($this->path); - } - - /** - * List the directory contents. - * - * @param bool $recursive - * - * @return array|bool directory contents or false - */ - public function getContents($recursive = false) - { - return $this->filesystem->listContents($this->path, $recursive); - } -} diff --git a/vendor/league/flysystem/src/Exception.php b/vendor/league/flysystem/src/Exception.php deleted file mode 100644 index 4596c0a9a9..0000000000 --- a/vendor/league/flysystem/src/Exception.php +++ /dev/null @@ -1,8 +0,0 @@ -<?php - -namespace League\Flysystem; - -class Exception extends \Exception implements FilesystemException -{ - // -} diff --git a/vendor/league/flysystem/src/File.php b/vendor/league/flysystem/src/File.php deleted file mode 100644 index 4a4b7a02eb..0000000000 --- a/vendor/league/flysystem/src/File.php +++ /dev/null @@ -1,205 +0,0 @@ -<?php - -namespace League\Flysystem; - -/** - * @deprecated - */ -class File extends Handler -{ - /** - * Check whether the file exists. - * - * @return bool - */ - public function exists() - { - return $this->filesystem->has($this->path); - } - - /** - * Read the file. - * - * @return string|false file contents - */ - public function read() - { - return $this->filesystem->read($this->path); - } - - /** - * Read the file as a stream. - * - * @return resource|false file stream - */ - public function readStream() - { - return $this->filesystem->readStream($this->path); - } - - /** - * Write the new file. - * - * @param string $content - * - * @return bool success boolean - */ - public function write($content) - { - return $this->filesystem->write($this->path, $content); - } - - /** - * Write the new file using a stream. - * - * @param resource $resource - * - * @return bool success boolean - */ - public function writeStream($resource) - { - return $this->filesystem->writeStream($this->path, $resource); - } - - /** - * Update the file contents. - * - * @param string $content - * - * @return bool success boolean - */ - public function update($content) - { - return $this->filesystem->update($this->path, $content); - } - - /** - * Update the file contents with a stream. - * - * @param resource $resource - * - * @return bool success boolean - */ - public function updateStream($resource) - { - return $this->filesystem->updateStream($this->path, $resource); - } - - /** - * Create the file or update if exists. - * - * @param string $content - * - * @return bool success boolean - */ - public function put($content) - { - return $this->filesystem->put($this->path, $content); - } - - /** - * Create the file or update if exists using a stream. - * - * @param resource $resource - * - * @return bool success boolean - */ - public function putStream($resource) - { - return $this->filesystem->putStream($this->path, $resource); - } - - /** - * Rename the file. - * - * @param string $newpath - * - * @return bool success boolean - */ - public function rename($newpath) - { - if ($this->filesystem->rename($this->path, $newpath)) { - $this->path = $newpath; - - return true; - } - - return false; - } - - /** - * Copy the file. - * - * @param string $newpath - * - * @return File|false new file or false - */ - public function copy($newpath) - { - if ($this->filesystem->copy($this->path, $newpath)) { - return new File($this->filesystem, $newpath); - } - - return false; - } - - /** - * Get the file's timestamp. - * - * @return string|false The timestamp or false on failure. - */ - public function getTimestamp() - { - return $this->filesystem->getTimestamp($this->path); - } - - /** - * Get the file's mimetype. - * - * @return string|false The file mime-type or false on failure. - */ - public function getMimetype() - { - return $this->filesystem->getMimetype($this->path); - } - - /** - * Get the file's visibility. - * - * @return string|false The visibility (public|private) or false on failure. - */ - public function getVisibility() - { - return $this->filesystem->getVisibility($this->path); - } - - /** - * Get the file's metadata. - * - * @return array|false The file metadata or false on failure. - */ - public function getMetadata() - { - return $this->filesystem->getMetadata($this->path); - } - - /** - * Get the file size. - * - * @return int|false The file size or false on failure. - */ - public function getSize() - { - return $this->filesystem->getSize($this->path); - } - - /** - * Delete the file. - * - * @return bool success boolean - */ - public function delete() - { - return $this->filesystem->delete($this->path); - } -} diff --git a/vendor/league/flysystem/src/FileExistsException.php b/vendor/league/flysystem/src/FileExistsException.php deleted file mode 100644 index c82e20c169..0000000000 --- a/vendor/league/flysystem/src/FileExistsException.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php - -namespace League\Flysystem; - -use Exception as BaseException; - -class FileExistsException extends Exception -{ - /** - * @var string - */ - protected $path; - - /** - * Constructor. - * - * @param string $path - * @param int $code - * @param BaseException $previous - */ - public function __construct($path, $code = 0, BaseException $previous = null) - { - $this->path = $path; - - parent::__construct('File already exists at path: ' . $this->getPath(), $code, $previous); - } - - /** - * Get the path which was found. - * - * @return string - */ - public function getPath() - { - return $this->path; - } -} diff --git a/vendor/league/flysystem/src/FileNotFoundException.php b/vendor/league/flysystem/src/FileNotFoundException.php deleted file mode 100644 index 989df69bbe..0000000000 --- a/vendor/league/flysystem/src/FileNotFoundException.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php - -namespace League\Flysystem; - -use Exception as BaseException; - -class FileNotFoundException extends Exception -{ - /** - * @var string - */ - protected $path; - - /** - * Constructor. - * - * @param string $path - * @param int $code - * @param \Exception $previous - */ - public function __construct($path, $code = 0, BaseException $previous = null) - { - $this->path = $path; - - parent::__construct('File not found at path: ' . $this->getPath(), $code, $previous); - } - - /** - * Get the path which was not found. - * - * @return string - */ - public function getPath() - { - return $this->path; - } -} diff --git a/vendor/league/flysystem/src/Filesystem.php b/vendor/league/flysystem/src/Filesystem.php deleted file mode 100644 index 0ce24845ab..0000000000 --- a/vendor/league/flysystem/src/Filesystem.php +++ /dev/null @@ -1,408 +0,0 @@ -<?php - -namespace League\Flysystem; - -use InvalidArgumentException; -use League\Flysystem\Adapter\CanOverwriteFiles; -use League\Flysystem\Plugin\PluggableTrait; -use League\Flysystem\Util\ContentListingFormatter; - -/** - * @method array getWithMetadata(string $path, array $metadata) - * @method bool forceCopy(string $path, string $newpath) - * @method bool forceRename(string $path, string $newpath) - * @method array listFiles(string $path = '', boolean $recursive = false) - * @method array listPaths(string $path = '', boolean $recursive = false) - * @method array listWith(array $keys = [], $directory = '', $recursive = false) - */ -class Filesystem implements FilesystemInterface -{ - use PluggableTrait; - use ConfigAwareTrait; - - /** - * @var AdapterInterface - */ - protected $adapter; - - /** - * Constructor. - * - * @param AdapterInterface $adapter - * @param Config|array $config - */ - public function __construct(AdapterInterface $adapter, $config = null) - { - $this->adapter = $adapter; - $this->setConfig($config); - } - - /** - * Get the Adapter. - * - * @return AdapterInterface adapter - */ - public function getAdapter() - { - return $this->adapter; - } - - /** - * @inheritdoc - */ - public function has($path) - { - $path = Util::normalizePath($path); - - return strlen($path) === 0 ? false : (bool) $this->getAdapter()->has($path); - } - - /** - * @inheritdoc - */ - public function write($path, $contents, array $config = []) - { - $path = Util::normalizePath($path); - $this->assertAbsent($path); - $config = $this->prepareConfig($config); - - return (bool) $this->getAdapter()->write($path, $contents, $config); - } - - /** - * @inheritdoc - */ - public function writeStream($path, $resource, array $config = []) - { - if ( ! is_resource($resource)) { - throw new InvalidArgumentException(__METHOD__ . ' expects argument #2 to be a valid resource.'); - } - - $path = Util::normalizePath($path); - $this->assertAbsent($path); - $config = $this->prepareConfig($config); - - Util::rewindStream($resource); - - return (bool) $this->getAdapter()->writeStream($path, $resource, $config); - } - - /** - * @inheritdoc - */ - public function put($path, $contents, array $config = []) - { - $path = Util::normalizePath($path); - $config = $this->prepareConfig($config); - - if ( ! $this->getAdapter() instanceof CanOverwriteFiles && $this->has($path)) { - return (bool) $this->getAdapter()->update($path, $contents, $config); - } - - return (bool) $this->getAdapter()->write($path, $contents, $config); - } - - /** - * @inheritdoc - */ - public function putStream($path, $resource, array $config = []) - { - if ( ! is_resource($resource)) { - throw new InvalidArgumentException(__METHOD__ . ' expects argument #2 to be a valid resource.'); - } - - $path = Util::normalizePath($path); - $config = $this->prepareConfig($config); - Util::rewindStream($resource); - - if ( ! $this->getAdapter() instanceof CanOverwriteFiles && $this->has($path)) { - return (bool) $this->getAdapter()->updateStream($path, $resource, $config); - } - - return (bool) $this->getAdapter()->writeStream($path, $resource, $config); - } - - /** - * @inheritdoc - */ - public function readAndDelete($path) - { - $path = Util::normalizePath($path); - $this->assertPresent($path); - $contents = $this->read($path); - - if ($contents === false) { - return false; - } - - $this->delete($path); - - return $contents; - } - - /** - * @inheritdoc - */ - public function update($path, $contents, array $config = []) - { - $path = Util::normalizePath($path); - $config = $this->prepareConfig($config); - - $this->assertPresent($path); - - return (bool) $this->getAdapter()->update($path, $contents, $config); - } - - /** - * @inheritdoc - */ - public function updateStream($path, $resource, array $config = []) - { - if ( ! is_resource($resource)) { - throw new InvalidArgumentException(__METHOD__ . ' expects argument #2 to be a valid resource.'); - } - - $path = Util::normalizePath($path); - $config = $this->prepareConfig($config); - $this->assertPresent($path); - Util::rewindStream($resource); - - return (bool) $this->getAdapter()->updateStream($path, $resource, $config); - } - - /** - * @inheritdoc - */ - public function read($path) - { - $path = Util::normalizePath($path); - $this->assertPresent($path); - - if ( ! ($object = $this->getAdapter()->read($path))) { - return false; - } - - return $object['contents']; - } - - /** - * @inheritdoc - */ - public function readStream($path) - { - $path = Util::normalizePath($path); - $this->assertPresent($path); - - if ( ! $object = $this->getAdapter()->readStream($path)) { - return false; - } - - return $object['stream']; - } - - /** - * @inheritdoc - */ - public function rename($path, $newpath) - { - $path = Util::normalizePath($path); - $newpath = Util::normalizePath($newpath); - $this->assertPresent($path); - $this->assertAbsent($newpath); - - return (bool) $this->getAdapter()->rename($path, $newpath); - } - - /** - * @inheritdoc - */ - public function copy($path, $newpath) - { - $path = Util::normalizePath($path); - $newpath = Util::normalizePath($newpath); - $this->assertPresent($path); - $this->assertAbsent($newpath); - - return $this->getAdapter()->copy($path, $newpath); - } - - /** - * @inheritdoc - */ - public function delete($path) - { - $path = Util::normalizePath($path); - $this->assertPresent($path); - - return $this->getAdapter()->delete($path); - } - - /** - * @inheritdoc - */ - public function deleteDir($dirname) - { - $dirname = Util::normalizePath($dirname); - - if ($dirname === '') { - throw new RootViolationException('Root directories can not be deleted.'); - } - - return (bool) $this->getAdapter()->deleteDir($dirname); - } - - /** - * @inheritdoc - */ - public function createDir($dirname, array $config = []) - { - $dirname = Util::normalizePath($dirname); - $config = $this->prepareConfig($config); - - return (bool) $this->getAdapter()->createDir($dirname, $config); - } - - /** - * @inheritdoc - */ - public function listContents($directory = '', $recursive = false) - { - $directory = Util::normalizePath($directory); - $contents = $this->getAdapter()->listContents($directory, $recursive); - - return (new ContentListingFormatter($directory, $recursive, $this->config->get('case_sensitive', true))) - ->formatListing($contents); - } - - /** - * @inheritdoc - */ - public function getMimetype($path) - { - $path = Util::normalizePath($path); - $this->assertPresent($path); - - if (( ! $object = $this->getAdapter()->getMimetype($path)) || ! array_key_exists('mimetype', $object)) { - return false; - } - - return $object['mimetype']; - } - - /** - * @inheritdoc - */ - public function getTimestamp($path) - { - $path = Util::normalizePath($path); - $this->assertPresent($path); - - if (( ! $object = $this->getAdapter()->getTimestamp($path)) || ! array_key_exists('timestamp', $object)) { - return false; - } - - return (int) $object['timestamp']; - } - - /** - * @inheritdoc - */ - public function getVisibility($path) - { - $path = Util::normalizePath($path); - $this->assertPresent($path); - - if (( ! $object = $this->getAdapter()->getVisibility($path)) || ! array_key_exists('visibility', $object)) { - return false; - } - - return $object['visibility']; - } - - /** - * @inheritdoc - */ - public function getSize($path) - { - $path = Util::normalizePath($path); - $this->assertPresent($path); - - if (( ! $object = $this->getAdapter()->getSize($path)) || ! array_key_exists('size', $object)) { - return false; - } - - return (int) $object['size']; - } - - /** - * @inheritdoc - */ - public function setVisibility($path, $visibility) - { - $path = Util::normalizePath($path); - $this->assertPresent($path); - - return (bool) $this->getAdapter()->setVisibility($path, $visibility); - } - - /** - * @inheritdoc - */ - public function getMetadata($path) - { - $path = Util::normalizePath($path); - $this->assertPresent($path); - - return $this->getAdapter()->getMetadata($path); - } - - /** - * @inheritdoc - */ - public function get($path, Handler $handler = null) - { - $path = Util::normalizePath($path); - - if ( ! $handler) { - $metadata = $this->getMetadata($path); - $handler = ($metadata && $metadata['type'] === 'file') ? new File($this, $path) : new Directory($this, $path); - } - - $handler->setPath($path); - $handler->setFilesystem($this); - - return $handler; - } - - /** - * Assert a file is present. - * - * @param string $path path to file - * - * @throws FileNotFoundException - * - * @return void - */ - public function assertPresent($path) - { - if ($this->config->get('disable_asserts', false) === false && ! $this->has($path)) { - throw new FileNotFoundException($path); - } - } - - /** - * Assert a file is absent. - * - * @param string $path path to file - * - * @throws FileExistsException - * - * @return void - */ - public function assertAbsent($path) - { - if ($this->config->get('disable_asserts', false) === false && $this->has($path)) { - throw new FileExistsException($path); - } - } -} diff --git a/vendor/league/flysystem/src/FilesystemException.php b/vendor/league/flysystem/src/FilesystemException.php deleted file mode 100644 index 3121e533d7..0000000000 --- a/vendor/league/flysystem/src/FilesystemException.php +++ /dev/null @@ -1,7 +0,0 @@ -<?php - -namespace League\Flysystem; - -interface FilesystemException -{ -} diff --git a/vendor/league/flysystem/src/FilesystemInterface.php b/vendor/league/flysystem/src/FilesystemInterface.php deleted file mode 100644 index a6b99ba060..0000000000 --- a/vendor/league/flysystem/src/FilesystemInterface.php +++ /dev/null @@ -1,284 +0,0 @@ -<?php - -namespace League\Flysystem; - -use InvalidArgumentException; - -interface FilesystemInterface -{ - /** - * Check whether a file exists. - * - * @param string $path - * - * @return bool - */ - public function has($path); - - /** - * Read a file. - * - * @param string $path The path to the file. - * - * @throws FileNotFoundException - * - * @return string|false The file contents or false on failure. - */ - public function read($path); - - /** - * Retrieves a read-stream for a path. - * - * @param string $path The path to the file. - * - * @throws FileNotFoundException - * - * @return resource|false The path resource or false on failure. - */ - public function readStream($path); - - /** - * List contents of a directory. - * - * @param string $directory The directory to list. - * @param bool $recursive Whether to list recursively. - * - * @return array A list of file metadata. - */ - public function listContents($directory = '', $recursive = false); - - /** - * Get a file's metadata. - * - * @param string $path The path to the file. - * - * @throws FileNotFoundException - * - * @return array|false The file metadata or false on failure. - */ - public function getMetadata($path); - - /** - * Get a file's size. - * - * @param string $path The path to the file. - * - * @throws FileNotFoundException - * - * @return int|false The file size or false on failure. - */ - public function getSize($path); - - /** - * Get a file's mime-type. - * - * @param string $path The path to the file. - * - * @throws FileNotFoundException - * - * @return string|false The file mime-type or false on failure. - */ - public function getMimetype($path); - - /** - * Get a file's timestamp. - * - * @param string $path The path to the file. - * - * @throws FileNotFoundException - * - * @return int|false The timestamp or false on failure. - */ - public function getTimestamp($path); - - /** - * Get a file's visibility. - * - * @param string $path The path to the file. - * - * @throws FileNotFoundException - * - * @return string|false The visibility (public|private) or false on failure. - */ - public function getVisibility($path); - - /** - * Write a new file. - * - * @param string $path The path of the new file. - * @param string $contents The file contents. - * @param array $config An optional configuration array. - * - * @throws FileExistsException - * - * @return bool True on success, false on failure. - */ - public function write($path, $contents, array $config = []); - - /** - * Write a new file using a stream. - * - * @param string $path The path of the new file. - * @param resource $resource The file handle. - * @param array $config An optional configuration array. - * - * @throws InvalidArgumentException If $resource is not a file handle. - * @throws FileExistsException - * - * @return bool True on success, false on failure. - */ - public function writeStream($path, $resource, array $config = []); - - /** - * Update an existing file. - * - * @param string $path The path of the existing file. - * @param string $contents The file contents. - * @param array $config An optional configuration array. - * - * @throws FileNotFoundException - * - * @return bool True on success, false on failure. - */ - public function update($path, $contents, array $config = []); - - /** - * Update an existing file using a stream. - * - * @param string $path The path of the existing file. - * @param resource $resource The file handle. - * @param array $config An optional configuration array. - * - * @throws InvalidArgumentException If $resource is not a file handle. - * @throws FileNotFoundException - * - * @return bool True on success, false on failure. - */ - public function updateStream($path, $resource, array $config = []); - - /** - * Rename a file. - * - * @param string $path Path to the existing file. - * @param string $newpath The new path of the file. - * - * @throws FileExistsException Thrown if $newpath exists. - * @throws FileNotFoundException Thrown if $path does not exist. - * - * @return bool True on success, false on failure. - */ - public function rename($path, $newpath); - - /** - * Copy a file. - * - * @param string $path Path to the existing file. - * @param string $newpath The new path of the file. - * - * @throws FileExistsException Thrown if $newpath exists. - * @throws FileNotFoundException Thrown if $path does not exist. - * - * @return bool True on success, false on failure. - */ - public function copy($path, $newpath); - - /** - * Delete a file. - * - * @param string $path - * - * @throws FileNotFoundException - * - * @return bool True on success, false on failure. - */ - public function delete($path); - - /** - * Delete a directory. - * - * @param string $dirname - * - * @throws RootViolationException Thrown if $dirname is empty. - * - * @return bool True on success, false on failure. - */ - public function deleteDir($dirname); - - /** - * Create a directory. - * - * @param string $dirname The name of the new directory. - * @param array $config An optional configuration array. - * - * @return bool True on success, false on failure. - */ - public function createDir($dirname, array $config = []); - - /** - * Set the visibility for a file. - * - * @param string $path The path to the file. - * @param string $visibility One of 'public' or 'private'. - * - * @throws FileNotFoundException - * - * @return bool True on success, false on failure. - */ - public function setVisibility($path, $visibility); - - /** - * Create a file or update if exists. - * - * @param string $path The path to the file. - * @param string $contents The file contents. - * @param array $config An optional configuration array. - * - * @return bool True on success, false on failure. - */ - public function put($path, $contents, array $config = []); - - /** - * Create a file or update if exists. - * - * @param string $path The path to the file. - * @param resource $resource The file handle. - * @param array $config An optional configuration array. - * - * @throws InvalidArgumentException Thrown if $resource is not a resource. - * - * @return bool True on success, false on failure. - */ - public function putStream($path, $resource, array $config = []); - - /** - * Read and delete a file. - * - * @param string $path The path to the file. - * - * @throws FileNotFoundException - * - * @return string|false The file contents, or false on failure. - */ - public function readAndDelete($path); - - /** - * Get a file/directory handler. - * - * @deprecated - * - * @param string $path The path to the file. - * @param Handler $handler An optional existing handler to populate. - * - * @return Handler Either a file or directory handler. - */ - public function get($path, Handler $handler = null); - - /** - * Register a plugin. - * - * @param PluginInterface $plugin The plugin to register. - * - * @return $this - */ - public function addPlugin(PluginInterface $plugin); -} diff --git a/vendor/league/flysystem/src/FilesystemNotFoundException.php b/vendor/league/flysystem/src/FilesystemNotFoundException.php deleted file mode 100644 index f928fa1d03..0000000000 --- a/vendor/league/flysystem/src/FilesystemNotFoundException.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -namespace League\Flysystem; - -use LogicException; - -/** - * Thrown when the MountManager cannot find a filesystem. - */ -class FilesystemNotFoundException extends LogicException implements FilesystemException -{ -} diff --git a/vendor/league/flysystem/src/Handler.php b/vendor/league/flysystem/src/Handler.php deleted file mode 100644 index 098bb854ed..0000000000 --- a/vendor/league/flysystem/src/Handler.php +++ /dev/null @@ -1,137 +0,0 @@ -<?php - -namespace League\Flysystem; - -use BadMethodCallException; - -/** - * @deprecated - */ -abstract class Handler -{ - /** - * @var string - */ - protected $path; - - /** - * @var FilesystemInterface - */ - protected $filesystem; - - /** - * Constructor. - * - * @param FilesystemInterface $filesystem - * @param string $path - */ - public function __construct(FilesystemInterface $filesystem = null, $path = null) - { - $this->path = $path; - $this->filesystem = $filesystem; - } - - /** - * Check whether the entree is a directory. - * - * @return bool - */ - public function isDir() - { - return $this->getType() === 'dir'; - } - - /** - * Check whether the entree is a file. - * - * @return bool - */ - public function isFile() - { - return $this->getType() === 'file'; - } - - /** - * Retrieve the entree type (file|dir). - * - * @return string file or dir - */ - public function getType() - { - $metadata = $this->filesystem->getMetadata($this->path); - - return $metadata ? $metadata['type'] : 'dir'; - } - - /** - * Set the Filesystem object. - * - * @param FilesystemInterface $filesystem - * - * @return $this - */ - public function setFilesystem(FilesystemInterface $filesystem) - { - $this->filesystem = $filesystem; - - return $this; - } - - /** - * Retrieve the Filesystem object. - * - * @return FilesystemInterface - */ - public function getFilesystem() - { - return $this->filesystem; - } - - /** - * Set the entree path. - * - * @param string $path - * - * @return $this - */ - public function setPath($path) - { - $this->path = $path; - - return $this; - } - - /** - * Retrieve the entree path. - * - * @return string path - */ - public function getPath() - { - return $this->path; - } - - /** - * Plugins pass-through. - * - * @param string $method - * @param array $arguments - * - * @return mixed - */ - public function __call($method, array $arguments) - { - array_unshift($arguments, $this->path); - $callback = [$this->filesystem, $method]; - - try { - return call_user_func_array($callback, $arguments); - } catch (BadMethodCallException $e) { - throw new BadMethodCallException( - 'Call to undefined method ' - . get_called_class() - . '::' . $method - ); - } - } -} diff --git a/vendor/league/flysystem/src/InvalidRootException.php b/vendor/league/flysystem/src/InvalidRootException.php deleted file mode 100644 index 468d1d58c1..0000000000 --- a/vendor/league/flysystem/src/InvalidRootException.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -namespace League\Flysystem; - -use RuntimeException; - -class InvalidRootException extends RuntimeException implements FilesystemException -{ -} diff --git a/vendor/league/flysystem/src/MountManager.php b/vendor/league/flysystem/src/MountManager.php deleted file mode 100644 index 150aee3a81..0000000000 --- a/vendor/league/flysystem/src/MountManager.php +++ /dev/null @@ -1,650 +0,0 @@ -<?php - -namespace League\Flysystem; - -use InvalidArgumentException; -use League\Flysystem\Plugin\PluggableTrait; -use League\Flysystem\Plugin\PluginNotFoundException; - -/** - * Class MountManager. - * - * Proxies methods to Filesystem (@see __call): - * - * @method AdapterInterface getAdapter($prefix) - * @method Config getConfig($prefix) - * @method array listFiles($directory = '', $recursive = false) - * @method array listPaths($directory = '', $recursive = false) - * @method array getWithMetadata($path, array $metadata) - * @method Filesystem flushCache() - * @method void assertPresent($path) - * @method void assertAbsent($path) - * @method Filesystem addPlugin(PluginInterface $plugin) - * - * @deprecated This functionality will be removed in 2.0 - */ -class MountManager implements FilesystemInterface -{ - use PluggableTrait; - - /** - * @var FilesystemInterface[] - */ - protected $filesystems = []; - - /** - * Constructor. - * - * @param FilesystemInterface[] $filesystems [:prefix => Filesystem,] - * - * @throws InvalidArgumentException - */ - public function __construct(array $filesystems = []) - { - $this->mountFilesystems($filesystems); - } - - /** - * Mount filesystems. - * - * @param FilesystemInterface[] $filesystems [:prefix => Filesystem,] - * - * @throws InvalidArgumentException - * - * @return $this - */ - public function mountFilesystems(array $filesystems) - { - foreach ($filesystems as $prefix => $filesystem) { - $this->mountFilesystem($prefix, $filesystem); - } - - return $this; - } - - /** - * Mount filesystems. - * - * @param string $prefix - * @param FilesystemInterface $filesystem - * - * @throws InvalidArgumentException - * - * @return $this - */ - public function mountFilesystem($prefix, FilesystemInterface $filesystem) - { - if ( ! is_string($prefix)) { - throw new InvalidArgumentException(__METHOD__ . ' expects argument #1 to be a string.'); - } - - $this->filesystems[$prefix] = $filesystem; - - return $this; - } - - /** - * Get the filesystem with the corresponding prefix. - * - * @param string $prefix - * - * @throws FilesystemNotFoundException - * - * @return FilesystemInterface - */ - public function getFilesystem($prefix) - { - if ( ! isset($this->filesystems[$prefix])) { - throw new FilesystemNotFoundException('No filesystem mounted with prefix ' . $prefix); - } - - return $this->filesystems[$prefix]; - } - - /** - * Retrieve the prefix from an arguments array. - * - * @param array $arguments - * - * @throws InvalidArgumentException - * - * @return array [:prefix, :arguments] - */ - public function filterPrefix(array $arguments) - { - if (empty($arguments)) { - throw new InvalidArgumentException('At least one argument needed'); - } - - $path = array_shift($arguments); - - if ( ! is_string($path)) { - throw new InvalidArgumentException('First argument should be a string'); - } - - list($prefix, $path) = $this->getPrefixAndPath($path); - array_unshift($arguments, $path); - - return [$prefix, $arguments]; - } - - /** - * @param string $directory - * @param bool $recursive - * - * @throws InvalidArgumentException - * @throws FilesystemNotFoundException - * - * @return array - */ - public function listContents($directory = '', $recursive = false) - { - list($prefix, $directory) = $this->getPrefixAndPath($directory); - $filesystem = $this->getFilesystem($prefix); - $result = $filesystem->listContents($directory, $recursive); - - foreach ($result as &$file) { - $file['filesystem'] = $prefix; - } - - return $result; - } - - /** - * Call forwarder. - * - * @param string $method - * @param array $arguments - * - * @throws InvalidArgumentException - * @throws FilesystemNotFoundException - * - * @return mixed - */ - public function __call($method, $arguments) - { - list($prefix, $arguments) = $this->filterPrefix($arguments); - - return $this->invokePluginOnFilesystem($method, $arguments, $prefix); - } - - /** - * @param string $from - * @param string $to - * @param array $config - * - * @throws InvalidArgumentException - * @throws FilesystemNotFoundException - * @throws FileExistsException - * - * @return bool - */ - public function copy($from, $to, array $config = []) - { - list($prefixFrom, $from) = $this->getPrefixAndPath($from); - - $buffer = $this->getFilesystem($prefixFrom)->readStream($from); - - if ($buffer === false) { - return false; - } - - list($prefixTo, $to) = $this->getPrefixAndPath($to); - - $result = $this->getFilesystem($prefixTo)->writeStream($to, $buffer, $config); - - if (is_resource($buffer)) { - fclose($buffer); - } - - return $result; - } - - /** - * List with plugin adapter. - * - * @param array $keys - * @param string $directory - * @param bool $recursive - * - * @throws InvalidArgumentException - * @throws FilesystemNotFoundException - * - * @return array - */ - public function listWith(array $keys = [], $directory = '', $recursive = false) - { - list($prefix, $directory) = $this->getPrefixAndPath($directory); - $arguments = [$keys, $directory, $recursive]; - - return $this->invokePluginOnFilesystem('listWith', $arguments, $prefix); - } - - /** - * Move a file. - * - * @param string $from - * @param string $to - * @param array $config - * - * @throws InvalidArgumentException - * @throws FilesystemNotFoundException - * - * @return bool - */ - public function move($from, $to, array $config = []) - { - list($prefixFrom, $pathFrom) = $this->getPrefixAndPath($from); - list($prefixTo, $pathTo) = $this->getPrefixAndPath($to); - - if ($prefixFrom === $prefixTo) { - $filesystem = $this->getFilesystem($prefixFrom); - $renamed = $filesystem->rename($pathFrom, $pathTo); - - if ($renamed && isset($config['visibility'])) { - return $filesystem->setVisibility($pathTo, $config['visibility']); - } - - return $renamed; - } - - $copied = $this->copy($from, $to, $config); - - if ($copied) { - return $this->delete($from); - } - - return false; - } - - /** - * Invoke a plugin on a filesystem mounted on a given prefix. - * - * @param string $method - * @param array $arguments - * @param string $prefix - * - * @throws FilesystemNotFoundException - * - * @return mixed - */ - public function invokePluginOnFilesystem($method, $arguments, $prefix) - { - $filesystem = $this->getFilesystem($prefix); - - try { - return $this->invokePlugin($method, $arguments, $filesystem); - } catch (PluginNotFoundException $e) { - // Let it pass, it's ok, don't panic. - } - - $callback = [$filesystem, $method]; - - return call_user_func_array($callback, $arguments); - } - - /** - * @param string $path - * - * @throws InvalidArgumentException - * - * @return string[] [:prefix, :path] - */ - protected function getPrefixAndPath($path) - { - if (strpos($path, '://') < 1) { - throw new InvalidArgumentException('No prefix detected in path: ' . $path); - } - - return explode('://', $path, 2); - } - - /** - * Check whether a file exists. - * - * @param string $path - * - * @return bool - */ - public function has($path) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->has($path); - } - - /** - * Read a file. - * - * @param string $path The path to the file. - * - * @throws FileNotFoundException - * - * @return string|false The file contents or false on failure. - */ - public function read($path) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->read($path); - } - - /** - * Retrieves a read-stream for a path. - * - * @param string $path The path to the file. - * - * @throws FileNotFoundException - * - * @return resource|false The path resource or false on failure. - */ - public function readStream($path) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->readStream($path); - } - - /** - * Get a file's metadata. - * - * @param string $path The path to the file. - * - * @throws FileNotFoundException - * - * @return array|false The file metadata or false on failure. - */ - public function getMetadata($path) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->getMetadata($path); - } - - /** - * Get a file's size. - * - * @param string $path The path to the file. - * - * @throws FileNotFoundException - * - * @return int|false The file size or false on failure. - */ - public function getSize($path) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->getSize($path); - } - - /** - * Get a file's mime-type. - * - * @param string $path The path to the file. - * - * @throws FileNotFoundException - * - * @return string|false The file mime-type or false on failure. - */ - public function getMimetype($path) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->getMimetype($path); - } - - /** - * Get a file's timestamp. - * - * @param string $path The path to the file. - * - * @throws FileNotFoundException - * - * @return string|false The timestamp or false on failure. - */ - public function getTimestamp($path) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->getTimestamp($path); - } - - /** - * Get a file's visibility. - * - * @param string $path The path to the file. - * - * @throws FileNotFoundException - * - * @return string|false The visibility (public|private) or false on failure. - */ - public function getVisibility($path) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->getVisibility($path); - } - - /** - * Write a new file. - * - * @param string $path The path of the new file. - * @param string $contents The file contents. - * @param array $config An optional configuration array. - * - * @throws FileExistsException - * - * @return bool True on success, false on failure. - */ - public function write($path, $contents, array $config = []) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->write($path, $contents, $config); - } - - /** - * Write a new file using a stream. - * - * @param string $path The path of the new file. - * @param resource $resource The file handle. - * @param array $config An optional configuration array. - * - * @throws InvalidArgumentException If $resource is not a file handle. - * @throws FileExistsException - * - * @return bool True on success, false on failure. - */ - public function writeStream($path, $resource, array $config = []) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->writeStream($path, $resource, $config); - } - - /** - * Update an existing file. - * - * @param string $path The path of the existing file. - * @param string $contents The file contents. - * @param array $config An optional configuration array. - * - * @throws FileNotFoundException - * - * @return bool True on success, false on failure. - */ - public function update($path, $contents, array $config = []) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->update($path, $contents, $config); - } - - /** - * Update an existing file using a stream. - * - * @param string $path The path of the existing file. - * @param resource $resource The file handle. - * @param array $config An optional configuration array. - * - * @throws InvalidArgumentException If $resource is not a file handle. - * @throws FileNotFoundException - * - * @return bool True on success, false on failure. - */ - public function updateStream($path, $resource, array $config = []) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->updateStream($path, $resource, $config); - } - - /** - * Rename a file. - * - * @param string $path Path to the existing file. - * @param string $newpath The new path of the file. - * - * @throws FileExistsException Thrown if $newpath exists. - * @throws FileNotFoundException Thrown if $path does not exist. - * - * @return bool True on success, false on failure. - */ - public function rename($path, $newpath) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->rename($path, $newpath); - } - - /** - * Delete a file. - * - * @param string $path - * - * @throws FileNotFoundException - * - * @return bool True on success, false on failure. - */ - public function delete($path) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->delete($path); - } - - /** - * Delete a directory. - * - * @param string $dirname - * - * @throws RootViolationException Thrown if $dirname is empty. - * - * @return bool True on success, false on failure. - */ - public function deleteDir($dirname) - { - list($prefix, $dirname) = $this->getPrefixAndPath($dirname); - - return $this->getFilesystem($prefix)->deleteDir($dirname); - } - - /** - * Create a directory. - * - * @param string $dirname The name of the new directory. - * @param array $config An optional configuration array. - * - * @return bool True on success, false on failure. - */ - public function createDir($dirname, array $config = []) - { - list($prefix, $dirname) = $this->getPrefixAndPath($dirname); - - return $this->getFilesystem($prefix)->createDir($dirname); - } - - /** - * Set the visibility for a file. - * - * @param string $path The path to the file. - * @param string $visibility One of 'public' or 'private'. - * - * @throws FileNotFoundException - * - * @return bool True on success, false on failure. - */ - public function setVisibility($path, $visibility) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->setVisibility($path, $visibility); - } - - /** - * Create a file or update if exists. - * - * @param string $path The path to the file. - * @param string $contents The file contents. - * @param array $config An optional configuration array. - * - * @return bool True on success, false on failure. - */ - public function put($path, $contents, array $config = []) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->put($path, $contents, $config); - } - - /** - * Create a file or update if exists. - * - * @param string $path The path to the file. - * @param resource $resource The file handle. - * @param array $config An optional configuration array. - * - * @throws InvalidArgumentException Thrown if $resource is not a resource. - * - * @return bool True on success, false on failure. - */ - public function putStream($path, $resource, array $config = []) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->putStream($path, $resource, $config); - } - - /** - * Read and delete a file. - * - * @param string $path The path to the file. - * - * @throws FileNotFoundException - * - * @return string|false The file contents, or false on failure. - */ - public function readAndDelete($path) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->readAndDelete($path); - } - - /** - * Get a file/directory handler. - * - * @deprecated - * - * @param string $path The path to the file. - * @param Handler $handler An optional existing handler to populate. - * - * @return Handler Either a file or directory handler. - */ - public function get($path, Handler $handler = null) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->get($path); - } -} diff --git a/vendor/league/flysystem/src/NotSupportedException.php b/vendor/league/flysystem/src/NotSupportedException.php deleted file mode 100644 index e0a989b22c..0000000000 --- a/vendor/league/flysystem/src/NotSupportedException.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php - -namespace League\Flysystem; - -use RuntimeException; -use SplFileInfo; - -class NotSupportedException extends RuntimeException implements FilesystemException -{ - /** - * Create a new exception for a link. - * - * @param SplFileInfo $file - * - * @return static - */ - public static function forLink(SplFileInfo $file) - { - $message = 'Links are not supported, encountered link at '; - - return new static($message . $file->getPathname()); - } - - /** - * Create a new exception for a link. - * - * @param string $systemType - * - * @return static - */ - public static function forFtpSystemType($systemType) - { - $message = "The FTP system type '$systemType' is currently not supported."; - - return new static($message); - } -} diff --git a/vendor/league/flysystem/src/Plugin/AbstractPlugin.php b/vendor/league/flysystem/src/Plugin/AbstractPlugin.php deleted file mode 100644 index 0d56789769..0000000000 --- a/vendor/league/flysystem/src/Plugin/AbstractPlugin.php +++ /dev/null @@ -1,24 +0,0 @@ -<?php - -namespace League\Flysystem\Plugin; - -use League\Flysystem\FilesystemInterface; -use League\Flysystem\PluginInterface; - -abstract class AbstractPlugin implements PluginInterface -{ - /** - * @var FilesystemInterface - */ - protected $filesystem; - - /** - * Set the Filesystem object. - * - * @param FilesystemInterface $filesystem - */ - public function setFilesystem(FilesystemInterface $filesystem) - { - $this->filesystem = $filesystem; - } -} diff --git a/vendor/league/flysystem/src/Plugin/EmptyDir.php b/vendor/league/flysystem/src/Plugin/EmptyDir.php deleted file mode 100644 index b5ae7f582d..0000000000 --- a/vendor/league/flysystem/src/Plugin/EmptyDir.php +++ /dev/null @@ -1,34 +0,0 @@ -<?php - -namespace League\Flysystem\Plugin; - -class EmptyDir extends AbstractPlugin -{ - /** - * Get the method name. - * - * @return string - */ - public function getMethod() - { - return 'emptyDir'; - } - - /** - * Empty a directory's contents. - * - * @param string $dirname - */ - public function handle($dirname) - { - $listing = $this->filesystem->listContents($dirname, false); - - foreach ($listing as $item) { - if ($item['type'] === 'dir') { - $this->filesystem->deleteDir($item['path']); - } else { - $this->filesystem->delete($item['path']); - } - } - } -} diff --git a/vendor/league/flysystem/src/Plugin/ForcedCopy.php b/vendor/league/flysystem/src/Plugin/ForcedCopy.php deleted file mode 100644 index a41e9f3aeb..0000000000 --- a/vendor/league/flysystem/src/Plugin/ForcedCopy.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php - -namespace League\Flysystem\Plugin; - -use League\Flysystem\FileExistsException; -use League\Flysystem\FileNotFoundException; - -class ForcedCopy extends AbstractPlugin -{ - /** - * @inheritdoc - */ - public function getMethod() - { - return 'forceCopy'; - } - - /** - * Copies a file, overwriting any existing files. - * - * @param string $path Path to the existing file. - * @param string $newpath The new path of the file. - * - * @throws FileExistsException - * @throws FileNotFoundException Thrown if $path does not exist. - * - * @return bool True on success, false on failure. - */ - public function handle($path, $newpath) - { - try { - $deleted = $this->filesystem->delete($newpath); - } catch (FileNotFoundException $e) { - // The destination path does not exist. That's ok. - $deleted = true; - } - - if ($deleted) { - return $this->filesystem->copy($path, $newpath); - } - - return false; - } -} diff --git a/vendor/league/flysystem/src/Plugin/ForcedRename.php b/vendor/league/flysystem/src/Plugin/ForcedRename.php deleted file mode 100644 index 3f51cd6076..0000000000 --- a/vendor/league/flysystem/src/Plugin/ForcedRename.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php - -namespace League\Flysystem\Plugin; - -use League\Flysystem\FileExistsException; -use League\Flysystem\FileNotFoundException; - -class ForcedRename extends AbstractPlugin -{ - /** - * @inheritdoc - */ - public function getMethod() - { - return 'forceRename'; - } - - /** - * Renames a file, overwriting the destination if it exists. - * - * @param string $path Path to the existing file. - * @param string $newpath The new path of the file. - * - * @throws FileNotFoundException Thrown if $path does not exist. - * @throws FileExistsException - * - * @return bool True on success, false on failure. - */ - public function handle($path, $newpath) - { - try { - $deleted = $this->filesystem->delete($newpath); - } catch (FileNotFoundException $e) { - // The destination path does not exist. That's ok. - $deleted = true; - } - - if ($deleted) { - return $this->filesystem->rename($path, $newpath); - } - - return false; - } -} diff --git a/vendor/league/flysystem/src/Plugin/GetWithMetadata.php b/vendor/league/flysystem/src/Plugin/GetWithMetadata.php deleted file mode 100644 index 6fe4f05628..0000000000 --- a/vendor/league/flysystem/src/Plugin/GetWithMetadata.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php - -namespace League\Flysystem\Plugin; - -use InvalidArgumentException; -use League\Flysystem\FileNotFoundException; - -class GetWithMetadata extends AbstractPlugin -{ - /** - * Get the method name. - * - * @return string - */ - public function getMethod() - { - return 'getWithMetadata'; - } - - /** - * Get metadata for an object with required metadata. - * - * @param string $path path to file - * @param array $metadata metadata keys - * - * @throws InvalidArgumentException - * @throws FileNotFoundException - * - * @return array|false metadata - */ - public function handle($path, array $metadata) - { - $object = $this->filesystem->getMetadata($path); - - if ( ! $object) { - return false; - } - - $keys = array_diff($metadata, array_keys($object)); - - foreach ($keys as $key) { - if ( ! method_exists($this->filesystem, $method = 'get' . ucfirst($key))) { - throw new InvalidArgumentException('Could not fetch metadata: ' . $key); - } - - $object[$key] = $this->filesystem->{$method}($path); - } - - return $object; - } -} diff --git a/vendor/league/flysystem/src/Plugin/ListFiles.php b/vendor/league/flysystem/src/Plugin/ListFiles.php deleted file mode 100644 index 9669fe7e7b..0000000000 --- a/vendor/league/flysystem/src/Plugin/ListFiles.php +++ /dev/null @@ -1,35 +0,0 @@ -<?php - -namespace League\Flysystem\Plugin; - -class ListFiles extends AbstractPlugin -{ - /** - * Get the method name. - * - * @return string - */ - public function getMethod() - { - return 'listFiles'; - } - - /** - * List all files in the directory. - * - * @param string $directory - * @param bool $recursive - * - * @return array - */ - public function handle($directory = '', $recursive = false) - { - $contents = $this->filesystem->listContents($directory, $recursive); - - $filter = function ($object) { - return $object['type'] === 'file'; - }; - - return array_values(array_filter($contents, $filter)); - } -} diff --git a/vendor/league/flysystem/src/Plugin/ListPaths.php b/vendor/league/flysystem/src/Plugin/ListPaths.php deleted file mode 100644 index 514bdf0b3a..0000000000 --- a/vendor/league/flysystem/src/Plugin/ListPaths.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php - -namespace League\Flysystem\Plugin; - -class ListPaths extends AbstractPlugin -{ - /** - * Get the method name. - * - * @return string - */ - public function getMethod() - { - return 'listPaths'; - } - - /** - * List all paths. - * - * @param string $directory - * @param bool $recursive - * - * @return array paths - */ - public function handle($directory = '', $recursive = false) - { - $result = []; - $contents = $this->filesystem->listContents($directory, $recursive); - - foreach ($contents as $object) { - $result[] = $object['path']; - } - - return $result; - } -} diff --git a/vendor/league/flysystem/src/Plugin/ListWith.php b/vendor/league/flysystem/src/Plugin/ListWith.php deleted file mode 100644 index d90464e528..0000000000 --- a/vendor/league/flysystem/src/Plugin/ListWith.php +++ /dev/null @@ -1,60 +0,0 @@ -<?php - -namespace League\Flysystem\Plugin; - -class ListWith extends AbstractPlugin -{ - /** - * Get the method name. - * - * @return string - */ - public function getMethod() - { - return 'listWith'; - } - - /** - * List contents with metadata. - * - * @param array $keys - * @param string $directory - * @param bool $recursive - * - * @return array listing with metadata - */ - public function handle(array $keys = [], $directory = '', $recursive = false) - { - $contents = $this->filesystem->listContents($directory, $recursive); - - foreach ($contents as $index => $object) { - if ($object['type'] === 'file') { - $missingKeys = array_diff($keys, array_keys($object)); - $contents[$index] = array_reduce($missingKeys, [$this, 'getMetadataByName'], $object); - } - } - - return $contents; - } - - /** - * Get a meta-data value by key name. - * - * @param array $object - * @param string $key - * - * @return array - */ - protected function getMetadataByName(array $object, $key) - { - $method = 'get' . ucfirst($key); - - if ( ! method_exists($this->filesystem, $method)) { - throw new \InvalidArgumentException('Could not get meta-data for key: ' . $key); - } - - $object[$key] = $this->filesystem->{$method}($object['path']); - - return $object; - } -} diff --git a/vendor/league/flysystem/src/Plugin/PluggableTrait.php b/vendor/league/flysystem/src/Plugin/PluggableTrait.php deleted file mode 100644 index 922edfe52b..0000000000 --- a/vendor/league/flysystem/src/Plugin/PluggableTrait.php +++ /dev/null @@ -1,97 +0,0 @@ -<?php - -namespace League\Flysystem\Plugin; - -use BadMethodCallException; -use League\Flysystem\FilesystemInterface; -use League\Flysystem\PluginInterface; -use LogicException; - -trait PluggableTrait -{ - /** - * @var array - */ - protected $plugins = []; - - /** - * Register a plugin. - * - * @param PluginInterface $plugin - * - * @throws LogicException - * - * @return $this - */ - public function addPlugin(PluginInterface $plugin) - { - if ( ! method_exists($plugin, 'handle')) { - throw new LogicException(get_class($plugin) . ' does not have a handle method.'); - } - - $this->plugins[$plugin->getMethod()] = $plugin; - - return $this; - } - - /** - * Find a specific plugin. - * - * @param string $method - * - * @throws PluginNotFoundException - * - * @return PluginInterface - */ - protected function findPlugin($method) - { - if ( ! isset($this->plugins[$method])) { - throw new PluginNotFoundException('Plugin not found for method: ' . $method); - } - - return $this->plugins[$method]; - } - - /** - * Invoke a plugin by method name. - * - * @param string $method - * @param array $arguments - * @param FilesystemInterface $filesystem - * - * @throws PluginNotFoundException - * - * @return mixed - */ - protected function invokePlugin($method, array $arguments, FilesystemInterface $filesystem) - { - $plugin = $this->findPlugin($method); - $plugin->setFilesystem($filesystem); - $callback = [$plugin, 'handle']; - - return call_user_func_array($callback, $arguments); - } - - /** - * Plugins pass-through. - * - * @param string $method - * @param array $arguments - * - * @throws BadMethodCallException - * - * @return mixed - */ - public function __call($method, array $arguments) - { - try { - return $this->invokePlugin($method, $arguments, $this); - } catch (PluginNotFoundException $e) { - throw new BadMethodCallException( - 'Call to undefined method ' - . get_class($this) - . '::' . $method - ); - } - } -} diff --git a/vendor/league/flysystem/src/Plugin/PluginNotFoundException.php b/vendor/league/flysystem/src/Plugin/PluginNotFoundException.php deleted file mode 100644 index fd1d7e7e30..0000000000 --- a/vendor/league/flysystem/src/Plugin/PluginNotFoundException.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -namespace League\Flysystem\Plugin; - -use LogicException; - -class PluginNotFoundException extends LogicException -{ - // This exception doesn't require additional information. -} diff --git a/vendor/league/flysystem/src/PluginInterface.php b/vendor/league/flysystem/src/PluginInterface.php deleted file mode 100644 index 7010a35688..0000000000 --- a/vendor/league/flysystem/src/PluginInterface.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php - -namespace League\Flysystem; - -interface PluginInterface -{ - /** - * Get the method name. - * - * @return string - */ - public function getMethod(); - - /** - * Set the Filesystem object. - * - * @param FilesystemInterface $filesystem - */ - public function setFilesystem(FilesystemInterface $filesystem); -} diff --git a/vendor/league/flysystem/src/ReadInterface.php b/vendor/league/flysystem/src/ReadInterface.php deleted file mode 100644 index 898a8d5c81..0000000000 --- a/vendor/league/flysystem/src/ReadInterface.php +++ /dev/null @@ -1,88 +0,0 @@ -<?php - -namespace League\Flysystem; - -interface ReadInterface -{ - /** - * Check whether a file exists. - * - * @param string $path - * - * @return array|bool|null - */ - public function has($path); - - /** - * Read a file. - * - * @param string $path - * - * @return array|false - */ - public function read($path); - - /** - * Read a file as a stream. - * - * @param string $path - * - * @return array|false - */ - public function readStream($path); - - /** - * List contents of a directory. - * - * @param string $directory - * @param bool $recursive - * - * @return array - */ - public function listContents($directory = '', $recursive = false); - - /** - * Get all the meta data of a file or directory. - * - * @param string $path - * - * @return array|false - */ - public function getMetadata($path); - - /** - * Get the size of a file. - * - * @param string $path - * - * @return array|false - */ - public function getSize($path); - - /** - * Get the mimetype of a file. - * - * @param string $path - * - * @return array|false - */ - public function getMimetype($path); - - /** - * Get the last modified time of a file as a timestamp. - * - * @param string $path - * - * @return array|false - */ - public function getTimestamp($path); - - /** - * Get the visibility of a file. - * - * @param string $path - * - * @return array|false - */ - public function getVisibility($path); -} diff --git a/vendor/league/flysystem/src/RootViolationException.php b/vendor/league/flysystem/src/RootViolationException.php deleted file mode 100644 index 073fc92b43..0000000000 --- a/vendor/league/flysystem/src/RootViolationException.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -namespace League\Flysystem; - -use LogicException; - -class RootViolationException extends LogicException implements FilesystemException -{ - // -} diff --git a/vendor/league/flysystem/src/SafeStorage.php b/vendor/league/flysystem/src/SafeStorage.php deleted file mode 100644 index 5397f580ea..0000000000 --- a/vendor/league/flysystem/src/SafeStorage.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php - -namespace League\Flysystem; - -final class SafeStorage -{ - /** - * @var string - */ - private $hash; - - /** - * @var array - */ - protected static $safeStorage = []; - - public function __construct() - { - $this->hash = spl_object_hash($this); - static::$safeStorage[$this->hash] = []; - } - - public function storeSafely($key, $value) - { - static::$safeStorage[$this->hash][$key] = $value; - } - - public function retrieveSafely($key) - { - if (array_key_exists($key, static::$safeStorage[$this->hash])) { - return static::$safeStorage[$this->hash][$key]; - } - } - - public function __destruct() - { - unset(static::$safeStorage[$this->hash]); - } -} diff --git a/vendor/league/flysystem/src/UnreadableFileException.php b/vendor/league/flysystem/src/UnreadableFileException.php deleted file mode 100644 index e66803383f..0000000000 --- a/vendor/league/flysystem/src/UnreadableFileException.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -namespace League\Flysystem; - -use SplFileInfo; - -class UnreadableFileException extends Exception -{ - public static function forFileInfo(SplFileInfo $fileInfo) - { - return new static( - sprintf( - 'Unreadable file encountered: %s', - $fileInfo->getRealPath() - ) - ); - } -} diff --git a/vendor/league/flysystem/src/Util.php b/vendor/league/flysystem/src/Util.php deleted file mode 100644 index 76454a05ea..0000000000 --- a/vendor/league/flysystem/src/Util.php +++ /dev/null @@ -1,353 +0,0 @@ -<?php - -namespace League\Flysystem; - -use League\Flysystem\Util\MimeType; -use LogicException; - -class Util -{ - /** - * Get normalized pathinfo. - * - * @param string $path - * - * @return array pathinfo - */ - public static function pathinfo($path) - { - $pathinfo = compact('path'); - - if ('' !== $dirname = dirname($path)) { - $pathinfo['dirname'] = static::normalizeDirname($dirname); - } - - $pathinfo['basename'] = static::basename($path); - - $pathinfo += pathinfo($pathinfo['basename']); - - return $pathinfo + ['dirname' => '']; - } - - /** - * Normalize a dirname return value. - * - * @param string $dirname - * - * @return string normalized dirname - */ - public static function normalizeDirname($dirname) - { - return $dirname === '.' ? '' : $dirname; - } - - /** - * Get a normalized dirname from a path. - * - * @param string $path - * - * @return string dirname - */ - public static function dirname($path) - { - return static::normalizeDirname(dirname($path)); - } - - /** - * Map result arrays. - * - * @param array $object - * @param array $map - * - * @return array mapped result - */ - public static function map(array $object, array $map) - { - $result = []; - - foreach ($map as $from => $to) { - if ( ! isset($object[$from])) { - continue; - } - - $result[$to] = $object[$from]; - } - - return $result; - } - - /** - * Normalize path. - * - * @param string $path - * - * @throws LogicException - * - * @return string - */ - public static function normalizePath($path) - { - return static::normalizeRelativePath($path); - } - - /** - * Normalize relative directories in a path. - * - * @param string $path - * - * @throws LogicException - * - * @return string - */ - public static function normalizeRelativePath($path) - { - $path = str_replace('\\', '/', $path); - $path = static::removeFunkyWhiteSpace($path); - - $parts = []; - - foreach (explode('/', $path) as $part) { - switch ($part) { - case '': - case '.': - break; - - case '..': - if (empty($parts)) { - throw new LogicException( - 'Path is outside of the defined root, path: [' . $path . ']' - ); - } - array_pop($parts); - break; - - default: - $parts[] = $part; - break; - } - } - - return implode('/', $parts); - } - - /** - * Removes unprintable characters and invalid unicode characters. - * - * @param string $path - * - * @return string $path - */ - protected static function removeFunkyWhiteSpace($path) - { - // We do this check in a loop, since removing invalid unicode characters - // can lead to new characters being created. - while (preg_match('#\p{C}+|^\./#u', $path)) { - $path = preg_replace('#\p{C}+|^\./#u', '', $path); - } - - return $path; - } - - /** - * Normalize prefix. - * - * @param string $prefix - * @param string $separator - * - * @return string normalized path - */ - public static function normalizePrefix($prefix, $separator) - { - return rtrim($prefix, $separator) . $separator; - } - - /** - * Get content size. - * - * @param string $contents - * - * @return int content size - */ - public static function contentSize($contents) - { - return defined('MB_OVERLOAD_STRING') ? mb_strlen($contents, '8bit') : strlen($contents); - } - - /** - * Guess MIME Type based on the path of the file and it's content. - * - * @param string $path - * @param string|resource $content - * - * @return string|null MIME Type or NULL if no extension detected - */ - public static function guessMimeType($path, $content) - { - $mimeType = MimeType::detectByContent($content); - - if ( ! (empty($mimeType) || in_array($mimeType, ['application/x-empty', 'text/plain', 'text/x-asm']))) { - return $mimeType; - } - - return MimeType::detectByFilename($path); - } - - /** - * Emulate directories. - * - * @param array $listing - * - * @return array listing with emulated directories - */ - public static function emulateDirectories(array $listing) - { - $directories = []; - $listedDirectories = []; - - foreach ($listing as $object) { - list($directories, $listedDirectories) = static::emulateObjectDirectories($object, $directories, $listedDirectories); - } - - $directories = array_diff(array_unique($directories), array_unique($listedDirectories)); - - foreach ($directories as $directory) { - $listing[] = static::pathinfo($directory) + ['type' => 'dir']; - } - - return $listing; - } - - /** - * Ensure a Config instance. - * - * @param null|array|Config $config - * - * @return Config config instance - * - * @throw LogicException - */ - public static function ensureConfig($config) - { - if ($config === null) { - return new Config(); - } - - if ($config instanceof Config) { - return $config; - } - - if (is_array($config)) { - return new Config($config); - } - - throw new LogicException('A config should either be an array or a Flysystem\Config object.'); - } - - /** - * Rewind a stream. - * - * @param resource $resource - */ - public static function rewindStream($resource) - { - if (ftell($resource) !== 0 && static::isSeekableStream($resource)) { - rewind($resource); - } - } - - public static function isSeekableStream($resource) - { - $metadata = stream_get_meta_data($resource); - - return $metadata['seekable']; - } - - /** - * Get the size of a stream. - * - * @param resource $resource - * - * @return int|null stream size - */ - public static function getStreamSize($resource) - { - $stat = fstat($resource); - - if ( ! is_array($stat) || ! isset($stat['size'])) { - return null; - } - - return $stat['size']; - } - - /** - * Emulate the directories of a single object. - * - * @param array $object - * @param array $directories - * @param array $listedDirectories - * - * @return array - */ - protected static function emulateObjectDirectories(array $object, array $directories, array $listedDirectories) - { - if ($object['type'] === 'dir') { - $listedDirectories[] = $object['path']; - } - - if ( ! isset($object['dirname']) || trim($object['dirname']) === '') { - return [$directories, $listedDirectories]; - } - - $parent = $object['dirname']; - - while (isset($parent) && trim($parent) !== '' && ! in_array($parent, $directories)) { - $directories[] = $parent; - $parent = static::dirname($parent); - } - - if (isset($object['type']) && $object['type'] === 'dir') { - $listedDirectories[] = $object['path']; - - return [$directories, $listedDirectories]; - } - - return [$directories, $listedDirectories]; - } - - /** - * Returns the trailing name component of the path. - * - * @param string $path - * - * @return string - */ - private static function basename($path) - { - $separators = DIRECTORY_SEPARATOR === '/' ? '/' : '\/'; - - $path = rtrim($path, $separators); - - $basename = preg_replace('#.*?([^' . preg_quote($separators, '#') . ']+$)#', '$1', $path); - - if (DIRECTORY_SEPARATOR === '/') { - return $basename; - } - // @codeCoverageIgnoreStart - // Extra Windows path munging. This is tested via AppVeyor, but code - // coverage is not reported. - - // Handle relative paths with drive letters. c:file.txt. - while (preg_match('#^[a-zA-Z]{1}:[^\\\/]#', $basename)) { - $basename = substr($basename, 2); - } - - // Remove colon for standalone drive letter names. - if (preg_match('#^[a-zA-Z]{1}:$#', $basename)) { - $basename = rtrim($basename, ':'); - } - - return $basename; - // @codeCoverageIgnoreEnd - } -} diff --git a/vendor/league/flysystem/src/Util/ContentListingFormatter.php b/vendor/league/flysystem/src/Util/ContentListingFormatter.php deleted file mode 100644 index ae0d3b91d2..0000000000 --- a/vendor/league/flysystem/src/Util/ContentListingFormatter.php +++ /dev/null @@ -1,122 +0,0 @@ -<?php - -namespace League\Flysystem\Util; - -use League\Flysystem\Util; - -/** - * @internal - */ -class ContentListingFormatter -{ - /** - * @var string - */ - private $directory; - - /** - * @var bool - */ - private $recursive; - - /** - * @var bool - */ - private $caseSensitive; - - /** - * @param string $directory - * @param bool $recursive - */ - public function __construct($directory, $recursive, $caseSensitive = true) - { - $this->directory = rtrim($directory, '/'); - $this->recursive = $recursive; - $this->caseSensitive = $caseSensitive; - } - - /** - * Format contents listing. - * - * @param array $listing - * - * @return array - */ - public function formatListing(array $listing) - { - $listing = array_filter(array_map([$this, 'addPathInfo'], $listing), [$this, 'isEntryOutOfScope']); - - return $this->sortListing(array_values($listing)); - } - - private function addPathInfo(array $entry) - { - return $entry + Util::pathinfo($entry['path']); - } - - /** - * Determine if the entry is out of scope. - * - * @param array $entry - * - * @return bool - */ - private function isEntryOutOfScope(array $entry) - { - if (empty($entry['path']) && $entry['path'] !== '0') { - return false; - } - - if ($this->recursive) { - return $this->residesInDirectory($entry); - } - - return $this->isDirectChild($entry); - } - - /** - * Check if the entry resides within the parent directory. - * - * @param array $entry - * - * @return bool - */ - private function residesInDirectory(array $entry) - { - if ($this->directory === '') { - return true; - } - - return $this->caseSensitive - ? strpos($entry['path'], $this->directory . '/') === 0 - : stripos($entry['path'], $this->directory . '/') === 0; - } - - /** - * Check if the entry is a direct child of the directory. - * - * @param array $entry - * - * @return bool - */ - private function isDirectChild(array $entry) - { - return $this->caseSensitive - ? $entry['dirname'] === $this->directory - : strcasecmp($this->directory, $entry['dirname']) === 0; - } - - /** - * @param array $listing - * - * @return array - */ - private function sortListing(array $listing) - { - usort($listing, function ($a, $b) { - return strcasecmp($a['path'], $b['path']); - }); - - return $listing; - } -} diff --git a/vendor/league/flysystem/src/Util/MimeType.php b/vendor/league/flysystem/src/Util/MimeType.php deleted file mode 100644 index 1f1949ce07..0000000000 --- a/vendor/league/flysystem/src/Util/MimeType.php +++ /dev/null @@ -1,249 +0,0 @@ -<?php - -namespace League\Flysystem\Util; - -use ErrorException; -use finfo; - -/** - * @internal - */ -class MimeType -{ - protected static $extensionToMimeTypeMap = [ - 'hqx' => 'application/mac-binhex40', - 'cpt' => 'application/mac-compactpro', - 'csv' => 'text/csv', - 'bin' => 'application/octet-stream', - 'dms' => 'application/octet-stream', - 'lha' => 'application/octet-stream', - 'lzh' => 'application/octet-stream', - 'exe' => 'application/octet-stream', - 'class' => 'application/octet-stream', - 'psd' => 'application/x-photoshop', - 'so' => 'application/octet-stream', - 'sea' => 'application/octet-stream', - 'dll' => 'application/octet-stream', - 'oda' => 'application/oda', - 'pdf' => 'application/pdf', - 'ai' => 'application/pdf', - 'eps' => 'application/postscript', - 'epub' => 'application/epub+zip', - 'ps' => 'application/postscript', - 'smi' => 'application/smil', - 'smil' => 'application/smil', - 'mif' => 'application/vnd.mif', - 'xls' => 'application/vnd.ms-excel', - 'xlt' => 'application/vnd.ms-excel', - 'xla' => 'application/vnd.ms-excel', - 'ppt' => 'application/powerpoint', - 'pot' => 'application/vnd.ms-powerpoint', - 'pps' => 'application/vnd.ms-powerpoint', - 'ppa' => 'application/vnd.ms-powerpoint', - 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', - 'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template', - 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', - 'ppam' => 'application/vnd.ms-powerpoint.addin.macroEnabled.12', - 'pptm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', - 'potm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', - 'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12', - 'wbxml' => 'application/wbxml', - 'wmlc' => 'application/wmlc', - 'dcr' => 'application/x-director', - 'dir' => 'application/x-director', - 'dxr' => 'application/x-director', - 'dvi' => 'application/x-dvi', - 'gtar' => 'application/x-gtar', - 'gz' => 'application/x-gzip', - 'gzip' => 'application/x-gzip', - 'php' => 'application/x-httpd-php', - 'php4' => 'application/x-httpd-php', - 'php3' => 'application/x-httpd-php', - 'phtml' => 'application/x-httpd-php', - 'phps' => 'application/x-httpd-php-source', - 'js' => 'application/javascript', - 'swf' => 'application/x-shockwave-flash', - 'sit' => 'application/x-stuffit', - 'tar' => 'application/x-tar', - 'tgz' => 'application/x-tar', - 'z' => 'application/x-compress', - 'xhtml' => 'application/xhtml+xml', - 'xht' => 'application/xhtml+xml', - 'rdf' => 'application/rdf+xml', - 'zip' => 'application/x-zip', - 'rar' => 'application/x-rar', - 'mid' => 'audio/midi', - 'midi' => 'audio/midi', - 'mpga' => 'audio/mpeg', - 'mp2' => 'audio/mpeg', - 'mp3' => 'audio/mpeg', - 'aif' => 'audio/x-aiff', - 'aiff' => 'audio/x-aiff', - 'aifc' => 'audio/x-aiff', - 'ram' => 'audio/x-pn-realaudio', - 'rm' => 'audio/x-pn-realaudio', - 'rpm' => 'audio/x-pn-realaudio-plugin', - 'ra' => 'audio/x-realaudio', - 'rv' => 'video/vnd.rn-realvideo', - 'wav' => 'audio/x-wav', - 'jpg' => 'image/jpeg', - 'jpeg' => 'image/jpeg', - 'jpe' => 'image/jpeg', - 'png' => 'image/png', - 'gif' => 'image/gif', - 'bmp' => 'image/bmp', - 'tiff' => 'image/tiff', - 'tif' => 'image/tiff', - 'svg' => 'image/svg+xml', - 'css' => 'text/css', - 'html' => 'text/html', - 'htm' => 'text/html', - 'shtml' => 'text/html', - 'txt' => 'text/plain', - 'text' => 'text/plain', - 'log' => 'text/plain', - 'markdown' => 'text/markdown', - 'md' => 'text/markdown', - 'rtx' => 'text/richtext', - 'rtf' => 'text/rtf', - 'xml' => 'application/xml', - 'xsl' => 'application/xml', - 'dmn' => 'application/octet-stream', - 'bpmn' => 'application/octet-stream', - 'mpeg' => 'video/mpeg', - 'mpg' => 'video/mpeg', - 'mpe' => 'video/mpeg', - 'qt' => 'video/quicktime', - 'mov' => 'video/quicktime', - 'avi' => 'video/x-msvideo', - 'movie' => 'video/x-sgi-movie', - 'doc' => 'application/msword', - 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - 'docm' => 'application/vnd.ms-word.template.macroEnabled.12', - 'dotm' => 'application/vnd.ms-word.template.macroEnabled.12', - 'dot' => 'application/msword', - 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', - 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', - 'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', - 'xlsm' => 'application/vnd.ms-excel.sheet.macroEnabled.12', - 'xltm' => 'application/vnd.ms-excel.template.macroEnabled.12', - 'xlam' => 'application/vnd.ms-excel.addin.macroEnabled.12', - 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12', - 'word' => 'application/msword', - 'xl' => 'application/excel', - 'eml' => 'message/rfc822', - 'json' => 'application/json', - 'pem' => 'application/x-x509-user-cert', - 'p10' => 'application/x-pkcs10', - 'p12' => 'application/x-pkcs12', - 'p7a' => 'application/x-pkcs7-signature', - 'p7c' => 'application/pkcs7-mime', - 'p7m' => 'application/pkcs7-mime', - 'p7r' => 'application/x-pkcs7-certreqresp', - 'p7s' => 'application/pkcs7-signature', - 'crt' => 'application/x-x509-ca-cert', - 'crl' => 'application/pkix-crl', - 'der' => 'application/x-x509-ca-cert', - 'kdb' => 'application/octet-stream', - 'pgp' => 'application/pgp', - 'gpg' => 'application/gpg-keys', - 'sst' => 'application/octet-stream', - 'csr' => 'application/octet-stream', - 'rsa' => 'application/x-pkcs7', - 'cer' => 'application/pkix-cert', - '3g2' => 'video/3gpp2', - '3gp' => 'video/3gp', - 'mp4' => 'video/mp4', - 'm4a' => 'audio/x-m4a', - 'f4v' => 'video/mp4', - 'webm' => 'video/webm', - 'aac' => 'audio/x-acc', - 'm4u' => 'application/vnd.mpegurl', - 'm3u' => 'text/plain', - 'xspf' => 'application/xspf+xml', - 'vlc' => 'application/videolan', - 'wmv' => 'video/x-ms-wmv', - 'au' => 'audio/x-au', - 'ac3' => 'audio/ac3', - 'flac' => 'audio/x-flac', - 'ogg' => 'audio/ogg', - 'kmz' => 'application/vnd.google-earth.kmz', - 'kml' => 'application/vnd.google-earth.kml+xml', - 'ics' => 'text/calendar', - 'zsh' => 'text/x-scriptzsh', - '7zip' => 'application/x-7z-compressed', - 'cdr' => 'application/cdr', - 'wma' => 'audio/x-ms-wma', - 'jar' => 'application/java-archive', - 'tex' => 'application/x-tex', - 'latex' => 'application/x-latex', - 'odt' => 'application/vnd.oasis.opendocument.text', - 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', - 'odp' => 'application/vnd.oasis.opendocument.presentation', - 'odg' => 'application/vnd.oasis.opendocument.graphics', - 'odc' => 'application/vnd.oasis.opendocument.chart', - 'odf' => 'application/vnd.oasis.opendocument.formula', - 'odi' => 'application/vnd.oasis.opendocument.image', - 'odm' => 'application/vnd.oasis.opendocument.text-master', - 'odb' => 'application/vnd.oasis.opendocument.database', - 'ott' => 'application/vnd.oasis.opendocument.text-template', - 'webp' => 'image/webp', - 'ico' => 'image/x-icon', - ]; - - /** - * Detects MIME Type based on given content. - * - * @param mixed $content - * - * @return string|null MIME Type or NULL if no mime type detected - */ - public static function detectByContent($content) - { - if ( ! class_exists('finfo') || ! is_string($content)) { - return null; - } - try { - $finfo = new finfo(FILEINFO_MIME_TYPE); - - return $finfo->buffer($content) ?: null; - // @codeCoverageIgnoreStart - } catch (ErrorException $e) { - // This is caused by an array to string conversion error. - } - } // @codeCoverageIgnoreEnd - - /** - * Detects MIME Type based on file extension. - * - * @param string $extension - * - * @return string|null MIME Type or NULL if no extension detected - */ - public static function detectByFileExtension($extension) - { - return isset(static::$extensionToMimeTypeMap[$extension]) - ? static::$extensionToMimeTypeMap[$extension] - : 'text/plain'; - } - - /** - * @param string $filename - * - * @return string|null MIME Type or NULL if no extension detected - */ - public static function detectByFilename($filename) - { - $extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); - - return empty($extension) ? 'text/plain' : static::detectByFileExtension($extension); - } - - /** - * @return array Map of file extension to MIME Type - */ - public static function getExtensionToMimeTypeMap() - { - return static::$extensionToMimeTypeMap; - } -} diff --git a/vendor/league/flysystem/src/Util/StreamHasher.php b/vendor/league/flysystem/src/Util/StreamHasher.php deleted file mode 100644 index 938ec5db71..0000000000 --- a/vendor/league/flysystem/src/Util/StreamHasher.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php - -namespace League\Flysystem\Util; - -class StreamHasher -{ - /** - * @var string - */ - private $algo; - - /** - * StreamHasher constructor. - * - * @param string $algo - */ - public function __construct($algo) - { - $this->algo = $algo; - } - - /** - * @param resource $resource - * - * @return string - */ - public function hash($resource) - { - rewind($resource); - $context = hash_init($this->algo); - hash_update_stream($context, $resource); - fclose($resource); - - return hash_final($context); - } -} |
