From 5d0c7d3a8fc5f4babf39cedd4ead5e4a27b606d0 Mon Sep 17 00:00:00 2001 From: GZod01 Date: Fri, 7 Feb 2025 15:49:22 +0100 Subject: [PATCH] h --- .gitignore | 1 + vendor/autoload.php | 25 - vendor/bin/yaml-lint | 120 -- vendor/composer/ClassLoader.php | 585 -------- vendor/composer/InstalledVersions.php | 359 ----- vendor/composer/LICENSE | 19 - vendor/composer/autoload_classmap.php | 76 - vendor/composer/autoload_files.php | 12 - vendor/composer/autoload_namespaces.php | 9 - vendor/composer/autoload_psr4.php | 18 - vendor/composer/autoload_real.php | 50 - vendor/composer/autoload_static.php | 163 --- vendor/composer/installed.json | 836 ----------- vendor/composer/installed.php | 122 -- vendor/composer/platform_check.php | 26 - vendor/dflydev/dot-access-data/CHANGELOG.md | 74 - vendor/dflydev/dot-access-data/LICENSE | 19 - vendor/dflydev/dot-access-data/README.md | 158 --- vendor/dflydev/dot-access-data/composer.json | 67 - vendor/dflydev/dot-access-data/src/Data.php | 286 ---- .../dot-access-data/src/DataInterface.php | 131 -- .../src/Exception/DataException.php | 21 - .../src/Exception/InvalidPathException.php | 21 - .../src/Exception/MissingPathException.php | 37 - vendor/dflydev/dot-access-data/src/Util.php | 78 - vendor/league/commonmark/.phpstorm.meta.php | 106 -- vendor/league/commonmark/CHANGELOG.md | 727 ---------- vendor/league/commonmark/LICENSE | 28 - vendor/league/commonmark/README.md | 223 --- vendor/league/commonmark/composer.json | 128 -- .../commonmark/src/CommonMarkConverter.php | 46 - .../commonmark/src/ConverterInterface.php | 30 - .../commonmark/src/Delimiter/Bracket.php | 83 -- .../commonmark/src/Delimiter/Delimiter.php | 134 -- .../src/Delimiter/DelimiterInterface.php | 56 - .../src/Delimiter/DelimiterParser.php | 106 -- .../src/Delimiter/DelimiterStack.php | 396 ------ .../CacheableDelimiterProcessorInterface.php | 46 - .../DelimiterProcessorCollection.php | 89 -- .../DelimiterProcessorCollectionInterface.php | 46 - .../Processor/DelimiterProcessorInterface.php | 81 -- .../Processor/StaggeredDelimiterProcessor.php | 111 -- .../src/Environment/Environment.php | 448 ------ .../Environment/EnvironmentAwareInterface.php | 19 - .../EnvironmentBuilderInterface.php | 97 -- .../src/Environment/EnvironmentInterface.php | 55 - .../commonmark/src/Event/AbstractEvent.php | 54 - .../src/Event/DocumentParsedEvent.php | 35 - .../src/Event/DocumentPreParsedEvent.php | 49 - .../src/Event/DocumentPreRenderEvent.php | 44 - .../src/Event/DocumentRenderedEvent.php | 42 - .../commonmark/src/Event/ListenerData.php | 50 - .../Exception/AlreadyInitializedException.php | 18 - .../src/Exception/CommonMarkException.php | 21 - .../commonmark/src/Exception/IOException.php | 18 - .../Exception/InvalidArgumentException.php | 18 - .../src/Exception/LogicException.php | 18 - .../Exception/MissingDependencyException.php | 18 - .../Exception/UnexpectedEncodingException.php | 18 - .../Attributes/AttributesExtension.php | 32 - .../Attributes/Event/AttributesListener.php | 139 -- .../Extension/Attributes/Node/Attributes.php | 65 - .../Attributes/Node/AttributesInline.php | 57 - .../Parser/AttributesBlockContinueParser.php | 92 -- .../Parser/AttributesBlockStartParser.php | 40 - .../Parser/AttributesInlineParser.php | 54 - .../Attributes/Util/AttributesHelper.php | 142 -- .../Extension/Autolink/AutolinkExtension.php | 39 - .../Autolink/EmailAutolinkParser.php | 48 - .../Extension/Autolink/UrlAutolinkParser.php | 157 -- .../CommonMark/CommonMarkCoreExtension.php | 92 -- .../Processor/EmphasisDelimiterProcessor.php | 119 -- .../CommonMark/Node/Block/BlockQuote.php | 20 - .../CommonMark/Node/Block/FencedCode.php | 100 -- .../CommonMark/Node/Block/Heading.php | 41 - .../CommonMark/Node/Block/HtmlBlock.php | 79 -- .../CommonMark/Node/Block/IndentedCode.php | 32 - .../CommonMark/Node/Block/ListBlock.php | 56 - .../CommonMark/Node/Block/ListData.php | 47 - .../CommonMark/Node/Block/ListItem.php | 37 - .../CommonMark/Node/Block/ThematicBreak.php | 20 - .../Node/Inline/AbstractWebResource.php | 41 - .../Extension/CommonMark/Node/Inline/Code.php | 23 - .../CommonMark/Node/Inline/Emphasis.php | 42 - .../CommonMark/Node/Inline/HtmlInline.php | 24 - .../CommonMark/Node/Inline/Image.php | 49 - .../Extension/CommonMark/Node/Inline/Link.php | 49 - .../CommonMark/Node/Inline/Strong.php | 42 - .../Parser/Block/BlockQuoteParser.php | 60 - .../Parser/Block/BlockQuoteStartParser.php | 39 - .../Parser/Block/FencedCodeParser.php | 84 -- .../Parser/Block/FencedCodeStartParser.php | 40 - .../CommonMark/Parser/Block/HeadingParser.php | 51 - .../Parser/Block/HeadingStartParser.php | 80 -- .../Parser/Block/HtmlBlockParser.php | 82 -- .../Parser/Block/HtmlBlockStartParser.php | 62 - .../Parser/Block/IndentedCodeParser.php | 76 - .../Parser/Block/IndentedCodeStartParser.php | 42 - .../Parser/Block/ListBlockParser.php | 93 -- .../Parser/Block/ListBlockStartParser.php | 154 -- .../Parser/Block/ListItemParser.php | 82 -- .../Parser/Block/ThematicBreakParser.php | 42 - .../Parser/Block/ThematicBreakStartParser.php | 40 - .../Parser/Inline/AutolinkParser.php | 54 - .../Parser/Inline/BacktickParser.php | 132 -- .../CommonMark/Parser/Inline/BangParser.php | 44 - .../Parser/Inline/CloseBracketParser.php | 214 --- .../CommonMark/Parser/Inline/EntityParser.php | 42 - .../Parser/Inline/EscapableParser.php | 57 - .../Parser/Inline/HtmlInlineParser.php | 41 - .../Parser/Inline/OpenBracketParser.php | 42 - .../Renderer/Block/BlockQuoteRenderer.php | 70 - .../Renderer/Block/FencedCodeRenderer.php | 81 -- .../Renderer/Block/HeadingRenderer.php | 64 - .../Renderer/Block/HtmlBlockRenderer.php | 66 - .../Renderer/Block/IndentedCodeRenderer.php | 61 - .../Renderer/Block/ListBlockRenderer.php | 86 -- .../Renderer/Block/ListItemRenderer.php | 80 -- .../Renderer/Block/ThematicBreakRenderer.php | 56 - .../Renderer/Inline/CodeRenderer.php | 57 - .../Renderer/Inline/EmphasisRenderer.php | 56 - .../Renderer/Inline/HtmlInlineRenderer.php | 66 - .../Renderer/Inline/ImageRenderer.php | 107 -- .../Renderer/Inline/LinkRenderer.php | 89 -- .../Renderer/Inline/StrongRenderer.php | 56 - .../ConfigurableExtensionInterface.php | 21 - .../ApplyDefaultAttributesProcessor.php | 65 - .../DefaultAttributesExtension.php | 39 - .../DescriptionListExtension.php | 42 - .../ConsecutiveDescriptionListMerger.php | 41 - .../Event/LooseDescriptionHandler.php | 66 - .../DescriptionList/Node/Description.php | 39 - .../DescriptionList/Node/DescriptionList.php | 20 - .../DescriptionList/Node/DescriptionTerm.php | 20 - .../Parser/DescriptionContinueParser.php | 71 - .../Parser/DescriptionListContinueParser.php | 53 - .../Parser/DescriptionStartParser.php | 73 - .../Parser/DescriptionTermContinueParser.php | 52 - .../Renderer/DescriptionListRenderer.php | 39 - .../Renderer/DescriptionRenderer.php | 37 - .../Renderer/DescriptionTermRenderer.php | 37 - .../DisallowedRawHtmlExtension.php | 51 - .../DisallowedRawHtmlRenderer.php | 62 - .../Embed/Bridge/OscaroteroEmbedAdapter.php | 50 - .../Embed/DomainFilteringAdapter.php | 53 - .../commonmark/src/Extension/Embed/Embed.php | 50 - .../Extension/Embed/EmbedAdapterInterface.php | 25 - .../src/Extension/Embed/EmbedExtension.php | 48 - .../src/Extension/Embed/EmbedParser.php | 62 - .../src/Extension/Embed/EmbedProcessor.php | 70 - .../src/Extension/Embed/EmbedRenderer.php | 35 - .../src/Extension/Embed/EmbedStartParser.php | 53 - .../src/Extension/ExtensionInterface.php | 24 - .../ExternalLink/ExternalLinkExtension.php | 47 - .../ExternalLink/ExternalLinkProcessor.php | 119 -- .../Event/AnonymousFootnotesListener.php | 62 - .../FixOrphanedFootnotesAndRefsListener.php | 68 - .../Event/GatherFootnotesListener.php | 106 -- .../Event/NumberFootnotesListener.php | 75 - .../Extension/Footnote/FootnoteExtension.php | 70 - .../src/Extension/Footnote/Node/Footnote.php | 37 - .../Footnote/Node/FootnoteBackref.php | 40 - .../Footnote/Node/FootnoteContainer.php | 21 - .../Extension/Footnote/Node/FootnoteRef.php | 57 - .../Parser/AnonymousFootnoteRefParser.php | 66 - .../Footnote/Parser/FootnoteParser.php | 68 - .../Footnote/Parser/FootnoteRefParser.php | 57 - .../Footnote/Parser/FootnoteStartParser.php | 56 - .../Renderer/FootnoteBackrefRenderer.php | 81 -- .../Renderer/FootnoteContainerRenderer.php | 71 - .../Footnote/Renderer/FootnoteRefRenderer.php | 87 -- .../Footnote/Renderer/FootnoteRenderer.php | 80 -- .../Data/FrontMatterDataParserInterface.php | 26 - .../Data/LibYamlFrontMatterParser.php | 47 - .../Data/SymfonyYamlFrontMatterParser.php | 39 - .../Exception/InvalidFrontMatterException.php | 24 - .../FrontMatter/FrontMatterExtension.php | 46 - .../FrontMatter/FrontMatterParser.php | 64 - .../FrontMatterParserInterface.php | 21 - .../FrontMatterProviderInterface.php | 22 - .../Input/MarkdownInputWithFrontMatter.php | 43 - .../FrontMatterPostRenderListener.php | 35 - .../Listener/FrontMatterPreParser.php | 37 - .../Output/RenderedContentWithFrontMatter.php | 51 - .../GithubFlavoredMarkdownExtension.php | 33 - .../HeadingPermalink/HeadingPermalink.php | 37 - .../HeadingPermalinkExtension.php | 49 - .../HeadingPermalinkProcessor.php | 101 -- .../HeadingPermalinkRenderer.php | 106 -- .../Extension/InlinesOnly/ChildRenderer.php | 35 - .../InlinesOnly/InlinesOnlyExtension.php | 73 - .../Mention/Generator/CallbackGenerator.php | 54 - .../Generator/MentionGeneratorInterface.php | 22 - .../Generator/StringTemplateLinkGenerator.php | 34 - .../src/Extension/Mention/Mention.php | 93 -- .../Extension/Mention/MentionExtension.php | 61 - .../src/Extension/Mention/MentionParser.php | 87 -- .../src/Extension/SmartPunct/DashParser.php | 59 - .../Extension/SmartPunct/EllipsesParser.php | 38 - .../src/Extension/SmartPunct/Quote.php | 30 - .../src/Extension/SmartPunct/QuoteParser.php | 98 -- .../Extension/SmartPunct/QuoteProcessor.php | 82 -- .../ReplaceUnpairedQuotesListener.php | 43 - .../SmartPunct/SmartPunctExtension.php | 64 - .../Extension/Strikethrough/Strikethrough.php | 39 - .../StrikethroughDelimiterProcessor.php | 69 - .../Strikethrough/StrikethroughExtension.php | 26 - .../Strikethrough/StrikethroughRenderer.php | 50 - .../commonmark/src/Extension/Table/Table.php | 22 - .../src/Extension/Table/TableCell.php | 99 -- .../src/Extension/Table/TableCellRenderer.php | 89 -- .../src/Extension/Table/TableExtension.php | 63 - .../src/Extension/Table/TableParser.php | 212 --- .../src/Extension/Table/TableRenderer.php | 58 - .../src/Extension/Table/TableRow.php | 22 - .../src/Extension/Table/TableRowRenderer.php | 56 - .../src/Extension/Table/TableSection.php | 64 - .../Extension/Table/TableSectionRenderer.php | 70 - .../src/Extension/Table/TableStartParser.php | 165 --- .../TableOfContents/Node/TableOfContents.php | 20 - .../Node/TableOfContentsPlaceholder.php | 20 - .../Normalizer/AsIsNormalizerStrategy.php | 72 - .../Normalizer/FlatNormalizerStrategy.php | 33 - .../NormalizerStrategyInterface.php | 21 - .../Normalizer/RelativeNormalizerStrategy.php | 67 - .../TableOfContentsBuilder.php | 106 -- .../TableOfContentsExtension.php | 53 - .../TableOfContentsGenerator.php | 168 --- .../TableOfContentsGeneratorInterface.php | 22 - .../TableOfContentsPlaceholderParser.php | 74 - .../TableOfContentsPlaceholderRenderer.php | 40 - .../TableOfContentsRenderer.php | 56 - .../Extension/TaskList/TaskListExtension.php | 26 - .../Extension/TaskList/TaskListItemMarker.php | 39 - .../TaskList/TaskListItemMarkerParser.php | 55 - .../TaskList/TaskListItemMarkerRenderer.php | 70 - .../src/GithubFlavoredMarkdownConverter.php | 45 - .../commonmark/src/Input/MarkdownInput.php | 102 -- .../src/Input/MarkdownInputInterface.php | 26 - .../commonmark/src/MarkdownConverter.php | 93 -- .../src/MarkdownConverterInterface.php | 34 - .../src/Node/Block/AbstractBlock.php | 64 - .../commonmark/src/Node/Block/Document.php | 56 - .../commonmark/src/Node/Block/Paragraph.php | 23 - .../src/Node/Block/TightBlockInterface.php | 21 - .../src/Node/Inline/AbstractInline.php | 23 - .../Node/Inline/AbstractStringContainer.php | 47 - .../src/Node/Inline/AdjacentTextMerger.php | 105 -- .../src/Node/Inline/DelimitedInterface.php | 21 - .../commonmark/src/Node/Inline/Newline.php | 40 - .../commonmark/src/Node/Inline/Text.php | 25 - vendor/league/commonmark/src/Node/Node.php | 262 ---- .../commonmark/src/Node/NodeIterator.php | 58 - .../league/commonmark/src/Node/NodeWalker.php | 80 -- .../commonmark/src/Node/NodeWalkerEvent.php | 42 - vendor/league/commonmark/src/Node/Query.php | 139 -- .../commonmark/src/Node/Query/AndExpr.php | 55 - .../src/Node/Query/ExpressionInterface.php | 21 - .../commonmark/src/Node/Query/OrExpr.php | 55 - .../src/Node/RawMarkupContainerInterface.php | 21 - .../src/Node/StringContainerHelper.php | 54 - .../src/Node/StringContainerInterface.php | 27 - .../src/Normalizer/SlugNormalizer.php | 57 - .../src/Normalizer/TextNormalizer.php | 44 - .../Normalizer/TextNormalizerInterface.php | 33 - .../src/Normalizer/UniqueSlugNormalizer.php | 56 - .../UniqueSlugNormalizerInterface.php | 28 - .../commonmark/src/Output/RenderedContent.php | 49 - .../src/Output/RenderedContentInterface.php | 29 - .../Block/AbstractBlockContinueParser.php | 47 - .../src/Parser/Block/BlockContinue.php | 73 - .../Block/BlockContinueParserInterface.php | 64 - ...lockContinueParserWithInlinesInterface.php | 24 - .../src/Parser/Block/BlockStart.php | 124 -- .../Block/BlockStartParserInterface.php | 33 - .../src/Parser/Block/DocumentBlockParser.php | 80 -- .../src/Parser/Block/ParagraphParser.php | 85 -- .../SkipLinesStartingWithLettersParser.php | 45 - .../league/commonmark/src/Parser/Cursor.php | 494 ------- .../commonmark/src/Parser/CursorState.php | 56 - .../Parser/Inline/InlineParserInterface.php | 23 - .../src/Parser/Inline/InlineParserMatch.php | 87 -- .../src/Parser/Inline/NewlineParser.php | 53 - .../src/Parser/InlineParserContext.php | 120 -- .../src/Parser/InlineParserEngine.php | 177 --- .../Parser/InlineParserEngineInterface.php | 27 - .../commonmark/src/Parser/MarkdownParser.php | 356 ----- .../src/Parser/MarkdownParserInterface.php | 25 - .../src/Parser/MarkdownParserState.php | 57 - .../Parser/MarkdownParserStateInterface.php | 36 - .../src/Parser/ParserLogicException.php | 20 - .../Reference/MemoryLimitedReferenceMap.php | 68 - .../commonmark/src/Reference/Reference.php | 54 - .../src/Reference/ReferenceInterface.php | 29 - .../commonmark/src/Reference/ReferenceMap.php | 85 -- .../src/Reference/ReferenceMapInterface.php | 31 - .../src/Reference/ReferenceParser.php | 324 ----- .../src/Reference/ReferenceableInterface.php | 19 - .../src/Renderer/Block/DocumentRenderer.php | 57 - .../src/Renderer/Block/ParagraphRenderer.php | 74 - .../Renderer/ChildNodeRendererInterface.php | 31 - .../Renderer/DocumentRendererInterface.php | 28 - .../commonmark/src/Renderer/HtmlDecorator.php | 45 - .../commonmark/src/Renderer/HtmlRenderer.php | 100 -- .../src/Renderer/Inline/NewlineRenderer.php | 76 - .../src/Renderer/Inline/TextRenderer.php | 54 - .../Renderer/MarkdownRendererInterface.php | 30 - .../Renderer/NoMatchingRendererException.php | 20 - .../src/Renderer/NodeRendererInterface.php | 27 - .../commonmark/src/Util/ArrayCollection.php | 173 --- .../src/Util/Html5EntityDecoder.php | 75 - .../commonmark/src/Util/HtmlElement.php | 160 --- .../league/commonmark/src/Util/HtmlFilter.php | 55 - .../commonmark/src/Util/LinkParserHelper.php | 165 --- .../commonmark/src/Util/PrioritizedList.php | 73 - .../commonmark/src/Util/RegexHelper.php | 243 ---- .../league/commonmark/src/Util/SpecReader.php | 72 - .../league/commonmark/src/Util/UrlEncoder.php | 69 - vendor/league/commonmark/src/Util/Xml.php | 33 - .../src/Xml/FallbackNodeXmlRenderer.php | 85 -- .../src/Xml/MarkdownToXmlConverter.php | 59 - .../src/Xml/XmlNodeRendererInterface.php | 28 - .../league/commonmark/src/Xml/XmlRenderer.php | 135 -- vendor/league/config/CHANGELOG.md | 42 - vendor/league/config/LICENSE.md | 28 - vendor/league/config/README.md | 153 -- vendor/league/config/composer.json | 69 - vendor/league/config/src/Configuration.php | 255 ---- .../src/ConfigurationAwareInterface.php | 22 - .../src/ConfigurationBuilderInterface.php | 21 - .../config/src/ConfigurationInterface.php | 46 - .../src/ConfigurationProviderInterface.php | 22 - .../ConfigurationExceptionInterface.php | 21 - .../InvalidConfigurationException.php | 46 - .../src/Exception/UnknownOptionException.php | 33 - .../src/Exception/ValidationException.php | 37 - .../src/MutableConfigurationInterface.php | 34 - .../config/src/ReadOnlyConfiguration.php | 40 - .../config/src/SchemaBuilderInterface.php | 27 - vendor/mnapoli/front-yaml/.gitattributes | 5 - vendor/mnapoli/front-yaml/.gitignore | 5 - vendor/mnapoli/front-yaml/LICENSE | 18 - vendor/mnapoli/front-yaml/README.md | 77 - vendor/mnapoli/front-yaml/composer.json | 22 - vendor/mnapoli/front-yaml/phpunit.xml.dist | 21 - .../Bridge/CommonMark/CommonMarkParser.php | 25 - .../src/Bridge/Symfony/SymfonyYAMLParser.php | 24 - vendor/mnapoli/front-yaml/src/Document.php | 37 - .../src/Markdown/MarkdownParser.php | 18 - vendor/mnapoli/front-yaml/src/Parser.php | 71 - .../front-yaml/src/YAML/YAMLParser.php | 16 - vendor/nette/schema/composer.json | 39 - vendor/nette/schema/license.md | 60 - vendor/nette/schema/readme.md | 537 ------- vendor/nette/schema/src/Schema/Context.php | 51 - .../schema/src/Schema/DynamicParameter.php | 15 - .../schema/src/Schema/Elements/AnyOf.php | 147 -- .../nette/schema/src/Schema/Elements/Base.php | 162 --- .../schema/src/Schema/Elements/Structure.php | 210 --- .../nette/schema/src/Schema/Elements/Type.php | 208 --- vendor/nette/schema/src/Schema/Expect.php | 118 -- vendor/nette/schema/src/Schema/Helpers.php | 183 --- vendor/nette/schema/src/Schema/Message.php | 98 -- vendor/nette/schema/src/Schema/Processor.php | 96 -- vendor/nette/schema/src/Schema/Schema.php | 37 - .../schema/src/Schema/ValidationException.php | 55 - vendor/nette/utils/.phpstorm.meta.php | 13 - vendor/nette/utils/composer.json | 51 - vendor/nette/utils/license.md | 60 - vendor/nette/utils/readme.md | 55 - vendor/nette/utils/src/HtmlStringable.php | 22 - .../utils/src/Iterators/CachingIterator.php | 150 -- vendor/nette/utils/src/Iterators/Mapper.php | 33 - vendor/nette/utils/src/SmartObject.php | 140 -- vendor/nette/utils/src/StaticClass.php | 34 - vendor/nette/utils/src/Translator.php | 25 - vendor/nette/utils/src/Utils/ArrayHash.php | 106 -- vendor/nette/utils/src/Utils/ArrayList.php | 136 -- vendor/nette/utils/src/Utils/Arrays.php | 553 -------- vendor/nette/utils/src/Utils/Callback.php | 137 -- vendor/nette/utils/src/Utils/DateTime.php | 140 -- vendor/nette/utils/src/Utils/FileInfo.php | 69 - vendor/nette/utils/src/Utils/FileSystem.php | 326 ----- vendor/nette/utils/src/Utils/Finder.php | 510 ------- vendor/nette/utils/src/Utils/Floats.php | 107 -- vendor/nette/utils/src/Utils/Helpers.php | 104 -- vendor/nette/utils/src/Utils/Html.php | 839 ----------- vendor/nette/utils/src/Utils/Image.php | 831 ----------- vendor/nette/utils/src/Utils/ImageColor.php | 75 - vendor/nette/utils/src/Utils/ImageType.php | 25 - vendor/nette/utils/src/Utils/Iterables.php | 238 ---- vendor/nette/utils/src/Utils/Json.php | 84 -- .../nette/utils/src/Utils/ObjectHelpers.php | 229 --- vendor/nette/utils/src/Utils/Paginator.php | 245 ---- vendor/nette/utils/src/Utils/Random.php | 52 - vendor/nette/utils/src/Utils/Reflection.php | 322 ----- .../utils/src/Utils/ReflectionMethod.php | 36 - vendor/nette/utils/src/Utils/Strings.php | 728 ---------- vendor/nette/utils/src/Utils/Type.php | 267 ---- vendor/nette/utils/src/Utils/Validators.php | 416 ------ vendor/nette/utils/src/Utils/exceptions.php | 50 - vendor/nette/utils/src/compatibility.php | 32 - vendor/nette/utils/src/exceptions.php | 109 -- vendor/psr/event-dispatcher/.editorconfig | 15 - vendor/psr/event-dispatcher/.gitignore | 2 - vendor/psr/event-dispatcher/LICENSE | 21 - vendor/psr/event-dispatcher/README.md | 6 - vendor/psr/event-dispatcher/composer.json | 26 - .../src/EventDispatcherInterface.php | 21 - .../src/ListenerProviderInterface.php | 19 - .../src/StoppableEventInterface.php | 26 - .../deprecation-contracts/CHANGELOG.md | 5 - vendor/symfony/deprecation-contracts/LICENSE | 19 - .../symfony/deprecation-contracts/README.md | 26 - .../deprecation-contracts/composer.json | 35 - .../deprecation-contracts/function.php | 27 - vendor/symfony/polyfill-ctype/Ctype.php | 232 --- vendor/symfony/polyfill-ctype/LICENSE | 19 - vendor/symfony/polyfill-ctype/README.md | 12 - vendor/symfony/polyfill-ctype/bootstrap.php | 50 - vendor/symfony/polyfill-ctype/bootstrap80.php | 46 - vendor/symfony/polyfill-ctype/composer.json | 38 - vendor/symfony/polyfill-php80/LICENSE | 19 - vendor/symfony/polyfill-php80/Php80.php | 115 -- vendor/symfony/polyfill-php80/PhpToken.php | 103 -- vendor/symfony/polyfill-php80/README.md | 25 - .../Resources/stubs/Attribute.php | 31 - .../Resources/stubs/PhpToken.php | 16 - .../Resources/stubs/Stringable.php | 20 - .../Resources/stubs/UnhandledMatchError.php | 16 - .../Resources/stubs/ValueError.php | 16 - vendor/symfony/polyfill-php80/bootstrap.php | 42 - vendor/symfony/polyfill-php80/composer.json | 37 - vendor/symfony/yaml/CHANGELOG.md | 268 ---- vendor/symfony/yaml/Command/LintCommand.php | 277 ---- vendor/symfony/yaml/Dumper.php | 174 --- vendor/symfony/yaml/Escaper.php | 95 -- .../symfony/yaml/Exception/DumpException.php | 21 - .../yaml/Exception/ExceptionInterface.php | 21 - .../symfony/yaml/Exception/ParseException.php | 121 -- .../yaml/Exception/RuntimeException.php | 21 - vendor/symfony/yaml/Inline.php | 848 ----------- vendor/symfony/yaml/LICENSE | 19 - vendor/symfony/yaml/Parser.php | 1260 ----------------- vendor/symfony/yaml/README.md | 13 - vendor/symfony/yaml/Resources/bin/yaml-lint | 49 - vendor/symfony/yaml/Tag/TaggedValue.php | 35 - vendor/symfony/yaml/Unescaper.php | 108 -- vendor/symfony/yaml/Yaml.php | 97 -- vendor/symfony/yaml/composer.json | 39 - 450 files changed, 1 insertion(+), 39131 deletions(-) create mode 100644 .gitignore delete mode 100644 vendor/autoload.php delete mode 100755 vendor/bin/yaml-lint delete mode 100644 vendor/composer/ClassLoader.php delete mode 100644 vendor/composer/InstalledVersions.php delete mode 100644 vendor/composer/LICENSE delete mode 100644 vendor/composer/autoload_classmap.php delete mode 100644 vendor/composer/autoload_files.php delete mode 100644 vendor/composer/autoload_namespaces.php delete mode 100644 vendor/composer/autoload_psr4.php delete mode 100644 vendor/composer/autoload_real.php delete mode 100644 vendor/composer/autoload_static.php delete mode 100644 vendor/composer/installed.json delete mode 100644 vendor/composer/installed.php delete mode 100644 vendor/composer/platform_check.php delete mode 100644 vendor/dflydev/dot-access-data/CHANGELOG.md delete mode 100644 vendor/dflydev/dot-access-data/LICENSE delete mode 100644 vendor/dflydev/dot-access-data/README.md delete mode 100644 vendor/dflydev/dot-access-data/composer.json delete mode 100644 vendor/dflydev/dot-access-data/src/Data.php delete mode 100644 vendor/dflydev/dot-access-data/src/DataInterface.php delete mode 100644 vendor/dflydev/dot-access-data/src/Exception/DataException.php delete mode 100644 vendor/dflydev/dot-access-data/src/Exception/InvalidPathException.php delete mode 100644 vendor/dflydev/dot-access-data/src/Exception/MissingPathException.php delete mode 100644 vendor/dflydev/dot-access-data/src/Util.php delete mode 100644 vendor/league/commonmark/.phpstorm.meta.php delete mode 100644 vendor/league/commonmark/CHANGELOG.md delete mode 100644 vendor/league/commonmark/LICENSE delete mode 100644 vendor/league/commonmark/README.md delete mode 100644 vendor/league/commonmark/composer.json delete mode 100644 vendor/league/commonmark/src/CommonMarkConverter.php delete mode 100644 vendor/league/commonmark/src/ConverterInterface.php delete mode 100644 vendor/league/commonmark/src/Delimiter/Bracket.php delete mode 100644 vendor/league/commonmark/src/Delimiter/Delimiter.php delete mode 100644 vendor/league/commonmark/src/Delimiter/DelimiterInterface.php delete mode 100644 vendor/league/commonmark/src/Delimiter/DelimiterParser.php delete mode 100644 vendor/league/commonmark/src/Delimiter/DelimiterStack.php delete mode 100644 vendor/league/commonmark/src/Delimiter/Processor/CacheableDelimiterProcessorInterface.php delete mode 100644 vendor/league/commonmark/src/Delimiter/Processor/DelimiterProcessorCollection.php delete mode 100644 vendor/league/commonmark/src/Delimiter/Processor/DelimiterProcessorCollectionInterface.php delete mode 100644 vendor/league/commonmark/src/Delimiter/Processor/DelimiterProcessorInterface.php delete mode 100644 vendor/league/commonmark/src/Delimiter/Processor/StaggeredDelimiterProcessor.php delete mode 100644 vendor/league/commonmark/src/Environment/Environment.php delete mode 100644 vendor/league/commonmark/src/Environment/EnvironmentAwareInterface.php delete mode 100644 vendor/league/commonmark/src/Environment/EnvironmentBuilderInterface.php delete mode 100644 vendor/league/commonmark/src/Environment/EnvironmentInterface.php delete mode 100644 vendor/league/commonmark/src/Event/AbstractEvent.php delete mode 100644 vendor/league/commonmark/src/Event/DocumentParsedEvent.php delete mode 100644 vendor/league/commonmark/src/Event/DocumentPreParsedEvent.php delete mode 100644 vendor/league/commonmark/src/Event/DocumentPreRenderEvent.php delete mode 100644 vendor/league/commonmark/src/Event/DocumentRenderedEvent.php delete mode 100644 vendor/league/commonmark/src/Event/ListenerData.php delete mode 100644 vendor/league/commonmark/src/Exception/AlreadyInitializedException.php delete mode 100644 vendor/league/commonmark/src/Exception/CommonMarkException.php delete mode 100644 vendor/league/commonmark/src/Exception/IOException.php delete mode 100644 vendor/league/commonmark/src/Exception/InvalidArgumentException.php delete mode 100644 vendor/league/commonmark/src/Exception/LogicException.php delete mode 100644 vendor/league/commonmark/src/Exception/MissingDependencyException.php delete mode 100644 vendor/league/commonmark/src/Exception/UnexpectedEncodingException.php delete mode 100644 vendor/league/commonmark/src/Extension/Attributes/AttributesExtension.php delete mode 100644 vendor/league/commonmark/src/Extension/Attributes/Event/AttributesListener.php delete mode 100644 vendor/league/commonmark/src/Extension/Attributes/Node/Attributes.php delete mode 100644 vendor/league/commonmark/src/Extension/Attributes/Node/AttributesInline.php delete mode 100644 vendor/league/commonmark/src/Extension/Attributes/Parser/AttributesBlockContinueParser.php delete mode 100644 vendor/league/commonmark/src/Extension/Attributes/Parser/AttributesBlockStartParser.php delete mode 100644 vendor/league/commonmark/src/Extension/Attributes/Parser/AttributesInlineParser.php delete mode 100644 vendor/league/commonmark/src/Extension/Attributes/Util/AttributesHelper.php delete mode 100644 vendor/league/commonmark/src/Extension/Autolink/AutolinkExtension.php delete mode 100644 vendor/league/commonmark/src/Extension/Autolink/EmailAutolinkParser.php delete mode 100644 vendor/league/commonmark/src/Extension/Autolink/UrlAutolinkParser.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/CommonMarkCoreExtension.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Delimiter/Processor/EmphasisDelimiterProcessor.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Node/Block/BlockQuote.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Node/Block/FencedCode.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Node/Block/Heading.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Node/Block/HtmlBlock.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Node/Block/IndentedCode.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Node/Block/ListBlock.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Node/Block/ListData.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Node/Block/ListItem.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Node/Block/ThematicBreak.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/AbstractWebResource.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/Code.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/Emphasis.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/HtmlInline.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/Image.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/Link.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/Strong.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/BlockQuoteParser.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/BlockQuoteStartParser.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/FencedCodeParser.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/FencedCodeStartParser.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/HeadingParser.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/HeadingStartParser.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/HtmlBlockParser.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/HtmlBlockStartParser.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/IndentedCodeParser.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/IndentedCodeStartParser.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ListBlockParser.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ListBlockStartParser.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ListItemParser.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ThematicBreakParser.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ThematicBreakStartParser.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/AutolinkParser.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/BacktickParser.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/BangParser.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/CloseBracketParser.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/EntityParser.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/EscapableParser.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/HtmlInlineParser.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/OpenBracketParser.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/BlockQuoteRenderer.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/FencedCodeRenderer.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/HeadingRenderer.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/HtmlBlockRenderer.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/IndentedCodeRenderer.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/ListBlockRenderer.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/ListItemRenderer.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/ThematicBreakRenderer.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/CodeRenderer.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/EmphasisRenderer.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/HtmlInlineRenderer.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/ImageRenderer.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/LinkRenderer.php delete mode 100644 vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/StrongRenderer.php delete mode 100644 vendor/league/commonmark/src/Extension/ConfigurableExtensionInterface.php delete mode 100644 vendor/league/commonmark/src/Extension/DefaultAttributes/ApplyDefaultAttributesProcessor.php delete mode 100644 vendor/league/commonmark/src/Extension/DefaultAttributes/DefaultAttributesExtension.php delete mode 100644 vendor/league/commonmark/src/Extension/DescriptionList/DescriptionListExtension.php delete mode 100644 vendor/league/commonmark/src/Extension/DescriptionList/Event/ConsecutiveDescriptionListMerger.php delete mode 100644 vendor/league/commonmark/src/Extension/DescriptionList/Event/LooseDescriptionHandler.php delete mode 100644 vendor/league/commonmark/src/Extension/DescriptionList/Node/Description.php delete mode 100644 vendor/league/commonmark/src/Extension/DescriptionList/Node/DescriptionList.php delete mode 100644 vendor/league/commonmark/src/Extension/DescriptionList/Node/DescriptionTerm.php delete mode 100644 vendor/league/commonmark/src/Extension/DescriptionList/Parser/DescriptionContinueParser.php delete mode 100644 vendor/league/commonmark/src/Extension/DescriptionList/Parser/DescriptionListContinueParser.php delete mode 100644 vendor/league/commonmark/src/Extension/DescriptionList/Parser/DescriptionStartParser.php delete mode 100644 vendor/league/commonmark/src/Extension/DescriptionList/Parser/DescriptionTermContinueParser.php delete mode 100644 vendor/league/commonmark/src/Extension/DescriptionList/Renderer/DescriptionListRenderer.php delete mode 100644 vendor/league/commonmark/src/Extension/DescriptionList/Renderer/DescriptionRenderer.php delete mode 100644 vendor/league/commonmark/src/Extension/DescriptionList/Renderer/DescriptionTermRenderer.php delete mode 100644 vendor/league/commonmark/src/Extension/DisallowedRawHtml/DisallowedRawHtmlExtension.php delete mode 100644 vendor/league/commonmark/src/Extension/DisallowedRawHtml/DisallowedRawHtmlRenderer.php delete mode 100644 vendor/league/commonmark/src/Extension/Embed/Bridge/OscaroteroEmbedAdapter.php delete mode 100644 vendor/league/commonmark/src/Extension/Embed/DomainFilteringAdapter.php delete mode 100644 vendor/league/commonmark/src/Extension/Embed/Embed.php delete mode 100644 vendor/league/commonmark/src/Extension/Embed/EmbedAdapterInterface.php delete mode 100644 vendor/league/commonmark/src/Extension/Embed/EmbedExtension.php delete mode 100644 vendor/league/commonmark/src/Extension/Embed/EmbedParser.php delete mode 100644 vendor/league/commonmark/src/Extension/Embed/EmbedProcessor.php delete mode 100644 vendor/league/commonmark/src/Extension/Embed/EmbedRenderer.php delete mode 100644 vendor/league/commonmark/src/Extension/Embed/EmbedStartParser.php delete mode 100644 vendor/league/commonmark/src/Extension/ExtensionInterface.php delete mode 100644 vendor/league/commonmark/src/Extension/ExternalLink/ExternalLinkExtension.php delete mode 100644 vendor/league/commonmark/src/Extension/ExternalLink/ExternalLinkProcessor.php delete mode 100644 vendor/league/commonmark/src/Extension/Footnote/Event/AnonymousFootnotesListener.php delete mode 100644 vendor/league/commonmark/src/Extension/Footnote/Event/FixOrphanedFootnotesAndRefsListener.php delete mode 100644 vendor/league/commonmark/src/Extension/Footnote/Event/GatherFootnotesListener.php delete mode 100644 vendor/league/commonmark/src/Extension/Footnote/Event/NumberFootnotesListener.php delete mode 100644 vendor/league/commonmark/src/Extension/Footnote/FootnoteExtension.php delete mode 100644 vendor/league/commonmark/src/Extension/Footnote/Node/Footnote.php delete mode 100644 vendor/league/commonmark/src/Extension/Footnote/Node/FootnoteBackref.php delete mode 100644 vendor/league/commonmark/src/Extension/Footnote/Node/FootnoteContainer.php delete mode 100644 vendor/league/commonmark/src/Extension/Footnote/Node/FootnoteRef.php delete mode 100644 vendor/league/commonmark/src/Extension/Footnote/Parser/AnonymousFootnoteRefParser.php delete mode 100644 vendor/league/commonmark/src/Extension/Footnote/Parser/FootnoteParser.php delete mode 100644 vendor/league/commonmark/src/Extension/Footnote/Parser/FootnoteRefParser.php delete mode 100644 vendor/league/commonmark/src/Extension/Footnote/Parser/FootnoteStartParser.php delete mode 100644 vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteBackrefRenderer.php delete mode 100644 vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteContainerRenderer.php delete mode 100644 vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteRefRenderer.php delete mode 100644 vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteRenderer.php delete mode 100644 vendor/league/commonmark/src/Extension/FrontMatter/Data/FrontMatterDataParserInterface.php delete mode 100644 vendor/league/commonmark/src/Extension/FrontMatter/Data/LibYamlFrontMatterParser.php delete mode 100644 vendor/league/commonmark/src/Extension/FrontMatter/Data/SymfonyYamlFrontMatterParser.php delete mode 100644 vendor/league/commonmark/src/Extension/FrontMatter/Exception/InvalidFrontMatterException.php delete mode 100644 vendor/league/commonmark/src/Extension/FrontMatter/FrontMatterExtension.php delete mode 100644 vendor/league/commonmark/src/Extension/FrontMatter/FrontMatterParser.php delete mode 100644 vendor/league/commonmark/src/Extension/FrontMatter/FrontMatterParserInterface.php delete mode 100644 vendor/league/commonmark/src/Extension/FrontMatter/FrontMatterProviderInterface.php delete mode 100644 vendor/league/commonmark/src/Extension/FrontMatter/Input/MarkdownInputWithFrontMatter.php delete mode 100644 vendor/league/commonmark/src/Extension/FrontMatter/Listener/FrontMatterPostRenderListener.php delete mode 100644 vendor/league/commonmark/src/Extension/FrontMatter/Listener/FrontMatterPreParser.php delete mode 100644 vendor/league/commonmark/src/Extension/FrontMatter/Output/RenderedContentWithFrontMatter.php delete mode 100644 vendor/league/commonmark/src/Extension/GithubFlavoredMarkdownExtension.php delete mode 100644 vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalink.php delete mode 100644 vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkExtension.php delete mode 100644 vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkProcessor.php delete mode 100644 vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkRenderer.php delete mode 100644 vendor/league/commonmark/src/Extension/InlinesOnly/ChildRenderer.php delete mode 100644 vendor/league/commonmark/src/Extension/InlinesOnly/InlinesOnlyExtension.php delete mode 100644 vendor/league/commonmark/src/Extension/Mention/Generator/CallbackGenerator.php delete mode 100644 vendor/league/commonmark/src/Extension/Mention/Generator/MentionGeneratorInterface.php delete mode 100644 vendor/league/commonmark/src/Extension/Mention/Generator/StringTemplateLinkGenerator.php delete mode 100644 vendor/league/commonmark/src/Extension/Mention/Mention.php delete mode 100644 vendor/league/commonmark/src/Extension/Mention/MentionExtension.php delete mode 100644 vendor/league/commonmark/src/Extension/Mention/MentionParser.php delete mode 100644 vendor/league/commonmark/src/Extension/SmartPunct/DashParser.php delete mode 100644 vendor/league/commonmark/src/Extension/SmartPunct/EllipsesParser.php delete mode 100644 vendor/league/commonmark/src/Extension/SmartPunct/Quote.php delete mode 100644 vendor/league/commonmark/src/Extension/SmartPunct/QuoteParser.php delete mode 100644 vendor/league/commonmark/src/Extension/SmartPunct/QuoteProcessor.php delete mode 100644 vendor/league/commonmark/src/Extension/SmartPunct/ReplaceUnpairedQuotesListener.php delete mode 100644 vendor/league/commonmark/src/Extension/SmartPunct/SmartPunctExtension.php delete mode 100644 vendor/league/commonmark/src/Extension/Strikethrough/Strikethrough.php delete mode 100644 vendor/league/commonmark/src/Extension/Strikethrough/StrikethroughDelimiterProcessor.php delete mode 100644 vendor/league/commonmark/src/Extension/Strikethrough/StrikethroughExtension.php delete mode 100644 vendor/league/commonmark/src/Extension/Strikethrough/StrikethroughRenderer.php delete mode 100644 vendor/league/commonmark/src/Extension/Table/Table.php delete mode 100644 vendor/league/commonmark/src/Extension/Table/TableCell.php delete mode 100644 vendor/league/commonmark/src/Extension/Table/TableCellRenderer.php delete mode 100644 vendor/league/commonmark/src/Extension/Table/TableExtension.php delete mode 100644 vendor/league/commonmark/src/Extension/Table/TableParser.php delete mode 100644 vendor/league/commonmark/src/Extension/Table/TableRenderer.php delete mode 100644 vendor/league/commonmark/src/Extension/Table/TableRow.php delete mode 100644 vendor/league/commonmark/src/Extension/Table/TableRowRenderer.php delete mode 100644 vendor/league/commonmark/src/Extension/Table/TableSection.php delete mode 100644 vendor/league/commonmark/src/Extension/Table/TableSectionRenderer.php delete mode 100644 vendor/league/commonmark/src/Extension/Table/TableStartParser.php delete mode 100644 vendor/league/commonmark/src/Extension/TableOfContents/Node/TableOfContents.php delete mode 100644 vendor/league/commonmark/src/Extension/TableOfContents/Node/TableOfContentsPlaceholder.php delete mode 100644 vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/AsIsNormalizerStrategy.php delete mode 100644 vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/FlatNormalizerStrategy.php delete mode 100644 vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/NormalizerStrategyInterface.php delete mode 100644 vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/RelativeNormalizerStrategy.php delete mode 100644 vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsBuilder.php delete mode 100644 vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsExtension.php delete mode 100644 vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsGenerator.php delete mode 100644 vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsGeneratorInterface.php delete mode 100644 vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsPlaceholderParser.php delete mode 100644 vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsPlaceholderRenderer.php delete mode 100644 vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsRenderer.php delete mode 100644 vendor/league/commonmark/src/Extension/TaskList/TaskListExtension.php delete mode 100644 vendor/league/commonmark/src/Extension/TaskList/TaskListItemMarker.php delete mode 100644 vendor/league/commonmark/src/Extension/TaskList/TaskListItemMarkerParser.php delete mode 100644 vendor/league/commonmark/src/Extension/TaskList/TaskListItemMarkerRenderer.php delete mode 100644 vendor/league/commonmark/src/GithubFlavoredMarkdownConverter.php delete mode 100644 vendor/league/commonmark/src/Input/MarkdownInput.php delete mode 100644 vendor/league/commonmark/src/Input/MarkdownInputInterface.php delete mode 100644 vendor/league/commonmark/src/MarkdownConverter.php delete mode 100644 vendor/league/commonmark/src/MarkdownConverterInterface.php delete mode 100644 vendor/league/commonmark/src/Node/Block/AbstractBlock.php delete mode 100644 vendor/league/commonmark/src/Node/Block/Document.php delete mode 100644 vendor/league/commonmark/src/Node/Block/Paragraph.php delete mode 100644 vendor/league/commonmark/src/Node/Block/TightBlockInterface.php delete mode 100644 vendor/league/commonmark/src/Node/Inline/AbstractInline.php delete mode 100644 vendor/league/commonmark/src/Node/Inline/AbstractStringContainer.php delete mode 100644 vendor/league/commonmark/src/Node/Inline/AdjacentTextMerger.php delete mode 100644 vendor/league/commonmark/src/Node/Inline/DelimitedInterface.php delete mode 100644 vendor/league/commonmark/src/Node/Inline/Newline.php delete mode 100644 vendor/league/commonmark/src/Node/Inline/Text.php delete mode 100644 vendor/league/commonmark/src/Node/Node.php delete mode 100644 vendor/league/commonmark/src/Node/NodeIterator.php delete mode 100644 vendor/league/commonmark/src/Node/NodeWalker.php delete mode 100644 vendor/league/commonmark/src/Node/NodeWalkerEvent.php delete mode 100644 vendor/league/commonmark/src/Node/Query.php delete mode 100644 vendor/league/commonmark/src/Node/Query/AndExpr.php delete mode 100644 vendor/league/commonmark/src/Node/Query/ExpressionInterface.php delete mode 100644 vendor/league/commonmark/src/Node/Query/OrExpr.php delete mode 100644 vendor/league/commonmark/src/Node/RawMarkupContainerInterface.php delete mode 100644 vendor/league/commonmark/src/Node/StringContainerHelper.php delete mode 100644 vendor/league/commonmark/src/Node/StringContainerInterface.php delete mode 100644 vendor/league/commonmark/src/Normalizer/SlugNormalizer.php delete mode 100644 vendor/league/commonmark/src/Normalizer/TextNormalizer.php delete mode 100644 vendor/league/commonmark/src/Normalizer/TextNormalizerInterface.php delete mode 100644 vendor/league/commonmark/src/Normalizer/UniqueSlugNormalizer.php delete mode 100644 vendor/league/commonmark/src/Normalizer/UniqueSlugNormalizerInterface.php delete mode 100644 vendor/league/commonmark/src/Output/RenderedContent.php delete mode 100644 vendor/league/commonmark/src/Output/RenderedContentInterface.php delete mode 100644 vendor/league/commonmark/src/Parser/Block/AbstractBlockContinueParser.php delete mode 100644 vendor/league/commonmark/src/Parser/Block/BlockContinue.php delete mode 100644 vendor/league/commonmark/src/Parser/Block/BlockContinueParserInterface.php delete mode 100644 vendor/league/commonmark/src/Parser/Block/BlockContinueParserWithInlinesInterface.php delete mode 100644 vendor/league/commonmark/src/Parser/Block/BlockStart.php delete mode 100644 vendor/league/commonmark/src/Parser/Block/BlockStartParserInterface.php delete mode 100644 vendor/league/commonmark/src/Parser/Block/DocumentBlockParser.php delete mode 100644 vendor/league/commonmark/src/Parser/Block/ParagraphParser.php delete mode 100644 vendor/league/commonmark/src/Parser/Block/SkipLinesStartingWithLettersParser.php delete mode 100644 vendor/league/commonmark/src/Parser/Cursor.php delete mode 100644 vendor/league/commonmark/src/Parser/CursorState.php delete mode 100644 vendor/league/commonmark/src/Parser/Inline/InlineParserInterface.php delete mode 100644 vendor/league/commonmark/src/Parser/Inline/InlineParserMatch.php delete mode 100644 vendor/league/commonmark/src/Parser/Inline/NewlineParser.php delete mode 100644 vendor/league/commonmark/src/Parser/InlineParserContext.php delete mode 100644 vendor/league/commonmark/src/Parser/InlineParserEngine.php delete mode 100644 vendor/league/commonmark/src/Parser/InlineParserEngineInterface.php delete mode 100644 vendor/league/commonmark/src/Parser/MarkdownParser.php delete mode 100644 vendor/league/commonmark/src/Parser/MarkdownParserInterface.php delete mode 100644 vendor/league/commonmark/src/Parser/MarkdownParserState.php delete mode 100644 vendor/league/commonmark/src/Parser/MarkdownParserStateInterface.php delete mode 100644 vendor/league/commonmark/src/Parser/ParserLogicException.php delete mode 100644 vendor/league/commonmark/src/Reference/MemoryLimitedReferenceMap.php delete mode 100644 vendor/league/commonmark/src/Reference/Reference.php delete mode 100644 vendor/league/commonmark/src/Reference/ReferenceInterface.php delete mode 100644 vendor/league/commonmark/src/Reference/ReferenceMap.php delete mode 100644 vendor/league/commonmark/src/Reference/ReferenceMapInterface.php delete mode 100644 vendor/league/commonmark/src/Reference/ReferenceParser.php delete mode 100644 vendor/league/commonmark/src/Reference/ReferenceableInterface.php delete mode 100644 vendor/league/commonmark/src/Renderer/Block/DocumentRenderer.php delete mode 100644 vendor/league/commonmark/src/Renderer/Block/ParagraphRenderer.php delete mode 100644 vendor/league/commonmark/src/Renderer/ChildNodeRendererInterface.php delete mode 100644 vendor/league/commonmark/src/Renderer/DocumentRendererInterface.php delete mode 100644 vendor/league/commonmark/src/Renderer/HtmlDecorator.php delete mode 100644 vendor/league/commonmark/src/Renderer/HtmlRenderer.php delete mode 100644 vendor/league/commonmark/src/Renderer/Inline/NewlineRenderer.php delete mode 100644 vendor/league/commonmark/src/Renderer/Inline/TextRenderer.php delete mode 100644 vendor/league/commonmark/src/Renderer/MarkdownRendererInterface.php delete mode 100644 vendor/league/commonmark/src/Renderer/NoMatchingRendererException.php delete mode 100644 vendor/league/commonmark/src/Renderer/NodeRendererInterface.php delete mode 100644 vendor/league/commonmark/src/Util/ArrayCollection.php delete mode 100644 vendor/league/commonmark/src/Util/Html5EntityDecoder.php delete mode 100644 vendor/league/commonmark/src/Util/HtmlElement.php delete mode 100644 vendor/league/commonmark/src/Util/HtmlFilter.php delete mode 100644 vendor/league/commonmark/src/Util/LinkParserHelper.php delete mode 100644 vendor/league/commonmark/src/Util/PrioritizedList.php delete mode 100644 vendor/league/commonmark/src/Util/RegexHelper.php delete mode 100644 vendor/league/commonmark/src/Util/SpecReader.php delete mode 100644 vendor/league/commonmark/src/Util/UrlEncoder.php delete mode 100644 vendor/league/commonmark/src/Util/Xml.php delete mode 100644 vendor/league/commonmark/src/Xml/FallbackNodeXmlRenderer.php delete mode 100644 vendor/league/commonmark/src/Xml/MarkdownToXmlConverter.php delete mode 100644 vendor/league/commonmark/src/Xml/XmlNodeRendererInterface.php delete mode 100644 vendor/league/commonmark/src/Xml/XmlRenderer.php delete mode 100644 vendor/league/config/CHANGELOG.md delete mode 100644 vendor/league/config/LICENSE.md delete mode 100644 vendor/league/config/README.md delete mode 100644 vendor/league/config/composer.json delete mode 100644 vendor/league/config/src/Configuration.php delete mode 100644 vendor/league/config/src/ConfigurationAwareInterface.php delete mode 100644 vendor/league/config/src/ConfigurationBuilderInterface.php delete mode 100644 vendor/league/config/src/ConfigurationInterface.php delete mode 100644 vendor/league/config/src/ConfigurationProviderInterface.php delete mode 100644 vendor/league/config/src/Exception/ConfigurationExceptionInterface.php delete mode 100644 vendor/league/config/src/Exception/InvalidConfigurationException.php delete mode 100644 vendor/league/config/src/Exception/UnknownOptionException.php delete mode 100644 vendor/league/config/src/Exception/ValidationException.php delete mode 100644 vendor/league/config/src/MutableConfigurationInterface.php delete mode 100644 vendor/league/config/src/ReadOnlyConfiguration.php delete mode 100644 vendor/league/config/src/SchemaBuilderInterface.php delete mode 100644 vendor/mnapoli/front-yaml/.gitattributes delete mode 100644 vendor/mnapoli/front-yaml/.gitignore delete mode 100644 vendor/mnapoli/front-yaml/LICENSE delete mode 100644 vendor/mnapoli/front-yaml/README.md delete mode 100644 vendor/mnapoli/front-yaml/composer.json delete mode 100644 vendor/mnapoli/front-yaml/phpunit.xml.dist delete mode 100644 vendor/mnapoli/front-yaml/src/Bridge/CommonMark/CommonMarkParser.php delete mode 100644 vendor/mnapoli/front-yaml/src/Bridge/Symfony/SymfonyYAMLParser.php delete mode 100644 vendor/mnapoli/front-yaml/src/Document.php delete mode 100644 vendor/mnapoli/front-yaml/src/Markdown/MarkdownParser.php delete mode 100644 vendor/mnapoli/front-yaml/src/Parser.php delete mode 100644 vendor/mnapoli/front-yaml/src/YAML/YAMLParser.php delete mode 100644 vendor/nette/schema/composer.json delete mode 100644 vendor/nette/schema/license.md delete mode 100644 vendor/nette/schema/readme.md delete mode 100644 vendor/nette/schema/src/Schema/Context.php delete mode 100644 vendor/nette/schema/src/Schema/DynamicParameter.php delete mode 100644 vendor/nette/schema/src/Schema/Elements/AnyOf.php delete mode 100644 vendor/nette/schema/src/Schema/Elements/Base.php delete mode 100644 vendor/nette/schema/src/Schema/Elements/Structure.php delete mode 100644 vendor/nette/schema/src/Schema/Elements/Type.php delete mode 100644 vendor/nette/schema/src/Schema/Expect.php delete mode 100644 vendor/nette/schema/src/Schema/Helpers.php delete mode 100644 vendor/nette/schema/src/Schema/Message.php delete mode 100644 vendor/nette/schema/src/Schema/Processor.php delete mode 100644 vendor/nette/schema/src/Schema/Schema.php delete mode 100644 vendor/nette/schema/src/Schema/ValidationException.php delete mode 100644 vendor/nette/utils/.phpstorm.meta.php delete mode 100644 vendor/nette/utils/composer.json delete mode 100644 vendor/nette/utils/license.md delete mode 100644 vendor/nette/utils/readme.md delete mode 100644 vendor/nette/utils/src/HtmlStringable.php delete mode 100644 vendor/nette/utils/src/Iterators/CachingIterator.php delete mode 100644 vendor/nette/utils/src/Iterators/Mapper.php delete mode 100644 vendor/nette/utils/src/SmartObject.php delete mode 100644 vendor/nette/utils/src/StaticClass.php delete mode 100644 vendor/nette/utils/src/Translator.php delete mode 100644 vendor/nette/utils/src/Utils/ArrayHash.php delete mode 100644 vendor/nette/utils/src/Utils/ArrayList.php delete mode 100644 vendor/nette/utils/src/Utils/Arrays.php delete mode 100644 vendor/nette/utils/src/Utils/Callback.php delete mode 100644 vendor/nette/utils/src/Utils/DateTime.php delete mode 100644 vendor/nette/utils/src/Utils/FileInfo.php delete mode 100644 vendor/nette/utils/src/Utils/FileSystem.php delete mode 100644 vendor/nette/utils/src/Utils/Finder.php delete mode 100644 vendor/nette/utils/src/Utils/Floats.php delete mode 100644 vendor/nette/utils/src/Utils/Helpers.php delete mode 100644 vendor/nette/utils/src/Utils/Html.php delete mode 100644 vendor/nette/utils/src/Utils/Image.php delete mode 100644 vendor/nette/utils/src/Utils/ImageColor.php delete mode 100644 vendor/nette/utils/src/Utils/ImageType.php delete mode 100644 vendor/nette/utils/src/Utils/Iterables.php delete mode 100644 vendor/nette/utils/src/Utils/Json.php delete mode 100644 vendor/nette/utils/src/Utils/ObjectHelpers.php delete mode 100644 vendor/nette/utils/src/Utils/Paginator.php delete mode 100644 vendor/nette/utils/src/Utils/Random.php delete mode 100644 vendor/nette/utils/src/Utils/Reflection.php delete mode 100644 vendor/nette/utils/src/Utils/ReflectionMethod.php delete mode 100644 vendor/nette/utils/src/Utils/Strings.php delete mode 100644 vendor/nette/utils/src/Utils/Type.php delete mode 100644 vendor/nette/utils/src/Utils/Validators.php delete mode 100644 vendor/nette/utils/src/Utils/exceptions.php delete mode 100644 vendor/nette/utils/src/compatibility.php delete mode 100644 vendor/nette/utils/src/exceptions.php delete mode 100644 vendor/psr/event-dispatcher/.editorconfig delete mode 100644 vendor/psr/event-dispatcher/.gitignore delete mode 100644 vendor/psr/event-dispatcher/LICENSE delete mode 100644 vendor/psr/event-dispatcher/README.md delete mode 100644 vendor/psr/event-dispatcher/composer.json delete mode 100644 vendor/psr/event-dispatcher/src/EventDispatcherInterface.php delete mode 100644 vendor/psr/event-dispatcher/src/ListenerProviderInterface.php delete mode 100644 vendor/psr/event-dispatcher/src/StoppableEventInterface.php delete mode 100644 vendor/symfony/deprecation-contracts/CHANGELOG.md delete mode 100644 vendor/symfony/deprecation-contracts/LICENSE delete mode 100644 vendor/symfony/deprecation-contracts/README.md delete mode 100644 vendor/symfony/deprecation-contracts/composer.json delete mode 100644 vendor/symfony/deprecation-contracts/function.php delete mode 100644 vendor/symfony/polyfill-ctype/Ctype.php delete mode 100644 vendor/symfony/polyfill-ctype/LICENSE delete mode 100644 vendor/symfony/polyfill-ctype/README.md delete mode 100644 vendor/symfony/polyfill-ctype/bootstrap.php delete mode 100644 vendor/symfony/polyfill-ctype/bootstrap80.php delete mode 100644 vendor/symfony/polyfill-ctype/composer.json delete mode 100644 vendor/symfony/polyfill-php80/LICENSE delete mode 100644 vendor/symfony/polyfill-php80/Php80.php delete mode 100644 vendor/symfony/polyfill-php80/PhpToken.php delete mode 100644 vendor/symfony/polyfill-php80/README.md delete mode 100644 vendor/symfony/polyfill-php80/Resources/stubs/Attribute.php delete mode 100644 vendor/symfony/polyfill-php80/Resources/stubs/PhpToken.php delete mode 100644 vendor/symfony/polyfill-php80/Resources/stubs/Stringable.php delete mode 100644 vendor/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php delete mode 100644 vendor/symfony/polyfill-php80/Resources/stubs/ValueError.php delete mode 100644 vendor/symfony/polyfill-php80/bootstrap.php delete mode 100644 vendor/symfony/polyfill-php80/composer.json delete mode 100644 vendor/symfony/yaml/CHANGELOG.md delete mode 100644 vendor/symfony/yaml/Command/LintCommand.php delete mode 100644 vendor/symfony/yaml/Dumper.php delete mode 100644 vendor/symfony/yaml/Escaper.php delete mode 100644 vendor/symfony/yaml/Exception/DumpException.php delete mode 100644 vendor/symfony/yaml/Exception/ExceptionInterface.php delete mode 100644 vendor/symfony/yaml/Exception/ParseException.php delete mode 100644 vendor/symfony/yaml/Exception/RuntimeException.php delete mode 100644 vendor/symfony/yaml/Inline.php delete mode 100644 vendor/symfony/yaml/LICENSE delete mode 100644 vendor/symfony/yaml/Parser.php delete mode 100644 vendor/symfony/yaml/README.md delete mode 100755 vendor/symfony/yaml/Resources/bin/yaml-lint delete mode 100644 vendor/symfony/yaml/Tag/TaggedValue.php delete mode 100644 vendor/symfony/yaml/Unescaper.php delete mode 100644 vendor/symfony/yaml/Yaml.php delete mode 100644 vendor/symfony/yaml/composer.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57872d0 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/vendor/ diff --git a/vendor/autoload.php b/vendor/autoload.php deleted file mode 100644 index 5dc217d..0000000 --- a/vendor/autoload.php +++ /dev/null @@ -1,25 +0,0 @@ -realpath = realpath($opened_path) ?: $opened_path; - $opened_path = $this->realpath; - $this->handle = fopen($this->realpath, $mode); - $this->position = 0; - - return (bool) $this->handle; - } - - public function stream_read($count) - { - $data = fread($this->handle, $count); - - if ($this->position === 0) { - $data = preg_replace('{^#!.*\r?\n}', '', $data); - } - - $this->position += strlen($data); - - return $data; - } - - public function stream_cast($castAs) - { - return $this->handle; - } - - public function stream_close() - { - fclose($this->handle); - } - - public function stream_lock($operation) - { - return $operation ? flock($this->handle, $operation) : true; - } - - public function stream_seek($offset, $whence) - { - if (0 === fseek($this->handle, $offset, $whence)) { - $this->position = ftell($this->handle); - return true; - } - - return false; - } - - public function stream_tell() - { - return $this->position; - } - - public function stream_eof() - { - return feof($this->handle); - } - - public function stream_stat() - { - return array(); - } - - public function stream_set_option($option, $arg1, $arg2) - { - return true; - } - - public function url_stat($path, $flags) - { - $path = substr($path, 17); - if (file_exists($path)) { - return stat($path); - } - - return false; - } - } - } - - if ( - (function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true)) - || (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper')) - ) { - include("phpvfscomposer://" . __DIR__ . '/..'.'/symfony/yaml/Resources/bin/yaml-lint'); - exit(0); - } -} - -include __DIR__ . '/..'.'/symfony/yaml/Resources/bin/yaml-lint'; diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php deleted file mode 100644 index a72151c..0000000 --- a/vendor/composer/ClassLoader.php +++ /dev/null @@ -1,585 +0,0 @@ - - * Jordi Boggiano - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Composer\Autoload; - -/** - * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. - * - * $loader = new \Composer\Autoload\ClassLoader(); - * - * // register classes with namespaces - * $loader->add('Symfony\Component', __DIR__.'/component'); - * $loader->add('Symfony', __DIR__.'/framework'); - * - * // activate the autoloader - * $loader->register(); - * - * // to enable searching the include path (eg. for PEAR packages) - * $loader->setUseIncludePath(true); - * - * In this example, if you try to use a class in the Symfony\Component - * namespace or one of its children (Symfony\Component\Console for instance), - * the autoloader will first look for the class under the component/ - * directory, and it will then fallback to the framework/ directory if not - * found before giving up. - * - * This class is loosely based on the Symfony UniversalClassLoader. - * - * @author Fabien Potencier - * @author Jordi Boggiano - * @see https://www.php-fig.org/psr/psr-0/ - * @see https://www.php-fig.org/psr/psr-4/ - */ -class ClassLoader -{ - /** @var \Closure(string):void */ - private static $includeFile; - - /** @var ?string */ - private $vendorDir; - - // PSR-4 - /** - * @var array[] - * @psalm-var array> - */ - private $prefixLengthsPsr4 = array(); - /** - * @var array[] - * @psalm-var array> - */ - private $prefixDirsPsr4 = array(); - /** - * @var array[] - * @psalm-var array - */ - private $fallbackDirsPsr4 = array(); - - // PSR-0 - /** - * @var array[] - * @psalm-var array> - */ - private $prefixesPsr0 = array(); - /** - * @var array[] - * @psalm-var array - */ - private $fallbackDirsPsr0 = array(); - - /** @var bool */ - private $useIncludePath = false; - - /** - * @var string[] - * @psalm-var array - */ - private $classMap = array(); - - /** @var bool */ - private $classMapAuthoritative = false; - - /** - * @var bool[] - * @psalm-var array - */ - private $missingClasses = array(); - - /** @var ?string */ - private $apcuPrefix; - - /** - * @var self[] - */ - private static $registeredLoaders = array(); - - /** - * @param ?string $vendorDir - */ - public function __construct($vendorDir = null) - { - $this->vendorDir = $vendorDir; - self::initializeIncludeClosure(); - } - - /** - * @return string[] - */ - public function getPrefixes() - { - if (!empty($this->prefixesPsr0)) { - return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); - } - - return array(); - } - - /** - * @return array[] - * @psalm-return array> - */ - public function getPrefixesPsr4() - { - return $this->prefixDirsPsr4; - } - - /** - * @return array[] - * @psalm-return array - */ - public function getFallbackDirs() - { - return $this->fallbackDirsPsr0; - } - - /** - * @return array[] - * @psalm-return array - */ - public function getFallbackDirsPsr4() - { - return $this->fallbackDirsPsr4; - } - - /** - * @return string[] Array of classname => path - * @psalm-return array - */ - public function getClassMap() - { - return $this->classMap; - } - - /** - * @param string[] $classMap Class to filename map - * @psalm-param array $classMap - * - * @return void - */ - public function addClassMap(array $classMap) - { - if ($this->classMap) { - $this->classMap = array_merge($this->classMap, $classMap); - } else { - $this->classMap = $classMap; - } - } - - /** - * Registers a set of PSR-0 directories for a given prefix, either - * appending or prepending to the ones previously set for this prefix. - * - * @param string $prefix The prefix - * @param string[]|string $paths The PSR-0 root directories - * @param bool $prepend Whether to prepend the directories - * - * @return void - */ - public function add($prefix, $paths, $prepend = false) - { - if (!$prefix) { - if ($prepend) { - $this->fallbackDirsPsr0 = array_merge( - (array) $paths, - $this->fallbackDirsPsr0 - ); - } else { - $this->fallbackDirsPsr0 = array_merge( - $this->fallbackDirsPsr0, - (array) $paths - ); - } - - return; - } - - $first = $prefix[0]; - if (!isset($this->prefixesPsr0[$first][$prefix])) { - $this->prefixesPsr0[$first][$prefix] = (array) $paths; - - return; - } - if ($prepend) { - $this->prefixesPsr0[$first][$prefix] = array_merge( - (array) $paths, - $this->prefixesPsr0[$first][$prefix] - ); - } else { - $this->prefixesPsr0[$first][$prefix] = array_merge( - $this->prefixesPsr0[$first][$prefix], - (array) $paths - ); - } - } - - /** - * Registers a set of PSR-4 directories for a given namespace, either - * appending or prepending to the ones previously set for this namespace. - * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param string[]|string $paths The PSR-4 base directories - * @param bool $prepend Whether to prepend the directories - * - * @throws \InvalidArgumentException - * - * @return void - */ - public function addPsr4($prefix, $paths, $prepend = false) - { - if (!$prefix) { - // Register directories for the root namespace. - if ($prepend) { - $this->fallbackDirsPsr4 = array_merge( - (array) $paths, - $this->fallbackDirsPsr4 - ); - } else { - $this->fallbackDirsPsr4 = array_merge( - $this->fallbackDirsPsr4, - (array) $paths - ); - } - } elseif (!isset($this->prefixDirsPsr4[$prefix])) { - // Register directories for a new namespace. - $length = strlen($prefix); - if ('\\' !== $prefix[$length - 1]) { - throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); - } - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = (array) $paths; - } elseif ($prepend) { - // Prepend directories for an already registered namespace. - $this->prefixDirsPsr4[$prefix] = array_merge( - (array) $paths, - $this->prefixDirsPsr4[$prefix] - ); - } else { - // Append directories for an already registered namespace. - $this->prefixDirsPsr4[$prefix] = array_merge( - $this->prefixDirsPsr4[$prefix], - (array) $paths - ); - } - } - - /** - * Registers a set of PSR-0 directories for a given prefix, - * replacing any others previously set for this prefix. - * - * @param string $prefix The prefix - * @param string[]|string $paths The PSR-0 base directories - * - * @return void - */ - public function set($prefix, $paths) - { - if (!$prefix) { - $this->fallbackDirsPsr0 = (array) $paths; - } else { - $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; - } - } - - /** - * Registers a set of PSR-4 directories for a given namespace, - * replacing any others previously set for this namespace. - * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param string[]|string $paths The PSR-4 base directories - * - * @throws \InvalidArgumentException - * - * @return void - */ - public function setPsr4($prefix, $paths) - { - if (!$prefix) { - $this->fallbackDirsPsr4 = (array) $paths; - } else { - $length = strlen($prefix); - if ('\\' !== $prefix[$length - 1]) { - throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); - } - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = (array) $paths; - } - } - - /** - * Turns on searching the include path for class files. - * - * @param bool $useIncludePath - * - * @return void - */ - public function setUseIncludePath($useIncludePath) - { - $this->useIncludePath = $useIncludePath; - } - - /** - * Can be used to check if the autoloader uses the include path to check - * for classes. - * - * @return bool - */ - public function getUseIncludePath() - { - return $this->useIncludePath; - } - - /** - * Turns off searching the prefix and fallback directories for classes - * that have not been registered with the class map. - * - * @param bool $classMapAuthoritative - * - * @return void - */ - public function setClassMapAuthoritative($classMapAuthoritative) - { - $this->classMapAuthoritative = $classMapAuthoritative; - } - - /** - * Should class lookup fail if not found in the current class map? - * - * @return bool - */ - public function isClassMapAuthoritative() - { - return $this->classMapAuthoritative; - } - - /** - * APCu prefix to use to cache found/not-found classes, if the extension is enabled. - * - * @param string|null $apcuPrefix - * - * @return void - */ - public function setApcuPrefix($apcuPrefix) - { - $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; - } - - /** - * The APCu prefix in use, or null if APCu caching is not enabled. - * - * @return string|null - */ - public function getApcuPrefix() - { - return $this->apcuPrefix; - } - - /** - * Registers this instance as an autoloader. - * - * @param bool $prepend Whether to prepend the autoloader or not - * - * @return void - */ - public function register($prepend = false) - { - spl_autoload_register(array($this, 'loadClass'), true, $prepend); - - if (null === $this->vendorDir) { - return; - } - - if ($prepend) { - self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; - } else { - unset(self::$registeredLoaders[$this->vendorDir]); - self::$registeredLoaders[$this->vendorDir] = $this; - } - } - - /** - * Unregisters this instance as an autoloader. - * - * @return void - */ - public function unregister() - { - spl_autoload_unregister(array($this, 'loadClass')); - - if (null !== $this->vendorDir) { - unset(self::$registeredLoaders[$this->vendorDir]); - } - } - - /** - * Loads the given class or interface. - * - * @param string $class The name of the class - * @return true|null True if loaded, null otherwise - */ - public function loadClass($class) - { - if ($file = $this->findFile($class)) { - $includeFile = self::$includeFile; - $includeFile($file); - - return true; - } - - return null; - } - - /** - * Finds the path to the file where the class is defined. - * - * @param string $class The name of the class - * - * @return string|false The path if found, false otherwise - */ - public function findFile($class) - { - // class map lookup - if (isset($this->classMap[$class])) { - return $this->classMap[$class]; - } - if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { - return false; - } - if (null !== $this->apcuPrefix) { - $file = apcu_fetch($this->apcuPrefix.$class, $hit); - if ($hit) { - return $file; - } - } - - $file = $this->findFileWithExtension($class, '.php'); - - // Search for Hack files if we are running on HHVM - if (false === $file && defined('HHVM_VERSION')) { - $file = $this->findFileWithExtension($class, '.hh'); - } - - if (null !== $this->apcuPrefix) { - apcu_add($this->apcuPrefix.$class, $file); - } - - if (false === $file) { - // Remember that this class does not exist. - $this->missingClasses[$class] = true; - } - - return $file; - } - - /** - * Returns the currently registered loaders indexed by their corresponding vendor directories. - * - * @return self[] - */ - public static function getRegisteredLoaders() - { - return self::$registeredLoaders; - } - - /** - * @param string $class - * @param string $ext - * @return string|false - */ - private function findFileWithExtension($class, $ext) - { - // PSR-4 lookup - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; - - $first = $class[0]; - if (isset($this->prefixLengthsPsr4[$first])) { - $subPath = $class; - while (false !== $lastPos = strrpos($subPath, '\\')) { - $subPath = substr($subPath, 0, $lastPos); - $search = $subPath . '\\'; - if (isset($this->prefixDirsPsr4[$search])) { - $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); - foreach ($this->prefixDirsPsr4[$search] as $dir) { - if (file_exists($file = $dir . $pathEnd)) { - return $file; - } - } - } - } - } - - // PSR-4 fallback dirs - foreach ($this->fallbackDirsPsr4 as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { - return $file; - } - } - - // PSR-0 lookup - if (false !== $pos = strrpos($class, '\\')) { - // namespaced class name - $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) - . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); - } else { - // PEAR-like class name - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; - } - - if (isset($this->prefixesPsr0[$first])) { - foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { - if (0 === strpos($class, $prefix)) { - foreach ($dirs as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { - return $file; - } - } - } - } - } - - // PSR-0 fallback dirs - foreach ($this->fallbackDirsPsr0 as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { - return $file; - } - } - - // PSR-0 include paths. - if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { - return $file; - } - - return false; - } - - /** - * @return void - */ - private static function initializeIncludeClosure() - { - if (self::$includeFile !== null) { - return; - } - - /** - * Scope isolated include. - * - * Prevents access to $this/self from included files. - * - * @param string $file - * @return void - */ - self::$includeFile = \Closure::bind(static function($file) { - include $file; - }, null, null); - } -} diff --git a/vendor/composer/InstalledVersions.php b/vendor/composer/InstalledVersions.php deleted file mode 100644 index 51e734a..0000000 --- a/vendor/composer/InstalledVersions.php +++ /dev/null @@ -1,359 +0,0 @@ - - * Jordi Boggiano - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Composer; - -use Composer\Autoload\ClassLoader; -use Composer\Semver\VersionParser; - -/** - * This class is copied in every Composer installed project and available to all - * - * See also https://getcomposer.org/doc/07-runtime.md#installed-versions - * - * To require its presence, you can require `composer-runtime-api ^2.0` - * - * @final - */ -class InstalledVersions -{ - /** - * @var mixed[]|null - * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array}|array{}|null - */ - private static $installed; - - /** - * @var bool|null - */ - private static $canGetVendors; - - /** - * @var array[] - * @psalm-var array}> - */ - private static $installedByVendor = array(); - - /** - * Returns a list of all package names which are present, either by being installed, replaced or provided - * - * @return string[] - * @psalm-return list - */ - public static function getInstalledPackages() - { - $packages = array(); - foreach (self::getInstalled() as $installed) { - $packages[] = array_keys($installed['versions']); - } - - if (1 === \count($packages)) { - return $packages[0]; - } - - return array_keys(array_flip(\call_user_func_array('array_merge', $packages))); - } - - /** - * Returns a list of all package names with a specific type e.g. 'library' - * - * @param string $type - * @return string[] - * @psalm-return list - */ - public static function getInstalledPackagesByType($type) - { - $packagesByType = array(); - - foreach (self::getInstalled() as $installed) { - foreach ($installed['versions'] as $name => $package) { - if (isset($package['type']) && $package['type'] === $type) { - $packagesByType[] = $name; - } - } - } - - return $packagesByType; - } - - /** - * Checks whether the given package is installed - * - * This also returns true if the package name is provided or replaced by another package - * - * @param string $packageName - * @param bool $includeDevRequirements - * @return bool - */ - public static function isInstalled($packageName, $includeDevRequirements = true) - { - foreach (self::getInstalled() as $installed) { - if (isset($installed['versions'][$packageName])) { - return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false; - } - } - - return false; - } - - /** - * Checks whether the given package satisfies a version constraint - * - * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call: - * - * Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3') - * - * @param VersionParser $parser Install composer/semver to have access to this class and functionality - * @param string $packageName - * @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package - * @return bool - */ - public static function satisfies(VersionParser $parser, $packageName, $constraint) - { - $constraint = $parser->parseConstraints((string) $constraint); - $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); - - return $provided->matches($constraint); - } - - /** - * Returns a version constraint representing all the range(s) which are installed for a given package - * - * It is easier to use this via isInstalled() with the $constraint argument if you need to check - * whether a given version of a package is installed, and not just whether it exists - * - * @param string $packageName - * @return string Version constraint usable with composer/semver - */ - public static function getVersionRanges($packageName) - { - foreach (self::getInstalled() as $installed) { - if (!isset($installed['versions'][$packageName])) { - continue; - } - - $ranges = array(); - if (isset($installed['versions'][$packageName]['pretty_version'])) { - $ranges[] = $installed['versions'][$packageName]['pretty_version']; - } - if (array_key_exists('aliases', $installed['versions'][$packageName])) { - $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']); - } - if (array_key_exists('replaced', $installed['versions'][$packageName])) { - $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']); - } - if (array_key_exists('provided', $installed['versions'][$packageName])) { - $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']); - } - - return implode(' || ', $ranges); - } - - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); - } - - /** - * @param string $packageName - * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present - */ - public static function getVersion($packageName) - { - foreach (self::getInstalled() as $installed) { - if (!isset($installed['versions'][$packageName])) { - continue; - } - - if (!isset($installed['versions'][$packageName]['version'])) { - return null; - } - - return $installed['versions'][$packageName]['version']; - } - - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); - } - - /** - * @param string $packageName - * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present - */ - public static function getPrettyVersion($packageName) - { - foreach (self::getInstalled() as $installed) { - if (!isset($installed['versions'][$packageName])) { - continue; - } - - if (!isset($installed['versions'][$packageName]['pretty_version'])) { - return null; - } - - return $installed['versions'][$packageName]['pretty_version']; - } - - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); - } - - /** - * @param string $packageName - * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference - */ - public static function getReference($packageName) - { - foreach (self::getInstalled() as $installed) { - if (!isset($installed['versions'][$packageName])) { - continue; - } - - if (!isset($installed['versions'][$packageName]['reference'])) { - return null; - } - - return $installed['versions'][$packageName]['reference']; - } - - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); - } - - /** - * @param string $packageName - * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path. - */ - public static function getInstallPath($packageName) - { - foreach (self::getInstalled() as $installed) { - if (!isset($installed['versions'][$packageName])) { - continue; - } - - return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null; - } - - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); - } - - /** - * @return array - * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool} - */ - public static function getRootPackage() - { - $installed = self::getInstalled(); - - return $installed[0]['root']; - } - - /** - * Returns the raw installed.php data for custom implementations - * - * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect. - * @return array[] - * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} - */ - public static function getRawData() - { - @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED); - - if (null === self::$installed) { - // only require the installed.php file if this file is loaded from its dumped location, - // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 - if (substr(__DIR__, -8, 1) !== 'C') { - self::$installed = include __DIR__ . '/installed.php'; - } else { - self::$installed = array(); - } - } - - return self::$installed; - } - - /** - * Returns the raw data of all installed.php which are currently loaded for custom implementations - * - * @return array[] - * @psalm-return list}> - */ - public static function getAllRawData() - { - return self::getInstalled(); - } - - /** - * Lets you reload the static array from another file - * - * This is only useful for complex integrations in which a project needs to use - * this class but then also needs to execute another project's autoloader in process, - * and wants to ensure both projects have access to their version of installed.php. - * - * A typical case would be PHPUnit, where it would need to make sure it reads all - * the data it needs from this class, then call reload() with - * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure - * the project in which it runs can then also use this class safely, without - * interference between PHPUnit's dependencies and the project's dependencies. - * - * @param array[] $data A vendor/composer/installed.php data set - * @return void - * - * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $data - */ - public static function reload($data) - { - self::$installed = $data; - self::$installedByVendor = array(); - } - - /** - * @return array[] - * @psalm-return list}> - */ - private static function getInstalled() - { - if (null === self::$canGetVendors) { - self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); - } - - $installed = array(); - - if (self::$canGetVendors) { - foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { - if (isset(self::$installedByVendor[$vendorDir])) { - $installed[] = self::$installedByVendor[$vendorDir]; - } elseif (is_file($vendorDir.'/composer/installed.php')) { - /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ - $required = require $vendorDir.'/composer/installed.php'; - $installed[] = self::$installedByVendor[$vendorDir] = $required; - if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { - self::$installed = $installed[count($installed) - 1]; - } - } - } - } - - if (null === self::$installed) { - // only require the installed.php file if this file is loaded from its dumped location, - // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 - if (substr(__DIR__, -8, 1) !== 'C') { - /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ - $required = require __DIR__ . '/installed.php'; - self::$installed = $required; - } else { - self::$installed = array(); - } - } - - if (self::$installed !== array()) { - $installed[] = self::$installed; - } - - return $installed; - } -} diff --git a/vendor/composer/LICENSE b/vendor/composer/LICENSE deleted file mode 100644 index 62ecfd8..0000000 --- a/vendor/composer/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) Nils Adermann, Jordi Boggiano - -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/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php deleted file mode 100644 index a7beaa1..0000000 --- a/vendor/composer/autoload_classmap.php +++ /dev/null @@ -1,76 +0,0 @@ - $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Attribute.php', - 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', - 'Nette\\ArgumentOutOfRangeException' => $vendorDir . '/nette/utils/src/exceptions.php', - 'Nette\\DeprecatedException' => $vendorDir . '/nette/utils/src/exceptions.php', - 'Nette\\DirectoryNotFoundException' => $vendorDir . '/nette/utils/src/exceptions.php', - 'Nette\\FileNotFoundException' => $vendorDir . '/nette/utils/src/exceptions.php', - 'Nette\\HtmlStringable' => $vendorDir . '/nette/utils/src/HtmlStringable.php', - 'Nette\\IOException' => $vendorDir . '/nette/utils/src/exceptions.php', - 'Nette\\InvalidArgumentException' => $vendorDir . '/nette/utils/src/exceptions.php', - 'Nette\\InvalidStateException' => $vendorDir . '/nette/utils/src/exceptions.php', - 'Nette\\Iterators\\CachingIterator' => $vendorDir . '/nette/utils/src/Iterators/CachingIterator.php', - 'Nette\\Iterators\\Mapper' => $vendorDir . '/nette/utils/src/Iterators/Mapper.php', - 'Nette\\Localization\\ITranslator' => $vendorDir . '/nette/utils/src/compatibility.php', - 'Nette\\Localization\\Translator' => $vendorDir . '/nette/utils/src/Translator.php', - 'Nette\\MemberAccessException' => $vendorDir . '/nette/utils/src/exceptions.php', - 'Nette\\NotImplementedException' => $vendorDir . '/nette/utils/src/exceptions.php', - 'Nette\\NotSupportedException' => $vendorDir . '/nette/utils/src/exceptions.php', - 'Nette\\OutOfRangeException' => $vendorDir . '/nette/utils/src/exceptions.php', - 'Nette\\Schema\\Context' => $vendorDir . '/nette/schema/src/Schema/Context.php', - 'Nette\\Schema\\DynamicParameter' => $vendorDir . '/nette/schema/src/Schema/DynamicParameter.php', - 'Nette\\Schema\\Elements\\AnyOf' => $vendorDir . '/nette/schema/src/Schema/Elements/AnyOf.php', - 'Nette\\Schema\\Elements\\Base' => $vendorDir . '/nette/schema/src/Schema/Elements/Base.php', - 'Nette\\Schema\\Elements\\Structure' => $vendorDir . '/nette/schema/src/Schema/Elements/Structure.php', - 'Nette\\Schema\\Elements\\Type' => $vendorDir . '/nette/schema/src/Schema/Elements/Type.php', - 'Nette\\Schema\\Expect' => $vendorDir . '/nette/schema/src/Schema/Expect.php', - 'Nette\\Schema\\Helpers' => $vendorDir . '/nette/schema/src/Schema/Helpers.php', - 'Nette\\Schema\\Message' => $vendorDir . '/nette/schema/src/Schema/Message.php', - 'Nette\\Schema\\Processor' => $vendorDir . '/nette/schema/src/Schema/Processor.php', - 'Nette\\Schema\\Schema' => $vendorDir . '/nette/schema/src/Schema/Schema.php', - 'Nette\\Schema\\ValidationException' => $vendorDir . '/nette/schema/src/Schema/ValidationException.php', - 'Nette\\SmartObject' => $vendorDir . '/nette/utils/src/SmartObject.php', - 'Nette\\StaticClass' => $vendorDir . '/nette/utils/src/StaticClass.php', - 'Nette\\UnexpectedValueException' => $vendorDir . '/nette/utils/src/exceptions.php', - 'Nette\\Utils\\ArrayHash' => $vendorDir . '/nette/utils/src/Utils/ArrayHash.php', - 'Nette\\Utils\\ArrayList' => $vendorDir . '/nette/utils/src/Utils/ArrayList.php', - 'Nette\\Utils\\Arrays' => $vendorDir . '/nette/utils/src/Utils/Arrays.php', - 'Nette\\Utils\\AssertionException' => $vendorDir . '/nette/utils/src/Utils/exceptions.php', - 'Nette\\Utils\\Callback' => $vendorDir . '/nette/utils/src/Utils/Callback.php', - 'Nette\\Utils\\DateTime' => $vendorDir . '/nette/utils/src/Utils/DateTime.php', - 'Nette\\Utils\\FileInfo' => $vendorDir . '/nette/utils/src/Utils/FileInfo.php', - 'Nette\\Utils\\FileSystem' => $vendorDir . '/nette/utils/src/Utils/FileSystem.php', - 'Nette\\Utils\\Finder' => $vendorDir . '/nette/utils/src/Utils/Finder.php', - 'Nette\\Utils\\Floats' => $vendorDir . '/nette/utils/src/Utils/Floats.php', - 'Nette\\Utils\\Helpers' => $vendorDir . '/nette/utils/src/Utils/Helpers.php', - 'Nette\\Utils\\Html' => $vendorDir . '/nette/utils/src/Utils/Html.php', - 'Nette\\Utils\\IHtmlString' => $vendorDir . '/nette/utils/src/compatibility.php', - 'Nette\\Utils\\Image' => $vendorDir . '/nette/utils/src/Utils/Image.php', - 'Nette\\Utils\\ImageColor' => $vendorDir . '/nette/utils/src/Utils/ImageColor.php', - 'Nette\\Utils\\ImageException' => $vendorDir . '/nette/utils/src/Utils/exceptions.php', - 'Nette\\Utils\\ImageType' => $vendorDir . '/nette/utils/src/Utils/ImageType.php', - 'Nette\\Utils\\Iterables' => $vendorDir . '/nette/utils/src/Utils/Iterables.php', - 'Nette\\Utils\\Json' => $vendorDir . '/nette/utils/src/Utils/Json.php', - 'Nette\\Utils\\JsonException' => $vendorDir . '/nette/utils/src/Utils/exceptions.php', - 'Nette\\Utils\\ObjectHelpers' => $vendorDir . '/nette/utils/src/Utils/ObjectHelpers.php', - 'Nette\\Utils\\Paginator' => $vendorDir . '/nette/utils/src/Utils/Paginator.php', - 'Nette\\Utils\\Random' => $vendorDir . '/nette/utils/src/Utils/Random.php', - 'Nette\\Utils\\Reflection' => $vendorDir . '/nette/utils/src/Utils/Reflection.php', - 'Nette\\Utils\\ReflectionMethod' => $vendorDir . '/nette/utils/src/Utils/ReflectionMethod.php', - 'Nette\\Utils\\RegexpException' => $vendorDir . '/nette/utils/src/Utils/exceptions.php', - 'Nette\\Utils\\Strings' => $vendorDir . '/nette/utils/src/Utils/Strings.php', - 'Nette\\Utils\\Type' => $vendorDir . '/nette/utils/src/Utils/Type.php', - 'Nette\\Utils\\UnknownImageFileException' => $vendorDir . '/nette/utils/src/Utils/exceptions.php', - 'Nette\\Utils\\Validators' => $vendorDir . '/nette/utils/src/Utils/Validators.php', - 'PhpToken' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php', - 'Stringable' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Stringable.php', - 'UnhandledMatchError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php', - 'ValueError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/ValueError.php', -); diff --git a/vendor/composer/autoload_files.php b/vendor/composer/autoload_files.php deleted file mode 100644 index ee5af49..0000000 --- a/vendor/composer/autoload_files.php +++ /dev/null @@ -1,12 +0,0 @@ - $vendorDir . '/symfony/deprecation-contracts/function.php', - '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php', - 'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php', -); diff --git a/vendor/composer/autoload_namespaces.php b/vendor/composer/autoload_namespaces.php deleted file mode 100644 index 15a2ff3..0000000 --- a/vendor/composer/autoload_namespaces.php +++ /dev/null @@ -1,9 +0,0 @@ - array($vendorDir . '/symfony/polyfill-php80'), - 'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'), - 'Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'), - 'Psr\\EventDispatcher\\' => array($vendorDir . '/psr/event-dispatcher/src'), - 'Mni\\FrontYAML\\' => array($vendorDir . '/mnapoli/front-yaml/src'), - 'League\\Config\\' => array($vendorDir . '/league/config/src'), - 'League\\CommonMark\\' => array($vendorDir . '/league/commonmark/src'), - 'Gzod01\\Gammaphp\\' => array($baseDir . '/src'), - 'Dflydev\\DotAccessData\\' => array($vendorDir . '/dflydev/dot-access-data/src'), -); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php deleted file mode 100644 index d2f8740..0000000 --- a/vendor/composer/autoload_real.php +++ /dev/null @@ -1,50 +0,0 @@ -register(true); - - $filesToLoad = \Composer\Autoload\ComposerStaticInit50a1aec382ec30ec751d2cd17f0397cf::$files; - $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { - if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { - $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; - - require $file; - } - }, null, null); - foreach ($filesToLoad as $fileIdentifier => $file) { - $requireFile($fileIdentifier, $file); - } - - return $loader; - } -} diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php deleted file mode 100644 index 4d33096..0000000 --- a/vendor/composer/autoload_static.php +++ /dev/null @@ -1,163 +0,0 @@ - __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php', - '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php', - 'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php', - ); - - public static $prefixLengthsPsr4 = array ( - 'S' => - array ( - 'Symfony\\Polyfill\\Php80\\' => 23, - 'Symfony\\Polyfill\\Ctype\\' => 23, - 'Symfony\\Component\\Yaml\\' => 23, - ), - 'P' => - array ( - 'Psr\\EventDispatcher\\' => 20, - ), - 'M' => - array ( - 'Mni\\FrontYAML\\' => 14, - ), - 'L' => - array ( - 'League\\Config\\' => 14, - 'League\\CommonMark\\' => 18, - ), - 'G' => - array ( - 'Gzod01\\Gammaphp\\' => 16, - ), - 'D' => - array ( - 'Dflydev\\DotAccessData\\' => 22, - ), - ); - - public static $prefixDirsPsr4 = array ( - 'Symfony\\Polyfill\\Php80\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/polyfill-php80', - ), - 'Symfony\\Polyfill\\Ctype\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/polyfill-ctype', - ), - 'Symfony\\Component\\Yaml\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/yaml', - ), - 'Psr\\EventDispatcher\\' => - array ( - 0 => __DIR__ . '/..' . '/psr/event-dispatcher/src', - ), - 'Mni\\FrontYAML\\' => - array ( - 0 => __DIR__ . '/..' . '/mnapoli/front-yaml/src', - ), - 'League\\Config\\' => - array ( - 0 => __DIR__ . '/..' . '/league/config/src', - ), - 'League\\CommonMark\\' => - array ( - 0 => __DIR__ . '/..' . '/league/commonmark/src', - ), - 'Gzod01\\Gammaphp\\' => - array ( - 0 => __DIR__ . '/../..' . '/src', - ), - 'Dflydev\\DotAccessData\\' => - array ( - 0 => __DIR__ . '/..' . '/dflydev/dot-access-data/src', - ), - ); - - public static $classMap = array ( - 'Attribute' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Attribute.php', - 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', - 'Nette\\ArgumentOutOfRangeException' => __DIR__ . '/..' . '/nette/utils/src/exceptions.php', - 'Nette\\DeprecatedException' => __DIR__ . '/..' . '/nette/utils/src/exceptions.php', - 'Nette\\DirectoryNotFoundException' => __DIR__ . '/..' . '/nette/utils/src/exceptions.php', - 'Nette\\FileNotFoundException' => __DIR__ . '/..' . '/nette/utils/src/exceptions.php', - 'Nette\\HtmlStringable' => __DIR__ . '/..' . '/nette/utils/src/HtmlStringable.php', - 'Nette\\IOException' => __DIR__ . '/..' . '/nette/utils/src/exceptions.php', - 'Nette\\InvalidArgumentException' => __DIR__ . '/..' . '/nette/utils/src/exceptions.php', - 'Nette\\InvalidStateException' => __DIR__ . '/..' . '/nette/utils/src/exceptions.php', - 'Nette\\Iterators\\CachingIterator' => __DIR__ . '/..' . '/nette/utils/src/Iterators/CachingIterator.php', - 'Nette\\Iterators\\Mapper' => __DIR__ . '/..' . '/nette/utils/src/Iterators/Mapper.php', - 'Nette\\Localization\\ITranslator' => __DIR__ . '/..' . '/nette/utils/src/compatibility.php', - 'Nette\\Localization\\Translator' => __DIR__ . '/..' . '/nette/utils/src/Translator.php', - 'Nette\\MemberAccessException' => __DIR__ . '/..' . '/nette/utils/src/exceptions.php', - 'Nette\\NotImplementedException' => __DIR__ . '/..' . '/nette/utils/src/exceptions.php', - 'Nette\\NotSupportedException' => __DIR__ . '/..' . '/nette/utils/src/exceptions.php', - 'Nette\\OutOfRangeException' => __DIR__ . '/..' . '/nette/utils/src/exceptions.php', - 'Nette\\Schema\\Context' => __DIR__ . '/..' . '/nette/schema/src/Schema/Context.php', - 'Nette\\Schema\\DynamicParameter' => __DIR__ . '/..' . '/nette/schema/src/Schema/DynamicParameter.php', - 'Nette\\Schema\\Elements\\AnyOf' => __DIR__ . '/..' . '/nette/schema/src/Schema/Elements/AnyOf.php', - 'Nette\\Schema\\Elements\\Base' => __DIR__ . '/..' . '/nette/schema/src/Schema/Elements/Base.php', - 'Nette\\Schema\\Elements\\Structure' => __DIR__ . '/..' . '/nette/schema/src/Schema/Elements/Structure.php', - 'Nette\\Schema\\Elements\\Type' => __DIR__ . '/..' . '/nette/schema/src/Schema/Elements/Type.php', - 'Nette\\Schema\\Expect' => __DIR__ . '/..' . '/nette/schema/src/Schema/Expect.php', - 'Nette\\Schema\\Helpers' => __DIR__ . '/..' . '/nette/schema/src/Schema/Helpers.php', - 'Nette\\Schema\\Message' => __DIR__ . '/..' . '/nette/schema/src/Schema/Message.php', - 'Nette\\Schema\\Processor' => __DIR__ . '/..' . '/nette/schema/src/Schema/Processor.php', - 'Nette\\Schema\\Schema' => __DIR__ . '/..' . '/nette/schema/src/Schema/Schema.php', - 'Nette\\Schema\\ValidationException' => __DIR__ . '/..' . '/nette/schema/src/Schema/ValidationException.php', - 'Nette\\SmartObject' => __DIR__ . '/..' . '/nette/utils/src/SmartObject.php', - 'Nette\\StaticClass' => __DIR__ . '/..' . '/nette/utils/src/StaticClass.php', - 'Nette\\UnexpectedValueException' => __DIR__ . '/..' . '/nette/utils/src/exceptions.php', - 'Nette\\Utils\\ArrayHash' => __DIR__ . '/..' . '/nette/utils/src/Utils/ArrayHash.php', - 'Nette\\Utils\\ArrayList' => __DIR__ . '/..' . '/nette/utils/src/Utils/ArrayList.php', - 'Nette\\Utils\\Arrays' => __DIR__ . '/..' . '/nette/utils/src/Utils/Arrays.php', - 'Nette\\Utils\\AssertionException' => __DIR__ . '/..' . '/nette/utils/src/Utils/exceptions.php', - 'Nette\\Utils\\Callback' => __DIR__ . '/..' . '/nette/utils/src/Utils/Callback.php', - 'Nette\\Utils\\DateTime' => __DIR__ . '/..' . '/nette/utils/src/Utils/DateTime.php', - 'Nette\\Utils\\FileInfo' => __DIR__ . '/..' . '/nette/utils/src/Utils/FileInfo.php', - 'Nette\\Utils\\FileSystem' => __DIR__ . '/..' . '/nette/utils/src/Utils/FileSystem.php', - 'Nette\\Utils\\Finder' => __DIR__ . '/..' . '/nette/utils/src/Utils/Finder.php', - 'Nette\\Utils\\Floats' => __DIR__ . '/..' . '/nette/utils/src/Utils/Floats.php', - 'Nette\\Utils\\Helpers' => __DIR__ . '/..' . '/nette/utils/src/Utils/Helpers.php', - 'Nette\\Utils\\Html' => __DIR__ . '/..' . '/nette/utils/src/Utils/Html.php', - 'Nette\\Utils\\IHtmlString' => __DIR__ . '/..' . '/nette/utils/src/compatibility.php', - 'Nette\\Utils\\Image' => __DIR__ . '/..' . '/nette/utils/src/Utils/Image.php', - 'Nette\\Utils\\ImageColor' => __DIR__ . '/..' . '/nette/utils/src/Utils/ImageColor.php', - 'Nette\\Utils\\ImageException' => __DIR__ . '/..' . '/nette/utils/src/Utils/exceptions.php', - 'Nette\\Utils\\ImageType' => __DIR__ . '/..' . '/nette/utils/src/Utils/ImageType.php', - 'Nette\\Utils\\Iterables' => __DIR__ . '/..' . '/nette/utils/src/Utils/Iterables.php', - 'Nette\\Utils\\Json' => __DIR__ . '/..' . '/nette/utils/src/Utils/Json.php', - 'Nette\\Utils\\JsonException' => __DIR__ . '/..' . '/nette/utils/src/Utils/exceptions.php', - 'Nette\\Utils\\ObjectHelpers' => __DIR__ . '/..' . '/nette/utils/src/Utils/ObjectHelpers.php', - 'Nette\\Utils\\Paginator' => __DIR__ . '/..' . '/nette/utils/src/Utils/Paginator.php', - 'Nette\\Utils\\Random' => __DIR__ . '/..' . '/nette/utils/src/Utils/Random.php', - 'Nette\\Utils\\Reflection' => __DIR__ . '/..' . '/nette/utils/src/Utils/Reflection.php', - 'Nette\\Utils\\ReflectionMethod' => __DIR__ . '/..' . '/nette/utils/src/Utils/ReflectionMethod.php', - 'Nette\\Utils\\RegexpException' => __DIR__ . '/..' . '/nette/utils/src/Utils/exceptions.php', - 'Nette\\Utils\\Strings' => __DIR__ . '/..' . '/nette/utils/src/Utils/Strings.php', - 'Nette\\Utils\\Type' => __DIR__ . '/..' . '/nette/utils/src/Utils/Type.php', - 'Nette\\Utils\\UnknownImageFileException' => __DIR__ . '/..' . '/nette/utils/src/Utils/exceptions.php', - 'Nette\\Utils\\Validators' => __DIR__ . '/..' . '/nette/utils/src/Utils/Validators.php', - 'PhpToken' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php', - 'Stringable' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Stringable.php', - 'UnhandledMatchError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php', - 'ValueError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/ValueError.php', - ); - - public static function getInitializer(ClassLoader $loader) - { - return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit50a1aec382ec30ec751d2cd17f0397cf::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit50a1aec382ec30ec751d2cd17f0397cf::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit50a1aec382ec30ec751d2cd17f0397cf::$classMap; - - }, null, ClassLoader::class); - } -} diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json deleted file mode 100644 index 646a22a..0000000 --- a/vendor/composer/installed.json +++ /dev/null @@ -1,836 +0,0 @@ -{ - "packages": [ - { - "name": "dflydev/dot-access-data", - "version": "v3.0.3", - "version_normalized": "3.0.3.0", - "source": { - "type": "git", - "url": "https://github.com/dflydev/dflydev-dot-access-data.git", - "reference": "a23a2bf4f31d3518f3ecb38660c95715dfead60f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/dflydev/dflydev-dot-access-data/zipball/a23a2bf4f31d3518f3ecb38660c95715dfead60f", - "reference": "a23a2bf4f31d3518f3ecb38660c95715dfead60f", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "require-dev": { - "phpstan/phpstan": "^0.12.42", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.3", - "scrutinizer/ocular": "1.6.0", - "squizlabs/php_codesniffer": "^3.5", - "vimeo/psalm": "^4.0.0" - }, - "time": "2024-07-08T12:26:09+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Dflydev\\DotAccessData\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Dragonfly Development Inc.", - "email": "info@dflydev.com", - "homepage": "http://dflydev.com" - }, - { - "name": "Beau Simensen", - "email": "beau@dflydev.com", - "homepage": "http://beausimensen.com" - }, - { - "name": "Carlos Frutos", - "email": "carlos@kiwing.it", - "homepage": "https://github.com/cfrutos" - }, - { - "name": "Colin O'Dell", - "email": "colinodell@gmail.com", - "homepage": "https://www.colinodell.com" - } - ], - "description": "Given a deep data structure, access data by dot notation.", - "homepage": "https://github.com/dflydev/dflydev-dot-access-data", - "keywords": [ - "access", - "data", - "dot", - "notation" - ], - "support": { - "issues": "https://github.com/dflydev/dflydev-dot-access-data/issues", - "source": "https://github.com/dflydev/dflydev-dot-access-data/tree/v3.0.3" - }, - "install-path": "../dflydev/dot-access-data" - }, - { - "name": "league/commonmark", - "version": "2.6.1", - "version_normalized": "2.6.1.0", - "source": { - "type": "git", - "url": "https://github.com/thephpleague/commonmark.git", - "reference": "d990688c91cedfb69753ffc2512727ec646df2ad" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/d990688c91cedfb69753ffc2512727ec646df2ad", - "reference": "d990688c91cedfb69753ffc2512727ec646df2ad", - "shasum": "" - }, - "require": { - "ext-mbstring": "*", - "league/config": "^1.1.1", - "php": "^7.4 || ^8.0", - "psr/event-dispatcher": "^1.0", - "symfony/deprecation-contracts": "^2.1 || ^3.0", - "symfony/polyfill-php80": "^1.16" - }, - "require-dev": { - "cebe/markdown": "^1.0", - "commonmark/cmark": "0.31.1", - "commonmark/commonmark.js": "0.31.1", - "composer/package-versions-deprecated": "^1.8", - "embed/embed": "^4.4", - "erusev/parsedown": "^1.0", - "ext-json": "*", - "github/gfm": "0.29.0", - "michelf/php-markdown": "^1.4 || ^2.0", - "nyholm/psr7": "^1.5", - "phpstan/phpstan": "^1.8.2", - "phpunit/phpunit": "^9.5.21 || ^10.5.9 || ^11.0.0", - "scrutinizer/ocular": "^1.8.1", - "symfony/finder": "^5.3 | ^6.0 | ^7.0", - "symfony/process": "^5.4 | ^6.0 | ^7.0", - "symfony/yaml": "^2.3 | ^3.0 | ^4.0 | ^5.0 | ^6.0 | ^7.0", - "unleashedtech/php-coding-standard": "^3.1.1", - "vimeo/psalm": "^4.24.0 || ^5.0.0" - }, - "suggest": { - "symfony/yaml": "v2.3+ required if using the Front Matter extension" - }, - "time": "2024-12-29T14:10:59+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "2.7-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "League\\CommonMark\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Colin O'Dell", - "email": "colinodell@gmail.com", - "homepage": "https://www.colinodell.com", - "role": "Lead Developer" - } - ], - "description": "Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and GitHub-Flavored Markdown (GFM)", - "homepage": "https://commonmark.thephpleague.com", - "keywords": [ - "commonmark", - "flavored", - "gfm", - "github", - "github-flavored", - "markdown", - "md", - "parser" - ], - "support": { - "docs": "https://commonmark.thephpleague.com/", - "forum": "https://github.com/thephpleague/commonmark/discussions", - "issues": "https://github.com/thephpleague/commonmark/issues", - "rss": "https://github.com/thephpleague/commonmark/releases.atom", - "source": "https://github.com/thephpleague/commonmark" - }, - "funding": [ - { - "url": "https://www.colinodell.com/sponsor", - "type": "custom" - }, - { - "url": "https://www.paypal.me/colinpodell/10.00", - "type": "custom" - }, - { - "url": "https://github.com/colinodell", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/league/commonmark", - "type": "tidelift" - } - ], - "install-path": "../league/commonmark" - }, - { - "name": "league/config", - "version": "v1.2.0", - "version_normalized": "1.2.0.0", - "source": { - "type": "git", - "url": "https://github.com/thephpleague/config.git", - "reference": "754b3604fb2984c71f4af4a9cbe7b57f346ec1f3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/thephpleague/config/zipball/754b3604fb2984c71f4af4a9cbe7b57f346ec1f3", - "reference": "754b3604fb2984c71f4af4a9cbe7b57f346ec1f3", - "shasum": "" - }, - "require": { - "dflydev/dot-access-data": "^3.0.1", - "nette/schema": "^1.2", - "php": "^7.4 || ^8.0" - }, - "require-dev": { - "phpstan/phpstan": "^1.8.2", - "phpunit/phpunit": "^9.5.5", - "scrutinizer/ocular": "^1.8.1", - "unleashedtech/php-coding-standard": "^3.1", - "vimeo/psalm": "^4.7.3" - }, - "time": "2022-12-11T20:36:23+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.2-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "League\\Config\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Colin O'Dell", - "email": "colinodell@gmail.com", - "homepage": "https://www.colinodell.com", - "role": "Lead Developer" - } - ], - "description": "Define configuration arrays with strict schemas and access values with dot notation", - "homepage": "https://config.thephpleague.com", - "keywords": [ - "array", - "config", - "configuration", - "dot", - "dot-access", - "nested", - "schema" - ], - "support": { - "docs": "https://config.thephpleague.com/", - "issues": "https://github.com/thephpleague/config/issues", - "rss": "https://github.com/thephpleague/config/releases.atom", - "source": "https://github.com/thephpleague/config" - }, - "funding": [ - { - "url": "https://www.colinodell.com/sponsor", - "type": "custom" - }, - { - "url": "https://www.paypal.me/colinpodell/10.00", - "type": "custom" - }, - { - "url": "https://github.com/colinodell", - "type": "github" - } - ], - "install-path": "../league/config" - }, - { - "name": "mnapoli/front-yaml", - "version": "2.0.4", - "version_normalized": "2.0.4.0", - "source": { - "type": "git", - "url": "https://github.com/mnapoli/FrontYAML.git", - "reference": "06e43e7720f8fdd140c24de882416c4bfc1aaabd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/mnapoli/FrontYAML/zipball/06e43e7720f8fdd140c24de882416c4bfc1aaabd", - "reference": "06e43e7720f8fdd140c24de882416c4bfc1aaabd", - "shasum": "" - }, - "require": { - "league/commonmark": "^2.0", - "php": "^7.4|^8.0", - "symfony/yaml": "^4.0|^5.0|^6.0|^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" - }, - "time": "2025-01-29T09:02:26+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Mni\\FrontYAML\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "support": { - "source": "https://github.com/mnapoli/FrontYAML/tree/2.0.4" - }, - "install-path": "../mnapoli/front-yaml" - }, - { - "name": "nette/schema", - "version": "v1.3.2", - "version_normalized": "1.3.2.0", - "source": { - "type": "git", - "url": "https://github.com/nette/schema.git", - "reference": "da801d52f0354f70a638673c4a0f04e16529431d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/schema/zipball/da801d52f0354f70a638673c4a0f04e16529431d", - "reference": "da801d52f0354f70a638673c4a0f04e16529431d", - "shasum": "" - }, - "require": { - "nette/utils": "^4.0", - "php": "8.1 - 8.4" - }, - "require-dev": { - "nette/tester": "^2.5.2", - "phpstan/phpstan-nette": "^1.0", - "tracy/tracy": "^2.8" - }, - "time": "2024-10-06T23:10:23+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, - "installation-source": "dist", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0-only", - "GPL-3.0-only" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "📐 Nette Schema: validating data structures against a given Schema.", - "homepage": "https://nette.org", - "keywords": [ - "config", - "nette" - ], - "support": { - "issues": "https://github.com/nette/schema/issues", - "source": "https://github.com/nette/schema/tree/v1.3.2" - }, - "install-path": "../nette/schema" - }, - { - "name": "nette/utils", - "version": "v4.0.5", - "version_normalized": "4.0.5.0", - "source": { - "type": "git", - "url": "https://github.com/nette/utils.git", - "reference": "736c567e257dbe0fcf6ce81b4d6dbe05c6899f96" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/utils/zipball/736c567e257dbe0fcf6ce81b4d6dbe05c6899f96", - "reference": "736c567e257dbe0fcf6ce81b4d6dbe05c6899f96", - "shasum": "" - }, - "require": { - "php": "8.0 - 8.4" - }, - "conflict": { - "nette/finder": "<3", - "nette/schema": "<1.2.2" - }, - "require-dev": { - "jetbrains/phpstorm-attributes": "dev-master", - "nette/tester": "^2.5", - "phpstan/phpstan": "^1.0", - "tracy/tracy": "^2.9" - }, - "suggest": { - "ext-gd": "to use Image", - "ext-iconv": "to use Strings::webalize(), toAscii(), chr() and reverse()", - "ext-intl": "to use Strings::webalize(), toAscii(), normalize() and compare()", - "ext-json": "to use Nette\\Utils\\Json", - "ext-mbstring": "to use Strings::lower() etc...", - "ext-tokenizer": "to use Nette\\Utils\\Reflection::getUseStatements()" - }, - "time": "2024-08-07T15:39:19+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "installation-source": "dist", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0-only", - "GPL-3.0-only" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "🛠 Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.", - "homepage": "https://nette.org", - "keywords": [ - "array", - "core", - "datetime", - "images", - "json", - "nette", - "paginator", - "password", - "slugify", - "string", - "unicode", - "utf-8", - "utility", - "validation" - ], - "support": { - "issues": "https://github.com/nette/utils/issues", - "source": "https://github.com/nette/utils/tree/v4.0.5" - }, - "install-path": "../nette/utils" - }, - { - "name": "psr/event-dispatcher", - "version": "1.0.0", - "version_normalized": "1.0.0.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/event-dispatcher.git", - "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", - "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", - "shasum": "" - }, - "require": { - "php": ">=7.2.0" - }, - "time": "2019-01-08T18:20:26+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Psr\\EventDispatcher\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Standard interfaces for event handling.", - "keywords": [ - "events", - "psr", - "psr-14" - ], - "support": { - "issues": "https://github.com/php-fig/event-dispatcher/issues", - "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" - }, - "install-path": "../psr/event-dispatcher" - }, - { - "name": "symfony/deprecation-contracts", - "version": "v3.5.1", - "version_normalized": "3.5.1.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6", - "reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6", - "shasum": "" - }, - "require": { - "php": ">=8.1" - }, - "time": "2024-09-25T14:20:29+00:00", - "type": "library", - "extra": { - "thanks": { - "url": "https://github.com/symfony/contracts", - "name": "symfony/contracts" - }, - "branch-alias": { - "dev-main": "3.5-dev" - } - }, - "installation-source": "dist", - "autoload": { - "files": [ - "function.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "A generic function and convention to trigger deprecation notices", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.1" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "install-path": "../symfony/deprecation-contracts" - }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.31.0", - "version_normalized": "1.31.0.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638", - "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638", - "shasum": "" - }, - "require": { - "php": ">=7.2" - }, - "provide": { - "ext-ctype": "*" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "time": "2024-09-09T11:45:10+00:00", - "type": "library", - "extra": { - "thanks": { - "url": "https://github.com/symfony/polyfill", - "name": "symfony/polyfill" - } - }, - "installation-source": "dist", - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "install-path": "../symfony/polyfill-ctype" - }, - { - "name": "symfony/polyfill-php80", - "version": "v1.31.0", - "version_normalized": "1.31.0.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", - "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", - "shasum": "" - }, - "require": { - "php": ">=7.2" - }, - "time": "2024-09-09T11:45:10+00:00", - "type": "library", - "extra": { - "thanks": { - "url": "https://github.com/symfony/polyfill", - "name": "symfony/polyfill" - } - }, - "installation-source": "dist", - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ion Bazan", - "email": "ion.bazan@gmail.com" - }, - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.31.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "install-path": "../symfony/polyfill-php80" - }, - { - "name": "symfony/yaml", - "version": "v7.2.3", - "version_normalized": "7.2.3.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "ac238f173df0c9c1120f862d0f599e17535a87ec" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/ac238f173df0c9c1120f862d0f599e17535a87ec", - "reference": "ac238f173df0c9c1120f862d0f599e17535a87ec", - "shasum": "" - }, - "require": { - "php": ">=8.2", - "symfony/deprecation-contracts": "^2.5|^3.0", - "symfony/polyfill-ctype": "^1.8" - }, - "conflict": { - "symfony/console": "<6.4" - }, - "require-dev": { - "symfony/console": "^6.4|^7.0" - }, - "time": "2025-01-07T12:55:42+00:00", - "bin": [ - "Resources/bin/yaml-lint" - ], - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Loads and dumps YAML files", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/yaml/tree/v7.2.3" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "install-path": "../symfony/yaml" - } - ], - "dev": true, - "dev-package-names": [] -} diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php deleted file mode 100644 index aa286bc..0000000 --- a/vendor/composer/installed.php +++ /dev/null @@ -1,122 +0,0 @@ - array( - 'name' => 'gzod01/gammaphp', - 'pretty_version' => 'dev-main', - 'version' => 'dev-main', - 'reference' => 'd7cdf68679c851f2f65a47ca69be7af01515226d', - 'type' => 'tool', - 'install_path' => __DIR__ . '/../../', - 'aliases' => array(), - 'dev' => true, - ), - 'versions' => array( - 'dflydev/dot-access-data' => array( - 'pretty_version' => 'v3.0.3', - 'version' => '3.0.3.0', - 'reference' => 'a23a2bf4f31d3518f3ecb38660c95715dfead60f', - 'type' => 'library', - 'install_path' => __DIR__ . '/../dflydev/dot-access-data', - 'aliases' => array(), - 'dev_requirement' => false, - ), - 'gzod01/gammaphp' => array( - 'pretty_version' => 'dev-main', - 'version' => 'dev-main', - 'reference' => 'd7cdf68679c851f2f65a47ca69be7af01515226d', - 'type' => 'tool', - 'install_path' => __DIR__ . '/../../', - 'aliases' => array(), - 'dev_requirement' => false, - ), - 'league/commonmark' => array( - 'pretty_version' => '2.6.1', - 'version' => '2.6.1.0', - 'reference' => 'd990688c91cedfb69753ffc2512727ec646df2ad', - 'type' => 'library', - 'install_path' => __DIR__ . '/../league/commonmark', - 'aliases' => array(), - 'dev_requirement' => false, - ), - 'league/config' => array( - 'pretty_version' => 'v1.2.0', - 'version' => '1.2.0.0', - 'reference' => '754b3604fb2984c71f4af4a9cbe7b57f346ec1f3', - 'type' => 'library', - 'install_path' => __DIR__ . '/../league/config', - 'aliases' => array(), - 'dev_requirement' => false, - ), - 'mnapoli/front-yaml' => array( - 'pretty_version' => '2.0.4', - 'version' => '2.0.4.0', - 'reference' => '06e43e7720f8fdd140c24de882416c4bfc1aaabd', - 'type' => 'library', - 'install_path' => __DIR__ . '/../mnapoli/front-yaml', - 'aliases' => array(), - 'dev_requirement' => false, - ), - 'nette/schema' => array( - 'pretty_version' => 'v1.3.2', - 'version' => '1.3.2.0', - 'reference' => 'da801d52f0354f70a638673c4a0f04e16529431d', - 'type' => 'library', - 'install_path' => __DIR__ . '/../nette/schema', - 'aliases' => array(), - 'dev_requirement' => false, - ), - 'nette/utils' => array( - 'pretty_version' => 'v4.0.5', - 'version' => '4.0.5.0', - 'reference' => '736c567e257dbe0fcf6ce81b4d6dbe05c6899f96', - 'type' => 'library', - 'install_path' => __DIR__ . '/../nette/utils', - 'aliases' => array(), - 'dev_requirement' => false, - ), - 'psr/event-dispatcher' => array( - 'pretty_version' => '1.0.0', - 'version' => '1.0.0.0', - 'reference' => 'dbefd12671e8a14ec7f180cab83036ed26714bb0', - 'type' => 'library', - 'install_path' => __DIR__ . '/../psr/event-dispatcher', - 'aliases' => array(), - 'dev_requirement' => false, - ), - 'symfony/deprecation-contracts' => array( - 'pretty_version' => 'v3.5.1', - 'version' => '3.5.1.0', - 'reference' => '74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6', - 'type' => 'library', - 'install_path' => __DIR__ . '/../symfony/deprecation-contracts', - 'aliases' => array(), - 'dev_requirement' => false, - ), - 'symfony/polyfill-ctype' => array( - 'pretty_version' => 'v1.31.0', - 'version' => '1.31.0.0', - 'reference' => 'a3cc8b044a6ea513310cbd48ef7333b384945638', - 'type' => 'library', - 'install_path' => __DIR__ . '/../symfony/polyfill-ctype', - 'aliases' => array(), - 'dev_requirement' => false, - ), - 'symfony/polyfill-php80' => array( - 'pretty_version' => 'v1.31.0', - 'version' => '1.31.0.0', - 'reference' => '60328e362d4c2c802a54fcbf04f9d3fb892b4cf8', - 'type' => 'library', - 'install_path' => __DIR__ . '/../symfony/polyfill-php80', - 'aliases' => array(), - 'dev_requirement' => false, - ), - 'symfony/yaml' => array( - 'pretty_version' => 'v7.2.3', - 'version' => '7.2.3.0', - 'reference' => 'ac238f173df0c9c1120f862d0f599e17535a87ec', - 'type' => 'library', - 'install_path' => __DIR__ . '/../symfony/yaml', - 'aliases' => array(), - 'dev_requirement' => false, - ), - ), -); diff --git a/vendor/composer/platform_check.php b/vendor/composer/platform_check.php deleted file mode 100644 index d32d90c..0000000 --- a/vendor/composer/platform_check.php +++ /dev/null @@ -1,26 +0,0 @@ -= 80200)) { - $issues[] = 'Your Composer dependencies require a PHP version ">= 8.2.0". You are running ' . PHP_VERSION . '.'; -} - -if ($issues) { - if (!headers_sent()) { - header('HTTP/1.1 500 Internal Server Error'); - } - if (!ini_get('display_errors')) { - if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { - fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL); - } elseif (!headers_sent()) { - echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL; - } - } - trigger_error( - 'Composer detected issues in your platform: ' . implode(' ', $issues), - E_USER_ERROR - ); -} diff --git a/vendor/dflydev/dot-access-data/CHANGELOG.md b/vendor/dflydev/dot-access-data/CHANGELOG.md deleted file mode 100644 index b8b468d..0000000 --- a/vendor/dflydev/dot-access-data/CHANGELOG.md +++ /dev/null @@ -1,74 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [Unreleased] - -## [3.0.3] - 2024-07-08 - -### Fixed - - - Fixed PHP 8.4 deprecation notices (#47) - -## [3.0.2] - 2022-10-27 - -### Fixed - - - Added missing return types to docblocks (#44, #45) - -## [3.0.1] - 2021-08-13 - -### Added - - - Adds ReturnTypeWillChange to suppress PHP 8.1 warnings (#40) - -## [3.0.0] - 2021-01-01 - -### Added - - Added support for both `.` and `/`-delimited key paths (#24) - - Added parameter and return types to everything; enabled strict type checks (#18) - - Added new exception classes to better identify certain types of errors (#20) - - `Data` now implements `ArrayAccess` (#17) - - Added ability to merge non-associative array values (#31, #32) - -### Changed - - All thrown exceptions are now instances or subclasses of `DataException` (#20) - - Calling `get()` on a missing key path without providing a default will throw a `MissingPathException` instead of returning `null` (#29) - - Bumped supported PHP versions to 7.1 - 8.x (#18) - -### Fixed - - Fixed incorrect merging of array values into string values (#32) - - Fixed `get()` method behaving as if keys with `null` values didn't exist - -## [2.0.0] - 2017-12-21 - -### Changed - - Bumped supported PHP versions to 7.0 - 7.4 (#12) - - Switched to PSR-4 autoloading - -## [1.1.0] - 2017-01-20 - -### Added - - Added new `has()` method to check for the existence of the given key (#4, #7) - -## [1.0.1] - 2015-08-12 - -### Added - - Added new optional `$default` parameter to the `get()` method (#2) - -## [1.0.0] - 2012-07-17 - -**Initial release!** - -[Unreleased]: https://github.com/dflydev/dflydev-dot-access-data/compare/v3.0.3...main -[3.0.3]: https://github.com/dflydev/dflydev-dot-access-data/compare/v3.0.2...v3.0.3 -[3.0.2]: https://github.com/dflydev/dflydev-dot-access-data/compare/v3.0.1...v3.0.2 -[3.0.1]: https://github.com/dflydev/dflydev-dot-access-data/compare/v3.0.0...v3.0.1 -[3.0.0]: https://github.com/dflydev/dflydev-dot-access-data/compare/v2.0.0...v3.0.0 -[2.0.0]: https://github.com/dflydev/dflydev-dot-access-data/compare/v1.1.0...v2.0.0 -[1.1.0]: https://github.com/dflydev/dflydev-dot-access-data/compare/v1.0.1...v1.1.0 -[1.0.1]: https://github.com/dflydev/dflydev-dot-access-data/compare/v1.0.0...v1.0.1 -[1.0.0]: https://github.com/dflydev/dflydev-dot-access-data/releases/tag/v1.0.0 diff --git a/vendor/dflydev/dot-access-data/LICENSE b/vendor/dflydev/dot-access-data/LICENSE deleted file mode 100644 index b6880d4..0000000 --- a/vendor/dflydev/dot-access-data/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2012 Dragonfly Development Inc. - -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/dflydev/dot-access-data/README.md b/vendor/dflydev/dot-access-data/README.md deleted file mode 100644 index 775fbdf..0000000 --- a/vendor/dflydev/dot-access-data/README.md +++ /dev/null @@ -1,158 +0,0 @@ -Dot Access Data -=============== - -[![Latest Version](https://img.shields.io/packagist/v/dflydev/dot-access-data.svg?style=flat-square)](https://packagist.org/packages/dflydev/dot-access-data) -[![Total Downloads](https://img.shields.io/packagist/dt/dflydev/dot-access-data.svg?style=flat-square)](https://packagist.org/packages/dflydev/dot-access-data) -[![Software License](https://img.shields.io/badge/License-MIT-brightgreen.svg?style=flat-square)](LICENSE) -[![Build Status](https://img.shields.io/github/workflow/status/dflydev/dflydev-dot-access-data/Tests/main.svg?style=flat-square)](https://github.com/dflydev/dflydev-dot-access-data/actions?query=workflow%3ATests+branch%3Amain) -[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/dflydev/dflydev-dot-access-data.svg?style=flat-square)](https://scrutinizer-ci.com/g/dflydev/dflydev-dot-access-data/code-structure/) -[![Quality Score](https://img.shields.io/scrutinizer/g/dflydev/dflydev-dot-access-data.svg?style=flat-square)](https://scrutinizer-ci.com/g/dflydev/dflydev-dot-access-data) - -Given a deep data structure, access data by dot notation. - - -Requirements ------------- - - * PHP (7.1+) - -> For PHP (5.3+) please refer to version `1.0`. - - -Usage ------ - -Abstract example: - -```php -use Dflydev\DotAccessData\Data; - -$data = new Data; - -$data->set('a.b.c', 'C'); -$data->set('a.b.d', 'D1'); -$data->append('a.b.d', 'D2'); -$data->set('a.b.e', ['E0', 'E1', 'E2']); - -// C -$data->get('a.b.c'); - -// ['D1', 'D2'] -$data->get('a.b.d'); - -// ['E0', 'E1', 'E2'] -$data->get('a.b.e'); - -// true -$data->has('a.b.c'); - -// false -$data->has('a.b.d.j'); - - -// 'some-default-value' -$data->get('some.path.that.does.not.exist', 'some-default-value'); - -// throws a MissingPathException because no default was given -$data->get('some.path.that.does.not.exist'); -``` - -A more concrete example: - -```php -use Dflydev\DotAccessData\Data; - -$data = new Data([ - 'hosts' => [ - 'hewey' => [ - 'username' => 'hman', - 'password' => 'HPASS', - 'roles' => ['web'], - ], - 'dewey' => [ - 'username' => 'dman', - 'password' => 'D---S', - 'roles' => ['web', 'db'], - 'nick' => 'dewey dman', - ], - 'lewey' => [ - 'username' => 'lman', - 'password' => 'LP@$$', - 'roles' => ['db'], - ], - ], -]); - -// hman -$username = $data->get('hosts.hewey.username'); -// HPASS -$password = $data->get('hosts.hewey.password'); -// ['web'] -$roles = $data->get('hosts.hewey.roles'); -// dewey dman -$nick = $data->get('hosts.dewey.nick'); -// Unknown -$nick = $data->get('hosts.lewey.nick', 'Unknown'); - -// DataInterface instance -$dewey = $data->getData('hosts.dewey'); -// dman -$username = $dewey->get('username'); -// D---S -$password = $dewey->get('password'); -// ['web', 'db'] -$roles = $dewey->get('roles'); - -// No more lewey -$data->remove('hosts.lewey'); - -// Add DB to hewey's roles -$data->append('hosts.hewey.roles', 'db'); - -$data->set('hosts.april', [ - 'username' => 'aman', - 'password' => '@---S', - 'roles' => ['web'], -]); - -// Check if a key exists (true to this case) -$hasKey = $data->has('hosts.dewey.username'); -``` - -`Data` may be used as an array, since it implements `ArrayAccess` interface: - -```php -// Get -$data->get('name') === $data['name']; // true - -$data['name'] = 'Dewey'; -// is equivalent to -$data->set($name, 'Dewey'); - -isset($data['name']) === $data->has('name'); - -// Remove key -unset($data['name']); -``` - -`/` can also be used as a path delimiter: - -```php -$data->set('a/b/c', 'd'); -echo $data->get('a/b/c'); // "d" - -$data->get('a/b/c') === $data->get('a.b.c'); // true -``` - -License -------- - -This library is licensed under the MIT License - see the LICENSE file -for details. - - -Community ---------- - -If you have questions or want to help out, join us in the -[#dflydev](irc://irc.freenode.net/#dflydev) channel on irc.freenode.net. diff --git a/vendor/dflydev/dot-access-data/composer.json b/vendor/dflydev/dot-access-data/composer.json deleted file mode 100644 index 44dc5ed..0000000 --- a/vendor/dflydev/dot-access-data/composer.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "dflydev/dot-access-data", - "type": "library", - "description": "Given a deep data structure, access data by dot notation.", - "homepage": "https://github.com/dflydev/dflydev-dot-access-data", - "keywords": ["dot", "access", "data", "notation"], - "license": "MIT", - "authors": [ - { - "name": "Dragonfly Development Inc.", - "email": "info@dflydev.com", - "homepage": "http://dflydev.com" - }, - { - "name": "Beau Simensen", - "email": "beau@dflydev.com", - "homepage": "http://beausimensen.com" - }, - { - "name": "Carlos Frutos", - "email": "carlos@kiwing.it", - "homepage": "https://github.com/cfrutos" - }, - { - "name": "Colin O'Dell", - "email": "colinodell@gmail.com", - "homepage": "https://www.colinodell.com" - } - ], - "require": { - "php": "^7.1 || ^8.0" - }, - "require-dev": { - "phpstan/phpstan": "^0.12.42", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.3", - "scrutinizer/ocular": "1.6.0", - "squizlabs/php_codesniffer": "^3.5", - "vimeo/psalm": "^4.0.0" - }, - "autoload": { - "psr-4": { - "Dflydev\\DotAccessData\\": "src/" - } - }, - "autoload-dev": { - "psr-4": { - "Dflydev\\DotAccessData\\": "tests/" - } - }, - "extra": { - "branch-alias": { - "dev-main": "3.x-dev" - } - }, - "scripts": { - "phpcs": "phpcs", - "phpstan": "phpstan analyse", - "phpunit": "phpunit --no-coverage", - "psalm": "psalm", - "test": [ - "@phpcs", - "@phpstan", - "@psalm", - "@phpunit" - ] - } -} diff --git a/vendor/dflydev/dot-access-data/src/Data.php b/vendor/dflydev/dot-access-data/src/Data.php deleted file mode 100644 index 3409b8e..0000000 --- a/vendor/dflydev/dot-access-data/src/Data.php +++ /dev/null @@ -1,286 +0,0 @@ - - */ -class Data implements DataInterface, ArrayAccess -{ - private const DELIMITERS = ['.', '/']; - - /** - * Internal representation of data data - * - * @var array - */ - protected $data; - - /** - * Constructor - * - * @param array $data - */ - public function __construct(array $data = []) - { - $this->data = $data; - } - - /** - * {@inheritdoc} - */ - public function append(string $key, $value = null): void - { - $currentValue =& $this->data; - $keyPath = self::keyToPathArray($key); - - $endKey = array_pop($keyPath); - foreach ($keyPath as $currentKey) { - if (! isset($currentValue[$currentKey])) { - $currentValue[$currentKey] = []; - } - $currentValue =& $currentValue[$currentKey]; - } - - if (!isset($currentValue[$endKey])) { - $currentValue[$endKey] = []; - } - - if (!is_array($currentValue[$endKey])) { - // Promote this key to an array. - // TODO: Is this really what we want to do? - $currentValue[$endKey] = [$currentValue[$endKey]]; - } - - $currentValue[$endKey][] = $value; - } - - /** - * {@inheritdoc} - */ - public function set(string $key, $value = null): void - { - $currentValue =& $this->data; - $keyPath = self::keyToPathArray($key); - - $endKey = array_pop($keyPath); - foreach ($keyPath as $currentKey) { - if (!isset($currentValue[$currentKey])) { - $currentValue[$currentKey] = []; - } - if (!is_array($currentValue[$currentKey])) { - throw new DataException(sprintf('Key path "%s" within "%s" cannot be indexed into (is not an array)', $currentKey, self::formatPath($key))); - } - $currentValue =& $currentValue[$currentKey]; - } - $currentValue[$endKey] = $value; - } - - /** - * {@inheritdoc} - */ - public function remove(string $key): void - { - $currentValue =& $this->data; - $keyPath = self::keyToPathArray($key); - - $endKey = array_pop($keyPath); - foreach ($keyPath as $currentKey) { - if (!isset($currentValue[$currentKey])) { - return; - } - $currentValue =& $currentValue[$currentKey]; - } - unset($currentValue[$endKey]); - } - - /** - * {@inheritdoc} - * - * @psalm-mutation-free - */ - public function get(string $key, $default = null) - { - /** @psalm-suppress ImpureFunctionCall */ - $hasDefault = \func_num_args() > 1; - - $currentValue = $this->data; - $keyPath = self::keyToPathArray($key); - - foreach ($keyPath as $currentKey) { - if (!is_array($currentValue) || !array_key_exists($currentKey, $currentValue)) { - if ($hasDefault) { - return $default; - } - - throw new MissingPathException($key, sprintf('No data exists at the given path: "%s"', self::formatPath($keyPath))); - } - - $currentValue = $currentValue[$currentKey]; - } - - return $currentValue === null ? $default : $currentValue; - } - - /** - * {@inheritdoc} - * - * @psalm-mutation-free - */ - public function has(string $key): bool - { - $currentValue = $this->data; - - foreach (self::keyToPathArray($key) as $currentKey) { - if ( - !is_array($currentValue) || - !array_key_exists($currentKey, $currentValue) - ) { - return false; - } - $currentValue = $currentValue[$currentKey]; - } - - return true; - } - - /** - * {@inheritdoc} - * - * @psalm-mutation-free - */ - public function getData(string $key): DataInterface - { - $value = $this->get($key); - if (is_array($value) && Util::isAssoc($value)) { - return new Data($value); - } - - throw new DataException(sprintf('Value at "%s" could not be represented as a DataInterface', self::formatPath($key))); - } - - /** - * {@inheritdoc} - */ - public function import(array $data, int $mode = self::REPLACE): void - { - $this->data = Util::mergeAssocArray($this->data, $data, $mode); - } - - /** - * {@inheritdoc} - */ - public function importData(DataInterface $data, int $mode = self::REPLACE): void - { - $this->import($data->export(), $mode); - } - - /** - * {@inheritdoc} - * - * @psalm-mutation-free - */ - public function export(): array - { - return $this->data; - } - - /** - * {@inheritdoc} - * - * @return bool - */ - #[\ReturnTypeWillChange] - public function offsetExists($key) - { - return $this->has($key); - } - - /** - * {@inheritdoc} - * - * @return mixed - */ - #[\ReturnTypeWillChange] - public function offsetGet($key) - { - return $this->get($key, null); - } - - /** - * {@inheritdoc} - * - * @param string $key - * @param mixed $value - * - * @return void - */ - #[\ReturnTypeWillChange] - public function offsetSet($key, $value) - { - $this->set($key, $value); - } - - /** - * {@inheritdoc} - * - * @return void - */ - #[\ReturnTypeWillChange] - public function offsetUnset($key) - { - $this->remove($key); - } - - /** - * @param string $path - * - * @return string[] - * - * @psalm-return non-empty-list - * - * @psalm-pure - */ - protected static function keyToPathArray(string $path): array - { - if (\strlen($path) === 0) { - throw new InvalidPathException('Path cannot be an empty string'); - } - - $path = \str_replace(self::DELIMITERS, '.', $path); - - return \explode('.', $path); - } - - /** - * @param string|string[] $path - * - * @return string - * - * @psalm-pure - */ - protected static function formatPath($path): string - { - if (is_string($path)) { - $path = self::keyToPathArray($path); - } - - return implode(' » ', $path); - } -} diff --git a/vendor/dflydev/dot-access-data/src/DataInterface.php b/vendor/dflydev/dot-access-data/src/DataInterface.php deleted file mode 100644 index 5909a8c..0000000 --- a/vendor/dflydev/dot-access-data/src/DataInterface.php +++ /dev/null @@ -1,131 +0,0 @@ - $data - * @param self::PRESERVE|self::REPLACE|self::MERGE $mode - */ - public function import(array $data, int $mode = self::REPLACE): void; - - /** - * Import data from an external data into existing data - * - * @param DataInterface $data - * @param self::PRESERVE|self::REPLACE|self::MERGE $mode - */ - public function importData(DataInterface $data, int $mode = self::REPLACE): void; - - /** - * Export data as raw data - * - * @return array - * - * @psalm-mutation-free - */ - public function export(): array; -} diff --git a/vendor/dflydev/dot-access-data/src/Exception/DataException.php b/vendor/dflydev/dot-access-data/src/Exception/DataException.php deleted file mode 100644 index 2faf9f5..0000000 --- a/vendor/dflydev/dot-access-data/src/Exception/DataException.php +++ /dev/null @@ -1,21 +0,0 @@ -path = $path; - - parent::__construct($message, $code, $previous); - } - - public function getPath(): string - { - return $this->path; - } -} diff --git a/vendor/dflydev/dot-access-data/src/Util.php b/vendor/dflydev/dot-access-data/src/Util.php deleted file mode 100644 index 5634c51..0000000 --- a/vendor/dflydev/dot-access-data/src/Util.php +++ /dev/null @@ -1,78 +0,0 @@ - $arr - * - * @return bool - * - * @psalm-pure - */ - public static function isAssoc(array $arr): bool - { - return !count($arr) || count(array_filter(array_keys($arr), 'is_string')) == count($arr); - } - - /** - * Merge contents from one associtative array to another - * - * @param mixed $to - * @param mixed $from - * @param DataInterface::PRESERVE|DataInterface::REPLACE|DataInterface::MERGE $mode - * - * @return mixed - * - * @psalm-pure - */ - public static function mergeAssocArray($to, $from, int $mode = DataInterface::REPLACE) - { - if ($mode === DataInterface::MERGE && self::isList($to) && self::isList($from)) { - return array_merge($to, $from); - } - - if (is_array($from) && is_array($to)) { - foreach ($from as $k => $v) { - if (!isset($to[$k])) { - $to[$k] = $v; - } else { - $to[$k] = self::mergeAssocArray($to[$k], $v, $mode); - } - } - - return $to; - } - - return $mode === DataInterface::PRESERVE ? $to : $from; - } - - /** - * @param mixed $value - * - * @return bool - * - * @psalm-pure - */ - private static function isList($value): bool - { - return is_array($value) && array_values($value) === $value; - } -} diff --git a/vendor/league/commonmark/.phpstorm.meta.php b/vendor/league/commonmark/.phpstorm.meta.php deleted file mode 100644 index 5eb9270..0000000 --- a/vendor/league/commonmark/.phpstorm.meta.php +++ /dev/null @@ -1,106 +0,0 @@ - - * - * 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\Util\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\Extension\CommonMark\Node\Block\Heading::__construct(), 0, 1, 2, 3, 4, 5, 6); - expectedReturnValues(\League\CommonMark\Extension\CommonMark\Node\Block\Heading::getLevel(), 1, 2, 3, 4, 5, 6); - - registerArgumentsSet('league_commonmark_htmlblock_types', \League\CommonMark\Extension\CommonMark\Node\Block\HtmlBlock::TYPE_1_CODE_CONTAINER, \League\CommonMark\Extension\CommonMark\Node\Block\HtmlBlock::TYPE_2_COMMENT, \League\CommonMark\Extension\CommonMark\Node\Block\HtmlBlock::TYPE_3, \League\CommonMark\Extension\CommonMark\Node\Block\HtmlBlock::TYPE_4, \League\CommonMark\Extension\CommonMark\Node\Block\HtmlBlock::TYPE_5_CDATA, \League\CommonMark\Extension\CommonMark\Node\Block\HtmlBlock::TYPE_6_BLOCK_ELEMENT, \League\CommonMark\Extension\CommonMark\Node\Block\HtmlBlock::TYPE_7_MISC_ELEMENT); - expectedArguments(\League\CommonMark\Extension\CommonMark\Node\Block\HtmlBlock::__construct(), 0, argumentsSet('league_commonmark_htmlblock_types')); - expectedArguments(\League\CommonMark\Extension\CommonMark\Node\Block\HtmlBlock::setType(), 0, argumentsSet('league_commonmark_htmlblock_types')); - expectedReturnValues(\League\CommonMark\Extension\CommonMark\Node\Block\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\Node\Inline\Newline::HARDBREAK, \League\CommonMark\Node\Inline\Newline::SOFTBREAK); - expectedArguments(\League\CommonMark\Node\Inline\Newline::__construct(), 0, argumentsSet('league_commonmark_newline_types')); - expectedReturnValues(\League\CommonMark\Node\Inline\Newline::getType(), argumentsSet('league_commonmark_newline_types')); - - registerArgumentsSet('league_commonmark_options', - 'html_input', - 'allow_unsafe_links', - 'max_nesting_level', - 'max_delimiters_per_line', - 'renderer', - 'renderer/block_separator', - 'renderer/inner_separator', - 'renderer/soft_break', - 'commonmark', - 'commonmark/enable_em', - 'commonmark/enable_strong', - 'commonmark/use_asterisk', - 'commonmark/use_underscore', - 'commonmark/unordered_list_markers', - 'disallowed_raw_html', - 'disallowed_raw_html/disallowed_tags', - 'external_link', - 'external_link/html_class', - 'external_link/internal_hosts', - 'external_link/nofollow', - 'external_link/noopener', - 'external_link/noreferrer', - 'external_link/open_in_new_window', - 'footnote', - 'footnote/backref_class', - 'footnote/backref_symbol', - '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/apply_id_to_heading', - 'heading_permalink/heading_class', - 'heading_permalink/html_class', - 'heading_permalink/fragment_prefix', - 'heading_permalink/id_prefix', - 'heading_permalink/inner_contents', - 'heading_permalink/insert', - 'heading_permalink/max_heading_level', - 'heading_permalink/min_heading_level', - 'heading_permalink/symbol', - 'heading_permalink/title', - 'mentions', - 'smartpunct/double_quote_closer', - 'smartpunct/double_quote_opener', - 'smartpunct/single_quote_closer', - 'smartpunct/single_quote_opener', - 'slug_normalizer', - 'slug_normalizer/instance', - 'slug_normalizer/max_length', - 'slug_normalizer/unique', - 'table', - 'table/wrap', - 'table/wrap/attributes', - 'table/wrap/enabled', - 'table/wrap/tag', - 'table/alignment_attributes', - 'table/alignment_attributes/left', - 'table/alignment_attributes/center', - 'table/alignment_attributes/right', - 'table/max_autocompleted_cells', - 'table_of_contents', - 'table_of_contents/html_class', - 'table_of_contents/max_heading_level', - 'table_of_contents/min_heading_level', - 'table_of_contents/normalize', - 'table_of_contents/placeholder', - 'table_of_contents/position', - 'table_of_contents/style', - ); - expectedArguments(\League\Config\ConfigurationInterface::get(), 0, argumentsSet('league_commonmark_options')); - expectedArguments(\League\Config\ConfigurationInterface::exists(), 0, argumentsSet('league_commonmark_options')); - expectedArguments(\League\Config\MutableConfigurationInterface::set(), 0, argumentsSet('league_commonmark_options')); -} diff --git a/vendor/league/commonmark/CHANGELOG.md b/vendor/league/commonmark/CHANGELOG.md deleted file mode 100644 index e5daacb..0000000 --- a/vendor/league/commonmark/CHANGELOG.md +++ /dev/null @@ -1,727 +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. - -**Upgrading from 1.x?** See for additional information. - -## [Unreleased][unreleased] - -## [2.6.1] - 2024-12-29 - -### Fixed - -- Rendered list items should only add newlines around block-level children (#1059, #1061) - -## [2.6.0] - 2024-12-07 - -This is a **security release** to address potential denial of service attacks when parsing specially crafted, -malicious input from untrusted sources (like user input). - -### Added - -- Added `max_delimiters_per_line` config option to prevent denial of service attacks when parsing malicious input -- Added `table/max_autocompleted_cells` config option to prevent denial of service attacks when parsing large tables -- The `AttributesExtension` now supports attributes without values (#985, #986) -- The `AutolinkExtension` exposes two new configuration options to override the default behavior (#969, #987): - - `autolink/allowed_protocols` - an array of protocols to allow autolinking for - - `autolink/default_protocol` - the default protocol to use when none is specified -- Added `RegexHelper::isWhitespace()` method to check if a given character is an ASCII whitespace character -- Added `CacheableDelimiterProcessorInterface` to ensure linear complexity for dynamic delimiter processing -- Added `Bracket` delimiter type to optimize bracket parsing - -### Changed - -- `[` and `]` are no longer added as `Delimiter` objects on the stack; a new `Bracket` type with its own stack is used instead -- `UrlAutolinkParser` no longer parses URLs with more than 127 subdomains -- Expanded reference links can no longer exceed 100kb, or the size of the input document (whichever is greater) -- Delimiters should always provide a non-null value via `DelimiterInterface::getIndex()` - - We'll attempt to infer the index based on surrounding delimiters where possible -- The `DelimiterStack` now accepts integer positions for any `$stackBottom` argument -- Several small performance optimizations - -## [2.5.3] - 2024-08-16 - -### Changed - -- Made compatible with CommonMark spec 0.31.1, including: - - Remove `source`, add `search` to list of recognized block tags - -## [2.5.2] - 2024-08-14 - -### Changed - -- Boolean attributes now require an explicit `true` value (#1040) - -### Fixed - -- Fixed regression where text could be misinterpreted as an attribute (#1040) - -## [2.5.1] - 2024-07-24 - -### Fixed - -- Fixed attribute parsing incorrectly parsing mustache-like syntax (#1035) -- Fixed incorrect `Table` start line numbers (#1037) - -## [2.5.0] - 2024-07-22 - -### Added - -- The `AttributesExtension` now supports attributes without values (#985, #986) -- The `AutolinkExtension` exposes two new configuration options to override the default behavior (#969, #987): - - `autolink/allowed_protocols` - an array of protocols to allow autolinking for - - `autolink/default_protocol` - the default protocol to use when none is specified - -### Changed - -- Made compatible with CommonMark spec 0.31.0, including: - - Allow closing fence to be followed by tabs - - Remove restrictive limitation on inline comments - - Unicode symbols now treated like punctuation (for purposes of flankingness) - - Trailing tabs on the last line of indented code blocks will be excluded - - Improved HTML comment matching -- `Paragraph`s only containing link reference definitions will be kept in the AST until the `Document` is finalized - - (These were previously removed immediately after parsing the `Paragraph`) - -### Fixed - -- Fixed list tightness not being determined properly in some edge cases -- Fixed incorrect ending line numbers for several block types in various scenarios -- Fixed lowercase inline HTML declarations not being accepted - -## [2.4.4] - 2024-07-22 - -### Fixed - -- Fixed SmartPunct extension changing already-formatted quotation marks (#1030) - -## [2.4.3] - 2024-07-22 - -### Fixed - -- Fixed the Attributes extension not supporting CSS level 3 selectors (#1013) -- Fixed `UrlAutolinkParser` incorrectly parsing text containing `www` anywhere before an autolink (#1025) - - -## [2.4.2] - 2024-02-02 - -### Fixed - -- Fixed declaration parser being too strict -- `FencedCodeRenderer`: don't add `language-` to class if already prefixed - -### Deprecated - -- Returning dynamic values from `DelimiterProcessorInterface::getDelimiterUse()` is deprecated - - You should instead implement `CacheableDelimiterProcessorInterface` to help the engine perform caching to avoid performance issues. -- Failing to set a delimiter's index (or returning `null` from `DelimiterInterface::getIndex()`) is deprecated and will not be supported in 3.0 -- Deprecated `DelimiterInterface::isActive()` and `DelimiterInterface::setActive()`, as these are no longer used by the engine -- Deprecated `DelimiterStack::removeEarlierMatches()` and `DelimiterStack::searchByCharacter()`, as these are no longer used by the engine -- Passing a `DelimiterInterface` as the `$stackBottom` argument to `DelimiterStack::processDelimiters()` or `::removeAll()` is deprecated and will not be supported in 3.0; pass the integer position instead. - -### Fixed - -- Fixed NUL characters not being replaced in the input -- Fixed quadratic complexity parsing unclosed inline links -- Fixed quadratic complexity parsing emphasis and strikethrough delimiters -- Fixed issue where having 500,000+ delimiters could trigger a [known segmentation fault issue in PHP's garbage collection](https://bugs.php.net/bug.php?id=68606) -- Fixed quadratic complexity deactivating link openers -- Fixed quadratic complexity parsing long backtick code spans with no matching closers -- Fixed catastrophic backtracking when parsing link labels/titles - -## [2.4.1] - 2023-08-30 - -### Fixed - -- Fixed `ExternalLinkProcessor` not fully disabling the `rel` attribute when configured to do so (#992) - -## [2.4.0] - 2023-03-24 - -### Added - -- Added generic `CommonMarkException` marker interface for all exceptions thrown by the library -- Added several new specific exception types implementing that marker interface: - - `AlreadyInitializedException` - - `InvalidArgumentException` - - `IOException` - - `LogicException` - - `MissingDependencyException` - - `NoMatchingRendererException` - - `ParserLogicException` -- Added more configuration options to the Heading Permalinks extension (#939): - - `heading_permalink/apply_id_to_heading` - When `true`, the `id` attribute will be applied to the heading element itself instead of the `` tag - - `heading_permalink/heading_class` - class to apply to the heading element - - `heading_permalink/insert` - now accepts `none` to prevent the creation of the `` link -- Added new `table/alignment_attributes` configuration option to control how table cell alignment is rendered (#959) - -### Changed - -- Change several thrown exceptions from `RuntimeException` to `LogicException` (or something extending it), including: - - `CallbackGenerator`s that fail to set a URL or return an expected value - - `MarkdownParser` when deactivating the last block parser or attempting to get an active block parser when they've all been closed - - Adding items to an already-initialized `Environment` - - Rendering a `Node` when no renderer has been registered for it -- `HeadingPermalinkProcessor` now throws `InvalidConfigurationException` instead of `RuntimeException` when invalid config values are given. -- `HtmlElement::setAttribute()` no longer requires the second parameter for boolean attributes -- Several small micro-optimizations -- Changed Strikethrough to only allow 1 or 2 tildes per the updated GFM spec - -### Fixed - -- Fixed inaccurate `@throws` docblocks throughout the codebase, including `ConverterInterface`, `MarkdownConverter`, and `MarkdownConverterInterface`. - - These previously suggested that only `\RuntimeException`s were thrown, which was inaccurate as `\LogicException`s were also possible. - -## [2.3.9] - 2023-02-15 - -### Fixed - -- Fixed autolink extension not detecting some URIs with underscores (#956) - -## [2.3.8] - 2022-12-10 - -### Fixed - -- Fixed parsing issues when `mb_internal_encoding()` is set to something other than `UTF-8` (#951) - -## [2.3.7] - 2022-11-03 - -### Fixed - -- Fixed `TaskListItemMarkerRenderer` not including HTML attributes set on the node by other extensions (#947) - -## [2.3.6] - 2022-10-30 - -### Fixed - -- Fixed unquoted attribute parsing when closing curly brace is followed by certain characters (like a `.`) (#943) - -## [2.3.5] - 2022-07-29 - -### Fixed - -- Fixed error using `InlineParserEngine` when no inline parsers are registered in the `Environment` (#908) - -## [2.3.4] - 2022-07-17 - -### Changed - -- Made a number of small tweaks to the embed extension's parsing behavior to fix #898: - - Changed `EmbedStartParser` to always capture embed-like lines in container blocks, regardless of parent block type - - Changed `EmbedProcessor` to also remove `Embed` blocks that aren't direct children of the `Document` - - Increased the priority of `EmbedProcessor` to `1010` - -### Fixed - -- Fixed `EmbedExtension` not parsing embeds following a list block (#898) - -## [2.3.3] - 2022-06-07 - -### Fixed - -- Fixed `DomainFilteringAdapter` not reindexing the embed list (#884, #885) - -## [2.3.2] - 2022-06-03 - -### Fixed - -- Fixed FootnoteExtension stripping extra characters from tab-indented footnotes (#881) - -## [2.2.5] - 2022-06-03 - -### Fixed - -- Fixed FootnoteExtension stripping extra characters from tab-indented footnotes (#881) - -## [2.3.1] - 2022-05-14 - -### Fixed - -- Fixed AutolinkExtension not ignoring trailing strikethrough syntax (#867) - -## [2.2.4] - 2022-05-14 - -### Fixed - -- Fixed AutolinkExtension not ignoring trailing strikethrough syntax (#867) - -## [2.3.0] - 2022-04-07 - -### Added - -- Added new `EmbedExtension` (#805) -- Added `DocumentRendererInterface` as a replacement for the now-deprecated `MarkdownRendererInterface` - -### Deprecated - -- Deprecated `MarkdownRendererInterface`; use `DocumentRendererInterface` instead - -## [2.2.3] - 2022-02-26 - -### Fixed - -- Fixed front matter parsing with Windows line endings (#821) - -## [2.1.3] - 2022-02-26 - -### Fixed - -- Fixed front matter parsing with Windows line endings (#821) - -## [2.0.4] - 2022-02-26 - -### Fixed - -- Fixed front matter parsing with Windows line endings (#821) - -## [2.2.2] - 2022-02-13 - -### Fixed - -- Fixed double-escaping of image alt text (#806, #810) -- Fixed Psalm typehints for event class names - -## [2.2.1] - 2022-01-25 - -### Fixed - - - Fixed `symfony/deprecation-contracts` constraint - -### Removed - - - Removed deprecation trigger from `MarkdownConverterInterface` to reduce noise - -## [2.2.0] - 2022-01-22 - -### Added - - - Added new `ConverterInterface` - - Added new `MarkdownToXmlConverter` class - - Added new `HtmlDecorator` class which can wrap existing renderers with additional HTML tags - - Added new `table/wrap` config to apply an optional wrapping/container element around a table (#780) - -### Changed - - - `HtmlElement` contents can now consist of any `Stringable`, not just `HtmlElement` and `string` - -### Deprecated - - - Deprecated `MarkdownConverterInterface` and its `convertToHtml()` method; use `ConverterInterface` and `convert()` instead - -## [2.1.2] - 2022-02-13 - -### Fixed - -- Fixed double-escaping of image alt text (#806, #810) -- Fixed Psalm typehints for event class names - -## [2.1.1] - 2022-01-02 - -### Added - - - Added missing return type to `Environment::dispatch()` to fix deprecation warning (#778) - -## [2.1.0] - 2021-12-05 - -### Added - -- Added support for ext-yaml in FrontMatterExtension (#715) -- Added support for symfony/yaml v6.0 in FrontMatterExtension (#739) -- Added new `heading_permalink/aria_hidden` config option (#741) - -### Fixed - - - Fixed PHP 8.1 deprecation warning (#759, #762) - -## [2.0.3] - 2022-02-13 - -### Fixed - -- Fixed double-escaping of image alt text (#806, #810) -- Fixed Psalm typehints for event class names - -## [2.0.2] - 2021-08-14 - -### Changed - -- Bumped minimum version of league/config to support PHP 8.1 - -### Fixed - -- Fixed ability to register block parsers that identify lines starting with letters (#706) - -## [2.0.1] - 2021-07-31 - -### Fixed - -- Fixed nested autolinks (#689) -- Fixed description lists being parsed incorrectly (#692) -- Fixed Table of Contents not respecting Heading Permalink prefixes (#690) - -## [2.0.0] - 2021-07-24 - -No changes were introduced since the previous RC2 release. -See all entries below for a list of changes between 1.x and 2.0. - -## [2.0.0-rc2] - 2021-07-17 - -### Fixed - -- Fixed Mentions inside of links creating nested links against the spec's rules (#688) - -## [2.0.0-rc1] - 2021-07-10 - -No changes were introduced since the previous release. - -## [2.0.0-beta3] - 2021-07-03 - -### Changed - - - Any leading UTF-8 BOM will be stripped from the input - - The `getEnvironment()` method of `CommonMarkConverter` and `GithubFlavoredMarkdownConverter` will always return the concrete, configurable `Environment` for upgrading convenience - - Optimized AST iteration - - Lots of small micro-optimizations - -## [2.0.0-beta2] - 2021-06-27 - -### Added - -- Added new `Node::iterator()` method and `NodeIterator` class for faster AST iteration (#683, #684) - -### Changed - -- Made compatible with CommonMark spec 0.30.0 -- Optimized link label parsing -- Optimized AST iteration for a 50% performance boost in some event listeners (#683, #684) - -### Fixed - -- Fixed processing instructions with EOLs -- Fixed case-insensitive matching for HTML tag types -- Fixed type 7 HTML blocks incorrectly interrupting lazy paragraphs -- Fixed newlines in reference labels not collapsing into spaces -- Fixed link label normalization with escaped newlines -- Fixed unnecessary AST iteration when no default attributes are configured - -## [2.0.0-beta1] - 2021-06-20 - -### Added - - - **Added three new extensions:** - - `FrontMatterExtension` ([see documentation](https://commonmark.thephpleague.com/extensions/front-matter/)) - - `DescriptionListExtension` ([see documentation](https://commonmark.thephpleague.com/extensions/description-lists/)) - - `DefaultAttributesExtension` ([see documentation](https://commonmark.thephpleague.com/extensions/default-attributes/)) - - **Added new `XmlRenderer` to simplify AST debugging** ([see documentation](https://commonmark.thephpleague.com/xml/)) (#431) - - **Added the ability to configure disallowed raw HTML tags** (#507) - - **Added the ability for Mentions to use multiple characters for their symbol** (#514, #550) - - **Added the ability to delegate event dispatching to PSR-14 compliant event dispatcher libraries** - - **Added new configuration options:** - - Added `heading_permalink/min_heading_level` and `heading_permalink/max_heading_level` options to control which headings get permalinks (#519) - - Added `heading_permalink/fragment_prefix` to allow customizing the URL fragment prefix (#602) - - Added `footnote/backref_symbol` option for customizing backreference link appearance (#522) - - Added `slug_normalizer/max_length` option to control the maximum length of generated URL slugs - - Added `slug_normalizer/unique` option to control whether unique slugs should be generated per-document or per-environment - - **Added purity markers throughout the codebase** (verified with Psalm) - - Added `Query` class to simplify Node traversal when looking to take action on certain Nodes - - Added new `HtmlFilter` and `StringContainerHelper` utility classes - - Added new `AbstractBlockContinueParser` class to simplify the creation of custom block parsers - - Added several new classes and interfaces: - - `BlockContinue` - - `BlockContinueParserInterface` - - `BlockContinueParserWithInlinesInterface` - - `BlockStart` - - `BlockStartParserInterface` - - `ChildNodeRendererInterface` - - `ConfigurableExtensionInterface` - - `CursorState` - - `DashParser` (extracted from `PunctuationParser`) - - `DelimiterParser` - - `DocumentBlockParser` - - `DocumentPreRenderEvent` - - `DocumentRenderedEvent` - - `EllipsesParser` (extracted from `PunctuationParser`) - - `ExpressionInterface` - - `FallbackNodeXmlRenderer` - - `InlineParserEngineInterface` - - `InlineParserMatch` - - `MarkdownParserState` - - `MarkdownParserStateInterface` - - `MarkdownRendererInterface` - - `Query` - - `RawMarkupContainerInterface` - - `ReferenceableInterface` - - `RenderedContent` - - `RenderedContentInterface` - - `ReplaceUnpairedQuotesListener` - - `SpecReader` - - `TableOfContentsRenderer` - - `UniqueSlugNormalizer` - - `UniqueSlugNormalizerInterface` - - `XmlRenderer` - - `XmlNodeRendererInterface` - - Added several new methods: - - `Cursor::getCurrentCharacter()` - - `Environment::createDefaultConfiguration()` - - `Environment::setEventDispatcher()` - - `EnvironmentInterface::getExtensions()` - - `EnvironmentInterface::getInlineParsers()` - - `EnvironmentInterface::getSlugNormalizer()` - - `FencedCode::setInfo()` - - `Heading::setLevel()` - - `HtmlRenderer::renderDocument()` - - `InlineParserContext::getFullMatch()` - - `InlineParserContext::getFullMatchLength()` - - `InlineParserContext::getMatches()` - - `InlineParserContext::getSubMatches()` - - `LinkParserHelper::parsePartialLinkLabel()` - - `LinkParserHelper::parsePartialLinkTitle()` - - `Node::assertInstanceOf()` - - `RegexHelper::isLetter()` - - `StringContainerInterface::setLiteral()` - - `TableCell::getType()` - - `TableCell::setType()` - - `TableCell::getAlign()` - - `TableCell::setAlign()` - -### Changed - - - **Changed the converter return type** - - `CommonMarkConverter::convertToHtml()` now returns an instance of `RenderedContentInterface`. This can be cast to a string for backward compatibility with 1.x. - - **Table of Contents items are no longer wrapped with `

` tags** (#613) - - **Heading Permalinks now link to element IDs instead of using `name` attributes** (#602) - - **Heading Permalink IDs and URL fragments now have a `content` prefix by default** (#602) - - **Changes to configuration options:** - - `enable_em` has been renamed to `commonmark/enable_em` - - `enable_strong` has been renamed to `commonmark/enable_strong` - - `use_asterisk` has been renamed to `commonmark/use_asterisk` - - `use_underscore` has been renamed to `commonmark/use_underscore` - - `unordered_list_markers` has been renamed to `commonmark/unordered_list_markers` - - `mentions/*/symbol` has been renamed to `mentions/*/prefix` - - `mentions/*/regex` has been renamed to `mentions/*/pattern` and requires partial regular expressions (without delimiters or flags) - - `max_nesting_level` now defaults to `PHP_INT_MAX` and no longer supports floats - - `heading_permalink/slug_normalizer` has been renamed to `slug_normalizer/instance` - - **Event dispatching is now fully PSR-14 compliant** - - **Moved and renamed several classes** - [see the full list here](https://commonmark.thephpleague.com/2.0/upgrading/#classesnamespaces-renamed) - - The `HeadingPermalinkExtension` and `FootnoteExtension` were modified to ensure they never produce a slug which conflicts with slugs created by the other extension - - `SlugNormalizer::normalizer()` now supports optional prefixes and max length options passed in via the `$context` argument - - The `AbstractBlock::$data` and `AbstractInline::$data` arrays were replaced with a `Data` array-like object on the base `Node` class - - **Implemented a new approach to block parsing.** This was a massive change, so here are the highlights: - - Functionality previously found in block parsers and node elements has moved to block parser factories and block parsers, respectively ([more details](https://commonmark.thephpleague.com/2.0/upgrading/#new-block-parsing-approach)) - - `ConfigurableEnvironmentInterface::addBlockParser()` is now `EnvironmentBuilderInterface::addBlockParserFactory()` - - `ReferenceParser` was re-implemented and works completely different than before - - The paragraph parser no longer needs to be added manually to the environment - - **Implemented a new approach to inline parsing** where parsers can now specify longer strings or regular expressions they want to parse (instead of just single characters): - - `InlineParserInterface::getCharacters()` is now `getMatchDefinition()` and returns an instance of `InlineParserMatch` - - `InlineParserContext::__construct()` now requires the contents to be provided as a `Cursor` instead of a `string` - - **Implemented delimiter parsing as a special type of inline parser** (via the new `DelimiterParser` class) - - **Changed block and inline rendering to use common methods and interfaces** - - `BlockRendererInterface` and `InlineRendererInterface` were replaced by `NodeRendererInterface` with slightly different parameters. All core renderers now implement this interface. - - `ConfigurableEnvironmentInterface::addBlockRenderer()` and `addInlineRenderer()` were combined into `EnvironmentBuilderInterface::addRenderer()` - - `EnvironmentInterface::getBlockRenderersForClass()` and `getInlineRenderersForClass()` are now just `getRenderersForClass()` - - **Completely refactored the Configuration implementation** - - All configuration-specific classes have been moved into a new `league/config` package with a new namespace - - `Configuration` objects must now be configured with a schema and all options must match that schema - arbitrary keys are no longer permitted - - `Configuration::__construct()` no longer accepts the default configuration values - use `Configuration::merge()` instead - - `ConfigurationInterface` now only contains a `get(string $key)`; this method no longer allows arbitrary default values to be returned if the option is missing - - `ConfigurableEnvironmentInterface` was renamed to `EnvironmentBuilderInterface` - - `ExtensionInterface::register()` now requires an `EnvironmentBuilderInterface` param instead of `ConfigurableEnvironmentInterface` - - **Added missing return types to virtually every class and interface method** - - Re-implemented the GFM Autolink extension using the new inline parser approach instead of document processors - - `EmailAutolinkProcessor` is now `EmailAutolinkParser` - - `UrlAutolinkProcessor` is now `UrlAutolinkParser` - - `HtmlElement` can now properly handle array (i.e. `class`) and boolean (i.e. `checked`) attribute values - - `HtmlElement` automatically flattens any attributes with array values into space-separated strings, removing duplicate entries - - Combined separate classes/interfaces into one: - - `DisallowedRawHtmlRenderer` replaces `DisallowedRawHtmlBlockRenderer` and `DisallowedRawHtmlInlineRenderer` - - `NodeRendererInterface` replaces `BlockRendererInterface` and `InlineRendererInterface` - - Renamed the following methods: - - `Environment` and `ConfigurableEnvironmentInterface`: - - `addBlockParser()` is now `addBlockStartParser()` - - `ReferenceMap` and `ReferenceMapInterface`: - - `addReference()` is now `add()` - - `getReference()` is now `get()` - - `listReferences()` is now `getIterator()` - - Various node (block/inline) classes: - - `getContent()` is now `getLiteral()` - - `setContent()` is now `setLiteral()` - - Moved and renamed the following constants: - - `EnvironmentInterface::HTML_INPUT_ALLOW` is now `HtmlFilter::ALLOW` - - `EnvironmentInterface::HTML_INPUT_ESCAPE` is now `HtmlFilter::ESCAPE` - - `EnvironmentInterface::HTML_INPUT_STRIP` is now `HtmlFilter::STRIP` - - `TableCell::TYPE_HEAD` is now `TableCell::TYPE_HEADER` - - `TableCell::TYPE_BODY` is now `TableCell::TYPE_DATA` - - Changed the visibility of the following properties: - - `AttributesInline::$attributes` is now `private` - - `AttributesInline::$block` is now `private` - - `TableCell::$align` is now `private` - - `TableCell::$type` is now `private` - - `TableSection::$type` is now `private` - - Several methods which previously returned `$this` now return `void` - - `Delimiter::setPrevious()` - - `Node::replaceChildren()` - - `Context::setTip()` - - `Context::setContainer()` - - `Context::setBlocksParsed()` - - `AbstractStringContainer::setContent()` - - `AbstractWebResource::setUrl()` - - Several classes are now marked `final`: - - `ArrayCollection` - - `Emphasis` - - `FencedCode` - - `Heading` - - `HtmlBlock` - - `HtmlElement` - - `HtmlInline` - - `IndentedCode` - - `Newline` - - `Strikethrough` - - `Strong` - - `Text` - - `Heading` nodes no longer directly contain a copy of their inner text - - `StringContainerInterface` can now be used for inlines, not just blocks - - `ArrayCollection` only supports integer keys - - `HtmlElement` now implements `Stringable` - - `Cursor::saveState()` and `Cursor::restoreState()` now use `CursorState` objects instead of arrays - - `NodeWalker::next()` now enters, traverses any children, and leaves all elements which may have children (basically all blocks plus any inlines with children). Previously, it only did this for elements explicitly marked as "containers". - - `InvalidOptionException` was removed - - Anything with a `getReference(): ReferenceInterface` method now implements `ReferencableInterface` - - The `SmartPunct` extension now replaces all unpaired `Quote` elements with `Text` elements towards the end of parsing, making the `QuoteRenderer` unnecessary - - Several changes made to the Footnote extension: - - Footnote identifiers can no longer contain spaces - - Anonymous footnotes can now span subsequent lines - - Footnotes can now contain multiple lines of content, including sub-blocks, by indenting them - - Footnote event listeners now have numbered priorities (but still execute in the same order) - - Footnotes must now be separated from previous content by a blank line - - The line numbers (keys) returned via `MarkdownInput::getLines()` now start at 1 instead of 0 - - `DelimiterProcessorCollectionInterface` now extends `Countable` - - `RegexHelper::PARTIAL_` constants must always be used in case-insensitive contexts - - `HeadingPermalinkProcessor` no longer accepts text normalizers via the constructor - these must be provided via configuration instead - - Blocks which can't contain inlines will no longer be asked to render inlines - - `AnonymousFootnoteRefParser` and `HeadingPermalinkProcessor` now implement `EnvironmentAwareInterface` instead of `ConfigurationAwareInterface` - - The second argument to `TextNormalizerInterface::normalize()` must now be an array - - The `title` attribute for `Link` and `Image` nodes is now stored using a dedicated property instead of stashing it in `$data` - - `ListData::$delimiter` now returns either `ListBlock::DELIM_PERIOD` or `ListBlock::DELIM_PAREN` instead of the literal delimiter - -### Fixed - - - **Fixed parsing of footnotes without content** - - **Fixed rendering of orphaned footnotes and footnote refs** - - **Fixed some URL autolinks breaking too early** (#492) - - Fixed `AbstractStringContainer` not actually being `abstract` - -### Removed - - - **Removed support for PHP 7.1, 7.2, and 7.3** (#625, #671) - - **Removed all previously-deprecated functionality:** - - Removed the ability to pass custom `Environment` instances into the `CommonMarkConverter` and `GithubFlavoredMarkdownConverter` constructors - - Removed the `Converter` class and `ConverterInterface` - - Removed the `bin/commonmark` script - - Removed the `Html5Entities` utility class - - Removed the `InlineMentionParser` (use `MentionParser` instead) - - Removed `DefaultSlugGenerator` and `SlugGeneratorInterface` from the `Extension/HeadingPermalink/Slug` sub-namespace (use the new ones under `./SlugGenerator` instead) - - Removed the following `ArrayCollection` methods: - - `add()` - - `set()` - - `get()` - - `remove()` - - `isEmpty()` - - `contains()` - - `indexOf()` - - `containsKey()` - - `replaceWith()` - - `removeGaps()` - - Removed the `ConfigurableEnvironmentInterface::setConfig()` method - - Removed the `ListBlock::TYPE_UNORDERED` constant - - Removed the `CommonMarkConverter::VERSION` constant - - Removed the `HeadingPermalinkRenderer::DEFAULT_INNER_CONTENTS` constant - - Removed the `heading_permalink/inner_contents` configuration option - - **Removed now-unused classes:** - - `AbstractStringContainerBlock` - - `BlockRendererInterface` - - `Context` - - `ContextInterface` - - `Converter` - - `ConverterInterface` - - `InlineRendererInterface` - - `PunctuationParser` (was split into two classes: `DashParser` and `EllipsesParser`) - - `QuoteRenderer` - - `UnmatchedBlockCloser` - - Removed the following methods, properties, and constants: - - `AbstractBlock::$open` - - `AbstractBlock::$lastLineBlank` - - `AbstractBlock::isContainer()` - - `AbstractBlock::canContain()` - - `AbstractBlock::isCode()` - - `AbstractBlock::matchesNextLine()` - - `AbstractBlock::endsWithBlankLine()` - - `AbstractBlock::setLastLineBlank()` - - `AbstractBlock::shouldLastLineBeBlank()` - - `AbstractBlock::isOpen()` - - `AbstractBlock::finalize()` - - `AbstractBlock::getData()` - - `AbstractInline::getData()` - - `ConfigurableEnvironmentInterface::addBlockParser()` - - `ConfigurableEnvironmentInterface::mergeConfig()` - - `Delimiter::setCanClose()` - - `EnvironmentInterface::getConfig()` - - `EnvironmentInterface::getInlineParsersForCharacter()` - - `EnvironmentInterface::getInlineParserCharacterRegex()` - - `HtmlRenderer::renderBlock()` - - `HtmlRenderer::renderBlocks()` - - `HtmlRenderer::renderInline()` - - `HtmlRenderer::renderInlines()` - - `Node::isContainer()` - - `RegexHelper::matchAll()` (use the new `matchFirst()` method instead) - - `RegexHelper::REGEX_WHITESPACE` - - Removed the second `$contents` argument from the `Heading` constructor - -### Deprecated - -**The following things have been deprecated and will not be supported in v3.0:** - - - `Environment::mergeConfig()` (set configuration before instantiation instead) - - `Environment::createCommonMarkEnvironment()` and `Environment::createGFMEnvironment()` - - Alternative 1: Use `CommonMarkConverter` or `GithubFlavoredMarkdownConverter` if you don't need to customize the environment - - Alternative 2: Instantiate a new `Environment` and add the necessary extensions yourself - -[unreleased]: https://github.com/thephpleague/commonmark/compare/2.6.1...main -[2.6.1]: https://github.com/thephpleague/commonmark/compare/2.6.0...2.6.1 -[2.6.0]: https://github.com/thephpleague/commonmark/compare/2.5.3...2.6.0 -[2.5.3]: https://github.com/thephpleague/commonmark/compare/2.5.2...2.5.3 -[2.5.2]: https://github.com/thephpleague/commonmark/compare/2.5.1...2.5.2 -[2.5.1]: https://github.com/thephpleague/commonmark/compare/2.5.0...2.5.1 -[2.5.0]: https://github.com/thephpleague/commonmark/compare/2.4.4...2.5.0 -[2.4.4]: https://github.com/thephpleague/commonmark/compare/2.4.3...2.4.4 -[2.4.3]: https://github.com/thephpleague/commonmark/compare/2.4.2...2.4.3 -[2.4.2]: https://github.com/thephpleague/commonmark/compare/2.4.1...2.4.2 -[2.4.1]: https://github.com/thephpleague/commonmark/compare/2.4.0...2.4.1 -[2.4.0]: https://github.com/thephpleague/commonmark/compare/2.3.9...2.4.0 -[2.3.9]: https://github.com/thephpleague/commonmark/compare/2.3.8...2.3.9 -[2.3.8]: https://github.com/thephpleague/commonmark/compare/2.3.7...2.3.8 -[2.3.7]: https://github.com/thephpleague/commonmark/compare/2.3.6...2.3.7 -[2.3.6]: https://github.com/thephpleague/commonmark/compare/2.3.5...2.3.6 -[2.3.5]: https://github.com/thephpleague/commonmark/compare/2.3.4...2.3.5 -[2.3.4]: https://github.com/thephpleague/commonmark/compare/2.3.3...2.3.4 -[2.3.3]: https://github.com/thephpleague/commonmark/compare/2.3.2...2.3.3 -[2.3.2]: https://github.com/thephpleague/commonmark/compare/2.3.2...main -[2.3.1]: https://github.com/thephpleague/commonmark/compare/2.3.0...2.3.1 -[2.3.0]: https://github.com/thephpleague/commonmark/compare/2.2.3...2.3.0 -[2.2.5]: https://github.com/thephpleague/commonmark/compare/2.2.4...2.2.5 -[2.2.4]: https://github.com/thephpleague/commonmark/compare/2.2.3...2.2.4 -[2.2.3]: https://github.com/thephpleague/commonmark/compare/2.2.2...2.2.3 -[2.2.2]: https://github.com/thephpleague/commonmark/compare/2.2.1...2.2.2 -[2.2.1]: https://github.com/thephpleague/commonmark/compare/2.2.0...2.2.1 -[2.2.0]: https://github.com/thephpleague/commonmark/compare/2.1.1...2.2.0 -[2.1.3]: https://github.com/thephpleague/commonmark/compare/2.1.2...2.1.3 -[2.1.2]: https://github.com/thephpleague/commonmark/compare/2.1.1...2.1.2 -[2.1.1]: https://github.com/thephpleague/commonmark/compare/2.0.2...2.1.1 -[2.1.0]: https://github.com/thephpleague/commonmark/compare/2.0.2...2.1.0 -[2.0.4]: https://github.com/thephpleague/commonmark/compare/2.0.3...2.0.4 -[2.0.3]: https://github.com/thephpleague/commonmark/compare/2.0.2...2.0.3 -[2.0.2]: https://github.com/thephpleague/commonmark/compare/2.0.1...2.0.2 -[2.0.1]: https://github.com/thephpleague/commonmark/compare/2.0.0...2.0.1 -[2.0.0]: https://github.com/thephpleague/commonmark/compare/2.0.0-rc2...2.0.0 -[2.0.0-rc2]: https://github.com/thephpleague/commonmark/compare/2.0.0-rc1...2.0.0-rc2 -[2.0.0-rc1]: https://github.com/thephpleague/commonmark/compare/2.0.0-beta3...2.0.0-rc1 -[2.0.0-beta3]: https://github.com/thephpleague/commonmark/compare/2.0.0-beta2...2.0.0-beta3 -[2.0.0-beta2]: https://github.com/thephpleague/commonmark/compare/2.0.0-beta1...2.0.0-beta2 -[2.0.0-beta1]: https://github.com/thephpleague/commonmark/compare/1.6...2.0.0-beta1 diff --git a/vendor/league/commonmark/LICENSE b/vendor/league/commonmark/LICENSE deleted file mode 100644 index 5f04fad..0000000 --- a/vendor/league/commonmark/LICENSE +++ /dev/null @@ -1,28 +0,0 @@ -BSD 3-Clause License - -Copyright (c) 2014-2022, Colin O'Dell. All rights reserved. Some code based on commonmark.js (copyright 2014-2018, John MacFarlane) and commonmark-java (copyright 2015-2016, Atlassian Pty Ltd) - -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 1cb8560..0000000 --- a/vendor/league/commonmark/README.md +++ /dev/null @@ -1,223 +0,0 @@ -# league/commonmark - -[![Latest Version](https://img.shields.io/packagist/v/league/commonmark.svg?style=flat-square)](https://packagist.org/packages/league/commonmark) -[![Total Downloads](https://img.shields.io/packagist/dt/league/commonmark.svg?style=flat-square)](https://packagist.org/packages/league/commonmark) -[![Software License](https://img.shields.io/badge/License-BSD--3-brightgreen.svg?style=flat-square)](LICENSE) -[![Build Status](https://img.shields.io/github/actions/workflow/status/thephpleague/commonmark/tests.yml?branch=main&style=flat-square)](https://github.com/thephpleague/commonmark/actions?query=workflow%3ATests+branch%3Amain) -[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/thephpleague/commonmark.svg?style=flat-square)](https://scrutinizer-ci.com/g/thephpleague/commonmark/code-structure) -[![Quality Score](https://img.shields.io/scrutinizer/g/thephpleague/commonmark.svg?style=flat-square)](https://scrutinizer-ci.com/g/thephpleague/commonmark) -[![Psalm Type Coverage](https://shepherd.dev/github/thephpleague/commonmark/coverage.svg)](https://shepherd.dev/github/thephpleague/commonmark) -[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/126/badge)](https://bestpractices.coreinfrastructure.org/projects/126) -[![Sponsor development of this project](https://img.shields.io/badge/sponsor%20this%20package-%E2%9D%A4-ff69b4.svg?style=flat-square)](https://www.colinodell.com/sponsor) - -![league/commonmark](commonmark-banner.png) - -**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.4 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->convert('# Hello World!'); - -//

Hello World!

-``` - -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->convert('# Hello World!'); - -//

Hello World!

-``` - -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. - -> [!CAUTION] -> 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 for more details. If you also do choose to allow raw HTML input from untrusted users, consider 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 . - -## 💻 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+](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) -- [Laravel CommonMark Blog](https://github.com/spekulatius/laravel-commonmark-blog) - -### 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: - - - [Emoji extension](https://github.com/ElGigi/CommonMarkEmoji) - UTF-8 emoji extension with Github tag. - - [Sup Sub extensions](https://github.com/OWS/commonmark-sup-sub-extensions) - Adds support of superscript and subscript (`` and `` HTML tags) - - [YouTube iframe extension](https://github.com/zoonru/commonmark-ext-youtube-iframe) - Replaces youtube link with iframe. - - [Lazy Image extension](https://github.com/simonvomeyser/commonmark-ext-lazy-image) - Adds various options for lazy loading of images. - - [Marker Extension](https://github.com/noah1400/commonmark-marker-extension) - Adds support of highlighted text (`` HTML tag) - -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`: - -## 🏷️ 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. `2.0` -> `2.1`) is released, the previous one (`2.0`) will continue to receive security and critical bug fixes for *at least* 3 months. - -When a new **major** version is released (e.g. `1.6` -> `2.0`), the previous one (`1.6`) 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/main/.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 - -This code was originally 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. - -And a huge thanks to all of our amazing contributors: - -
- - - -### 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 - - [Blackfire](https://www.blackfire.io/) for providing an Open-Source Profiler subscription - - [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 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)! - ---- - -
- - Get professional support for league/commonmark with a Tidelift subscription - -
- - Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. -
-
- -[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/composer.json b/vendor/league/commonmark/composer.json deleted file mode 100644 index d20563b..0000000 --- a/vendor/league/commonmark/composer.json +++ /dev/null @@ -1,128 +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/", - "forum": "https://github.com/thephpleague/commonmark/discussions", - "issues": "https://github.com/thephpleague/commonmark/issues", - "rss": "https://github.com/thephpleague/commonmark/releases.atom", - "source": "https://github.com/thephpleague/commonmark" - }, - "require": { - "php": "^7.4 || ^8.0", - "ext-mbstring": "*", - "league/config": "^1.1.1", - "psr/event-dispatcher": "^1.0", - "symfony/deprecation-contracts": "^2.1 || ^3.0", - "symfony/polyfill-php80": "^1.16" - }, - "require-dev": { - "ext-json": "*", - "cebe/markdown": "^1.0", - "commonmark/cmark": "0.31.1", - "commonmark/commonmark.js": "0.31.1", - "composer/package-versions-deprecated": "^1.8", - "embed/embed": "^4.4", - "erusev/parsedown": "^1.0", - "github/gfm": "0.29.0", - "michelf/php-markdown": "^1.4 || ^2.0", - "nyholm/psr7": "^1.5", - "phpstan/phpstan": "^1.8.2", - "phpunit/phpunit": "^9.5.21 || ^10.5.9 || ^11.0.0", - "scrutinizer/ocular": "^1.8.1", - "symfony/finder": "^5.3 | ^6.0 | ^7.0", - "symfony/process": "^5.4 | ^6.0 | ^7.0", - "symfony/yaml": "^2.3 | ^3.0 | ^4.0 | ^5.0 | ^6.0 | ^7.0", - "unleashedtech/php-coding-standard": "^3.1.1", - "vimeo/psalm": "^4.24.0 || ^5.0.0" - }, - "minimum-stability": "beta", - "suggest": { - "symfony/yaml": "v2.3+ required if using the Front Matter extension" - }, - "repositories": [ - { - "type": "package", - "package": { - "name": "commonmark/commonmark.js", - "version": "0.31.1", - "dist": { - "url": "https://github.com/commonmark/commonmark.js/archive/0.31.1.zip", - "type": "zip" - } - } - }, - { - "type": "package", - "package": { - "name": "commonmark/cmark", - "version": "0.31.1", - "dist": { - "url": "https://github.com/commonmark/cmark/archive/0.31.1.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.13.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", - "League\\CommonMark\\Tests\\PHPStan\\": "tests/phpstan" - } - }, - "scripts": { - "phpcs": "phpcs", - "phpstan": "phpstan analyse", - "phpunit": "phpunit --no-coverage", - "psalm": "psalm --stats", - "pathological": "tests/pathological/test.php", - "test": [ - "@phpcs", - "@phpstan", - "@psalm", - "@phpunit", - "@pathological" - ] - }, - "extra": { - "branch-alias": { - "dev-main": "2.7-dev" - } - }, - "config": { - "allow-plugins": { - "composer/package-versions-deprecated": true, - "dealerdirect/phpcodesniffer-composer-installer": true - }, - "sort-packages": true - } -} diff --git a/vendor/league/commonmark/src/CommonMarkConverter.php b/vendor/league/commonmark/src/CommonMarkConverter.php deleted file mode 100644 index 4d70053..0000000 --- a/vendor/league/commonmark/src/CommonMarkConverter.php +++ /dev/null @@ -1,46 +0,0 @@ - - * - * 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\Environment\Environment; -use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension; - -/** - * Converts CommonMark-compatible Markdown to HTML. - */ -final class CommonMarkConverter extends MarkdownConverter -{ - /** - * Create a new Markdown converter pre-configured for CommonMark - * - * @param array $config - */ - public function __construct(array $config = []) - { - $environment = new Environment($config); - $environment->addExtension(new CommonMarkCoreExtension()); - - parent::__construct($environment); - } - - public function getEnvironment(): Environment - { - \assert($this->environment instanceof Environment); - - return $this->environment; - } -} diff --git a/vendor/league/commonmark/src/ConverterInterface.php b/vendor/league/commonmark/src/ConverterInterface.php deleted file mode 100644 index 8192b0f..0000000 --- a/vendor/league/commonmark/src/ConverterInterface.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * 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\CommonMarkException; -use League\CommonMark\Output\RenderedContentInterface; -use League\Config\Exception\ConfigurationExceptionInterface; - -/** - * Interface for a service which converts content from one format (like Markdown) to another (like HTML). - */ -interface ConverterInterface -{ - /** - * @throws CommonMarkException - * @throws ConfigurationExceptionInterface - */ - public function convert(string $input): RenderedContentInterface; -} diff --git a/vendor/league/commonmark/src/Delimiter/Bracket.php b/vendor/league/commonmark/src/Delimiter/Bracket.php deleted file mode 100644 index 3a86859..0000000 --- a/vendor/league/commonmark/src/Delimiter/Bracket.php +++ /dev/null @@ -1,83 +0,0 @@ - - * - * 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\Node\Node; - -final class Bracket -{ - private Node $node; - private ?Bracket $previous; - private bool $hasNext = false; - private int $position; - private bool $image; - private bool $active = true; - - public function __construct(Node $node, ?Bracket $previous, int $position, bool $image) - { - $this->node = $node; - $this->previous = $previous; - $this->position = $position; - $this->image = $image; - } - - public function getNode(): Node - { - return $this->node; - } - - public function getPrevious(): ?Bracket - { - return $this->previous; - } - - public function hasNext(): bool - { - return $this->hasNext; - } - - public function getPosition(): int - { - return $this->position; - } - - public function isImage(): bool - { - return $this->image; - } - - /** - * Only valid in the context of non-images (links) - */ - public function isActive(): bool - { - return $this->active; - } - - /** - * @internal - */ - public function setHasNext(bool $hasNext): void - { - $this->hasNext = $hasNext; - } - - /** - * @internal - */ - public function setActive(bool $active): void - { - $this->active = $active; - } -} diff --git a/vendor/league/commonmark/src/Delimiter/Delimiter.php b/vendor/league/commonmark/src/Delimiter/Delimiter.php deleted file mode 100644 index 2f04f24..0000000 --- a/vendor/league/commonmark/src/Delimiter/Delimiter.php +++ /dev/null @@ -1,134 +0,0 @@ - - * - * 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\Node\Inline\AbstractStringContainer; - -final class Delimiter implements DelimiterInterface -{ - /** @psalm-readonly */ - private string $char; - - /** @psalm-readonly-allow-private-mutation */ - private int $length; - - /** @psalm-readonly */ - private int $originalLength; - - /** @psalm-readonly */ - private AbstractStringContainer $inlineNode; - - /** @psalm-readonly-allow-private-mutation */ - private ?DelimiterInterface $previous = null; - - /** @psalm-readonly-allow-private-mutation */ - private ?DelimiterInterface $next = null; - - /** @psalm-readonly */ - private bool $canOpen; - - /** @psalm-readonly */ - private bool $canClose; - - /** @psalm-readonly-allow-private-mutation */ - private bool $active; - - /** @psalm-readonly */ - private ?int $index = null; - - 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; - } - - public function canOpen(): bool - { - return $this->canOpen; - } - - public function isActive(): bool - { - return $this->active; - } - - public function setActive(bool $active): void - { - $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): void - { - $this->next = $next; - } - - public function getLength(): int - { - return $this->length; - } - - public function setLength(int $length): void - { - $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): void - { - $this->previous = $previous; - } -} diff --git a/vendor/league/commonmark/src/Delimiter/DelimiterInterface.php b/vendor/league/commonmark/src/Delimiter/DelimiterInterface.php deleted file mode 100644 index 0cefba7..0000000 --- a/vendor/league/commonmark/src/Delimiter/DelimiterInterface.php +++ /dev/null @@ -1,56 +0,0 @@ - - * - * 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\Node\Inline\AbstractStringContainer; - -interface DelimiterInterface -{ - public function canClose(): bool; - - public function canOpen(): bool; - - /** - * @deprecated This method is no longer used internally and will be removed in 3.0 - */ - public function isActive(): bool; - - /** - * @deprecated This method is no longer used internally and will be removed in 3.0 - */ - public function setActive(bool $active): void; - - public function getChar(): string; - - public function getIndex(): ?int; - - public function getNext(): ?DelimiterInterface; - - public function setNext(?DelimiterInterface $next): void; - - public function getLength(): int; - - public function setLength(int $length): void; - - public function getOriginalLength(): int; - - public function getInlineNode(): AbstractStringContainer; - - public function getPrevious(): ?DelimiterInterface; - - public function setPrevious(?DelimiterInterface $previous): void; -} diff --git a/vendor/league/commonmark/src/Delimiter/DelimiterParser.php b/vendor/league/commonmark/src/Delimiter/DelimiterParser.php deleted file mode 100644 index fdfe093..0000000 --- a/vendor/league/commonmark/src/Delimiter/DelimiterParser.php +++ /dev/null @@ -1,106 +0,0 @@ -collection = $collection; - } - - public function getMatchDefinition(): InlineParserMatch - { - return InlineParserMatch::oneOf(...$this->collection->getDelimiterCharacters()); - } - - public function parse(InlineParserContext $inlineContext): bool - { - $character = $inlineContext->getFullMatch(); - $numDelims = 0; - $cursor = $inlineContext->getCursor(); - $processor = $this->collection->getDelimiterProcessor($character); - - \assert($processor !== null); // Delimiter processor should never be null here - - $charBefore = $cursor->peek(-1); - if ($charBefore === null) { - $charBefore = "\n"; - } - - while ($cursor->peek($numDelims) === $character) { - ++$numDelims; - } - - if ($numDelims < $processor->getMinLength()) { - return false; - } - - $cursor->advanceBy($numDelims); - - $charAfter = $cursor->getCurrentCharacter(); - if ($charAfter === null) { - $charAfter = "\n"; - } - - [$canOpen, $canClose] = self::determineCanOpenOrClose($charBefore, $charAfter, $character, $processor); - - if (! ($canOpen || $canClose)) { - $inlineContext->getContainer()->appendChild(new Text(\str_repeat($character, $numDelims))); - - return true; - } - - $node = new Text(\str_repeat($character, $numDelims), [ - 'delim' => true, - ]); - $inlineContext->getContainer()->appendChild($node); - - // Add entry to stack to this opener - $delimiter = new Delimiter($character, $numDelims, $node, $canOpen, $canClose, $inlineContext->getCursor()->getPosition()); - $inlineContext->getDelimiterStack()->push($delimiter); - - return true; - } - - /** - * @return bool[] - */ - private static function determineCanOpenOrClose(string $charBefore, string $charAfter, string $character, DelimiterProcessorInterface $delimiterProcessor): array - { - $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/Delimiter/DelimiterStack.php b/vendor/league/commonmark/src/Delimiter/DelimiterStack.php deleted file mode 100644 index cf2a41e..0000000 --- a/vendor/league/commonmark/src/Delimiter/DelimiterStack.php +++ /dev/null @@ -1,396 +0,0 @@ - - * - * 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\CacheableDelimiterProcessorInterface; -use League\CommonMark\Delimiter\Processor\DelimiterProcessorCollection; -use League\CommonMark\Node\Inline\AdjacentTextMerger; -use League\CommonMark\Node\Node; - -final class DelimiterStack -{ - /** @psalm-readonly-allow-private-mutation */ - private ?DelimiterInterface $top = null; - - /** @psalm-readonly-allow-private-mutation */ - private ?Bracket $brackets = null; - - /** - * @deprecated This property will be removed in 3.0 once all delimiters MUST have an index/position - * - * @var \SplObjectStorage|\WeakMap - */ - private $missingIndexCache; - - - private int $remainingDelimiters = 0; - - public function __construct(int $maximumStackSize = PHP_INT_MAX) - { - $this->remainingDelimiters = $maximumStackSize; - - if (\PHP_VERSION_ID >= 80000) { - /** @psalm-suppress PropertyTypeCoercion */ - $this->missingIndexCache = new \WeakMap(); // @phpstan-ignore-line - } else { - $this->missingIndexCache = new \SplObjectStorage(); // @phpstan-ignore-line - } - } - - public function push(DelimiterInterface $newDelimiter): void - { - if ($this->remainingDelimiters-- <= 0) { - return; - } - - $newDelimiter->setPrevious($this->top); - - if ($this->top !== null) { - $this->top->setNext($newDelimiter); - } - - $this->top = $newDelimiter; - } - - /** - * @internal - */ - public function addBracket(Node $node, int $index, bool $image): void - { - if ($this->brackets !== null) { - $this->brackets->setHasNext(true); - } - - $this->brackets = new Bracket($node, $this->brackets, $index, $image); - } - - /** - * @psalm-immutable - */ - public function getLastBracket(): ?Bracket - { - return $this->brackets; - } - - private function findEarliest(int $stackBottom): ?DelimiterInterface - { - // Move back to first relevant delim. - $delimiter = $this->top; - $lastChecked = null; - - while ($delimiter !== null && self::getIndex($delimiter) > $stackBottom) { - $lastChecked = $delimiter; - $delimiter = $delimiter->getPrevious(); - } - - return $lastChecked; - } - - /** - * @internal - */ - public function removeBracket(): void - { - if ($this->brackets === null) { - return; - } - - $this->brackets = $this->brackets->getPrevious(); - - if ($this->brackets !== null) { - $this->brackets->setHasNext(false); - } - } - - public function removeDelimiter(DelimiterInterface $delimiter): void - { - if ($delimiter->getPrevious() !== null) { - /** @psalm-suppress PossiblyNullReference */ - $delimiter->getPrevious()->setNext($delimiter->getNext()); - } - - if ($delimiter->getNext() === null) { - // top of stack - $this->top = $delimiter->getPrevious(); - } else { - /** @psalm-suppress PossiblyNullReference */ - $delimiter->getNext()->setPrevious($delimiter->getPrevious()); - } - - // Nullify all references from the removed delimiter to other delimiters. - // All references to this particular delimiter in the linked list should be gone, - // but it's possible we're still hanging on to other references to things that - // have been (or soon will be) removed, which may interfere with efficient - // garbage collection by the PHP runtime. - // Explicitly releasing these references should help to avoid possible - // segfaults like in https://bugs.php.net/bug.php?id=68606. - $delimiter->setPrevious(null); - $delimiter->setNext(null); - - // TODO: Remove the line below once PHP 7.4 support is dropped, as WeakMap won't hold onto the reference, making this unnecessary - unset($this->missingIndexCache[$delimiter]); - } - - private function removeDelimiterAndNode(DelimiterInterface $delimiter): void - { - $delimiter->getInlineNode()->detach(); - $this->removeDelimiter($delimiter); - } - - private function removeDelimitersBetween(DelimiterInterface $opener, DelimiterInterface $closer): void - { - $delimiter = $closer->getPrevious(); - $openerPosition = self::getIndex($opener); - while ($delimiter !== null && self::getIndex($delimiter) > $openerPosition) { - $previous = $delimiter->getPrevious(); - $this->removeDelimiter($delimiter); - $delimiter = $previous; - } - } - - /** - * @param DelimiterInterface|int|null $stackBottom - */ - public function removeAll($stackBottom = null): void - { - $stackBottomPosition = \is_int($stackBottom) ? $stackBottom : self::getIndex($stackBottom); - - while ($this->top && $this->getIndex($this->top) > $stackBottomPosition) { - $this->removeDelimiter($this->top); - } - } - - /** - * @deprecated This method is no longer used internally and will be removed in 3.0 - */ - public function removeEarlierMatches(string $character): void - { - $opener = $this->top; - while ($opener !== null) { - if ($opener->getChar() === $character) { - $opener->setActive(false); - } - - $opener = $opener->getPrevious(); - } - } - - /** - * @internal - */ - public function deactivateLinkOpeners(): void - { - $opener = $this->brackets; - while ($opener !== null && $opener->isActive()) { - $opener->setActive(false); - $opener = $opener->getPrevious(); - } - } - - /** - * @deprecated This method is no longer used internally and will be removed in 3.0 - * - * @param string|string[] $characters - */ - public function searchByCharacter($characters): ?DelimiterInterface - { - if (! \is_array($characters)) { - $characters = [$characters]; - } - - $opener = $this->top; - while ($opener !== null) { - if (\in_array($opener->getChar(), $characters, true)) { - break; - } - - $opener = $opener->getPrevious(); - } - - return $opener; - } - - /** - * @param DelimiterInterface|int|null $stackBottom - * - * @todo change $stackBottom to an int in 3.0 - */ - public function processDelimiters($stackBottom, DelimiterProcessorCollection $processors): void - { - /** @var array $openersBottom */ - $openersBottom = []; - - $stackBottomPosition = \is_int($stackBottom) ? $stackBottom : self::getIndex($stackBottom); - - // Find first closer above stackBottom - $closer = $this->findEarliest($stackBottomPosition); - - // Move forward, looking for closers, and handling each - while ($closer !== null) { - $closingDelimiterChar = $closer->getChar(); - - $delimiterProcessor = $processors->getDelimiterProcessor($closingDelimiterChar); - if (! $closer->canClose() || $delimiterProcessor === null) { - $closer = $closer->getNext(); - continue; - } - - if ($delimiterProcessor instanceof CacheableDelimiterProcessorInterface) { - $openersBottomCacheKey = $delimiterProcessor->getCacheKey($closer); - } else { - $openersBottomCacheKey = $closingDelimiterChar; - } - - $openingDelimiterChar = $delimiterProcessor->getOpeningCharacter(); - - $useDelims = 0; - $openerFound = false; - $potentialOpenerFound = false; - $opener = $closer->getPrevious(); - while ($opener !== null && ($openerPosition = self::getIndex($opener)) > $stackBottomPosition && $openerPosition >= ($openersBottom[$openersBottomCacheKey] ?? 0)) { - if ($opener->canOpen() && $opener->getChar() === $openingDelimiterChar) { - $potentialOpenerFound = true; - $useDelims = $delimiterProcessor->getDelimiterUse($opener, $closer); - if ($useDelims > 0) { - $openerFound = true; - break; - } - } - - $opener = $opener->getPrevious(); - } - - if (! $openerFound) { - // Set lower bound for future searches - // TODO: Remove this conditional check in 3.0. It only exists to prevent behavioral BC breaks in 2.x. - if ($potentialOpenerFound === false || $delimiterProcessor instanceof CacheableDelimiterProcessorInterface) { - $openersBottom[$openersBottomCacheKey] = self::getIndex($closer); - } - - if (! $potentialOpenerFound && ! $closer->canOpen()) { - // We can remove a closer that can't be an opener, - // once we've seen there's no matching opener. - $next = $closer->getNext(); - $this->removeDelimiter($closer); - $closer = $next; - } else { - $closer = $closer->getNext(); - } - - continue; - } - - \assert($opener !== null); - - $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->setLiteral(\substr($openerNode->getLiteral(), 0, -$useDelims)); - $closerNode->setLiteral(\substr($closerNode->getLiteral(), 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); - } - - // phpcs:disable SlevomatCodingStandard.ControlStructures.EarlyExit.EarlyExitNotUsed - if ($closer->getLength() === 0) { - $next = $closer->getNext(); - $this->removeDelimiterAndNode($closer); - $closer = $next; - } - } - - // Remove all delimiters - $this->removeAll($stackBottomPosition); - } - - /** - * @internal - */ - public function __destruct() - { - while ($this->top) { - $this->removeDelimiter($this->top); - } - - while ($this->brackets) { - $this->removeBracket(); - } - } - - /** - * @deprecated This method will be dropped in 3.0 once all delimiters MUST have an index/position - */ - private function getIndex(?DelimiterInterface $delimiter): int - { - if ($delimiter === null) { - return -1; - } - - if (($index = $delimiter->getIndex()) !== null) { - return $index; - } - - if (isset($this->missingIndexCache[$delimiter])) { - return $this->missingIndexCache[$delimiter]; - } - - $prev = $delimiter->getPrevious(); - $next = $delimiter->getNext(); - - $i = 0; - do { - $i++; - if ($prev === null) { - break; - } - - if ($prev->getIndex() !== null) { - return $this->missingIndexCache[$delimiter] = $prev->getIndex() + $i; - } - } while ($prev = $prev->getPrevious()); - - $j = 0; - do { - $j++; - if ($next === null) { - break; - } - - if ($next->getIndex() !== null) { - return $this->missingIndexCache[$delimiter] = $next->getIndex() - $j; - } - } while ($next = $next->getNext()); - - // No index was defined on this delimiter, and none could be guesstimated based on the stack. - return $this->missingIndexCache[$delimiter] = $this->getIndex($delimiter->getPrevious()) + 1; - } -} diff --git a/vendor/league/commonmark/src/Delimiter/Processor/CacheableDelimiterProcessorInterface.php b/vendor/league/commonmark/src/Delimiter/Processor/CacheableDelimiterProcessorInterface.php deleted file mode 100644 index a2a9b7e..0000000 --- a/vendor/league/commonmark/src/Delimiter/Processor/CacheableDelimiterProcessorInterface.php +++ /dev/null @@ -1,46 +0,0 @@ - - * - * 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; - -/** - * Special marker interface for delimiter processors that return dynamic values from getDelimiterUse() - * - * In order to guarantee linear performance of delimiter processing, the delimiter stack must be able to - * cache the lower bound when searching for a matching opener. This gets complicated for delimiter processors - * that use a dynamic number of characters (like with emphasis and its "multiple of 3" rule). - */ -interface CacheableDelimiterProcessorInterface extends DelimiterProcessorInterface -{ - /** - * Returns a cache key of the factors that determine the number of characters to use. - * - * In order to guarantee linear performance of delimiter processing, the delimiter stack must be able to - * cache the lower bound when searching for a matching opener. This lower bound is usually quite simple; - * for example, with quotes, it's just the last opener with that characted. However, this gets complicated - * for delimiter processors that use a dynamic number of characters (like with emphasis and its "multiple - * of 3" rule), because the delimiter length being considered may change during processing because of that - * dynamic logic in getDelimiterUse(). Therefore, we cannot safely cache the lower bound for these dynamic - * processors without knowing the factors that determine the number of characters to use. - * - * At a minimum, this should include the delimiter character, plus any other factors used to determine - * the result of getDelimiterUse(). The format of the string is not important so long as it is unique - * (compared to other processors) and consistent for a given set of factors. - * - * If getDelimiterUse() always returns the same hard-coded value, this method should return just - * the delimiter character. - */ - public function getCacheKey(DelimiterInterface $closer): string; -} 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 6e9f336..0000000 --- a/vendor/league/commonmark/src/Delimiter/Processor/DelimiterProcessorCollection.php +++ /dev/null @@ -1,89 +0,0 @@ - - * - * 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\Exception\InvalidArgumentException; - -final class DelimiterProcessorCollection implements DelimiterProcessorCollectionInterface -{ - /** - * @var array|DelimiterProcessorInterface[] - * - * @psalm-readonly-allow-private-mutation - */ - private array $processorsByChar = []; - - public function add(DelimiterProcessorInterface $processor): void - { - $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; - } - - /** - * @return string[] - */ - 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; - } - - public function count(): int - { - return \count($this->processorsByChar); - } -} 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 fea3ddb..0000000 --- a/vendor/league/commonmark/src/Delimiter/Processor/DelimiterProcessorCollectionInterface.php +++ /dev/null @@ -1,46 +0,0 @@ - - * - * 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\Exception\InvalidArgumentException; - -interface DelimiterProcessorCollectionInterface extends \Countable -{ - /** - * 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 - */ - public function add(DelimiterProcessorInterface $processor): void; - - /** - * Returns the delim processor which handles the given character if one exists - */ - 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 5e88ddc..0000000 --- a/vendor/league/commonmark/src/Delimiter/Processor/DelimiterProcessorInterface.php +++ /dev/null @@ -1,81 +0,0 @@ - - * - * 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\Node\Inline\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. - */ - 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. - */ - public function getClosingCharacter(): string; - - /** - * Minimum number of delimiter characters that are needed to active this. - * - * Must be at least 1. - */ - 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. - * - * IMPORTANT: Unless this method returns the same hard-coded value in all cases, - * you MUST implement the CacheableDelimiterProcessorInterface interface instead. - * - * @param DelimiterInterface $opener The opening delimiter run - * @param DelimiterInterface $closer The closing delimiter run - */ - 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 - */ - public function process(AbstractStringContainer $opener, AbstractStringContainer $closer, int $delimiterUse): void; -} 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 7d33e83..0000000 --- a/vendor/league/commonmark/src/Delimiter/Processor/StaggeredDelimiterProcessor.php +++ /dev/null @@ -1,111 +0,0 @@ - - * - * 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\Exception\InvalidArgumentException; -use League\CommonMark\Node\Inline\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 -{ - /** @psalm-readonly */ - private string $delimiterChar; - - /** @psalm-readonly-allow-private-mutation */ - private int $minLength = 0; - - /** - * @var array|DelimiterProcessorInterface[] - * - * @psalm-readonly-allow-private-mutation - */ - private array $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 - * - * @throws InvalidArgumentException if attempting to add another processors for the same character and minimum length - */ - public function add(DelimiterProcessorInterface $processor): void - { - $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): void - { - $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 - $first = \reset($this->processors); - \assert($first instanceof DelimiterProcessorInterface); - - return $first; - } -} diff --git a/vendor/league/commonmark/src/Environment/Environment.php b/vendor/league/commonmark/src/Environment/Environment.php deleted file mode 100644 index a811296..0000000 --- a/vendor/league/commonmark/src/Environment/Environment.php +++ /dev/null @@ -1,448 +0,0 @@ - - * - * 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\Environment; - -use League\CommonMark\Delimiter\DelimiterParser; -use League\CommonMark\Delimiter\Processor\DelimiterProcessorCollection; -use League\CommonMark\Delimiter\Processor\DelimiterProcessorInterface; -use League\CommonMark\Event\DocumentParsedEvent; -use League\CommonMark\Event\ListenerData; -use League\CommonMark\Exception\AlreadyInitializedException; -use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension; -use League\CommonMark\Extension\ConfigurableExtensionInterface; -use League\CommonMark\Extension\ExtensionInterface; -use League\CommonMark\Extension\GithubFlavoredMarkdownExtension; -use League\CommonMark\Normalizer\SlugNormalizer; -use League\CommonMark\Normalizer\TextNormalizerInterface; -use League\CommonMark\Normalizer\UniqueSlugNormalizer; -use League\CommonMark\Normalizer\UniqueSlugNormalizerInterface; -use League\CommonMark\Parser\Block\BlockStartParserInterface; -use League\CommonMark\Parser\Block\SkipLinesStartingWithLettersParser; -use League\CommonMark\Parser\Inline\InlineParserInterface; -use League\CommonMark\Renderer\NodeRendererInterface; -use League\CommonMark\Util\HtmlFilter; -use League\CommonMark\Util\PrioritizedList; -use League\Config\Configuration; -use League\Config\ConfigurationAwareInterface; -use League\Config\ConfigurationInterface; -use Nette\Schema\Expect; -use Psr\EventDispatcher\EventDispatcherInterface; -use Psr\EventDispatcher\ListenerProviderInterface; -use Psr\EventDispatcher\StoppableEventInterface; - -final class Environment implements EnvironmentInterface, EnvironmentBuilderInterface, ListenerProviderInterface -{ - /** - * @var ExtensionInterface[] - * - * @psalm-readonly-allow-private-mutation - */ - private array $extensions = []; - - /** - * @var ExtensionInterface[] - * - * @psalm-readonly-allow-private-mutation - */ - private array $uninitializedExtensions = []; - - /** @psalm-readonly-allow-private-mutation */ - private bool $extensionsInitialized = false; - - /** - * @var PrioritizedList - * - * @psalm-readonly - */ - private PrioritizedList $blockStartParsers; - - /** - * @var PrioritizedList - * - * @psalm-readonly - */ - private PrioritizedList $inlineParsers; - - /** @psalm-readonly */ - private DelimiterProcessorCollection $delimiterProcessors; - - /** - * @var array> - * - * @psalm-readonly-allow-private-mutation - */ - private array $renderersByClass = []; - - /** - * @var PrioritizedList - * - * @psalm-readonly-allow-private-mutation - */ - private PrioritizedList $listenerData; - - private ?EventDispatcherInterface $eventDispatcher = null; - - /** @psalm-readonly */ - private Configuration $config; - - private ?TextNormalizerInterface $slugNormalizer = null; - - /** - * @param array $config - */ - public function __construct(array $config = []) - { - $this->config = self::createDefaultConfiguration(); - $this->config->merge($config); - - $this->blockStartParsers = new PrioritizedList(); - $this->inlineParsers = new PrioritizedList(); - $this->listenerData = new PrioritizedList(); - $this->delimiterProcessors = new DelimiterProcessorCollection(); - - // Performance optimization: always include a block "parser" that aborts parsing if a line starts with a letter - // and is therefore unlikely to match any lines as a block start. - $this->addBlockStartParser(new SkipLinesStartingWithLettersParser(), 249); - } - - public function getConfiguration(): ConfigurationInterface - { - return $this->config->reader(); - } - - /** - * @deprecated Environment::mergeConfig() is deprecated since league/commonmark v2.0 and will be removed in v3.0. Configuration should be set when instantiating the environment instead. - * - * @param array $config - */ - public function mergeConfig(array $config): void - { - @\trigger_error('Environment::mergeConfig() is deprecated since league/commonmark v2.0 and will be removed in v3.0. Configuration should be set when instantiating the environment instead.', \E_USER_DEPRECATED); - - $this->assertUninitialized('Failed to modify configuration.'); - - $this->config->merge($config); - } - - public function addBlockStartParser(BlockStartParserInterface $parser, int $priority = 0): EnvironmentBuilderInterface - { - $this->assertUninitialized('Failed to add block start parser.'); - - $this->blockStartParsers->add($parser, $priority); - $this->injectEnvironmentAndConfigurationIfNeeded($parser); - - return $this; - } - - public function addInlineParser(InlineParserInterface $parser, int $priority = 0): EnvironmentBuilderInterface - { - $this->assertUninitialized('Failed to add inline parser.'); - - $this->inlineParsers->add($parser, $priority); - $this->injectEnvironmentAndConfigurationIfNeeded($parser); - - return $this; - } - - public function addDelimiterProcessor(DelimiterProcessorInterface $processor): EnvironmentBuilderInterface - { - $this->assertUninitialized('Failed to add delimiter processor.'); - $this->delimiterProcessors->add($processor); - $this->injectEnvironmentAndConfigurationIfNeeded($processor); - - return $this; - } - - public function addRenderer(string $nodeClass, NodeRendererInterface $renderer, int $priority = 0): EnvironmentBuilderInterface - { - $this->assertUninitialized('Failed to add renderer.'); - - if (! isset($this->renderersByClass[$nodeClass])) { - $this->renderersByClass[$nodeClass] = new PrioritizedList(); - } - - $this->renderersByClass[$nodeClass]->add($renderer, $priority); - $this->injectEnvironmentAndConfigurationIfNeeded($renderer); - - return $this; - } - - /** - * {@inheritDoc} - */ - public function getBlockStartParsers(): iterable - { - if (! $this->extensionsInitialized) { - $this->initializeExtensions(); - } - - return $this->blockStartParsers->getIterator(); - } - - public function getDelimiterProcessors(): DelimiterProcessorCollection - { - if (! $this->extensionsInitialized) { - $this->initializeExtensions(); - } - - return $this->delimiterProcessors; - } - - /** - * {@inheritDoc} - */ - public function getRenderersForClass(string $nodeClass): iterable - { - if (! $this->extensionsInitialized) { - $this->initializeExtensions(); - } - - // If renderers are defined for this specific class, return them immediately - if (isset($this->renderersByClass[$nodeClass])) { - return $this->renderersByClass[$nodeClass]; - } - - /** @psalm-suppress TypeDoesNotContainType -- Bug: https://github.com/vimeo/psalm/issues/3332 */ - while (\class_exists($parent ??= $nodeClass) && $parent = \get_parent_class($parent)) { - if (! isset($this->renderersByClass[$parent])) { - continue; - } - - // "Cache" this result to avoid future loops - return $this->renderersByClass[$nodeClass] = $this->renderersByClass[$parent]; - } - - return []; - } - - /** - * {@inheritDoc} - */ - public function getExtensions(): iterable - { - return $this->extensions; - } - - /** - * Add a single extension - * - * @return $this - */ - public function addExtension(ExtensionInterface $extension): EnvironmentBuilderInterface - { - $this->assertUninitialized('Failed to add extension.'); - - $this->extensions[] = $extension; - $this->uninitializedExtensions[] = $extension; - - if ($extension instanceof ConfigurableExtensionInterface) { - $extension->configureSchema($this->config); - } - - return $this; - } - - private function initializeExtensions(): void - { - // Initialize the slug normalizer - $this->getSlugNormalizer(); - - // Ask all extensions to register their components - while (\count($this->uninitializedExtensions) > 0) { - foreach ($this->uninitializedExtensions as $i => $extension) { - $extension->register($this); - unset($this->uninitializedExtensions[$i]); - } - } - - $this->extensionsInitialized = true; - - // Create the special delimiter parser if any processors were registered - if ($this->delimiterProcessors->count() > 0) { - $this->inlineParsers->add(new DelimiterParser($this->delimiterProcessors), PHP_INT_MIN); - } - } - - private function injectEnvironmentAndConfigurationIfNeeded(object $object): void - { - if ($object instanceof EnvironmentAwareInterface) { - $object->setEnvironment($this); - } - - if ($object instanceof ConfigurationAwareInterface) { - $object->setConfiguration($this->config->reader()); - } - } - - /** - * @deprecated Instantiate the environment and add the extension yourself - * - * @param array $config - */ - public static function createCommonMarkEnvironment(array $config = []): Environment - { - $environment = new self($config); - $environment->addExtension(new CommonMarkCoreExtension()); - - return $environment; - } - - /** - * @deprecated Instantiate the environment and add the extension yourself - * - * @param array $config - */ - public static function createGFMEnvironment(array $config = []): Environment - { - $environment = new self($config); - $environment->addExtension(new CommonMarkCoreExtension()); - $environment->addExtension(new GithubFlavoredMarkdownExtension()); - - return $environment; - } - - public function addEventListener(string $eventClass, callable $listener, int $priority = 0): EnvironmentBuilderInterface - { - $this->assertUninitialized('Failed to add event listener.'); - - $this->listenerData->add(new ListenerData($eventClass, $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(object $event): object - { - if (! $this->extensionsInitialized) { - $this->initializeExtensions(); - } - - if ($this->eventDispatcher !== null) { - return $this->eventDispatcher->dispatch($event); - } - - foreach ($this->getListenersForEvent($event) as $listener) { - if ($event instanceof StoppableEventInterface && $event->isPropagationStopped()) { - return $event; - } - - $listener($event); - } - - return $event; - } - - public function setEventDispatcher(EventDispatcherInterface $dispatcher): void - { - $this->eventDispatcher = $dispatcher; - } - - /** - * {@inheritDoc} - * - * @return iterable - */ - public function getListenersForEvent(object $event): iterable - { - foreach ($this->listenerData as $listenerData) { - \assert($listenerData instanceof ListenerData); - - /** @psalm-suppress ArgumentTypeCoercion */ - if (! \is_a($event, $listenerData->getEvent())) { - continue; - } - - yield function (object $event) use ($listenerData) { - if (! $this->extensionsInitialized) { - $this->initializeExtensions(); - } - - return \call_user_func($listenerData->getListener(), $event); - }; - } - } - - /** - * @return iterable - */ - public function getInlineParsers(): iterable - { - if (! $this->extensionsInitialized) { - $this->initializeExtensions(); - } - - return $this->inlineParsers->getIterator(); - } - - public function getSlugNormalizer(): TextNormalizerInterface - { - if ($this->slugNormalizer === null) { - $normalizer = $this->config->get('slug_normalizer/instance'); - \assert($normalizer instanceof TextNormalizerInterface); - $this->injectEnvironmentAndConfigurationIfNeeded($normalizer); - - if ($this->config->get('slug_normalizer/unique') !== UniqueSlugNormalizerInterface::DISABLED && ! $normalizer instanceof UniqueSlugNormalizer) { - $normalizer = new UniqueSlugNormalizer($normalizer); - } - - if ($normalizer instanceof UniqueSlugNormalizer) { - if ($this->config->get('slug_normalizer/unique') === UniqueSlugNormalizerInterface::PER_DOCUMENT) { - $this->addEventListener(DocumentParsedEvent::class, [$normalizer, 'clearHistory'], -1000); - } - } - - $this->slugNormalizer = $normalizer; - } - - return $this->slugNormalizer; - } - - /** - * @throws AlreadyInitializedException - */ - private function assertUninitialized(string $message): void - { - if ($this->extensionsInitialized) { - throw new AlreadyInitializedException($message . ' Extensions have already been initialized.'); - } - } - - public static function createDefaultConfiguration(): Configuration - { - return new Configuration([ - 'html_input' => Expect::anyOf(HtmlFilter::STRIP, HtmlFilter::ALLOW, HtmlFilter::ESCAPE)->default(HtmlFilter::ALLOW), - 'allow_unsafe_links' => Expect::bool(true), - 'max_nesting_level' => Expect::type('int')->default(PHP_INT_MAX), - 'max_delimiters_per_line' => Expect::type('int')->default(PHP_INT_MAX), - 'renderer' => Expect::structure([ - 'block_separator' => Expect::string("\n"), - 'inner_separator' => Expect::string("\n"), - 'soft_break' => Expect::string("\n"), - ]), - 'slug_normalizer' => Expect::structure([ - 'instance' => Expect::type(TextNormalizerInterface::class)->default(new SlugNormalizer()), - 'max_length' => Expect::int()->min(0)->default(255), - 'unique' => Expect::anyOf(UniqueSlugNormalizerInterface::DISABLED, UniqueSlugNormalizerInterface::PER_ENVIRONMENT, UniqueSlugNormalizerInterface::PER_DOCUMENT)->default(UniqueSlugNormalizerInterface::PER_DOCUMENT), - ]), - ]); - } -} diff --git a/vendor/league/commonmark/src/Environment/EnvironmentAwareInterface.php b/vendor/league/commonmark/src/Environment/EnvironmentAwareInterface.php deleted file mode 100644 index 44b9d3e..0000000 --- a/vendor/league/commonmark/src/Environment/EnvironmentAwareInterface.php +++ /dev/null @@ -1,19 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Environment; - -interface EnvironmentAwareInterface -{ - public function setEnvironment(EnvironmentInterface $environment): void; -} diff --git a/vendor/league/commonmark/src/Environment/EnvironmentBuilderInterface.php b/vendor/league/commonmark/src/Environment/EnvironmentBuilderInterface.php deleted file mode 100644 index 4df9761..0000000 --- a/vendor/league/commonmark/src/Environment/EnvironmentBuilderInterface.php +++ /dev/null @@ -1,97 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Environment; - -use League\CommonMark\Delimiter\Processor\DelimiterProcessorInterface; -use League\CommonMark\Exception\AlreadyInitializedException; -use League\CommonMark\Extension\ExtensionInterface; -use League\CommonMark\Node\Node; -use League\CommonMark\Parser\Block\BlockStartParserInterface; -use League\CommonMark\Parser\Inline\InlineParserInterface; -use League\CommonMark\Renderer\NodeRendererInterface; -use League\Config\ConfigurationProviderInterface; - -/** - * Interface for building the Environment with any extensions, parsers, listeners, etc. that it may need - */ -interface EnvironmentBuilderInterface extends ConfigurationProviderInterface -{ - /** - * Registers the given extension with the Environment - * - * @throws AlreadyInitializedException if the Environment has already been initialized - */ - public function addExtension(ExtensionInterface $extension): EnvironmentBuilderInterface; - - /** - * Registers the given block start parser with the Environment - * - * @param BlockStartParserInterface $parser Block parser instance - * @param int $priority Priority (a higher number will be executed earlier) - * - * @return $this - * - * @throws AlreadyInitializedException if the Environment has already been initialized - */ - public function addBlockStartParser(BlockStartParserInterface $parser, int $priority = 0): EnvironmentBuilderInterface; - - /** - * 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 $this - * - * @throws AlreadyInitializedException if the Environment has already been initialized - */ - public function addInlineParser(InlineParserInterface $parser, int $priority = 0): EnvironmentBuilderInterface; - - /** - * Registers the given delimiter processor with the Environment - * - * @param DelimiterProcessorInterface $processor Delimiter processors instance - * - * @throws AlreadyInitializedException if the Environment has already been initialized - */ - public function addDelimiterProcessor(DelimiterProcessorInterface $processor): EnvironmentBuilderInterface; - - /** - * Registers the given node renderer with the Environment - * - * @param string $nodeClass The fully-qualified node element class name the renderer below should handle - * @param NodeRendererInterface $renderer The renderer responsible for rendering the type of element given above - * @param int $priority Priority (a higher number will be executed earlier) - * - * @psalm-param class-string $nodeClass - * - * @return $this - * - * @throws AlreadyInitializedException if the Environment has already been initialized - */ - public function addRenderer(string $nodeClass, NodeRendererInterface $renderer, int $priority = 0): EnvironmentBuilderInterface; - - /** - * Registers the given event listener - * - * @param class-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 $this - * - * @throws AlreadyInitializedException if the Environment has already been initialized - */ - public function addEventListener(string $eventClass, callable $listener, int $priority = 0): EnvironmentBuilderInterface; -} diff --git a/vendor/league/commonmark/src/Environment/EnvironmentInterface.php b/vendor/league/commonmark/src/Environment/EnvironmentInterface.php deleted file mode 100644 index 8e19a52..0000000 --- a/vendor/league/commonmark/src/Environment/EnvironmentInterface.php +++ /dev/null @@ -1,55 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Environment; - -use League\CommonMark\Delimiter\Processor\DelimiterProcessorCollection; -use League\CommonMark\Extension\ExtensionInterface; -use League\CommonMark\Node\Node; -use League\CommonMark\Normalizer\TextNormalizerInterface; -use League\CommonMark\Parser\Block\BlockStartParserInterface; -use League\CommonMark\Parser\Inline\InlineParserInterface; -use League\CommonMark\Renderer\NodeRendererInterface; -use League\Config\ConfigurationProviderInterface; -use Psr\EventDispatcher\EventDispatcherInterface; - -interface EnvironmentInterface extends ConfigurationProviderInterface, EventDispatcherInterface -{ - /** - * Get all registered extensions - * - * @return ExtensionInterface[] - */ - public function getExtensions(): iterable; - - /** - * @return iterable - */ - public function getBlockStartParsers(): iterable; - - /** - * @return iterable - */ - public function getInlineParsers(): iterable; - - public function getDelimiterProcessors(): DelimiterProcessorCollection; - - /** - * @psalm-param class-string $nodeClass - * - * @return iterable - */ - public function getRenderersForClass(string $nodeClass): iterable; - - public function getSlugNormalizer(): TextNormalizerInterface; -} diff --git a/vendor/league/commonmark/src/Event/AbstractEvent.php b/vendor/league/commonmark/src/Event/AbstractEvent.php deleted file mode 100644 index 8c83f92..0000000 --- a/vendor/league/commonmark/src/Event/AbstractEvent.php +++ /dev/null @@ -1,54 +0,0 @@ - - * - * Original code based on the Symfony EventDispatcher "Event" contract - * - (c) 2018-2019 Fabien Potencier - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Event; - -use Psr\EventDispatcher\StoppableEventInterface; - -/** - * Base class for classes containing event data. - * - * This class contains no event data. It is used by events that do not pass - * state information to an event handler when an event is raised. - * - * You can call the method stopPropagation() to abort the execution of - * further listeners in your event listener. - */ -abstract class AbstractEvent implements StoppableEventInterface -{ - /** @psalm-readonly-allow-private-mutation */ - private bool $propagationStopped = false; - - /** - * Returns whether further event listeners should be triggered. - */ - final public function isPropagationStopped(): bool - { - return $this->propagationStopped; - } - - /** - * Stops the propagation of the event to further event listeners. - * - * If multiple event listeners are connected to the same event, no - * further event listener will be triggered once any trigger calls - * stopPropagation(). - */ - final public function stopPropagation(): void - { - $this->propagationStopped = true; - } -} diff --git a/vendor/league/commonmark/src/Event/DocumentParsedEvent.php b/vendor/league/commonmark/src/Event/DocumentParsedEvent.php deleted file mode 100644 index 04664c5..0000000 --- a/vendor/league/commonmark/src/Event/DocumentParsedEvent.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Event; - -use League\CommonMark\Node\Block\Document; - -/** - * Event dispatched when the document has been fully parsed - */ -final class DocumentParsedEvent extends AbstractEvent -{ - /** @psalm-readonly */ - private Document $document; - - public function __construct(Document $document) - { - $this->document = $document; - } - - public function getDocument(): Document - { - return $this->document; - } -} diff --git a/vendor/league/commonmark/src/Event/DocumentPreParsedEvent.php b/vendor/league/commonmark/src/Event/DocumentPreParsedEvent.php deleted file mode 100644 index ad72512..0000000 --- a/vendor/league/commonmark/src/Event/DocumentPreParsedEvent.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Event; - -use League\CommonMark\Input\MarkdownInputInterface; -use League\CommonMark\Node\Block\Document; - -/** - * Event dispatched when the document is about to be parsed - */ -final class DocumentPreParsedEvent extends AbstractEvent -{ - /** @psalm-readonly */ - private Document $document; - - private MarkdownInputInterface $markdown; - - public function __construct(Document $document, MarkdownInputInterface $markdown) - { - $this->document = $document; - $this->markdown = $markdown; - } - - public function getDocument(): Document - { - return $this->document; - } - - public function getMarkdown(): MarkdownInputInterface - { - return $this->markdown; - } - - public function replaceMarkdown(MarkdownInputInterface $markdownInput): void - { - $this->markdown = $markdownInput; - } -} diff --git a/vendor/league/commonmark/src/Event/DocumentPreRenderEvent.php b/vendor/league/commonmark/src/Event/DocumentPreRenderEvent.php deleted file mode 100644 index c569ca3..0000000 --- a/vendor/league/commonmark/src/Event/DocumentPreRenderEvent.php +++ /dev/null @@ -1,44 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Event; - -use League\CommonMark\Node\Block\Document; - -/** - * Event dispatched just before rendering begins - */ -final class DocumentPreRenderEvent extends AbstractEvent -{ - /** @psalm-readonly */ - private Document $document; - - /** @psalm-readonly */ - private string $format; - - public function __construct(Document $document, string $format) - { - $this->document = $document; - $this->format = $format; - } - - public function getDocument(): Document - { - return $this->document; - } - - public function getFormat(): string - { - return $this->format; - } -} diff --git a/vendor/league/commonmark/src/Event/DocumentRenderedEvent.php b/vendor/league/commonmark/src/Event/DocumentRenderedEvent.php deleted file mode 100644 index 7e49d01..0000000 --- a/vendor/league/commonmark/src/Event/DocumentRenderedEvent.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace League\CommonMark\Event; - -use League\CommonMark\Output\RenderedContentInterface; - -final class DocumentRenderedEvent extends AbstractEvent -{ - private RenderedContentInterface $output; - - public function __construct(RenderedContentInterface $output) - { - $this->output = $output; - } - - /** - * @psalm-mutation-free - */ - public function getOutput(): RenderedContentInterface - { - return $this->output; - } - - /** - * @psalm-external-mutation-free - */ - public function replaceOutput(RenderedContentInterface $output): void - { - $this->output = $output; - } -} diff --git a/vendor/league/commonmark/src/Event/ListenerData.php b/vendor/league/commonmark/src/Event/ListenerData.php deleted file mode 100644 index 4cf3b3a..0000000 --- a/vendor/league/commonmark/src/Event/ListenerData.php +++ /dev/null @@ -1,50 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Event; - -/** - * @internal - * - * @psalm-immutable - */ -final class ListenerData -{ - /** @var class-string */ - private string $event; - - /** @var callable */ - private $listener; - - /** - * @param class-string $event - */ - public function __construct(string $event, callable $listener) - { - $this->event = $event; - $this->listener = $listener; - } - - /** - * @return class-string - */ - public function getEvent(): string - { - return $this->event; - } - - public function getListener(): callable - { - return $this->listener; - } -} diff --git a/vendor/league/commonmark/src/Exception/AlreadyInitializedException.php b/vendor/league/commonmark/src/Exception/AlreadyInitializedException.php deleted file mode 100644 index 5faa6f8..0000000 --- a/vendor/league/commonmark/src/Exception/AlreadyInitializedException.php +++ /dev/null @@ -1,18 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Exception; - -class AlreadyInitializedException extends LogicException implements CommonMarkException -{ -} diff --git a/vendor/league/commonmark/src/Exception/CommonMarkException.php b/vendor/league/commonmark/src/Exception/CommonMarkException.php deleted file mode 100644 index 9fb349e..0000000 --- a/vendor/league/commonmark/src/Exception/CommonMarkException.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Exception; - -/** - * Marker interface for all exceptions thrown by this library. - */ -interface CommonMarkException extends \Throwable -{ -} diff --git a/vendor/league/commonmark/src/Exception/IOException.php b/vendor/league/commonmark/src/Exception/IOException.php deleted file mode 100644 index 09a5578..0000000 --- a/vendor/league/commonmark/src/Exception/IOException.php +++ /dev/null @@ -1,18 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Exception; - -class IOException extends \RuntimeException implements CommonMarkException -{ -} diff --git a/vendor/league/commonmark/src/Exception/InvalidArgumentException.php b/vendor/league/commonmark/src/Exception/InvalidArgumentException.php deleted file mode 100644 index fc67ac4..0000000 --- a/vendor/league/commonmark/src/Exception/InvalidArgumentException.php +++ /dev/null @@ -1,18 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Exception; - -class InvalidArgumentException extends \InvalidArgumentException implements CommonMarkException -{ -} diff --git a/vendor/league/commonmark/src/Exception/LogicException.php b/vendor/league/commonmark/src/Exception/LogicException.php deleted file mode 100644 index c1d00df..0000000 --- a/vendor/league/commonmark/src/Exception/LogicException.php +++ /dev/null @@ -1,18 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Exception; - -class LogicException extends \LogicException implements CommonMarkException -{ -} diff --git a/vendor/league/commonmark/src/Exception/MissingDependencyException.php b/vendor/league/commonmark/src/Exception/MissingDependencyException.php deleted file mode 100644 index b8eb841..0000000 --- a/vendor/league/commonmark/src/Exception/MissingDependencyException.php +++ /dev/null @@ -1,18 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Exception; - -class MissingDependencyException extends \RuntimeException implements CommonMarkException -{ -} diff --git a/vendor/league/commonmark/src/Exception/UnexpectedEncodingException.php b/vendor/league/commonmark/src/Exception/UnexpectedEncodingException.php deleted file mode 100644 index 0f4e399..0000000 --- a/vendor/league/commonmark/src/Exception/UnexpectedEncodingException.php +++ /dev/null @@ -1,18 +0,0 @@ - - * - * 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 implements CommonMarkException -{ -} 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 2ef3d85..0000000 --- a/vendor/league/commonmark/src/Extension/Attributes/AttributesExtension.php +++ /dev/null @@ -1,32 +0,0 @@ - - * (c) 2015 Martin Hasoň - * - * 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\Environment\EnvironmentBuilderInterface; -use League\CommonMark\Event\DocumentParsedEvent; -use League\CommonMark\Extension\Attributes\Event\AttributesListener; -use League\CommonMark\Extension\Attributes\Parser\AttributesBlockStartParser; -use League\CommonMark\Extension\Attributes\Parser\AttributesInlineParser; -use League\CommonMark\Extension\ExtensionInterface; - -final class AttributesExtension implements ExtensionInterface -{ - public function register(EnvironmentBuilderInterface $environment): void - { - $environment->addBlockStartParser(new AttributesBlockStartParser()); - $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 feec8cc..0000000 --- a/vendor/league/commonmark/src/Extension/Attributes/Event/AttributesListener.php +++ /dev/null @@ -1,139 +0,0 @@ - - * (c) 2015 Martin Hasoň - * - * 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\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\Extension\CommonMark\Node\Block\FencedCode; -use League\CommonMark\Extension\CommonMark\Node\Block\ListBlock; -use League\CommonMark\Extension\CommonMark\Node\Block\ListItem; -use League\CommonMark\Node\Inline\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 - { - foreach ($event->getDocument()->iterator() as $node) { - if (! ($node instanceof Attributes || $node instanceof AttributesInline)) { - continue; - } - - [$target, $direction] = self::findTargetAndDirection($node); - - if ($target instanceof Node) { - $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->set('attributes', $attributes); - } - - $node->detach(); - } - } - - /** - * @param Attributes|AttributesInline $node - * - * @return array - */ - private static function findTargetAndDirection($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]; - } - - /** - * Get any previous block (sibling or parent) this might apply to - */ - private static function getPrevious(?Node $node = null): ?Node - { - if ($node instanceof Attributes) { - if ($node->getTarget() === Attributes::TARGET_NEXT) { - return null; - } - - if ($node->getTarget() === Attributes::TARGET_PARENT) { - return $node->parent(); - } - } - - return $node instanceof Node ? $node->previous() : null; - } - - /** - * Get any previous block (sibling or parent) this might apply to - */ - private static function getNext(?Node $node = null): ?Node - { - if ($node instanceof Attributes && $node->getTarget() !== Attributes::TARGET_NEXT) { - return null; - } - - return $node instanceof Node ? $node->next() : null; - } - - 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 096f04a..0000000 --- a/vendor/league/commonmark/src/Extension/Attributes/Node/Attributes.php +++ /dev/null @@ -1,65 +0,0 @@ - - * (c) 2015 Martin Hasoň - * - * 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\Node\Block\AbstractBlock; - -final class Attributes extends AbstractBlock -{ - public const TARGET_PARENT = 0; - public const TARGET_PREVIOUS = 1; - public const TARGET_NEXT = 2; - - /** @var array */ - private array $attributes; - - private int $target = self::TARGET_NEXT; - - /** - * @param array $attributes - */ - public function __construct(array $attributes) - { - parent::__construct(); - - $this->attributes = $attributes; - } - - /** - * @return array - */ - public function getAttributes(): array - { - return $this->attributes; - } - - /** - * @param array $attributes - */ - public function setAttributes(array $attributes): void - { - $this->attributes = $attributes; - } - - public function getTarget(): int - { - return $this->target; - } - - public function setTarget(int $target): void - { - $this->target = $target; - } -} 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 d8b0d08..0000000 --- a/vendor/league/commonmark/src/Extension/Attributes/Node/AttributesInline.php +++ /dev/null @@ -1,57 +0,0 @@ - - * (c) 2015 Martin Hasoň - * - * 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\Node\Inline\AbstractInline; - -final class AttributesInline extends AbstractInline -{ - /** @var array */ - private array $attributes; - - private bool $block; - - /** - * @param array $attributes - */ - public function __construct(array $attributes, bool $block) - { - parent::__construct(); - - $this->attributes = $attributes; - $this->block = $block; - } - - /** - * @return array - */ - public function getAttributes(): array - { - return $this->attributes; - } - - /** - * @param array $attributes - */ - public function setAttributes(array $attributes): void - { - $this->attributes = $attributes; - } - - public function isBlock(): bool - { - return $this->block; - } -} diff --git a/vendor/league/commonmark/src/Extension/Attributes/Parser/AttributesBlockContinueParser.php b/vendor/league/commonmark/src/Extension/Attributes/Parser/AttributesBlockContinueParser.php deleted file mode 100644 index 6e0cdc6..0000000 --- a/vendor/league/commonmark/src/Extension/Attributes/Parser/AttributesBlockContinueParser.php +++ /dev/null @@ -1,92 +0,0 @@ - - * (c) 2015 Martin Hasoň - * - * 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\Attributes; -use League\CommonMark\Extension\Attributes\Util\AttributesHelper; -use League\CommonMark\Node\Block\AbstractBlock; -use League\CommonMark\Parser\Block\AbstractBlockContinueParser; -use League\CommonMark\Parser\Block\BlockContinue; -use League\CommonMark\Parser\Block\BlockContinueParserInterface; -use League\CommonMark\Parser\Cursor; - -final class AttributesBlockContinueParser extends AbstractBlockContinueParser -{ - private Attributes $block; - - private AbstractBlock $container; - - private bool $hasSubsequentLine = false; - - /** - * @param array $attributes The attributes identified by the block start parser - * @param AbstractBlock $container The node we were in when these attributes were discovered - */ - public function __construct(array $attributes, AbstractBlock $container) - { - $this->block = new Attributes($attributes); - - $this->container = $container; - } - - public function getBlock(): AbstractBlock - { - return $this->block; - } - - public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue - { - $this->hasSubsequentLine = true; - - $cursor->advanceToNextNonSpaceOrTab(); - - // Does this next line also have attributes? - $attributes = AttributesHelper::parseAttributes($cursor); - $cursor->advanceToNextNonSpaceOrTab(); - if ($cursor->isAtEnd() && $attributes !== []) { - // It does! Merge them into what we parsed previously - $this->block->setAttributes(AttributesHelper::mergeAttributes( - $this->block->getAttributes(), - $attributes - )); - - // Tell the core parser we've consumed everything - return BlockContinue::at($cursor); - } - - // Okay, so there are no attributes on the next line - // If this next line is blank we know we can't target the next node, it must be a previous one - if ($cursor->isBlank()) { - $this->block->setTarget(Attributes::TARGET_PREVIOUS); - } - - return BlockContinue::none(); - } - - public function closeBlock(): void - { - // Attributes appearing at the very end of the document won't have any last lines to check - // so we can make that determination here - if (! $this->hasSubsequentLine) { - $this->block->setTarget(Attributes::TARGET_PREVIOUS); - } - - // We know this block must apply to the "previous" block, but that could be a sibling or parent, - // so we check the containing block to see which one it might be. - if ($this->block->getTarget() === Attributes::TARGET_PREVIOUS && $this->block->parent() === $this->container) { - $this->block->setTarget(Attributes::TARGET_PARENT); - } - } -} diff --git a/vendor/league/commonmark/src/Extension/Attributes/Parser/AttributesBlockStartParser.php b/vendor/league/commonmark/src/Extension/Attributes/Parser/AttributesBlockStartParser.php deleted file mode 100644 index 299ccd4..0000000 --- a/vendor/league/commonmark/src/Extension/Attributes/Parser/AttributesBlockStartParser.php +++ /dev/null @@ -1,40 +0,0 @@ - - * (c) 2015 Martin Hasoň - * - * 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\Util\AttributesHelper; -use League\CommonMark\Parser\Block\BlockStart; -use League\CommonMark\Parser\Block\BlockStartParserInterface; -use League\CommonMark\Parser\Cursor; -use League\CommonMark\Parser\MarkdownParserStateInterface; - -final class AttributesBlockStartParser implements BlockStartParserInterface -{ - public function tryStart(Cursor $cursor, MarkdownParserStateInterface $parserState): ?BlockStart - { - $originalPosition = $cursor->getPosition(); - $attributes = AttributesHelper::parseAttributes($cursor); - - if ($attributes === [] && $originalPosition === $cursor->getPosition()) { - return BlockStart::none(); - } - - if ($cursor->getNextNonSpaceCharacter() !== null) { - return BlockStart::none(); - } - - return BlockStart::of(new AttributesBlockContinueParser($attributes, $parserState->getActiveBlockParser()->getBlock()))->at($cursor); - } -} 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 26af3ca..0000000 --- a/vendor/league/commonmark/src/Extension/Attributes/Parser/AttributesInlineParser.php +++ /dev/null @@ -1,54 +0,0 @@ - - * (c) 2015 Martin Hasoň - * - * 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\Node\StringContainerInterface; -use League\CommonMark\Parser\Inline\InlineParserInterface; -use League\CommonMark\Parser\Inline\InlineParserMatch; -use League\CommonMark\Parser\InlineParserContext; - -final class AttributesInlineParser implements InlineParserInterface -{ - public function getMatchDefinition(): InlineParserMatch - { - return InlineParserMatch::string('{'); - } - - public function parse(InlineParserContext $inlineContext): bool - { - $cursor = $inlineContext->getCursor(); - $char = (string) $cursor->peek(-1); - - $attributes = AttributesHelper::parseAttributes($cursor); - if ($attributes === []) { - return false; - } - - if ($char === ' ' && ($prev = $inlineContext->getContainer()->lastChild()) instanceof StringContainerInterface) { - $prev->setLiteral(\rtrim($prev->getLiteral(), ' ')); - } - - 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 d13a565..0000000 --- a/vendor/league/commonmark/src/Extension/Attributes/Util/AttributesHelper.php +++ /dev/null @@ -1,142 +0,0 @@ - - * (c) 2015 Martin Hasoň - * - * 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\Node\Node; -use League\CommonMark\Parser\Cursor; -use League\CommonMark\Util\RegexHelper; - -/** - * @internal - */ -final class AttributesHelper -{ - private const SINGLE_ATTRIBUTE = '\s*([.]-?[_a-z][^\s}]*|[#][^\s}]+|' . RegexHelper::PARTIAL_ATTRIBUTENAME . RegexHelper::PARTIAL_ATTRIBUTEVALUESPEC . ')\s*'; - private const ATTRIBUTE_LIST = '/^{:?(' . self::SINGLE_ATTRIBUTE . ')+}/i'; - - /** - * @return array - */ - public static function parseAttributes(Cursor $cursor): array - { - $state = $cursor->saveState(); - $cursor->advanceToNextNonSpaceOrNewline(); - - // Quick check to see if we might have attributes - if ($cursor->getCharacter() !== '{') { - $cursor->restoreState($state); - - return []; - } - - // Attempt to match the entire attribute list expression - // While this is less performant than checking for '{' now and '}' later, it simplifies - // matching individual attributes since they won't need to look ahead for the closing '}' - // while dealing with the fact that attributes can technically contain curly braces. - // So we'll just match the start and end braces up front. - $attributeExpression = $cursor->match(self::ATTRIBUTE_LIST); - if ($attributeExpression === null) { - $cursor->restoreState($state); - - return []; - } - - // Trim the leading '{' or '{:' and the trailing '}' - $attributeExpression = \ltrim(\substr($attributeExpression, 1, -1), ':'); - $attributeCursor = new Cursor($attributeExpression); - - /** @var array $attributes */ - $attributes = []; - while ($attribute = \trim((string) $attributeCursor->match('/^' . self::SINGLE_ATTRIBUTE . '/i'))) { - if ($attribute[0] === '#') { - $attributes['id'] = \substr($attribute, 1); - - continue; - } - - if ($attribute[0] === '.') { - $attributes['class'][] = \substr($attribute, 1); - - continue; - } - - /** @psalm-suppress PossiblyUndefinedArrayOffset */ - [$name, $value] = \explode('=', $attribute, 2); - - if ($value === 'true') { - $attributes[$name] = true; - continue; - } - - $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 (isset($attributes['class'])) { - $attributes['class'] = \implode(' ', (array) $attributes['class']); - } - - return $attributes; - } - - /** - * @param Node|array $attributes1 - * @param Node|array $attributes2 - * - * @return array - */ - public static function mergeAttributes($attributes1, $attributes2): array - { - $attributes = []; - foreach ([$attributes1, $attributes2] as $arg) { - if ($arg instanceof Node) { - $arg = $arg->data->get('attributes'); - } - - /** @var array $arg */ - $arg = (array) $arg; - if (isset($arg['class'])) { - if (\is_string($arg['class'])) { - $arg['class'] = \array_filter(\explode(' ', \trim($arg['class']))); - } - - foreach ($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 54aafd4..0000000 --- a/vendor/league/commonmark/src/Extension/Autolink/AutolinkExtension.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * 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\Environment\EnvironmentBuilderInterface; -use League\CommonMark\Extension\ConfigurableExtensionInterface; -use League\Config\ConfigurationBuilderInterface; -use Nette\Schema\Expect; - -final class AutolinkExtension implements ConfigurableExtensionInterface -{ - public function configureSchema(ConfigurationBuilderInterface $builder): void - { - $builder->addSchema('autolink', Expect::structure([ - 'allowed_protocols' => Expect::listOf('string')->default(['http', 'https', 'ftp'])->mergeDefaults(false), - 'default_protocol' => Expect::string()->default('http'), - ])); - } - - public function register(EnvironmentBuilderInterface $environment): void - { - $environment->addInlineParser(new EmailAutolinkParser()); - $environment->addInlineParser(new UrlAutolinkParser( - $environment->getConfiguration()->get('autolink.allowed_protocols'), - $environment->getConfiguration()->get('autolink.default_protocol'), - )); - } -} diff --git a/vendor/league/commonmark/src/Extension/Autolink/EmailAutolinkParser.php b/vendor/league/commonmark/src/Extension/Autolink/EmailAutolinkParser.php deleted file mode 100644 index 15a7d34..0000000 --- a/vendor/league/commonmark/src/Extension/Autolink/EmailAutolinkParser.php +++ /dev/null @@ -1,48 +0,0 @@ - - * - * 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\CommonMark\Node\Inline\Link; -use League\CommonMark\Parser\Inline\InlineParserInterface; -use League\CommonMark\Parser\Inline\InlineParserMatch; -use League\CommonMark\Parser\InlineParserContext; - -final class EmailAutolinkParser implements InlineParserInterface -{ - private const REGEX = '[A-Za-z0-9.\-_+]+@[A-Za-z0-9\-_]+\.[A-Za-z0-9\-_.]+'; - - public function getMatchDefinition(): InlineParserMatch - { - return InlineParserMatch::regex(self::REGEX); - } - - public function parse(InlineParserContext $inlineContext): bool - { - $email = $inlineContext->getFullMatch(); - // The last character cannot be - or _ - if (\in_array(\substr($email, -1), ['-', '_'], true)) { - return false; - } - - // Does the URL end with punctuation that should be stripped? - if (\substr($email, -1) === '.') { - $email = \substr($email, 0, -1); - } - - $inlineContext->getCursor()->advanceBy(\strlen($email)); - $inlineContext->getContainer()->appendChild(new Link('mailto:' . $email, $email)); - - return true; - } -} diff --git a/vendor/league/commonmark/src/Extension/Autolink/UrlAutolinkParser.php b/vendor/league/commonmark/src/Extension/Autolink/UrlAutolinkParser.php deleted file mode 100644 index f487616..0000000 --- a/vendor/league/commonmark/src/Extension/Autolink/UrlAutolinkParser.php +++ /dev/null @@ -1,157 +0,0 @@ - - * - * 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\CommonMark\Node\Inline\Link; -use League\CommonMark\Parser\Inline\InlineParserInterface; -use League\CommonMark\Parser\Inline\InlineParserMatch; -use League\CommonMark\Parser\InlineParserContext; - -final class UrlAutolinkParser implements InlineParserInterface -{ - private const ALLOWED_AFTER = [null, ' ', "\t", "\n", "\x0b", "\x0c", "\x0d", '*', '_', '~', '(']; - - // RegEx adapted from https://github.com/symfony/symfony/blob/6.3/src/Symfony/Component/Validator/Constraints/UrlValidator.php - private const REGEX = '~ - ( - # Must start with a supported scheme + auth, or "www" - (?: - (?:%s):// # protocol - (?:(?:(?:[\_\.\pL\pN-]|%%[0-9A-Fa-f]{2})+:)?((?:[\_\.\pL\pN-]|%%[0-9A-Fa-f]{2})+)@)? # basic auth - |www\.) - (?: - (?: - (?:xn--[a-z0-9-]++\.)*+xn--[a-z0-9-]++ # a domain name using punycode - | - (?:[\pL\pN\pS\pM\-\_]++\.){1,127}[\pL\pN\pM]++ # a multi-level domain name; total length must be 253 bytes or less - | - [a-z0-9\-\_]++ # a single-level 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[] - * - * @psalm-readonly - */ - private array $prefixes = ['www.']; - - /** - * @psalm-var non-empty-string - * - * @psalm-readonly - */ - private string $finalRegex; - - private string $defaultProtocol; - - /** - * @param array $allowedProtocols - */ - public function __construct(array $allowedProtocols = ['http', 'https', 'ftp'], string $defaultProtocol = 'http') - { - /** - * @psalm-suppress PropertyTypeCoercion - */ - $this->finalRegex = \sprintf(self::REGEX, \implode('|', $allowedProtocols)); - - foreach ($allowedProtocols as $protocol) { - $this->prefixes[] = $protocol . '://'; - } - - $this->defaultProtocol = $defaultProtocol; - } - - public function getMatchDefinition(): InlineParserMatch - { - return InlineParserMatch::oneOf(...$this->prefixes); - } - - public function parse(InlineParserContext $inlineContext): bool - { - $cursor = $inlineContext->getCursor(); - - // Autolinks can only come at the beginning of a line, after whitespace, or certain delimiting characters - $previousChar = $cursor->peek(-1); - if (! \in_array($previousChar, self::ALLOWED_AFTER, true)) { - return false; - } - - // Check if we have a valid URL - if (! \preg_match($this->finalRegex, $cursor->getRemainder(), $matches)) { - return false; - } - - $url = $matches[0]; - - // Does the URL end with punctuation that should be stripped? - if (\preg_match('/(.+?)([?!.,:*_~]+)$/', $url, $matches)) { - // Add the punctuation later - $url = $matches[1]; - } - - // Does the URL end with something that looks like an entity reference? - if (\preg_match('/(.+)(&[A-Za-z0-9]+;)$/', $url, $matches)) { - $url = $matches[1]; - } - - // Does the URL need unmatched parens chopped off? - if (\substr($url, -1) === ')' && ($diff = self::diffParens($url)) > 0) { - $url = \substr($url, 0, -$diff); - } - - $cursor->advanceBy(\mb_strlen($url, 'UTF-8')); - - // Auto-prefix 'http(s)://' onto 'www' URLs - if (\substr($url, 0, 4) === 'www.') { - $inlineContext->getContainer()->appendChild(new Link($this->defaultProtocol . '://' . $url, $url)); - - return true; - } - - $inlineContext->getContainer()->appendChild(new Link($url, $url)); - - return true; - } - - /** - * @psalm-pure - */ - 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/CommonMark/CommonMarkCoreExtension.php b/vendor/league/commonmark/src/Extension/CommonMark/CommonMarkCoreExtension.php deleted file mode 100644 index 91f7a22..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/CommonMarkCoreExtension.php +++ /dev/null @@ -1,92 +0,0 @@ - - * - * 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\CommonMark; - -use League\CommonMark\Environment\EnvironmentBuilderInterface; -use League\CommonMark\Extension\CommonMark\Delimiter\Processor\EmphasisDelimiterProcessor; -use League\CommonMark\Extension\ConfigurableExtensionInterface; -use League\CommonMark\Node as CoreNode; -use League\CommonMark\Parser as CoreParser; -use League\CommonMark\Renderer as CoreRenderer; -use League\Config\ConfigurationBuilderInterface; -use Nette\Schema\Expect; - -final class CommonMarkCoreExtension implements ConfigurableExtensionInterface -{ - public function configureSchema(ConfigurationBuilderInterface $builder): void - { - $builder->addSchema('commonmark', Expect::structure([ - 'use_asterisk' => Expect::bool(true), - 'use_underscore' => Expect::bool(true), - 'enable_strong' => Expect::bool(true), - 'enable_em' => Expect::bool(true), - 'unordered_list_markers' => Expect::listOf('string')->min(1)->default(['*', '+', '-'])->mergeDefaults(false), - ])); - } - - // phpcs:disable Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma,Squiz.WhiteSpace.SemicolonSpacing.Incorrect - public function register(EnvironmentBuilderInterface $environment): void - { - $environment - ->addBlockStartParser(new Parser\Block\BlockQuoteStartParser(), 70) - ->addBlockStartParser(new Parser\Block\HeadingStartParser(), 60) - ->addBlockStartParser(new Parser\Block\FencedCodeStartParser(), 50) - ->addBlockStartParser(new Parser\Block\HtmlBlockStartParser(), 40) - ->addBlockStartParser(new Parser\Block\ThematicBreakStartParser(), 20) - ->addBlockStartParser(new Parser\Block\ListBlockStartParser(), 10) - ->addBlockStartParser(new Parser\Block\IndentedCodeStartParser(), -100) - - ->addInlineParser(new CoreParser\Inline\NewlineParser(), 200) - ->addInlineParser(new Parser\Inline\BacktickParser(), 150) - ->addInlineParser(new Parser\Inline\EscapableParser(), 80) - ->addInlineParser(new Parser\Inline\EntityParser(), 70) - ->addInlineParser(new Parser\Inline\AutolinkParser(), 50) - ->addInlineParser(new Parser\Inline\HtmlInlineParser(), 40) - ->addInlineParser(new Parser\Inline\CloseBracketParser(), 30) - ->addInlineParser(new Parser\Inline\OpenBracketParser(), 20) - ->addInlineParser(new Parser\Inline\BangParser(), 10) - - ->addRenderer(Node\Block\BlockQuote::class, new Renderer\Block\BlockQuoteRenderer(), 0) - ->addRenderer(CoreNode\Block\Document::class, new CoreRenderer\Block\DocumentRenderer(), 0) - ->addRenderer(Node\Block\FencedCode::class, new Renderer\Block\FencedCodeRenderer(), 0) - ->addRenderer(Node\Block\Heading::class, new Renderer\Block\HeadingRenderer(), 0) - ->addRenderer(Node\Block\HtmlBlock::class, new Renderer\Block\HtmlBlockRenderer(), 0) - ->addRenderer(Node\Block\IndentedCode::class, new Renderer\Block\IndentedCodeRenderer(), 0) - ->addRenderer(Node\Block\ListBlock::class, new Renderer\Block\ListBlockRenderer(), 0) - ->addRenderer(Node\Block\ListItem::class, new Renderer\Block\ListItemRenderer(), 0) - ->addRenderer(CoreNode\Block\Paragraph::class, new CoreRenderer\Block\ParagraphRenderer(), 0) - ->addRenderer(Node\Block\ThematicBreak::class, new Renderer\Block\ThematicBreakRenderer(), 0) - - ->addRenderer(Node\Inline\Code::class, new Renderer\Inline\CodeRenderer(), 0) - ->addRenderer(Node\Inline\Emphasis::class, new Renderer\Inline\EmphasisRenderer(), 0) - ->addRenderer(Node\Inline\HtmlInline::class, new Renderer\Inline\HtmlInlineRenderer(), 0) - ->addRenderer(Node\Inline\Image::class, new Renderer\Inline\ImageRenderer(), 0) - ->addRenderer(Node\Inline\Link::class, new Renderer\Inline\LinkRenderer(), 0) - ->addRenderer(CoreNode\Inline\Newline::class, new CoreRenderer\Inline\NewlineRenderer(), 0) - ->addRenderer(Node\Inline\Strong::class, new Renderer\Inline\StrongRenderer(), 0) - ->addRenderer(CoreNode\Inline\Text::class, new CoreRenderer\Inline\TextRenderer(), 0) - ; - - if ($environment->getConfiguration()->get('commonmark/use_asterisk')) { - $environment->addDelimiterProcessor(new EmphasisDelimiterProcessor('*')); - } - - if ($environment->getConfiguration()->get('commonmark/use_underscore')) { - $environment->addDelimiterProcessor(new EmphasisDelimiterProcessor('_')); - } - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Delimiter/Processor/EmphasisDelimiterProcessor.php b/vendor/league/commonmark/src/Extension/CommonMark/Delimiter/Processor/EmphasisDelimiterProcessor.php deleted file mode 100644 index 9a6be13..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Delimiter/Processor/EmphasisDelimiterProcessor.php +++ /dev/null @@ -1,119 +0,0 @@ - - * - * 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\Extension\CommonMark\Delimiter\Processor; - -use League\CommonMark\Delimiter\DelimiterInterface; -use League\CommonMark\Delimiter\Processor\CacheableDelimiterProcessorInterface; -use League\CommonMark\Extension\CommonMark\Node\Inline\Emphasis; -use League\CommonMark\Extension\CommonMark\Node\Inline\Strong; -use League\CommonMark\Node\Inline\AbstractStringContainer; -use League\Config\ConfigurationAwareInterface; -use League\Config\ConfigurationInterface; - -final class EmphasisDelimiterProcessor implements CacheableDelimiterProcessorInterface, ConfigurationAwareInterface -{ - /** @psalm-readonly */ - private string $char; - - /** @psalm-readonly-allow-private-mutation */ - private ConfigurationInterface $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->get('commonmark/enable_strong')) { - return 2; - } - - return 0; - } - - if ($this->config->get('commonmark/enable_em')) { - return 1; - } - - return 0; - } - - public function process(AbstractStringContainer $opener, AbstractStringContainer $closer, int $delimiterUse): void - { - if ($delimiterUse === 1) { - $emphasis = new Emphasis($this->char); - } elseif ($delimiterUse === 2) { - $emphasis = new Strong($this->char . $this->char); - } 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): void - { - $this->config = $configuration; - } - - public function getCacheKey(DelimiterInterface $closer): string - { - return \sprintf( - '%s-%s-%d-%d', - $this->char, - $closer->canOpen() ? 'canOpen' : 'cannotOpen', - $closer->getOriginalLength() % 3, - $closer->getLength(), - ); - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/BlockQuote.php b/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/BlockQuote.php deleted file mode 100644 index 11094b9..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/BlockQuote.php +++ /dev/null @@ -1,20 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\CommonMark\Node\Block; - -use League\CommonMark\Node\Block\AbstractBlock; - -class BlockQuote extends AbstractBlock -{ -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/FencedCode.php b/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/FencedCode.php deleted file mode 100644 index b50b407..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/FencedCode.php +++ /dev/null @@ -1,100 +0,0 @@ - - * - * 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\CommonMark\Node\Block; - -use League\CommonMark\Node\Block\AbstractBlock; -use League\CommonMark\Node\StringContainerInterface; - -final class FencedCode extends AbstractBlock implements StringContainerInterface -{ - private ?string $info = null; - - private string $literal = ''; - - private int $length; - - private string $char; - - private int $offset; - - public function __construct(int $length, string $char, int $offset) - { - parent::__construct(); - - $this->length = $length; - $this->char = $char; - $this->offset = $offset; - } - - public function getInfo(): ?string - { - return $this->info; - } - - /** - * @return string[] - */ - public function getInfoWords(): array - { - return \preg_split('/\s+/', $this->info ?? '') ?: []; - } - - public function setInfo(string $info): void - { - $this->info = $info; - } - - public function getLiteral(): string - { - return $this->literal; - } - - public function setLiteral(string $literal): void - { - $this->literal = $literal; - } - - public function getChar(): string - { - return $this->char; - } - - public function setChar(string $char): void - { - $this->char = $char; - } - - public function getLength(): int - { - return $this->length; - } - - public function setLength(int $length): void - { - $this->length = $length; - } - - public function getOffset(): int - { - return $this->offset; - } - - public function setOffset(int $offset): void - { - $this->offset = $offset; - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/Heading.php b/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/Heading.php deleted file mode 100644 index 1cf1184..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/Heading.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * 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\CommonMark\Node\Block; - -use League\CommonMark\Node\Block\AbstractBlock; - -final class Heading extends AbstractBlock -{ - private int $level; - - public function __construct(int $level) - { - parent::__construct(); - - $this->level = $level; - } - - public function getLevel(): int - { - return $this->level; - } - - public function setLevel(int $level): void - { - $this->level = $level; - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/HtmlBlock.php b/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/HtmlBlock.php deleted file mode 100644 index 9879a89..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/HtmlBlock.php +++ /dev/null @@ -1,79 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\CommonMark\Node\Block; - -use League\CommonMark\Node\Block\AbstractBlock; -use League\CommonMark\Node\RawMarkupContainerInterface; - -final class HtmlBlock extends AbstractBlock implements RawMarkupContainerInterface -{ - // Any changes to these constants should be reflected in .phpstorm.meta.php - public const TYPE_1_CODE_CONTAINER = 1; - public const TYPE_2_COMMENT = 2; - public const TYPE_3 = 3; - public const TYPE_4 = 4; - public const TYPE_5_CDATA = 5; - public const TYPE_6_BLOCK_ELEMENT = 6; - public const TYPE_7_MISC_ELEMENT = 7; - - /** - * @psalm-var self::TYPE_* $type - * @phpstan-var self::TYPE_* $type - */ - private int $type; - - private string $literal = ''; - - /** - * @psalm-param self::TYPE_* $type - * - * @phpstan-param self::TYPE_* $type - */ - public function __construct(int $type) - { - parent::__construct(); - - $this->type = $type; - } - - /** - * @psalm-return self::TYPE_* - * - * @phpstan-return self::TYPE_* - */ - public function getType(): int - { - return $this->type; - } - - /** - * @psalm-param self::TYPE_* $type - * - * @phpstan-param self::TYPE_* $type - */ - public function setType(int $type): void - { - $this->type = $type; - } - - public function getLiteral(): string - { - return $this->literal; - } - - public function setLiteral(string $literal): void - { - $this->literal = $literal; - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/IndentedCode.php b/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/IndentedCode.php deleted file mode 100644 index d18be15..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/IndentedCode.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\CommonMark\Node\Block; - -use League\CommonMark\Node\Block\AbstractBlock; -use League\CommonMark\Node\StringContainerInterface; - -final class IndentedCode extends AbstractBlock implements StringContainerInterface -{ - private string $literal = ''; - - public function getLiteral(): string - { - return $this->literal; - } - - public function setLiteral(string $literal): void - { - $this->literal = $literal; - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/ListBlock.php b/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/ListBlock.php deleted file mode 100644 index 504a38a..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/ListBlock.php +++ /dev/null @@ -1,56 +0,0 @@ - - * - * 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\CommonMark\Node\Block; - -use League\CommonMark\Node\Block\AbstractBlock; -use League\CommonMark\Node\Block\TightBlockInterface; - -class ListBlock extends AbstractBlock implements TightBlockInterface -{ - public const TYPE_BULLET = 'bullet'; - public const TYPE_ORDERED = 'ordered'; - - public const DELIM_PERIOD = 'period'; - public const DELIM_PAREN = 'paren'; - - protected bool $tight = false; // TODO Make lists tight by default in v3 - - /** @psalm-readonly */ - protected ListData $listData; - - public function __construct(ListData $listData) - { - parent::__construct(); - - $this->listData = $listData; - } - - public function getListData(): ListData - { - return $this->listData; - } - - public function isTight(): bool - { - return $this->tight; - } - - public function setTight(bool $tight): void - { - $this->tight = $tight; - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/ListData.php b/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/ListData.php deleted file mode 100644 index 7108a93..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/ListData.php +++ /dev/null @@ -1,47 +0,0 @@ - - * - * 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\CommonMark\Node\Block; - -class ListData -{ - public ?int $start = null; - - public int $padding = 0; - - /** - * @psalm-var ListBlock::TYPE_* - * @phpstan-var ListBlock::TYPE_* - */ - public string $type; - - /** - * @psalm-var ListBlock::DELIM_*|null - * @phpstan-var ListBlock::DELIM_*|null - */ - public ?string $delimiter = null; - - public ?string $bulletChar = null; - - public int $markerOffset; - - public function equals(ListData $data): bool - { - return $this->type === $data->type && - $this->delimiter === $data->delimiter && - $this->bulletChar === $data->bulletChar; - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/ListItem.php b/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/ListItem.php deleted file mode 100644 index f136b7e..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/ListItem.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * 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\CommonMark\Node\Block; - -use League\CommonMark\Node\Block\AbstractBlock; - -class ListItem extends AbstractBlock -{ - /** @psalm-readonly */ - protected ListData $listData; - - public function __construct(ListData $listData) - { - parent::__construct(); - - $this->listData = $listData; - } - - public function getListData(): ListData - { - return $this->listData; - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/ThematicBreak.php b/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/ThematicBreak.php deleted file mode 100644 index bb6cea0..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/ThematicBreak.php +++ /dev/null @@ -1,20 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\CommonMark\Node\Block; - -use League\CommonMark\Node\Block\AbstractBlock; - -class ThematicBreak extends AbstractBlock -{ -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/AbstractWebResource.php b/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/AbstractWebResource.php deleted file mode 100644 index dc0ed0a..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/AbstractWebResource.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * 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\CommonMark\Node\Inline; - -use League\CommonMark\Node\Inline\AbstractInline; - -abstract class AbstractWebResource extends AbstractInline -{ - protected string $url; - - public function __construct(string $url) - { - parent::__construct(); - - $this->url = $url; - } - - public function getUrl(): string - { - return $this->url; - } - - public function setUrl(string $url): void - { - $this->url = $url; - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/Code.php b/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/Code.php deleted file mode 100644 index 3a6aca2..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/Code.php +++ /dev/null @@ -1,23 +0,0 @@ - - * - * 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\CommonMark\Node\Inline; - -use League\CommonMark\Node\Inline\AbstractStringContainer; - -class Code extends AbstractStringContainer -{ -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/Emphasis.php b/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/Emphasis.php deleted file mode 100644 index fab6869..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/Emphasis.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * 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\CommonMark\Node\Inline; - -use League\CommonMark\Node\Inline\AbstractInline; -use League\CommonMark\Node\Inline\DelimitedInterface; - -final class Emphasis extends AbstractInline implements DelimitedInterface -{ - private string $delimiter; - - public function __construct(string $delimiter = '_') - { - parent::__construct(); - - $this->delimiter = $delimiter; - } - - public function getOpeningDelimiter(): string - { - return $this->delimiter; - } - - public function getClosingDelimiter(): string - { - return $this->delimiter; - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/HtmlInline.php b/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/HtmlInline.php deleted file mode 100644 index 8594a06..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/HtmlInline.php +++ /dev/null @@ -1,24 +0,0 @@ - - * - * 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\CommonMark\Node\Inline; - -use League\CommonMark\Node\Inline\AbstractStringContainer; -use League\CommonMark\Node\RawMarkupContainerInterface; - -final class HtmlInline extends AbstractStringContainer implements RawMarkupContainerInterface -{ -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/Image.php b/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/Image.php deleted file mode 100644 index 20e3f87..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/Image.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * 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\CommonMark\Node\Inline; - -use League\CommonMark\Node\Inline\Text; - -class Image extends AbstractWebResource -{ - protected ?string $title = null; - - public function __construct(string $url, ?string $label = null, ?string $title = null) - { - parent::__construct($url); - - if ($label !== null && $label !== '') { - $this->appendChild(new Text($label)); - } - - $this->title = $title; - } - - public function getTitle(): ?string - { - if ($this->title === '') { - return null; - } - - return $this->title; - } - - public function setTitle(?string $title): void - { - $this->title = $title; - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/Link.php b/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/Link.php deleted file mode 100644 index 76d5609..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/Link.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * 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\CommonMark\Node\Inline; - -use League\CommonMark\Node\Inline\Text; - -class Link extends AbstractWebResource -{ - protected ?string $title = null; - - public function __construct(string $url, ?string $label = null, ?string $title = null) - { - parent::__construct($url); - - if ($label !== null && $label !== '') { - $this->appendChild(new Text($label)); - } - - $this->title = $title; - } - - public function getTitle(): ?string - { - if ($this->title === '') { - return null; - } - - return $this->title; - } - - public function setTitle(?string $title): void - { - $this->title = $title; - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/Strong.php b/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/Strong.php deleted file mode 100644 index 827960f..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/Strong.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * 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\CommonMark\Node\Inline; - -use League\CommonMark\Node\Inline\AbstractInline; -use League\CommonMark\Node\Inline\DelimitedInterface; - -final class Strong extends AbstractInline implements DelimitedInterface -{ - private string $delimiter; - - public function __construct(string $delimiter = '**') - { - parent::__construct(); - - $this->delimiter = $delimiter; - } - - public function getOpeningDelimiter(): string - { - return $this->delimiter; - } - - public function getClosingDelimiter(): string - { - return $this->delimiter; - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/BlockQuoteParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/BlockQuoteParser.php deleted file mode 100644 index 78db6c5..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/BlockQuoteParser.php +++ /dev/null @@ -1,60 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\CommonMark\Parser\Block; - -use League\CommonMark\Extension\CommonMark\Node\Block\BlockQuote; -use League\CommonMark\Node\Block\AbstractBlock; -use League\CommonMark\Parser\Block\AbstractBlockContinueParser; -use League\CommonMark\Parser\Block\BlockContinue; -use League\CommonMark\Parser\Block\BlockContinueParserInterface; -use League\CommonMark\Parser\Cursor; - -final class BlockQuoteParser extends AbstractBlockContinueParser -{ - /** @psalm-readonly */ - private BlockQuote $block; - - public function __construct() - { - $this->block = new BlockQuote(); - } - - public function getBlock(): BlockQuote - { - return $this->block; - } - - public function isContainer(): bool - { - return true; - } - - public function canContain(AbstractBlock $childBlock): bool - { - return true; - } - - public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue - { - if (! $cursor->isIndented() && $cursor->getNextNonSpaceCharacter() === '>') { - $cursor->advanceToNextNonSpaceOrTab(); - $cursor->advanceBy(1); - $cursor->advanceBySpaceOrTab(); - - return BlockContinue::at($cursor); - } - - return BlockContinue::none(); - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/BlockQuoteStartParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/BlockQuoteStartParser.php deleted file mode 100644 index de9a6bc..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/BlockQuoteStartParser.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\CommonMark\Parser\Block; - -use League\CommonMark\Parser\Block\BlockStart; -use League\CommonMark\Parser\Block\BlockStartParserInterface; -use League\CommonMark\Parser\Cursor; -use League\CommonMark\Parser\MarkdownParserStateInterface; - -final class BlockQuoteStartParser implements BlockStartParserInterface -{ - public function tryStart(Cursor $cursor, MarkdownParserStateInterface $parserState): ?BlockStart - { - if ($cursor->isIndented()) { - return BlockStart::none(); - } - - if ($cursor->getNextNonSpaceCharacter() !== '>') { - return BlockStart::none(); - } - - $cursor->advanceToNextNonSpaceOrTab(); - $cursor->advanceBy(1); - $cursor->advanceBySpaceOrTab(); - - return BlockStart::of(new BlockQuoteParser())->at($cursor); - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/FencedCodeParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/FencedCodeParser.php deleted file mode 100644 index 96a5baa..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/FencedCodeParser.php +++ /dev/null @@ -1,84 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\CommonMark\Parser\Block; - -use League\CommonMark\Extension\CommonMark\Node\Block\FencedCode; -use League\CommonMark\Parser\Block\AbstractBlockContinueParser; -use League\CommonMark\Parser\Block\BlockContinue; -use League\CommonMark\Parser\Block\BlockContinueParserInterface; -use League\CommonMark\Parser\Cursor; -use League\CommonMark\Util\ArrayCollection; -use League\CommonMark\Util\RegexHelper; - -final class FencedCodeParser extends AbstractBlockContinueParser -{ - /** @psalm-readonly */ - private FencedCode $block; - - /** @var ArrayCollection */ - private ArrayCollection $strings; - - public function __construct(int $fenceLength, string $fenceChar, int $fenceOffset) - { - $this->block = new FencedCode($fenceLength, $fenceChar, $fenceOffset); - $this->strings = new ArrayCollection(); - } - - public function getBlock(): FencedCode - { - return $this->block; - } - - public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue - { - // Check for closing code fence - if (! $cursor->isIndented() && $cursor->getNextNonSpaceCharacter() === $this->block->getChar()) { - $match = RegexHelper::matchFirst('/^(?:`{3,}|~{3,})(?=[ \t]*$)/', $cursor->getLine(), $cursor->getNextNonSpacePosition()); - if ($match !== null && \strlen($match[0]) >= $this->block->getLength()) { - // closing fence - we're at end of line, so we can finalize now - return BlockContinue::finished(); - } - } - - // Skip optional spaces of fence offset - // Optimization: don't attempt to match if we're at a non-space position - if ($cursor->getNextNonSpacePosition() > $cursor->getPosition()) { - $cursor->match('/^ {0,' . $this->block->getOffset() . '}/'); - } - - return BlockContinue::at($cursor); - } - - public function addLine(string $line): void - { - $this->strings[] = $line; - } - - public function closeBlock(): void - { - // first line becomes info string - $firstLine = $this->strings->first(); - if ($firstLine === false) { - $firstLine = ''; - } - - $this->block->setInfo(RegexHelper::unescape(\trim($firstLine))); - - if ($this->strings->count() === 1) { - $this->block->setLiteral(''); - } else { - $this->block->setLiteral(\implode("\n", $this->strings->slice(1)) . "\n"); - } - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/FencedCodeStartParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/FencedCodeStartParser.php deleted file mode 100644 index be1b1dc..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/FencedCodeStartParser.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\CommonMark\Parser\Block; - -use League\CommonMark\Parser\Block\BlockStart; -use League\CommonMark\Parser\Block\BlockStartParserInterface; -use League\CommonMark\Parser\Cursor; -use League\CommonMark\Parser\MarkdownParserStateInterface; - -final class FencedCodeStartParser implements BlockStartParserInterface -{ - public function tryStart(Cursor $cursor, MarkdownParserStateInterface $parserState): ?BlockStart - { - if ($cursor->isIndented() || ! \in_array($cursor->getNextNonSpaceCharacter(), ['`', '~'], true)) { - return BlockStart::none(); - } - - $indent = $cursor->getIndent(); - $fence = $cursor->match('/^[ \t]*(?:`{3,}(?!.*`)|~{3,})/'); - if ($fence === null) { - return BlockStart::none(); - } - - // fenced code block - $fence = \ltrim($fence, " \t"); - - return BlockStart::of(new FencedCodeParser(\strlen($fence), $fence[0], $indent))->at($cursor); - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/HeadingParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/HeadingParser.php deleted file mode 100644 index c3e3108..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/HeadingParser.php +++ /dev/null @@ -1,51 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\CommonMark\Parser\Block; - -use League\CommonMark\Extension\CommonMark\Node\Block\Heading; -use League\CommonMark\Parser\Block\AbstractBlockContinueParser; -use League\CommonMark\Parser\Block\BlockContinue; -use League\CommonMark\Parser\Block\BlockContinueParserInterface; -use League\CommonMark\Parser\Block\BlockContinueParserWithInlinesInterface; -use League\CommonMark\Parser\Cursor; -use League\CommonMark\Parser\InlineParserEngineInterface; - -final class HeadingParser extends AbstractBlockContinueParser implements BlockContinueParserWithInlinesInterface -{ - /** @psalm-readonly */ - private Heading $block; - - private string $content; - - public function __construct(int $level, string $content) - { - $this->block = new Heading($level); - $this->content = $content; - } - - public function getBlock(): Heading - { - return $this->block; - } - - public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue - { - return BlockContinue::none(); - } - - public function parseInlines(InlineParserEngineInterface $inlineParser): void - { - $inlineParser->parse($this->content, $this->block); - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/HeadingStartParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/HeadingStartParser.php deleted file mode 100644 index 404f403..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/HeadingStartParser.php +++ /dev/null @@ -1,80 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\CommonMark\Parser\Block; - -use League\CommonMark\Parser\Block\BlockStart; -use League\CommonMark\Parser\Block\BlockStartParserInterface; -use League\CommonMark\Parser\Cursor; -use League\CommonMark\Parser\MarkdownParserStateInterface; -use League\CommonMark\Util\RegexHelper; - -class HeadingStartParser implements BlockStartParserInterface -{ - public function tryStart(Cursor $cursor, MarkdownParserStateInterface $parserState): ?BlockStart - { - if ($cursor->isIndented() || ! \in_array($cursor->getNextNonSpaceCharacter(), ['#', '-', '='], true)) { - return BlockStart::none(); - } - - $cursor->advanceToNextNonSpaceOrTab(); - - if ($atxHeading = self::getAtxHeader($cursor)) { - return BlockStart::of($atxHeading)->at($cursor); - } - - $setextHeadingLevel = self::getSetextHeadingLevel($cursor); - if ($setextHeadingLevel > 0) { - $content = $parserState->getParagraphContent(); - if ($content !== null) { - $cursor->advanceToEnd(); - - return BlockStart::of(new HeadingParser($setextHeadingLevel, $content)) - ->at($cursor) - ->replaceActiveBlockParser(); - } - } - - return BlockStart::none(); - } - - private static function getAtxHeader(Cursor $cursor): ?HeadingParser - { - $match = RegexHelper::matchFirst('/^#{1,6}(?:[ \t]+|$)/', $cursor->getRemainder()); - if (! $match) { - return null; - } - - $cursor->advanceToNextNonSpaceOrTab(); - $cursor->advanceBy(\strlen($match[0])); - - $level = \strlen(\trim($match[0])); - $str = $cursor->getRemainder(); - $str = \preg_replace('/^[ \t]*#+[ \t]*$/', '', $str); - \assert(\is_string($str)); - $str = \preg_replace('/[ \t]+#+[ \t]*$/', '', $str); - \assert(\is_string($str)); - - return new HeadingParser($level, $str); - } - - private static function getSetextHeadingLevel(Cursor $cursor): int - { - $match = RegexHelper::matchFirst('/^(?:=+|-+)[ \t]*$/', $cursor->getRemainder()); - if ($match === null) { - return 0; - } - - return $match[0][0] === '=' ? 1 : 2; - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/HtmlBlockParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/HtmlBlockParser.php deleted file mode 100644 index 6778676..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/HtmlBlockParser.php +++ /dev/null @@ -1,82 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\CommonMark\Parser\Block; - -use League\CommonMark\Extension\CommonMark\Node\Block\HtmlBlock; -use League\CommonMark\Parser\Block\AbstractBlockContinueParser; -use League\CommonMark\Parser\Block\BlockContinue; -use League\CommonMark\Parser\Block\BlockContinueParserInterface; -use League\CommonMark\Parser\Cursor; -use League\CommonMark\Util\RegexHelper; - -final class HtmlBlockParser extends AbstractBlockContinueParser -{ - /** @psalm-readonly */ - private HtmlBlock $block; - - private string $content = ''; - - private bool $finished = false; - - /** - * @psalm-param HtmlBlock::TYPE_* $blockType - * - * @phpstan-param HtmlBlock::TYPE_* $blockType - */ - public function __construct(int $blockType) - { - $this->block = new HtmlBlock($blockType); - } - - public function getBlock(): HtmlBlock - { - return $this->block; - } - - public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue - { - if ($this->finished) { - return BlockContinue::none(); - } - - if ($cursor->isBlank() && \in_array($this->block->getType(), [HtmlBlock::TYPE_6_BLOCK_ELEMENT, HtmlBlock::TYPE_7_MISC_ELEMENT], true)) { - return BlockContinue::none(); - } - - return BlockContinue::at($cursor); - } - - public function addLine(string $line): void - { - if ($this->content !== '') { - $this->content .= "\n"; - } - - $this->content .= $line; - - // Check for end condition - // phpcs:disable SlevomatCodingStandard.ControlStructures.EarlyExit.EarlyExitNotUsed - if ($this->block->getType() <= HtmlBlock::TYPE_5_CDATA) { - if (\preg_match(RegexHelper::getHtmlBlockCloseRegex($this->block->getType()), $line) === 1) { - $this->finished = true; - } - } - } - - public function closeBlock(): void - { - $this->block->setLiteral($this->content); - $this->content = ''; - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/HtmlBlockStartParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/HtmlBlockStartParser.php deleted file mode 100644 index bcef0af..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/HtmlBlockStartParser.php +++ /dev/null @@ -1,62 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\CommonMark\Parser\Block; - -use League\CommonMark\Extension\CommonMark\Node\Block\HtmlBlock; -use League\CommonMark\Node\Block\Paragraph; -use League\CommonMark\Parser\Block\BlockStart; -use League\CommonMark\Parser\Block\BlockStartParserInterface; -use League\CommonMark\Parser\Cursor; -use League\CommonMark\Parser\MarkdownParserStateInterface; -use League\CommonMark\Util\RegexHelper; - -final class HtmlBlockStartParser implements BlockStartParserInterface -{ - public function tryStart(Cursor $cursor, MarkdownParserStateInterface $parserState): ?BlockStart - { - if ($cursor->isIndented() || $cursor->getNextNonSpaceCharacter() !== '<') { - return BlockStart::none(); - } - - $tmpCursor = clone $cursor; - $tmpCursor->advanceToNextNonSpaceOrTab(); - $line = $tmpCursor->getRemainder(); - - for ($blockType = 1; $blockType <= 7; $blockType++) { - /** @psalm-var HtmlBlock::TYPE_* $blockType */ - /** @phpstan-var HtmlBlock::TYPE_* $blockType */ - $match = RegexHelper::matchAt( - RegexHelper::getHtmlBlockOpenRegex($blockType), - $line - ); - - if ($match !== null && ($blockType < 7 || $this->isType7BlockAllowed($cursor, $parserState))) { - return BlockStart::of(new HtmlBlockParser($blockType))->at($cursor); - } - } - - return BlockStart::none(); - } - - private function isType7BlockAllowed(Cursor $cursor, MarkdownParserStateInterface $parserState): bool - { - // Type 7 blocks can't interrupt paragraphs - if ($parserState->getLastMatchedBlockParser()->getBlock() instanceof Paragraph) { - return false; - } - - // Even lazy ones - return ! $parserState->getActiveBlockParser()->canHaveLazyContinuationLines(); - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/IndentedCodeParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/IndentedCodeParser.php deleted file mode 100644 index ac6406f..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/IndentedCodeParser.php +++ /dev/null @@ -1,76 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\CommonMark\Parser\Block; - -use League\CommonMark\Extension\CommonMark\Node\Block\IndentedCode; -use League\CommonMark\Parser\Block\AbstractBlockContinueParser; -use League\CommonMark\Parser\Block\BlockContinue; -use League\CommonMark\Parser\Block\BlockContinueParserInterface; -use League\CommonMark\Parser\Cursor; -use League\CommonMark\Util\ArrayCollection; - -final class IndentedCodeParser extends AbstractBlockContinueParser -{ - /** @psalm-readonly */ - private IndentedCode $block; - - /** @var ArrayCollection */ - private ArrayCollection $strings; - - public function __construct() - { - $this->block = new IndentedCode(); - $this->strings = new ArrayCollection(); - } - - public function getBlock(): IndentedCode - { - return $this->block; - } - - public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue - { - if ($cursor->isIndented()) { - $cursor->advanceBy(Cursor::INDENT_LEVEL, true); - - return BlockContinue::at($cursor); - } - - if ($cursor->isBlank()) { - $cursor->advanceToNextNonSpaceOrTab(); - - return BlockContinue::at($cursor); - } - - return BlockContinue::none(); - } - - public function addLine(string $line): void - { - $this->strings[] = $line; - } - - public function closeBlock(): void - { - $lines = $this->strings->toArray(); - - // Note that indented code block cannot be empty, so $lines will always have at least one non-empty element - while (\preg_match('/^[ \t]*$/', \end($lines))) { // @phpstan-ignore-line - \array_pop($lines); - } - - $this->block->setLiteral(\implode("\n", $lines) . "\n"); - $this->block->setEndLine($this->block->getStartLine() + \count($lines) - 1); - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/IndentedCodeStartParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/IndentedCodeStartParser.php deleted file mode 100644 index bea4bde..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/IndentedCodeStartParser.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\CommonMark\Parser\Block; - -use League\CommonMark\Node\Block\Paragraph; -use League\CommonMark\Parser\Block\BlockStart; -use League\CommonMark\Parser\Block\BlockStartParserInterface; -use League\CommonMark\Parser\Cursor; -use League\CommonMark\Parser\MarkdownParserStateInterface; - -final class IndentedCodeStartParser implements BlockStartParserInterface -{ - public function tryStart(Cursor $cursor, MarkdownParserStateInterface $parserState): ?BlockStart - { - if (! $cursor->isIndented()) { - return BlockStart::none(); - } - - if ($parserState->getActiveBlockParser()->getBlock() instanceof Paragraph) { - return BlockStart::none(); - } - - if ($cursor->isBlank()) { - return BlockStart::none(); - } - - $cursor->advanceBy(Cursor::INDENT_LEVEL, true); - - return BlockStart::of(new IndentedCodeParser())->at($cursor); - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ListBlockParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ListBlockParser.php deleted file mode 100644 index 5a7ee45..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ListBlockParser.php +++ /dev/null @@ -1,93 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\CommonMark\Parser\Block; - -use League\CommonMark\Extension\CommonMark\Node\Block\ListBlock; -use League\CommonMark\Extension\CommonMark\Node\Block\ListData; -use League\CommonMark\Extension\CommonMark\Node\Block\ListItem; -use League\CommonMark\Node\Block\AbstractBlock; -use League\CommonMark\Parser\Block\AbstractBlockContinueParser; -use League\CommonMark\Parser\Block\BlockContinue; -use League\CommonMark\Parser\Block\BlockContinueParserInterface; -use League\CommonMark\Parser\Cursor; - -final class ListBlockParser extends AbstractBlockContinueParser -{ - /** @psalm-readonly */ - private ListBlock $block; - - public function __construct(ListData $listData) - { - $this->block = new ListBlock($listData); - } - - public function getBlock(): ListBlock - { - return $this->block; - } - - public function isContainer(): bool - { - return true; - } - - public function canContain(AbstractBlock $childBlock): bool - { - return $childBlock instanceof ListItem; - } - - public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue - { - // List blocks themselves don't have any markers, only list items. So try to stay in the list. - // If there is a block start other than list item, canContain makes sure that this list is closed. - return BlockContinue::at($cursor); - } - - public function closeBlock(): void - { - $item = $this->block->firstChild(); - while ($item instanceof AbstractBlock) { - // check for non-final list item ending with blank line: - if ($item->next() !== null && self::endsWithBlankLine($item)) { - $this->block->setTight(false); - break; - } - - // recurse into children of list item, to see if there are spaces between any of them - $subitem = $item->firstChild(); - while ($subitem instanceof AbstractBlock) { - if ($subitem->next() && self::endsWithBlankLine($subitem)) { - $this->block->setTight(false); - break 2; - } - - $subitem = $subitem->next(); - } - - $item = $item->next(); - } - - $lastChild = $this->block->lastChild(); - if ($lastChild instanceof AbstractBlock) { - $this->block->setEndLine($lastChild->getEndLine()); - } - } - - private static function endsWithBlankLine(AbstractBlock $block): bool - { - $next = $block->next(); - - return $next instanceof AbstractBlock && $block->getEndLine() !== $next->getStartLine() - 1; - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ListBlockStartParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ListBlockStartParser.php deleted file mode 100644 index a55f6f9..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ListBlockStartParser.php +++ /dev/null @@ -1,154 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\CommonMark\Parser\Block; - -use League\CommonMark\Extension\CommonMark\Node\Block\ListBlock; -use League\CommonMark\Extension\CommonMark\Node\Block\ListData; -use League\CommonMark\Parser\Block\BlockStart; -use League\CommonMark\Parser\Block\BlockStartParserInterface; -use League\CommonMark\Parser\Cursor; -use League\CommonMark\Parser\MarkdownParserStateInterface; -use League\CommonMark\Util\RegexHelper; -use League\Config\ConfigurationAwareInterface; -use League\Config\ConfigurationInterface; - -final class ListBlockStartParser implements BlockStartParserInterface, ConfigurationAwareInterface -{ - /** @psalm-readonly-allow-private-mutation */ - private ?ConfigurationInterface $config = null; - - /** - * @psalm-var non-empty-string|null - * - * @psalm-readonly-allow-private-mutation - */ - private ?string $listMarkerRegex = null; - - public function setConfiguration(ConfigurationInterface $configuration): void - { - $this->config = $configuration; - } - - public function tryStart(Cursor $cursor, MarkdownParserStateInterface $parserState): ?BlockStart - { - if ($cursor->isIndented()) { - return BlockStart::none(); - } - - $listData = $this->parseList($cursor, $parserState->getParagraphContent() !== null); - if ($listData === null) { - return BlockStart::none(); - } - - $listItemParser = new ListItemParser($listData); - - // prepend the list block if needed - $matched = $parserState->getLastMatchedBlockParser(); - if (! ($matched instanceof ListBlockParser) || ! $listData->equals($matched->getBlock()->getListData())) { - $listBlockParser = new ListBlockParser($listData); - // We start out with assuming a list is tight. If we find a blank line, we set it to loose later. - // TODO for 3.0: Just make them tight by default in the block so we can remove this call - $listBlockParser->getBlock()->setTight(true); - - return BlockStart::of($listBlockParser, $listItemParser)->at($cursor); - } - - return BlockStart::of($listItemParser)->at($cursor); - } - - private function parseList(Cursor $cursor, bool $inParagraph): ?ListData - { - $indent = $cursor->getIndent(); - - $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::matchFirst('/^(\d{1,9})([.)])/', $rest)) && (! $inParagraph || $matches[1] === '1')) { - $data = new ListData(); - $data->markerOffset = $indent; - $data->type = ListBlock::TYPE_ORDERED; - $data->start = (int) $matches[1]; - $data->delimiter = $matches[2] === '.' ? ListBlock::DELIM_PERIOD : ListBlock::DELIM_PAREN; - $data->bulletChar = null; - $markerLength = \strlen($matches[0]); - } else { - return null; - } - - // Make sure we have spaces after - $nextChar = $tmpCursor->peek($markerLength); - if (! ($nextChar === null || $nextChar === "\t" || $nextChar === ' ')) { - return null; - } - - // If it interrupts paragraph, make sure first line isn't blank - if ($inParagraph && ! RegexHelper::matchAt(RegexHelper::REGEX_NON_SPACE, $rest, $markerLength)) { - return null; - } - - $cursor->advanceToNextNonSpaceOrTab(); // to start of marker - $cursor->advanceBy($markerLength, true); // to end of marker - $data->padding = self::calculateListMarkerPadding($cursor, $markerLength); - - return $data; - } - - private static 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; - } - - /** - * @psalm-return non-empty-string - */ - private function generateListMarkerRegex(): string - { - // No configuration given - use the defaults - if ($this->config === null) { - return $this->listMarkerRegex = '/^[*+-]/'; - } - - $markers = $this->config->get('commonmark/unordered_list_markers'); - \assert(\is_array($markers)); - - return $this->listMarkerRegex = '/^[' . \preg_quote(\implode('', $markers), '/') . ']/'; - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ListItemParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ListItemParser.php deleted file mode 100644 index 739eefc..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ListItemParser.php +++ /dev/null @@ -1,82 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\CommonMark\Parser\Block; - -use League\CommonMark\Extension\CommonMark\Node\Block\ListData; -use League\CommonMark\Extension\CommonMark\Node\Block\ListItem; -use League\CommonMark\Node\Block\AbstractBlock; -use League\CommonMark\Parser\Block\AbstractBlockContinueParser; -use League\CommonMark\Parser\Block\BlockContinue; -use League\CommonMark\Parser\Block\BlockContinueParserInterface; -use League\CommonMark\Parser\Cursor; - -final class ListItemParser extends AbstractBlockContinueParser -{ - /** @psalm-readonly */ - private ListItem $block; - - public function __construct(ListData $listData) - { - $this->block = new ListItem($listData); - } - - public function getBlock(): ListItem - { - return $this->block; - } - - public function isContainer(): bool - { - return true; - } - - public function canContain(AbstractBlock $childBlock): bool - { - return ! $childBlock instanceof ListItem; - } - - public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue - { - if ($cursor->isBlank()) { - if ($this->block->firstChild() === null) { - // Blank line after empty list item - return BlockContinue::none(); - } - - $cursor->advanceToNextNonSpaceOrTab(); - - return BlockContinue::at($cursor); - } - - $contentIndent = $this->block->getListData()->markerOffset + $this->getBlock()->getListData()->padding; - if ($cursor->getIndent() >= $contentIndent) { - $cursor->advanceBy($contentIndent, true); - - return BlockContinue::at($cursor); - } - - // Note: We'll hit this case for lazy continuation lines, they will get added later. - return BlockContinue::none(); - } - - public function closeBlock(): void - { - if (($lastChild = $this->block->lastChild()) instanceof AbstractBlock) { - $this->block->setEndLine($lastChild->getEndLine()); - } else { - // Empty list item - $this->block->setEndLine($this->block->getStartLine()); - } - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ThematicBreakParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ThematicBreakParser.php deleted file mode 100644 index fb46637..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ThematicBreakParser.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\CommonMark\Parser\Block; - -use League\CommonMark\Extension\CommonMark\Node\Block\ThematicBreak; -use League\CommonMark\Parser\Block\AbstractBlockContinueParser; -use League\CommonMark\Parser\Block\BlockContinue; -use League\CommonMark\Parser\Block\BlockContinueParserInterface; -use League\CommonMark\Parser\Cursor; - -final class ThematicBreakParser extends AbstractBlockContinueParser -{ - /** @psalm-readonly */ - private ThematicBreak $block; - - public function __construct() - { - $this->block = new ThematicBreak(); - } - - public function getBlock(): ThematicBreak - { - return $this->block; - } - - public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue - { - // a horizontal rule can never container > 1 line, so fail to match - return BlockContinue::none(); - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ThematicBreakStartParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ThematicBreakStartParser.php deleted file mode 100644 index ba7ddf3..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ThematicBreakStartParser.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\CommonMark\Parser\Block; - -use League\CommonMark\Parser\Block\BlockStart; -use League\CommonMark\Parser\Block\BlockStartParserInterface; -use League\CommonMark\Parser\Cursor; -use League\CommonMark\Parser\MarkdownParserStateInterface; -use League\CommonMark\Util\RegexHelper; - -final class ThematicBreakStartParser implements BlockStartParserInterface -{ - public function tryStart(Cursor $cursor, MarkdownParserStateInterface $parserState): ?BlockStart - { - if ($cursor->isIndented()) { - return BlockStart::none(); - } - - $match = RegexHelper::matchAt(RegexHelper::REGEX_THEMATIC_BREAK, $cursor->getLine(), $cursor->getNextNonSpacePosition()); - if ($match === null) { - return BlockStart::none(); - } - - // Advance to the end of the string, consuming the entire line (of the thematic break) - $cursor->advanceToEnd(); - - return BlockStart::of(new ThematicBreakParser())->at($cursor); - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/AutolinkParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/AutolinkParser.php deleted file mode 100644 index 810769d..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/AutolinkParser.php +++ /dev/null @@ -1,54 +0,0 @@ - - * - * 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\CommonMark\Parser\Inline; - -use League\CommonMark\Extension\CommonMark\Node\Inline\Link; -use League\CommonMark\Parser\Inline\InlineParserInterface; -use League\CommonMark\Parser\Inline\InlineParserMatch; -use League\CommonMark\Parser\InlineParserContext; -use League\CommonMark\Util\UrlEncoder; - -final class AutolinkParser implements InlineParserInterface -{ - private 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])?)*)>'; - private const OTHER_LINK_REGEX = '<([A-Za-z][A-Za-z0-9.+-]{1,31}:[^<>\x00-\x20]*)>'; - - public function getMatchDefinition(): InlineParserMatch - { - return InlineParserMatch::regex(self::EMAIL_REGEX . '|' . self::OTHER_LINK_REGEX); - } - - public function parse(InlineParserContext $inlineContext): bool - { - $inlineContext->getCursor()->advanceBy($inlineContext->getFullMatchLength()); - $matches = $inlineContext->getMatches(); - - if ($matches[1] !== '') { - $inlineContext->getContainer()->appendChild(new Link('mailto:' . UrlEncoder::unescapeAndEncode($matches[1]), $matches[1])); - - return true; - } - - if ($matches[2] !== '') { - $inlineContext->getContainer()->appendChild(new Link(UrlEncoder::unescapeAndEncode($matches[2]), $matches[2])); - - return true; - } - - return false; // This should never happen - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/BacktickParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/BacktickParser.php deleted file mode 100644 index 3324fe3..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/BacktickParser.php +++ /dev/null @@ -1,132 +0,0 @@ - - * - * 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\CommonMark\Parser\Inline; - -use League\CommonMark\Extension\CommonMark\Node\Inline\Code; -use League\CommonMark\Node\Inline\Text; -use League\CommonMark\Parser\Cursor; -use League\CommonMark\Parser\Inline\InlineParserInterface; -use League\CommonMark\Parser\Inline\InlineParserMatch; -use League\CommonMark\Parser\InlineParserContext; - -final class BacktickParser implements InlineParserInterface -{ - /** - * Max bound for backtick code span delimiters. - * - * @see https://github.com/commonmark/cmark/commit/8ed5c9d - */ - private const MAX_BACKTICKS = 1000; - - /** @var \WeakReference|null */ - private ?\WeakReference $lastCursor = null; - private bool $lastCursorScanned = false; - - /** @var array backtick count => position of known ender */ - private array $seenBackticks = []; - - public function getMatchDefinition(): InlineParserMatch - { - return InlineParserMatch::regex('`+'); - } - - public function parse(InlineParserContext $inlineContext): bool - { - $ticks = $inlineContext->getFullMatch(); - $cursor = $inlineContext->getCursor(); - $cursor->advanceBy($inlineContext->getFullMatchLength()); - - $currentPosition = $cursor->getPosition(); - $previousState = $cursor->saveState(); - - if ($this->findMatchingTicks(\strlen($ticks), $cursor)) { - $code = $cursor->getSubstring($currentPosition, $cursor->getPosition() - $currentPosition - \strlen($ticks)); - - $c = \preg_replace('/\n/m', ' ', $code) ?? ''; - - if ( - $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; - } - - /** - * Locates the matching closer for a backtick code span. - * - * Leverages some caching to avoid traversing the same cursor multiple times when - * we've already seen all the potential backtick closers. - * - * @see https://github.com/commonmark/cmark/commit/8ed5c9d - * - * @param int $openTickLength Number of backticks in the opening sequence - * @param Cursor $cursor Cursor to scan - * - * @return bool True if a matching closer was found, false otherwise - */ - private function findMatchingTicks(int $openTickLength, Cursor $cursor): bool - { - // Reset the seenBackticks cache if this is a new cursor - if ($this->lastCursor === null || $this->lastCursor->get() !== $cursor) { - $this->seenBackticks = []; - $this->lastCursor = \WeakReference::create($cursor); - $this->lastCursorScanned = false; - } - - if ($openTickLength > self::MAX_BACKTICKS) { - return false; - } - - // Return if we already know there's no closer - if ($this->lastCursorScanned && isset($this->seenBackticks[$openTickLength]) && $this->seenBackticks[$openTickLength] <= $cursor->getPosition()) { - return false; - } - - while ($ticks = $cursor->match('/`{1,' . self::MAX_BACKTICKS . '}/m')) { - $numTicks = \strlen($ticks); - - // Did we find the closer? - if ($numTicks === $openTickLength) { - return true; - } - - // Store position of closer - if ($numTicks <= self::MAX_BACKTICKS) { - $this->seenBackticks[$numTicks] = $cursor->getPosition() - $numTicks; - } - } - - // Got through whole input without finding closer - $this->lastCursorScanned = true; - - return false; - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/BangParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/BangParser.php deleted file mode 100644 index cbf6ca3..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/BangParser.php +++ /dev/null @@ -1,44 +0,0 @@ - - * - * 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\CommonMark\Parser\Inline; - -use League\CommonMark\Node\Inline\Text; -use League\CommonMark\Parser\Inline\InlineParserInterface; -use League\CommonMark\Parser\Inline\InlineParserMatch; -use League\CommonMark\Parser\InlineParserContext; - -final class BangParser implements InlineParserInterface -{ - public function getMatchDefinition(): InlineParserMatch - { - return InlineParserMatch::string('!['); - } - - public function parse(InlineParserContext $inlineContext): bool - { - $cursor = $inlineContext->getCursor(); - $cursor->advanceBy(2); - - $node = new Text('![', ['delim' => true]); - $inlineContext->getContainer()->appendChild($node); - - // Add entry to stack for this opener - $inlineContext->getDelimiterStack()->addBracket($node, $cursor->getPosition(), true); - - return true; - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/CloseBracketParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/CloseBracketParser.php deleted file mode 100644 index f3b83fd..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/CloseBracketParser.php +++ /dev/null @@ -1,214 +0,0 @@ - - * - * 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\CommonMark\Parser\Inline; - -use League\CommonMark\Delimiter\Bracket; -use League\CommonMark\Environment\EnvironmentAwareInterface; -use League\CommonMark\Environment\EnvironmentInterface; -use League\CommonMark\Extension\CommonMark\Node\Inline\AbstractWebResource; -use League\CommonMark\Extension\CommonMark\Node\Inline\Image; -use League\CommonMark\Extension\CommonMark\Node\Inline\Link; -use League\CommonMark\Extension\Mention\Mention; -use League\CommonMark\Node\Inline\AdjacentTextMerger; -use League\CommonMark\Node\Inline\Text; -use League\CommonMark\Parser\Cursor; -use League\CommonMark\Parser\Inline\InlineParserInterface; -use League\CommonMark\Parser\Inline\InlineParserMatch; -use League\CommonMark\Parser\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 -{ - /** @psalm-readonly-allow-private-mutation */ - private EnvironmentInterface $environment; - - public function getMatchDefinition(): InlineParserMatch - { - return InlineParserMatch::string(']'); - } - - public function parse(InlineParserContext $inlineContext): bool - { - // Look through stack of delimiters for a [ or ! - $opener = $inlineContext->getDelimiterStack()->getLastBracket(); - if ($opener === null) { - return false; - } - - if (! $opener->isImage() && ! $opener->isActive()) { - // no matched opener; remove from stack - $inlineContext->getDelimiterStack()->removeBracket(); - - return false; - } - - $cursor = $inlineContext->getCursor(); - - $startPos = $cursor->getPosition(); - $previousState = $cursor->saveState(); - - $cursor->advanceBy(1); - - // Check to see if we have a link/image - - // Inline link? - if ($result = $this->tryParseInlineLinkAndTitle($cursor)) { - $link = $result; - } elseif ($link = $this->tryParseReference($cursor, $inlineContext->getReferenceMap(), $opener, $startPos)) { - $reference = $link; - $link = ['url' => $link->getDestination(), 'title' => $link->getTitle()]; - } else { - // No match; remove this opener from stack - $inlineContext->getDelimiterStack()->removeBracket(); - $cursor->restoreState($previousState); - - return false; - } - - $inline = $this->createInline($link['url'], $link['title'], $opener->isImage(), $reference ?? null); - $opener->getNode()->replaceWith($inline); - while (($label = $inline->next()) !== null) { - // Is there a Mention or Link contained within this link? - // CommonMark does not allow nested links, so we'll restore the original text. - if ($label instanceof Mention) { - $label->replaceWith($replacement = new Text($label->getPrefix() . $label->getIdentifier())); - $inline->appendChild($replacement); - } elseif ($label instanceof Link) { - foreach ($label->children() as $child) { - $label->insertBefore($child); - } - - $label->detach(); - } else { - $inline->appendChild($label); - } - } - - // Process delimiters such as emphasis inside link/image - $delimiterStack = $inlineContext->getDelimiterStack(); - $stackBottom = $opener->getPosition(); - $delimiterStack->processDelimiters($stackBottom, $this->environment->getDelimiterProcessors()); - $delimiterStack->removeBracket(); - $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 (! $opener->isImage()) { - $inlineContext->getDelimiterStack()->deactivateLinkOpeners(); - } - - return true; - } - - public function setEnvironment(EnvironmentInterface $environment): void - { - $this->environment = $environment; - } - - /** - * @return array|null - */ - private function tryParseInlineLinkAndTitle(Cursor $cursor): ?array - { - if ($cursor->getCurrentCharacter() !== '(') { - return null; - } - - $previousState = $cursor->saveState(); - - $cursor->advanceBy(1); - $cursor->advanceToNextNonSpaceOrNewline(); - if (($dest = LinkParserHelper::parseLinkDestination($cursor)) === null) { - $cursor->restoreState($previousState); - - return null; - } - - $cursor->advanceToNextNonSpaceOrNewline(); - $previousCharacter = $cursor->peek(-1); - // We know from previous lines that we've advanced at least one space so far, so this next call should never be null - \assert(\is_string($previousCharacter)); - - $title = ''; - // make sure there's a space before the title: - if (\preg_match(RegexHelper::REGEX_WHITESPACE_CHAR, $previousCharacter)) { - $title = LinkParserHelper::parseLinkTitle($cursor) ?? ''; - } - - $cursor->advanceToNextNonSpaceOrNewline(); - - if ($cursor->getCurrentCharacter() !== ')') { - $cursor->restoreState($previousState); - - return null; - } - - $cursor->advanceBy(1); - - return ['url' => $dest, 'title' => $title]; - } - - private function tryParseReference(Cursor $cursor, ReferenceMapInterface $referenceMap, Bracket $opener, int $startPos): ?ReferenceInterface - { - $savePos = $cursor->saveState(); - $beforeLabel = $cursor->getPosition(); - $n = LinkParserHelper::parseLinkLabel($cursor); - if ($n > 2) { - $start = $beforeLabel + 1; - $length = $n - 2; - } elseif (! $opener->hasNext()) { - // Empty or missing second label means to use the first label as the reference. - // The reference must not contain a bracket. If we know there's a bracket, we don't even bother checking it. - $start = $opener->getPosition(); - $length = $startPos - $start; - } else { - $cursor->restoreState($savePos); - - return null; - } - - $referenceLabel = $cursor->getSubstring($start, $length); - - if ($n === 0) { - // If shortcut reference link, rewind before spaces we skipped - $cursor->restoreState($savePos); - } - - return $referenceMap->get($referenceLabel); - } - - private function createInline(string $url, string $title, bool $isImage, ?ReferenceInterface $reference = null): AbstractWebResource - { - if ($isImage) { - $inline = new Image($url, null, $title); - } else { - $inline = new Link($url, null, $title); - } - - if ($reference) { - $inline->data->set('reference', $reference); - } - - return $inline; - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/EntityParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/EntityParser.php deleted file mode 100644 index 4122ff7..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/EntityParser.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * 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\CommonMark\Parser\Inline; - -use League\CommonMark\Node\Inline\Text; -use League\CommonMark\Parser\Inline\InlineParserInterface; -use League\CommonMark\Parser\Inline\InlineParserMatch; -use League\CommonMark\Parser\InlineParserContext; -use League\CommonMark\Util\Html5EntityDecoder; -use League\CommonMark\Util\RegexHelper; - -final class EntityParser implements InlineParserInterface -{ - public function getMatchDefinition(): InlineParserMatch - { - return InlineParserMatch::regex(RegexHelper::PARTIAL_ENTITY); - } - - public function parse(InlineParserContext $inlineContext): bool - { - $entity = $inlineContext->getFullMatch(); - - $inlineContext->getCursor()->advanceBy($inlineContext->getFullMatchLength()); - $inlineContext->getContainer()->appendChild(new Text(Html5EntityDecoder::decode($entity))); - - return true; - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/EscapableParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/EscapableParser.php deleted file mode 100644 index 64e6fab..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/EscapableParser.php +++ /dev/null @@ -1,57 +0,0 @@ - - * - * 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\CommonMark\Parser\Inline; - -use League\CommonMark\Node\Inline\Newline; -use League\CommonMark\Node\Inline\Text; -use League\CommonMark\Parser\Inline\InlineParserInterface; -use League\CommonMark\Parser\Inline\InlineParserMatch; -use League\CommonMark\Parser\InlineParserContext; -use League\CommonMark\Util\RegexHelper; - -final class EscapableParser implements InlineParserInterface -{ - public function getMatchDefinition(): InlineParserMatch - { - return InlineParserMatch::string('\\'); - } - - 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; - } - - if ($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/Extension/CommonMark/Parser/Inline/HtmlInlineParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/HtmlInlineParser.php deleted file mode 100644 index f38db13..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/HtmlInlineParser.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * 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\CommonMark\Parser\Inline; - -use League\CommonMark\Extension\CommonMark\Node\Inline\HtmlInline; -use League\CommonMark\Parser\Inline\InlineParserInterface; -use League\CommonMark\Parser\Inline\InlineParserMatch; -use League\CommonMark\Parser\InlineParserContext; -use League\CommonMark\Util\RegexHelper; - -final class HtmlInlineParser implements InlineParserInterface -{ - public function getMatchDefinition(): InlineParserMatch - { - return InlineParserMatch::regex(RegexHelper::PARTIAL_HTMLTAG)->caseSensitive(); - } - - public function parse(InlineParserContext $inlineContext): bool - { - $inline = $inlineContext->getFullMatch(); - - $inlineContext->getCursor()->advanceBy($inlineContext->getFullMatchLength()); - $inlineContext->getContainer()->appendChild(new HtmlInline($inline)); - - return true; - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/OpenBracketParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/OpenBracketParser.php deleted file mode 100644 index 1ba8c13..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/OpenBracketParser.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * 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\CommonMark\Parser\Inline; - -use League\CommonMark\Node\Inline\Text; -use League\CommonMark\Parser\Inline\InlineParserInterface; -use League\CommonMark\Parser\Inline\InlineParserMatch; -use League\CommonMark\Parser\InlineParserContext; - -final class OpenBracketParser implements InlineParserInterface -{ - public function getMatchDefinition(): InlineParserMatch - { - return InlineParserMatch::string('['); - } - - 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 - $inlineContext->getDelimiterStack()->addBracket($node, $inlineContext->getCursor()->getPosition(), false); - - return true; - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/BlockQuoteRenderer.php b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/BlockQuoteRenderer.php deleted file mode 100644 index 4a59bd3..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/BlockQuoteRenderer.php +++ /dev/null @@ -1,70 +0,0 @@ - - * - * 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\CommonMark\Renderer\Block; - -use League\CommonMark\Extension\CommonMark\Node\Block\BlockQuote; -use League\CommonMark\Node\Node; -use League\CommonMark\Renderer\ChildNodeRendererInterface; -use League\CommonMark\Renderer\NodeRendererInterface; -use League\CommonMark\Util\HtmlElement; -use League\CommonMark\Xml\XmlNodeRendererInterface; - -final class BlockQuoteRenderer implements NodeRendererInterface, XmlNodeRendererInterface -{ - /** - * @param BlockQuote $node - * - * {@inheritDoc} - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable - { - BlockQuote::assertInstanceOf($node); - - $attrs = $node->data->get('attributes'); - - $filling = $childRenderer->renderNodes($node->children()); - $innerSeparator = $childRenderer->getInnerSeparator(); - if ($filling === '') { - return new HtmlElement('blockquote', $attrs, $innerSeparator); - } - - return new HtmlElement( - 'blockquote', - $attrs, - $innerSeparator . $filling . $innerSeparator - ); - } - - public function getXmlTagName(Node $node): string - { - return 'block_quote'; - } - - /** - * @param BlockQuote $node - * - * @return array - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function getXmlAttributes(Node $node): array - { - return []; - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/FencedCodeRenderer.php b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/FencedCodeRenderer.php deleted file mode 100644 index 8df9a40..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/FencedCodeRenderer.php +++ /dev/null @@ -1,81 +0,0 @@ - - * - * 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\CommonMark\Renderer\Block; - -use League\CommonMark\Extension\CommonMark\Node\Block\FencedCode; -use League\CommonMark\Node\Node; -use League\CommonMark\Renderer\ChildNodeRendererInterface; -use League\CommonMark\Renderer\NodeRendererInterface; -use League\CommonMark\Util\HtmlElement; -use League\CommonMark\Util\Xml; -use League\CommonMark\Xml\XmlNodeRendererInterface; - -final class FencedCodeRenderer implements NodeRendererInterface, XmlNodeRendererInterface -{ - /** - * @param FencedCode $node - * - * {@inheritDoc} - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable - { - FencedCode::assertInstanceOf($node); - - $attrs = $node->data->getData('attributes'); - - $infoWords = $node->getInfoWords(); - if (\count($infoWords) !== 0 && $infoWords[0] !== '') { - $class = $infoWords[0]; - if (! \str_starts_with($class, 'language-')) { - $class = 'language-' . $class; - } - - $attrs->append('class', $class); - } - - return new HtmlElement( - 'pre', - [], - new HtmlElement('code', $attrs->export(), Xml::escape($node->getLiteral())) - ); - } - - public function getXmlTagName(Node $node): string - { - return 'code_block'; - } - - /** - * @param FencedCode $node - * - * @return array - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function getXmlAttributes(Node $node): array - { - FencedCode::assertInstanceOf($node); - - if (($info = $node->getInfo()) === null || $info === '') { - return []; - } - - return ['info' => $info]; - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/HeadingRenderer.php b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/HeadingRenderer.php deleted file mode 100644 index 8718b8c..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/HeadingRenderer.php +++ /dev/null @@ -1,64 +0,0 @@ - - * - * 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\CommonMark\Renderer\Block; - -use League\CommonMark\Extension\CommonMark\Node\Block\Heading; -use League\CommonMark\Node\Node; -use League\CommonMark\Renderer\ChildNodeRendererInterface; -use League\CommonMark\Renderer\NodeRendererInterface; -use League\CommonMark\Util\HtmlElement; -use League\CommonMark\Xml\XmlNodeRendererInterface; - -final class HeadingRenderer implements NodeRendererInterface, XmlNodeRendererInterface -{ - /** - * @param Heading $node - * - * {@inheritDoc} - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable - { - Heading::assertInstanceOf($node); - - $tag = 'h' . $node->getLevel(); - - $attrs = $node->data->get('attributes'); - - return new HtmlElement($tag, $attrs, $childRenderer->renderNodes($node->children())); - } - - public function getXmlTagName(Node $node): string - { - return 'heading'; - } - - /** - * @param Heading $node - * - * @return array - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function getXmlAttributes(Node $node): array - { - Heading::assertInstanceOf($node); - - return ['level' => $node->getLevel()]; - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/HtmlBlockRenderer.php b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/HtmlBlockRenderer.php deleted file mode 100644 index 63a1907..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/HtmlBlockRenderer.php +++ /dev/null @@ -1,66 +0,0 @@ - - * - * 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\CommonMark\Renderer\Block; - -use League\CommonMark\Extension\CommonMark\Node\Block\HtmlBlock; -use League\CommonMark\Node\Node; -use League\CommonMark\Renderer\ChildNodeRendererInterface; -use League\CommonMark\Renderer\NodeRendererInterface; -use League\CommonMark\Util\HtmlFilter; -use League\CommonMark\Xml\XmlNodeRendererInterface; -use League\Config\ConfigurationAwareInterface; -use League\Config\ConfigurationInterface; - -final class HtmlBlockRenderer implements NodeRendererInterface, XmlNodeRendererInterface, ConfigurationAwareInterface -{ - /** @psalm-readonly-allow-private-mutation */ - private ConfigurationInterface $config; - - /** - * @param HtmlBlock $node - * - * {@inheritDoc} - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function render(Node $node, ChildNodeRendererInterface $childRenderer): string - { - HtmlBlock::assertInstanceOf($node); - - $htmlInput = $this->config->get('html_input'); - - return HtmlFilter::filter($node->getLiteral(), $htmlInput); - } - - public function setConfiguration(ConfigurationInterface $configuration): void - { - $this->config = $configuration; - } - - public function getXmlTagName(Node $node): string - { - return 'html_block'; - } - - /** - * {@inheritDoc} - */ - public function getXmlAttributes(Node $node): array - { - return []; - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/IndentedCodeRenderer.php b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/IndentedCodeRenderer.php deleted file mode 100644 index c4bd4eb..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/IndentedCodeRenderer.php +++ /dev/null @@ -1,61 +0,0 @@ - - * - * 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\CommonMark\Renderer\Block; - -use League\CommonMark\Extension\CommonMark\Node\Block\IndentedCode; -use League\CommonMark\Node\Node; -use League\CommonMark\Renderer\ChildNodeRendererInterface; -use League\CommonMark\Renderer\NodeRendererInterface; -use League\CommonMark\Util\HtmlElement; -use League\CommonMark\Util\Xml; -use League\CommonMark\Xml\XmlNodeRendererInterface; - -final class IndentedCodeRenderer implements NodeRendererInterface, XmlNodeRendererInterface -{ - /** - * @param IndentedCode $node - * - * {@inheritDoc} - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable - { - IndentedCode::assertInstanceOf($node); - - $attrs = $node->data->get('attributes'); - - return new HtmlElement( - 'pre', - [], - new HtmlElement('code', $attrs, Xml::escape($node->getLiteral())) - ); - } - - public function getXmlTagName(Node $node): string - { - return 'code_block'; - } - - /** - * @return array - */ - public function getXmlAttributes(Node $node): array - { - return []; - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/ListBlockRenderer.php b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/ListBlockRenderer.php deleted file mode 100644 index f79b44d..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/ListBlockRenderer.php +++ /dev/null @@ -1,86 +0,0 @@ - - * - * 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\CommonMark\Renderer\Block; - -use League\CommonMark\Extension\CommonMark\Node\Block\ListBlock; -use League\CommonMark\Node\Node; -use League\CommonMark\Renderer\ChildNodeRendererInterface; -use League\CommonMark\Renderer\NodeRendererInterface; -use League\CommonMark\Util\HtmlElement; -use League\CommonMark\Xml\XmlNodeRendererInterface; - -final class ListBlockRenderer implements NodeRendererInterface, XmlNodeRendererInterface -{ - /** - * @param ListBlock $node - * - * {@inheritDoc} - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable - { - ListBlock::assertInstanceOf($node); - - $listData = $node->getListData(); - - $tag = $listData->type === ListBlock::TYPE_BULLET ? 'ul' : 'ol'; - - $attrs = $node->data->get('attributes'); - - if ($listData->start !== null && $listData->start !== 1) { - $attrs['start'] = (string) $listData->start; - } - - $innerSeparator = $childRenderer->getInnerSeparator(); - - return new HtmlElement($tag, $attrs, $innerSeparator . $childRenderer->renderNodes($node->children()) . $innerSeparator); - } - - public function getXmlTagName(Node $node): string - { - return 'list'; - } - - /** - * @param ListBlock $node - * - * @return array - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function getXmlAttributes(Node $node): array - { - ListBlock::assertInstanceOf($node); - - $data = $node->getListData(); - - if ($data->type === ListBlock::TYPE_BULLET) { - return [ - 'type' => $data->type, - 'tight' => $node->isTight() ? 'true' : 'false', - ]; - } - - return [ - 'type' => $data->type, - 'start' => $data->start ?? 1, - 'tight' => $node->isTight(), - 'delimiter' => $data->delimiter ?? ListBlock::DELIM_PERIOD, - ]; - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/ListItemRenderer.php b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/ListItemRenderer.php deleted file mode 100644 index 543baad..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/ListItemRenderer.php +++ /dev/null @@ -1,80 +0,0 @@ - - * - * 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\CommonMark\Renderer\Block; - -use League\CommonMark\Extension\CommonMark\Node\Block\ListItem; -use League\CommonMark\Node\Block\AbstractBlock; -use League\CommonMark\Node\Block\Paragraph; -use League\CommonMark\Node\Block\TightBlockInterface; -use League\CommonMark\Node\Node; -use League\CommonMark\Renderer\ChildNodeRendererInterface; -use League\CommonMark\Renderer\NodeRendererInterface; -use League\CommonMark\Util\HtmlElement; -use League\CommonMark\Xml\XmlNodeRendererInterface; - -final class ListItemRenderer implements NodeRendererInterface, XmlNodeRendererInterface -{ - /** - * @param ListItem $node - * - * {@inheritDoc} - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable - { - ListItem::assertInstanceOf($node); - - $contents = $childRenderer->renderNodes($node->children()); - - $inTightList = ($parent = $node->parent()) && $parent instanceof TightBlockInterface && $parent->isTight(); - - if ($this->needsBlockSeparator($node->firstChild(), $inTightList)) { - $contents = "\n" . $contents; - } - - if ($this->needsBlockSeparator($node->lastChild(), $inTightList)) { - $contents .= "\n"; - } - - $attrs = $node->data->get('attributes'); - - return new HtmlElement('li', $attrs, $contents); - } - - public function getXmlTagName(Node $node): string - { - return 'item'; - } - - /** - * {@inheritDoc} - */ - public function getXmlAttributes(Node $node): array - { - return []; - } - - private function needsBlockSeparator(?Node $child, bool $inTightList): bool - { - if ($child instanceof Paragraph && $inTightList) { - return false; - } - - return $child instanceof AbstractBlock; - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/ThematicBreakRenderer.php b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/ThematicBreakRenderer.php deleted file mode 100644 index 392bfee..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/ThematicBreakRenderer.php +++ /dev/null @@ -1,56 +0,0 @@ - - * - * 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\CommonMark\Renderer\Block; - -use League\CommonMark\Extension\CommonMark\Node\Block\ThematicBreak; -use League\CommonMark\Node\Node; -use League\CommonMark\Renderer\ChildNodeRendererInterface; -use League\CommonMark\Renderer\NodeRendererInterface; -use League\CommonMark\Util\HtmlElement; -use League\CommonMark\Xml\XmlNodeRendererInterface; - -final class ThematicBreakRenderer implements NodeRendererInterface, XmlNodeRendererInterface -{ - /** - * @param ThematicBreak $node - * - * {@inheritDoc} - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable - { - ThematicBreak::assertInstanceOf($node); - - $attrs = $node->data->get('attributes'); - - return new HtmlElement('hr', $attrs, '', true); - } - - public function getXmlTagName(Node $node): string - { - return 'thematic_break'; - } - - /** - * {@inheritDoc} - */ - public function getXmlAttributes(Node $node): array - { - return []; - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/CodeRenderer.php b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/CodeRenderer.php deleted file mode 100644 index de030e8..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/CodeRenderer.php +++ /dev/null @@ -1,57 +0,0 @@ - - * - * 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\CommonMark\Renderer\Inline; - -use League\CommonMark\Extension\CommonMark\Node\Inline\Code; -use League\CommonMark\Node\Node; -use League\CommonMark\Renderer\ChildNodeRendererInterface; -use League\CommonMark\Renderer\NodeRendererInterface; -use League\CommonMark\Util\HtmlElement; -use League\CommonMark\Util\Xml; -use League\CommonMark\Xml\XmlNodeRendererInterface; - -final class CodeRenderer implements NodeRendererInterface, XmlNodeRendererInterface -{ - /** - * @param Code $node - * - * {@inheritDoc} - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable - { - Code::assertInstanceOf($node); - - $attrs = $node->data->get('attributes'); - - return new HtmlElement('code', $attrs, Xml::escape($node->getLiteral())); - } - - public function getXmlTagName(Node $node): string - { - return 'code'; - } - - /** - * {@inheritDoc} - */ - public function getXmlAttributes(Node $node): array - { - return []; - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/EmphasisRenderer.php b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/EmphasisRenderer.php deleted file mode 100644 index 41169c4..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/EmphasisRenderer.php +++ /dev/null @@ -1,56 +0,0 @@ - - * - * 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\CommonMark\Renderer\Inline; - -use League\CommonMark\Extension\CommonMark\Node\Inline\Emphasis; -use League\CommonMark\Node\Node; -use League\CommonMark\Renderer\ChildNodeRendererInterface; -use League\CommonMark\Renderer\NodeRendererInterface; -use League\CommonMark\Util\HtmlElement; -use League\CommonMark\Xml\XmlNodeRendererInterface; - -final class EmphasisRenderer implements NodeRendererInterface, XmlNodeRendererInterface -{ - /** - * @param Emphasis $node - * - * {@inheritDoc} - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable - { - Emphasis::assertInstanceOf($node); - - $attrs = $node->data->get('attributes'); - - return new HtmlElement('em', $attrs, $childRenderer->renderNodes($node->children())); - } - - public function getXmlTagName(Node $node): string - { - return 'emph'; - } - - /** - * {@inheritDoc} - */ - public function getXmlAttributes(Node $node): array - { - return []; - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/HtmlInlineRenderer.php b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/HtmlInlineRenderer.php deleted file mode 100644 index 69f0fd5..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/HtmlInlineRenderer.php +++ /dev/null @@ -1,66 +0,0 @@ - - * - * 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\CommonMark\Renderer\Inline; - -use League\CommonMark\Extension\CommonMark\Node\Inline\HtmlInline; -use League\CommonMark\Node\Node; -use League\CommonMark\Renderer\ChildNodeRendererInterface; -use League\CommonMark\Renderer\NodeRendererInterface; -use League\CommonMark\Util\HtmlFilter; -use League\CommonMark\Xml\XmlNodeRendererInterface; -use League\Config\ConfigurationAwareInterface; -use League\Config\ConfigurationInterface; - -final class HtmlInlineRenderer implements NodeRendererInterface, XmlNodeRendererInterface, ConfigurationAwareInterface -{ - /** @psalm-readonly-allow-private-mutation */ - private ConfigurationInterface $config; - - /** - * @param HtmlInline $node - * - * {@inheritDoc} - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function render(Node $node, ChildNodeRendererInterface $childRenderer): string - { - HtmlInline::assertInstanceOf($node); - - $htmlInput = $this->config->get('html_input'); - - return HtmlFilter::filter($node->getLiteral(), $htmlInput); - } - - public function setConfiguration(ConfigurationInterface $configuration): void - { - $this->config = $configuration; - } - - public function getXmlTagName(Node $node): string - { - return 'html_inline'; - } - - /** - * {@inheritDoc} - */ - public function getXmlAttributes(Node $node): array - { - return []; - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/ImageRenderer.php b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/ImageRenderer.php deleted file mode 100644 index 7bf09ac..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/ImageRenderer.php +++ /dev/null @@ -1,107 +0,0 @@ - - * - * 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\CommonMark\Renderer\Inline; - -use League\CommonMark\Extension\CommonMark\Node\Inline\Image; -use League\CommonMark\Node\Inline\Newline; -use League\CommonMark\Node\Node; -use League\CommonMark\Node\NodeIterator; -use League\CommonMark\Node\StringContainerInterface; -use League\CommonMark\Renderer\ChildNodeRendererInterface; -use League\CommonMark\Renderer\NodeRendererInterface; -use League\CommonMark\Util\HtmlElement; -use League\CommonMark\Util\RegexHelper; -use League\CommonMark\Xml\XmlNodeRendererInterface; -use League\Config\ConfigurationAwareInterface; -use League\Config\ConfigurationInterface; - -final class ImageRenderer implements NodeRendererInterface, XmlNodeRendererInterface, ConfigurationAwareInterface -{ - /** @psalm-readonly-allow-private-mutation */ - private ConfigurationInterface $config; - - /** - * @param Image $node - * - * {@inheritDoc} - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable - { - Image::assertInstanceOf($node); - - $attrs = $node->data->get('attributes'); - - $forbidUnsafeLinks = ! $this->config->get('allow_unsafe_links'); - if ($forbidUnsafeLinks && RegexHelper::isLinkPotentiallyUnsafe($node->getUrl())) { - $attrs['src'] = ''; - } else { - $attrs['src'] = $node->getUrl(); - } - - $attrs['alt'] = $this->getAltText($node); - - if (($title = $node->getTitle()) !== null) { - $attrs['title'] = $title; - } - - return new HtmlElement('img', $attrs, '', true); - } - - public function setConfiguration(ConfigurationInterface $configuration): void - { - $this->config = $configuration; - } - - public function getXmlTagName(Node $node): string - { - return 'image'; - } - - /** - * @param Image $node - * - * @return array - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function getXmlAttributes(Node $node): array - { - Image::assertInstanceOf($node); - - return [ - 'destination' => $node->getUrl(), - 'title' => $node->getTitle() ?? '', - ]; - } - - private function getAltText(Image $node): string - { - $altText = ''; - - foreach ((new NodeIterator($node)) as $n) { - if ($n instanceof StringContainerInterface) { - $altText .= $n->getLiteral(); - } elseif ($n instanceof Newline) { - $altText .= "\n"; - } - } - - return $altText; - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/LinkRenderer.php b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/LinkRenderer.php deleted file mode 100644 index 4ef9645..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/LinkRenderer.php +++ /dev/null @@ -1,89 +0,0 @@ - - * - * 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\CommonMark\Renderer\Inline; - -use League\CommonMark\Extension\CommonMark\Node\Inline\Link; -use League\CommonMark\Node\Node; -use League\CommonMark\Renderer\ChildNodeRendererInterface; -use League\CommonMark\Renderer\NodeRendererInterface; -use League\CommonMark\Util\HtmlElement; -use League\CommonMark\Util\RegexHelper; -use League\CommonMark\Xml\XmlNodeRendererInterface; -use League\Config\ConfigurationAwareInterface; -use League\Config\ConfigurationInterface; - -final class LinkRenderer implements NodeRendererInterface, XmlNodeRendererInterface, ConfigurationAwareInterface -{ - /** @psalm-readonly-allow-private-mutation */ - private ConfigurationInterface $config; - - /** - * @param Link $node - * - * {@inheritDoc} - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable - { - Link::assertInstanceOf($node); - - $attrs = $node->data->get('attributes'); - - $forbidUnsafeLinks = ! $this->config->get('allow_unsafe_links'); - if (! ($forbidUnsafeLinks && RegexHelper::isLinkPotentiallyUnsafe($node->getUrl()))) { - $attrs['href'] = $node->getUrl(); - } - - if (($title = $node->getTitle()) !== null) { - $attrs['title'] = $title; - } - - if (isset($attrs['target']) && $attrs['target'] === '_blank' && ! isset($attrs['rel'])) { - $attrs['rel'] = 'noopener noreferrer'; - } - - return new HtmlElement('a', $attrs, $childRenderer->renderNodes($node->children())); - } - - public function setConfiguration(ConfigurationInterface $configuration): void - { - $this->config = $configuration; - } - - public function getXmlTagName(Node $node): string - { - return 'link'; - } - - /** - * @param Link $node - * - * @return array - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function getXmlAttributes(Node $node): array - { - Link::assertInstanceOf($node); - - return [ - 'destination' => $node->getUrl(), - 'title' => $node->getTitle() ?? '', - ]; - } -} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/StrongRenderer.php b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/StrongRenderer.php deleted file mode 100644 index f0bb8f9..0000000 --- a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/StrongRenderer.php +++ /dev/null @@ -1,56 +0,0 @@ - - * - * 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\CommonMark\Renderer\Inline; - -use League\CommonMark\Extension\CommonMark\Node\Inline\Strong; -use League\CommonMark\Node\Node; -use League\CommonMark\Renderer\ChildNodeRendererInterface; -use League\CommonMark\Renderer\NodeRendererInterface; -use League\CommonMark\Util\HtmlElement; -use League\CommonMark\Xml\XmlNodeRendererInterface; - -final class StrongRenderer implements NodeRendererInterface, XmlNodeRendererInterface -{ - /** - * @param Strong $node - * - * {@inheritDoc} - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable - { - Strong::assertInstanceOf($node); - - $attrs = $node->data->get('attributes'); - - return new HtmlElement('strong', $attrs, $childRenderer->renderNodes($node->children())); - } - - public function getXmlTagName(Node $node): string - { - return 'strong'; - } - - /** - * {@inheritDoc} - */ - public function getXmlAttributes(Node $node): array - { - return []; - } -} diff --git a/vendor/league/commonmark/src/Extension/ConfigurableExtensionInterface.php b/vendor/league/commonmark/src/Extension/ConfigurableExtensionInterface.php deleted file mode 100644 index 63e467c..0000000 --- a/vendor/league/commonmark/src/Extension/ConfigurableExtensionInterface.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * 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\Config\ConfigurationBuilderInterface; - -interface ConfigurableExtensionInterface extends ExtensionInterface -{ - public function configureSchema(ConfigurationBuilderInterface $builder): void; -} diff --git a/vendor/league/commonmark/src/Extension/DefaultAttributes/ApplyDefaultAttributesProcessor.php b/vendor/league/commonmark/src/Extension/DefaultAttributes/ApplyDefaultAttributesProcessor.php deleted file mode 100644 index 6b519f8..0000000 --- a/vendor/league/commonmark/src/Extension/DefaultAttributes/ApplyDefaultAttributesProcessor.php +++ /dev/null @@ -1,65 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\DefaultAttributes; - -use League\CommonMark\Event\DocumentParsedEvent; -use League\CommonMark\Extension\Attributes\Util\AttributesHelper; -use League\Config\ConfigurationAwareInterface; -use League\Config\ConfigurationInterface; - -final class ApplyDefaultAttributesProcessor implements ConfigurationAwareInterface -{ - private ConfigurationInterface $config; - - public function onDocumentParsed(DocumentParsedEvent $event): void - { - /** @var array> $map */ - $map = $this->config->get('default_attributes'); - - // Don't bother iterating if no default attributes are configured - if (! $map) { - return; - } - - foreach ($event->getDocument()->iterator() as $node) { - // Check to see if any default attributes were defined - if (($attributesToApply = $map[\get_class($node)] ?? []) === []) { - continue; - } - - $newAttributes = []; - foreach ($attributesToApply as $name => $value) { - if (\is_callable($value)) { - $value = $value($node); - // Callables are allowed to return `null` indicating that no changes should be made - if ($value !== null) { - $newAttributes[$name] = $value; - } - } else { - $newAttributes[$name] = $value; - } - } - - // Merge these attributes into the node - if (\count($newAttributes) > 0) { - $node->data->set('attributes', AttributesHelper::mergeAttributes($node, $newAttributes)); - } - } - } - - public function setConfiguration(ConfigurationInterface $configuration): void - { - $this->config = $configuration; - } -} diff --git a/vendor/league/commonmark/src/Extension/DefaultAttributes/DefaultAttributesExtension.php b/vendor/league/commonmark/src/Extension/DefaultAttributes/DefaultAttributesExtension.php deleted file mode 100644 index 152c29a..0000000 --- a/vendor/league/commonmark/src/Extension/DefaultAttributes/DefaultAttributesExtension.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\DefaultAttributes; - -use League\CommonMark\Environment\EnvironmentBuilderInterface; -use League\CommonMark\Event\DocumentParsedEvent; -use League\CommonMark\Extension\ConfigurableExtensionInterface; -use League\Config\ConfigurationBuilderInterface; -use Nette\Schema\Expect; - -final class DefaultAttributesExtension implements ConfigurableExtensionInterface -{ - public function configureSchema(ConfigurationBuilderInterface $builder): void - { - $builder->addSchema('default_attributes', Expect::arrayOf( - Expect::arrayOf( - Expect::type('string|string[]|bool|callable'), // attribute value(s) - 'string' // attribute name - ), - 'string' // node FQCN - )->default([])); - } - - public function register(EnvironmentBuilderInterface $environment): void - { - $environment->addEventListener(DocumentParsedEvent::class, [new ApplyDefaultAttributesProcessor(), 'onDocumentParsed']); - } -} diff --git a/vendor/league/commonmark/src/Extension/DescriptionList/DescriptionListExtension.php b/vendor/league/commonmark/src/Extension/DescriptionList/DescriptionListExtension.php deleted file mode 100644 index 9ddd2a8..0000000 --- a/vendor/league/commonmark/src/Extension/DescriptionList/DescriptionListExtension.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\DescriptionList; - -use League\CommonMark\Environment\EnvironmentBuilderInterface; -use League\CommonMark\Event\DocumentParsedEvent; -use League\CommonMark\Extension\DescriptionList\Event\ConsecutiveDescriptionListMerger; -use League\CommonMark\Extension\DescriptionList\Event\LooseDescriptionHandler; -use League\CommonMark\Extension\DescriptionList\Node\Description; -use League\CommonMark\Extension\DescriptionList\Node\DescriptionList; -use League\CommonMark\Extension\DescriptionList\Node\DescriptionTerm; -use League\CommonMark\Extension\DescriptionList\Parser\DescriptionStartParser; -use League\CommonMark\Extension\DescriptionList\Renderer\DescriptionListRenderer; -use League\CommonMark\Extension\DescriptionList\Renderer\DescriptionRenderer; -use League\CommonMark\Extension\DescriptionList\Renderer\DescriptionTermRenderer; -use League\CommonMark\Extension\ExtensionInterface; - -final class DescriptionListExtension implements ExtensionInterface -{ - public function register(EnvironmentBuilderInterface $environment): void - { - $environment->addBlockStartParser(new DescriptionStartParser()); - - $environment->addEventListener(DocumentParsedEvent::class, new LooseDescriptionHandler(), 1001); - $environment->addEventListener(DocumentParsedEvent::class, new ConsecutiveDescriptionListMerger(), 1000); - - $environment->addRenderer(DescriptionList::class, new DescriptionListRenderer()); - $environment->addRenderer(DescriptionTerm::class, new DescriptionTermRenderer()); - $environment->addRenderer(Description::class, new DescriptionRenderer()); - } -} diff --git a/vendor/league/commonmark/src/Extension/DescriptionList/Event/ConsecutiveDescriptionListMerger.php b/vendor/league/commonmark/src/Extension/DescriptionList/Event/ConsecutiveDescriptionListMerger.php deleted file mode 100644 index 15210e7..0000000 --- a/vendor/league/commonmark/src/Extension/DescriptionList/Event/ConsecutiveDescriptionListMerger.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\DescriptionList\Event; - -use League\CommonMark\Event\DocumentParsedEvent; -use League\CommonMark\Extension\DescriptionList\Node\DescriptionList; -use League\CommonMark\Node\NodeIterator; - -final class ConsecutiveDescriptionListMerger -{ - public function __invoke(DocumentParsedEvent $event): void - { - foreach ($event->getDocument()->iterator(NodeIterator::FLAG_BLOCKS_ONLY) as $node) { - if (! $node instanceof DescriptionList) { - continue; - } - - if (! ($prev = $node->previous()) instanceof DescriptionList) { - continue; - } - - // There's another description list behind this one; merge the current one into that - foreach ($node->children() as $child) { - $prev->appendChild($child); - } - - $node->detach(); - } - } -} diff --git a/vendor/league/commonmark/src/Extension/DescriptionList/Event/LooseDescriptionHandler.php b/vendor/league/commonmark/src/Extension/DescriptionList/Event/LooseDescriptionHandler.php deleted file mode 100644 index a8823fa..0000000 --- a/vendor/league/commonmark/src/Extension/DescriptionList/Event/LooseDescriptionHandler.php +++ /dev/null @@ -1,66 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\DescriptionList\Event; - -use League\CommonMark\Event\DocumentParsedEvent; -use League\CommonMark\Extension\DescriptionList\Node\Description; -use League\CommonMark\Extension\DescriptionList\Node\DescriptionList; -use League\CommonMark\Extension\DescriptionList\Node\DescriptionTerm; -use League\CommonMark\Node\Block\Paragraph; -use League\CommonMark\Node\Inline\Newline; -use League\CommonMark\Node\NodeIterator; - -final class LooseDescriptionHandler -{ - public function __invoke(DocumentParsedEvent $event): void - { - foreach ($event->getDocument()->iterator(NodeIterator::FLAG_BLOCKS_ONLY) as $description) { - if (! $description instanceof Description) { - continue; - } - - // Does this description need to be added to a list? - if (! $description->parent() instanceof DescriptionList) { - $list = new DescriptionList(); - // Taking any preceding paragraphs with it - if (($paragraph = $description->previous()) instanceof Paragraph) { - $list->appendChild($paragraph); - } - - $description->replaceWith($list); - $list->appendChild($description); - } - - // Is this description preceded by a paragraph that should really be a term? - if (! (($paragraph = $description->previous()) instanceof Paragraph)) { - continue; - } - - // Convert the paragraph into one or more terms - $term = new DescriptionTerm(); - $paragraph->replaceWith($term); - - foreach ($paragraph->children() as $child) { - if ($child instanceof Newline) { - $newTerm = new DescriptionTerm(); - $term->insertAfter($newTerm); - $term = $newTerm; - continue; - } - - $term->appendChild($child); - } - } - } -} diff --git a/vendor/league/commonmark/src/Extension/DescriptionList/Node/Description.php b/vendor/league/commonmark/src/Extension/DescriptionList/Node/Description.php deleted file mode 100644 index ccef962..0000000 --- a/vendor/league/commonmark/src/Extension/DescriptionList/Node/Description.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\DescriptionList\Node; - -use League\CommonMark\Node\Block\AbstractBlock; -use League\CommonMark\Node\Block\TightBlockInterface; - -class Description extends AbstractBlock implements TightBlockInterface -{ - private bool $tight; - - public function __construct(bool $tight = false) - { - parent::__construct(); - - $this->tight = $tight; - } - - public function isTight(): bool - { - return $this->tight; - } - - public function setTight(bool $tight): void - { - $this->tight = $tight; - } -} diff --git a/vendor/league/commonmark/src/Extension/DescriptionList/Node/DescriptionList.php b/vendor/league/commonmark/src/Extension/DescriptionList/Node/DescriptionList.php deleted file mode 100644 index 90d026c..0000000 --- a/vendor/league/commonmark/src/Extension/DescriptionList/Node/DescriptionList.php +++ /dev/null @@ -1,20 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\DescriptionList\Node; - -use League\CommonMark\Node\Block\AbstractBlock; - -class DescriptionList extends AbstractBlock -{ -} diff --git a/vendor/league/commonmark/src/Extension/DescriptionList/Node/DescriptionTerm.php b/vendor/league/commonmark/src/Extension/DescriptionList/Node/DescriptionTerm.php deleted file mode 100644 index b13ec75..0000000 --- a/vendor/league/commonmark/src/Extension/DescriptionList/Node/DescriptionTerm.php +++ /dev/null @@ -1,20 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\DescriptionList\Node; - -use League\CommonMark\Node\Block\AbstractBlock; - -class DescriptionTerm extends AbstractBlock -{ -} diff --git a/vendor/league/commonmark/src/Extension/DescriptionList/Parser/DescriptionContinueParser.php b/vendor/league/commonmark/src/Extension/DescriptionList/Parser/DescriptionContinueParser.php deleted file mode 100644 index 0cdd9d5..0000000 --- a/vendor/league/commonmark/src/Extension/DescriptionList/Parser/DescriptionContinueParser.php +++ /dev/null @@ -1,71 +0,0 @@ - - * - * 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\DescriptionList\Parser; - -use League\CommonMark\Extension\DescriptionList\Node\Description; -use League\CommonMark\Node\Block\AbstractBlock; -use League\CommonMark\Parser\Block\AbstractBlockContinueParser; -use League\CommonMark\Parser\Block\BlockContinue; -use League\CommonMark\Parser\Block\BlockContinueParserInterface; -use League\CommonMark\Parser\Cursor; - -final class DescriptionContinueParser extends AbstractBlockContinueParser -{ - private Description $block; - - private int $indentation; - - public function __construct(bool $tight, int $indentation) - { - $this->block = new Description($tight); - $this->indentation = $indentation; - } - - public function getBlock(): Description - { - return $this->block; - } - - public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue - { - if ($cursor->isBlank()) { - if ($this->block->firstChild() === null) { - // Blank line after empty item - return BlockContinue::none(); - } - - $cursor->advanceToNextNonSpaceOrTab(); - - return BlockContinue::at($cursor); - } - - if ($cursor->getIndent() >= $this->indentation) { - $cursor->advanceBy($this->indentation, true); - - return BlockContinue::at($cursor); - } - - return BlockContinue::none(); - } - - public function isContainer(): bool - { - return true; - } - - public function canContain(AbstractBlock $childBlock): bool - { - return true; - } -} diff --git a/vendor/league/commonmark/src/Extension/DescriptionList/Parser/DescriptionListContinueParser.php b/vendor/league/commonmark/src/Extension/DescriptionList/Parser/DescriptionListContinueParser.php deleted file mode 100644 index 1d446a7..0000000 --- a/vendor/league/commonmark/src/Extension/DescriptionList/Parser/DescriptionListContinueParser.php +++ /dev/null @@ -1,53 +0,0 @@ - - * - * 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\DescriptionList\Parser; - -use League\CommonMark\Extension\DescriptionList\Node\Description; -use League\CommonMark\Extension\DescriptionList\Node\DescriptionList; -use League\CommonMark\Extension\DescriptionList\Node\DescriptionTerm; -use League\CommonMark\Node\Block\AbstractBlock; -use League\CommonMark\Parser\Block\AbstractBlockContinueParser; -use League\CommonMark\Parser\Block\BlockContinue; -use League\CommonMark\Parser\Block\BlockContinueParserInterface; -use League\CommonMark\Parser\Cursor; - -final class DescriptionListContinueParser extends AbstractBlockContinueParser -{ - private DescriptionList $block; - - public function __construct() - { - $this->block = new DescriptionList(); - } - - public function getBlock(): DescriptionList - { - return $this->block; - } - - public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue - { - return BlockContinue::at($cursor); - } - - public function isContainer(): bool - { - return true; - } - - public function canContain(AbstractBlock $childBlock): bool - { - return $childBlock instanceof DescriptionTerm || $childBlock instanceof Description; - } -} diff --git a/vendor/league/commonmark/src/Extension/DescriptionList/Parser/DescriptionStartParser.php b/vendor/league/commonmark/src/Extension/DescriptionList/Parser/DescriptionStartParser.php deleted file mode 100644 index b4e8c98..0000000 --- a/vendor/league/commonmark/src/Extension/DescriptionList/Parser/DescriptionStartParser.php +++ /dev/null @@ -1,73 +0,0 @@ - - * - * 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\DescriptionList\Parser; - -use League\CommonMark\Extension\DescriptionList\Node\Description; -use League\CommonMark\Node\Block\Paragraph; -use League\CommonMark\Parser\Block\BlockStart; -use League\CommonMark\Parser\Block\BlockStartParserInterface; -use League\CommonMark\Parser\Cursor; -use League\CommonMark\Parser\MarkdownParserStateInterface; - -final class DescriptionStartParser implements BlockStartParserInterface -{ - public function tryStart(Cursor $cursor, MarkdownParserStateInterface $parserState): ?BlockStart - { - if ($cursor->isIndented()) { - return BlockStart::none(); - } - - $cursor->advanceToNextNonSpaceOrTab(); - if ($cursor->match('/^:[ \t]+/') === null) { - return BlockStart::none(); - } - - $terms = $parserState->getParagraphContent(); - - $activeBlock = $parserState->getActiveBlockParser()->getBlock(); - - if ($terms !== null && $terms !== '') { - // New description; tight; term(s) sitting in pending block that we will replace - return BlockStart::of(...[new DescriptionListContinueParser()], ...self::splitTerms($terms), ...[new DescriptionContinueParser(true, $cursor->getPosition())]) - ->at($cursor) - ->replaceActiveBlockParser(); - } - - if ($activeBlock instanceof Paragraph && $activeBlock->parent() instanceof Description) { - // Additional description in the same list as the parent description - return BlockStart::of(new DescriptionContinueParser(true, $cursor->getPosition()))->at($cursor); - } - - if ($activeBlock->lastChild() instanceof Paragraph) { - // New description; loose; term(s) sitting in previous closed paragraph block - return BlockStart::of(new DescriptionContinueParser(false, $cursor->getPosition()))->at($cursor); - } - - // No preceding terms - return BlockStart::none(); - } - - /** - * @return array - */ - private static function splitTerms(string $terms): array - { - $ret = []; - foreach (\explode("\n", $terms) as $term) { - $ret[] = new DescriptionTermContinueParser($term); - } - - return $ret; - } -} diff --git a/vendor/league/commonmark/src/Extension/DescriptionList/Parser/DescriptionTermContinueParser.php b/vendor/league/commonmark/src/Extension/DescriptionList/Parser/DescriptionTermContinueParser.php deleted file mode 100644 index 7b43882..0000000 --- a/vendor/league/commonmark/src/Extension/DescriptionList/Parser/DescriptionTermContinueParser.php +++ /dev/null @@ -1,52 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\DescriptionList\Parser; - -use League\CommonMark\Extension\DescriptionList\Node\DescriptionTerm; -use League\CommonMark\Parser\Block\AbstractBlockContinueParser; -use League\CommonMark\Parser\Block\BlockContinue; -use League\CommonMark\Parser\Block\BlockContinueParserInterface; -use League\CommonMark\Parser\Block\BlockContinueParserWithInlinesInterface; -use League\CommonMark\Parser\Cursor; -use League\CommonMark\Parser\InlineParserEngineInterface; - -final class DescriptionTermContinueParser extends AbstractBlockContinueParser implements BlockContinueParserWithInlinesInterface -{ - private DescriptionTerm $block; - - private string $term; - - public function __construct(string $term) - { - $this->block = new DescriptionTerm(); - $this->term = $term; - } - - public function getBlock(): DescriptionTerm - { - return $this->block; - } - - public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue - { - return BlockContinue::finished(); - } - - public function parseInlines(InlineParserEngineInterface $inlineParser): void - { - if ($this->term !== '') { - $inlineParser->parse($this->term, $this->block); - } - } -} diff --git a/vendor/league/commonmark/src/Extension/DescriptionList/Renderer/DescriptionListRenderer.php b/vendor/league/commonmark/src/Extension/DescriptionList/Renderer/DescriptionListRenderer.php deleted file mode 100644 index 7723038..0000000 --- a/vendor/league/commonmark/src/Extension/DescriptionList/Renderer/DescriptionListRenderer.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\DescriptionList\Renderer; - -use League\CommonMark\Extension\DescriptionList\Node\DescriptionList; -use League\CommonMark\Node\Node; -use League\CommonMark\Renderer\ChildNodeRendererInterface; -use League\CommonMark\Renderer\NodeRendererInterface; -use League\CommonMark\Util\HtmlElement; - -final class DescriptionListRenderer implements NodeRendererInterface -{ - /** - * @param DescriptionList $node - * - * {@inheritDoc} - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function render(Node $node, ChildNodeRendererInterface $childRenderer): HtmlElement - { - DescriptionList::assertInstanceOf($node); - - $separator = $childRenderer->getBlockSeparator(); - - return new HtmlElement('dl', [], $separator . $childRenderer->renderNodes($node->children()) . $separator); - } -} diff --git a/vendor/league/commonmark/src/Extension/DescriptionList/Renderer/DescriptionRenderer.php b/vendor/league/commonmark/src/Extension/DescriptionList/Renderer/DescriptionRenderer.php deleted file mode 100644 index 5fcffd6..0000000 --- a/vendor/league/commonmark/src/Extension/DescriptionList/Renderer/DescriptionRenderer.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\DescriptionList\Renderer; - -use League\CommonMark\Extension\DescriptionList\Node\Description; -use League\CommonMark\Node\Node; -use League\CommonMark\Renderer\ChildNodeRendererInterface; -use League\CommonMark\Renderer\NodeRendererInterface; -use League\CommonMark\Util\HtmlElement; - -final class DescriptionRenderer implements NodeRendererInterface -{ - /** - * @param Description $node - * - * {@inheritDoc} - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable - { - Description::assertInstanceOf($node); - - return new HtmlElement('dd', [], $childRenderer->renderNodes($node->children())); - } -} diff --git a/vendor/league/commonmark/src/Extension/DescriptionList/Renderer/DescriptionTermRenderer.php b/vendor/league/commonmark/src/Extension/DescriptionList/Renderer/DescriptionTermRenderer.php deleted file mode 100644 index ce8a1c4..0000000 --- a/vendor/league/commonmark/src/Extension/DescriptionList/Renderer/DescriptionTermRenderer.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace League\CommonMark\Extension\DescriptionList\Renderer; - -use League\CommonMark\Extension\DescriptionList\Node\DescriptionTerm; -use League\CommonMark\Node\Node; -use League\CommonMark\Renderer\ChildNodeRendererInterface; -use League\CommonMark\Renderer\NodeRendererInterface; -use League\CommonMark\Util\HtmlElement; - -final class DescriptionTermRenderer implements NodeRendererInterface -{ - /** - * @param DescriptionTerm $node - * - * {@inheritDoc} - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable - { - DescriptionTerm::assertInstanceOf($node); - - return new HtmlElement('dt', [], $childRenderer->renderNodes($node->children())); - } -} 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 0ece0c2..0000000 --- a/vendor/league/commonmark/src/Extension/DisallowedRawHtml/DisallowedRawHtmlExtension.php +++ /dev/null @@ -1,51 +0,0 @@ - - * - * 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\Environment\EnvironmentBuilderInterface; -use League\CommonMark\Extension\CommonMark\Node\Block\HtmlBlock; -use League\CommonMark\Extension\CommonMark\Node\Inline\HtmlInline; -use League\CommonMark\Extension\CommonMark\Renderer\Block\HtmlBlockRenderer; -use League\CommonMark\Extension\CommonMark\Renderer\Inline\HtmlInlineRenderer; -use League\CommonMark\Extension\ConfigurableExtensionInterface; -use League\Config\ConfigurationBuilderInterface; -use Nette\Schema\Expect; - -final class DisallowedRawHtmlExtension implements ConfigurableExtensionInterface -{ - private const DEFAULT_DISALLOWED_TAGS = [ - 'title', - 'textarea', - 'style', - 'xmp', - 'iframe', - 'noembed', - 'noframes', - 'script', - 'plaintext', - ]; - - public function configureSchema(ConfigurationBuilderInterface $builder): void - { - $builder->addSchema('disallowed_raw_html', Expect::structure([ - 'disallowed_tags' => Expect::listOf('string')->default(self::DEFAULT_DISALLOWED_TAGS)->mergeDefaults(false), - ])); - } - - public function register(EnvironmentBuilderInterface $environment): void - { - $environment->addRenderer(HtmlBlock::class, new DisallowedRawHtmlRenderer(new HtmlBlockRenderer()), 50); - $environment->addRenderer(HtmlInline::class, new DisallowedRawHtmlRenderer(new HtmlInlineRenderer()), 50); - } -} diff --git a/vendor/league/commonmark/src/Extension/DisallowedRawHtml/DisallowedRawHtmlRenderer.php b/vendor/league/commonmark/src/Extension/DisallowedRawHtml/DisallowedRawHtmlRenderer.php deleted file mode 100644 index 06252a3..0000000 --- a/vendor/league/commonmark/src/Extension/DisallowedRawHtml/DisallowedRawHtmlRenderer.php +++ /dev/null @@ -1,62 +0,0 @@ - - * - * 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\Node\Node; -use League\CommonMark\Renderer\ChildNodeRendererInterface; -use League\CommonMark\Renderer\NodeRendererInterface; -use League\Config\ConfigurationAwareInterface; -use League\Config\ConfigurationInterface; - -final class DisallowedRawHtmlRenderer implements NodeRendererInterface, ConfigurationAwareInterface -{ - /** @psalm-readonly */ - private NodeRendererInterface $innerRenderer; - - /** @psalm-readonly-allow-private-mutation */ - private ConfigurationInterface $config; - - public function __construct(NodeRendererInterface $innerRenderer) - { - $this->innerRenderer = $innerRenderer; - } - - public function render(Node $node, ChildNodeRendererInterface $childRenderer): ?string - { - $rendered = (string) $this->innerRenderer->render($node, $childRenderer); - - if ($rendered === '') { - return ''; - } - - $tags = (array) $this->config->get('disallowed_raw_html/disallowed_tags'); - if (\count($tags) === 0) { - return $rendered; - } - - $regex = \sprintf('/<(\/?(?:%s)[ \/>])/i', \implode('|', \array_map('preg_quote', $tags))); - - // Match these types of tags: <title/> <title /> - return \preg_replace($regex, '<$1', $rendered); - } - - public function setConfiguration(ConfigurationInterface $configuration): void - { - $this->config = $configuration; - - if ($this->innerRenderer instanceof ConfigurationAwareInterface) { - $this->innerRenderer->setConfiguration($configuration); - } - } -} diff --git a/vendor/league/commonmark/src/Extension/Embed/Bridge/OscaroteroEmbedAdapter.php b/vendor/league/commonmark/src/Extension/Embed/Bridge/OscaroteroEmbedAdapter.php deleted file mode 100644 index 06b8190..0000000 --- a/vendor/league/commonmark/src/Extension/Embed/Bridge/OscaroteroEmbedAdapter.php +++ /dev/null @@ -1,50 +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\Extension\Embed\Bridge; - -use Embed\Embed as EmbedLib; -use League\CommonMark\Exception\MissingDependencyException; -use League\CommonMark\Extension\Embed\Embed; -use League\CommonMark\Extension\Embed\EmbedAdapterInterface; - -final class OscaroteroEmbedAdapter implements EmbedAdapterInterface -{ - private EmbedLib $embedLib; - - public function __construct(?EmbedLib $embed = null) - { - if ($embed === null) { - if (! \class_exists(EmbedLib::class)) { - throw new MissingDependencyException('The embed/embed package is not installed. Please install it with Composer to use this adapter.'); - } - - $embed = new EmbedLib(); - } - - $this->embedLib = $embed; - } - - /** - * {@inheritDoc} - */ - public function updateEmbeds(array $embeds): void - { - $extractors = $this->embedLib->getMulti(...\array_map(static fn (Embed $embed) => $embed->getUrl(), $embeds)); - foreach ($extractors as $i => $extractor) { - if ($extractor->code !== null) { - $embeds[$i]->setEmbedCode($extractor->code->html); - } - } - } -} diff --git a/vendor/league/commonmark/src/Extension/Embed/DomainFilteringAdapter.php b/vendor/league/commonmark/src/Extension/Embed/DomainFilteringAdapter.php deleted file mode 100644 index d150764..0000000 --- a/vendor/league/commonmark/src/Extension/Embed/DomainFilteringAdapter.php +++ /dev/null @@ -1,53 +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\Extension\Embed; - -class DomainFilteringAdapter implements EmbedAdapterInterface -{ - private EmbedAdapterInterface $decorated; - - /** @psalm-var non-empty-string */ - private string $regex; - - /** - * @param string[] $allowedDomains - */ - public function __construct(EmbedAdapterInterface $decorated, array $allowedDomains) - { - $this->decorated = $decorated; - $this->regex = self::createRegex($allowedDomains); - } - - /** - * {@inheritDoc} - */ - public function updateEmbeds(array $embeds): void - { - $this->decorated->updateEmbeds(\array_values(\array_filter($embeds, function (Embed $embed): bool { - return \preg_match($this->regex, $embed->getUrl()) === 1; - }))); - } - - /** - * @param string[] $allowedDomains - * - * @psalm-return non-empty-string - */ - private static function createRegex(array $allowedDomains): string - { - $allowedDomains = \array_map('preg_quote', $allowedDomains); - - return '/^(?:https?:\/\/)?(?:[^.]+\.)*(' . \implode('|', $allowedDomains) . ')/'; - } -} diff --git a/vendor/league/commonmark/src/Extension/Embed/Embed.php b/vendor/league/commonmark/src/Extension/Embed/Embed.php deleted file mode 100644 index 94c1980..0000000 --- a/vendor/league/commonmark/src/Extension/Embed/Embed.php +++ /dev/null @@ -1,50 +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\Extension\Embed; - -use League\CommonMark\Node\Block\AbstractBlock; - -final class Embed extends AbstractBlock -{ - private string $url; - private ?string $embedCode; - - public function __construct(string $url, ?string $embedCode = null) - { - parent::__construct(); - - $this->url = $url; - $this->embedCode = $embedCode; - } - - public function getUrl(): string - { - return $this->url; - } - - public function setUrl(string $url): void - { - $this->url = $url; - } - - public function getEmbedCode(): ?string - { - return $this->embedCode; - } - - public function setEmbedCode(?string $embedCode): void - { - $this->embedCode = $embedCode; - } -} diff --git a/vendor/league/commonmark/src/Extension/Embed/EmbedAdapterInterface.php b/vendor/league/commonmark/src/Extension/Embed/EmbedAdapterInterface.php deleted file mode 100644 index 9880a43..0000000 --- a/vendor/league/commonmark/src/Extension/Embed/EmbedAdapterInterface.php +++ /dev/null @@ -1,25 +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\Extension\Embed; - -/** - * Interface for a service which updates the embed code(s) for the given array of embeds - */ -interface EmbedAdapterInterface -{ - /** - * @param Embed[] $embeds - */ - public function updateEmbeds(array $embeds): void; -} diff --git a/vendor/league/commonmark/src/Extension/Embed/EmbedExtension.php b/vendor/league/commonmark/src/Extension/Embed/EmbedExtension.php deleted file mode 100644 index babf048..0000000 --- a/vendor/league/commonmark/src/Extension/Embed/EmbedExtension.php +++ /dev/null @@ -1,48 +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\Extension\Embed; - -use League\CommonMark\Environment\EnvironmentBuilderInterface; -use League\CommonMark\Event\DocumentParsedEvent; -use League\CommonMark\Extension\ConfigurableExtensionInterface; -use League\Config\ConfigurationBuilderInterface; -use Nette\Schema\Expect; - -final class EmbedExtension implements ConfigurableExtensionInterface -{ - public function configureSchema(ConfigurationBuilderInterface $builder): void - { - $builder->addSchema('embed', Expect::structure([ - 'adapter' => Expect::type(EmbedAdapterInterface::class), - 'allowed_domains' => Expect::arrayOf('string')->default([]), - 'fallback' => Expect::anyOf('link', 'remove')->default('link'), - ])); - } - - public function register(EnvironmentBuilderInterface $environment): void - { - $adapter = $environment->getConfiguration()->get('embed.adapter'); - \assert($adapter instanceof EmbedAdapterInterface); - - $allowedDomains = $environment->getConfiguration()->get('embed.allowed_domains'); - if ($allowedDomains !== []) { - $adapter = new DomainFilteringAdapter($adapter, $allowedDomains); - } - - $environment - ->addBlockStartParser(new EmbedStartParser(), 300) - ->addEventListener(DocumentParsedEvent::class, new EmbedProcessor($adapter, $environment->getConfiguration()->get('embed.fallback')), 1010) - ->addRenderer(Embed::class, new EmbedRenderer()); - } -} diff --git a/vendor/league/commonmark/src/Extension/Embed/EmbedParser.php b/vendor/league/commonmark/src/Extension/Embed/EmbedParser.php deleted file mode 100644 index e957caf..0000000 --- a/vendor/league/commonmark/src/Extension/Embed/EmbedParser.php +++ /dev/null @@ -1,62 +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\Extension\Embed; - -use League\CommonMark\Node\Block\AbstractBlock; -use League\CommonMark\Parser\Block\BlockContinue; -use League\CommonMark\Parser\Block\BlockContinueParserInterface; -use League\CommonMark\Parser\Cursor; - -class EmbedParser implements BlockContinueParserInterface -{ - private Embed $embed; - - public function __construct(string $url) - { - $this->embed = new Embed($url); - } - - public function getBlock(): AbstractBlock - { - return $this->embed; - } - - public function isContainer(): bool - { - return false; - } - - public function canHaveLazyContinuationLines(): bool - { - return false; - } - - public function canContain(AbstractBlock $childBlock): bool - { - return false; - } - - public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue - { - return BlockContinue::none(); - } - - public function addLine(string $line): void - { - } - - public function closeBlock(): void - { - } -} diff --git a/vendor/league/commonmark/src/Extension/Embed/EmbedProcessor.php b/vendor/league/commonmark/src/Extension/Embed/EmbedProcessor.php deleted file mode 100644 index 68fb9ee..0000000 --- a/vendor/league/commonmark/src/Extension/Embed/EmbedProcessor.php +++ /dev/null @@ -1,70 +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\Extension\Embed; - -use League\CommonMark\Event\DocumentParsedEvent; -use League\CommonMark\Extension\CommonMark\Node\Inline\Link; -use League\CommonMark\Node\Block\Paragraph; -use League\CommonMark\Node\Inline\Text; -use League\CommonMark\Node\NodeIterator; - -final class EmbedProcessor -{ - public const FALLBACK_REMOVE = 'remove'; - public const FALLBACK_LINK = 'link'; - - private EmbedAdapterInterface $adapter; - private string $fallback; - - public function __construct(EmbedAdapterInterface $adapter, string $fallback = self::FALLBACK_REMOVE) - { - $this->adapter = $adapter; - $this->fallback = $fallback; - } - - public function __invoke(DocumentParsedEvent $event): void - { - $document = $event->getDocument(); - $embeds = []; - foreach (new NodeIterator($document) as $node) { - if (! ($node instanceof Embed)) { - continue; - } - - if ($node->parent() !== $document) { - $replacement = new Paragraph(); - $replacement->appendChild(new Text($node->getUrl())); - $node->replaceWith($replacement); - } else { - $embeds[] = $node; - } - } - - $this->adapter->updateEmbeds($embeds); - - foreach ($embeds as $embed) { - if ($embed->getEmbedCode() !== null) { - continue; - } - - if ($this->fallback === self::FALLBACK_REMOVE) { - $embed->detach(); - } elseif ($this->fallback === self::FALLBACK_LINK) { - $paragraph = new Paragraph(); - $paragraph->appendChild(new Link($embed->getUrl(), $embed->getUrl())); - $embed->replaceWith($paragraph); - } - } - } -} diff --git a/vendor/league/commonmark/src/Extension/Embed/EmbedRenderer.php b/vendor/league/commonmark/src/Extension/Embed/EmbedRenderer.php deleted file mode 100644 index 91655d8..0000000 --- a/vendor/league/commonmark/src/Extension/Embed/EmbedRenderer.php +++ /dev/null @@ -1,35 +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\Extension\Embed; - -use League\CommonMark\Node\Node; -use League\CommonMark\Renderer\ChildNodeRendererInterface; -use League\CommonMark\Renderer\NodeRendererInterface; - -class EmbedRenderer implements NodeRendererInterface -{ - /** - * @param Embed $node - * - * {@inheritDoc} - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function render(Node $node, ChildNodeRendererInterface $childRenderer) - { - Embed::assertInstanceOf($node); - - return $node->getEmbedCode() ?? ''; - } -} diff --git a/vendor/league/commonmark/src/Extension/Embed/EmbedStartParser.php b/vendor/league/commonmark/src/Extension/Embed/EmbedStartParser.php deleted file mode 100644 index 5ff3808..0000000 --- a/vendor/league/commonmark/src/Extension/Embed/EmbedStartParser.php +++ /dev/null @@ -1,53 +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\Extension\Embed; - -use League\CommonMark\Parser\Block\BlockStart; -use League\CommonMark\Parser\Block\BlockStartParserInterface; -use League\CommonMark\Parser\Cursor; -use League\CommonMark\Parser\MarkdownParserStateInterface; -use League\CommonMark\Util\LinkParserHelper; - -class EmbedStartParser implements BlockStartParserInterface -{ - public function tryStart(Cursor $cursor, MarkdownParserStateInterface $parserState): ?BlockStart - { - if ($cursor->isIndented() || $parserState->getParagraphContent() !== null || ! ($parserState->getActiveBlockParser()->isContainer())) { - return BlockStart::none(); - } - - // 0-3 leading spaces are okay - $cursor->advanceToNextNonSpaceOrTab(); - - // The line must begin with "https://" - if (! str_starts_with($cursor->getRemainder(), 'https://')) { - return BlockStart::none(); - } - - // A valid link must be found next - if (($dest = LinkParserHelper::parseLinkDestination($cursor)) === null) { - return BlockStart::none(); - } - - // Skip any trailing whitespace - $cursor->advanceToNextNonSpaceOrTab(); - - // We must be at the end of the line; otherwise, this link was not by itself - if (! $cursor->isAtEnd()) { - return BlockStart::none(); - } - - return BlockStart::of(new EmbedParser($dest))->at($cursor); - } -} diff --git a/vendor/league/commonmark/src/Extension/ExtensionInterface.php b/vendor/league/commonmark/src/Extension/ExtensionInterface.php deleted file mode 100644 index 01a9f2e..0000000 --- a/vendor/league/commonmark/src/Extension/ExtensionInterface.php +++ /dev/null @@ -1,24 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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\Environment\EnvironmentBuilderInterface; - -interface ExtensionInterface -{ - public function register(EnvironmentBuilderInterface $environment): void; -} 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 df0079c..0000000 --- a/vendor/league/commonmark/src/Extension/ExternalLink/ExternalLinkExtension.php +++ /dev/null @@ -1,47 +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\Extension\ExternalLink; - -use League\CommonMark\Environment\EnvironmentBuilderInterface; -use League\CommonMark\Event\DocumentParsedEvent; -use League\CommonMark\Extension\ConfigurableExtensionInterface; -use League\Config\ConfigurationBuilderInterface; -use Nette\Schema\Expect; - -final class ExternalLinkExtension implements ConfigurableExtensionInterface -{ - public function configureSchema(ConfigurationBuilderInterface $builder): void - { - $applyOptions = [ - ExternalLinkProcessor::APPLY_NONE, - ExternalLinkProcessor::APPLY_ALL, - ExternalLinkProcessor::APPLY_INTERNAL, - ExternalLinkProcessor::APPLY_EXTERNAL, - ]; - - $builder->addSchema('external_link', Expect::structure([ - 'internal_hosts' => Expect::type('string|string[]'), - 'open_in_new_window' => Expect::bool(false), - 'html_class' => Expect::string()->default(''), - 'nofollow' => Expect::anyOf(...$applyOptions)->default(ExternalLinkProcessor::APPLY_NONE), - 'noopener' => Expect::anyOf(...$applyOptions)->default(ExternalLinkProcessor::APPLY_EXTERNAL), - 'noreferrer' => Expect::anyOf(...$applyOptions)->default(ExternalLinkProcessor::APPLY_EXTERNAL), - ])); - } - - public function register(EnvironmentBuilderInterface $environment): void - { - $environment->addEventListener(DocumentParsedEvent::class, new ExternalLinkProcessor($environment->getConfiguration()), -50); - } -} 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 4a0aa89..0000000 --- a/vendor/league/commonmark/src/Extension/ExternalLink/ExternalLinkProcessor.php +++ /dev/null @@ -1,119 +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\Extension\ExternalLink; - -use League\CommonMark\Event\DocumentParsedEvent; -use League\CommonMark\Extension\CommonMark\Node\Inline\Link; -use League\Config\ConfigurationInterface; - -final class ExternalLinkProcessor -{ - public const APPLY_NONE = ''; - public const APPLY_ALL = 'all'; - public const APPLY_EXTERNAL = 'external'; - public const APPLY_INTERNAL = 'internal'; - - /** @psalm-readonly */ - private ConfigurationInterface $config; - - public function __construct(ConfigurationInterface $config) - { - $this->config = $config; - } - - public function __invoke(DocumentParsedEvent $e): void - { - $internalHosts = $this->config->get('external_link/internal_hosts'); - $openInNewWindow = $this->config->get('external_link/open_in_new_window'); - $classes = $this->config->get('external_link/html_class'); - - foreach ($e->getDocument()->iterator() as $link) { - if (! ($link instanceof Link)) { - continue; - } - - $host = \parse_url($link->getUrl(), PHP_URL_HOST); - if (! \is_string($host)) { - // Something is terribly wrong with this URL - continue; - } - - if (self::hostMatches($host, $internalHosts)) { - $link->data->set('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->set('external', true); - $this->applyRelAttribute($link, true); - - if ($openInNewWindow) { - $link->data->set('attributes/target', '_blank'); - } - - if ($classes !== '') { - $link->data->append('attributes/class', $classes); - } - } - - private function applyRelAttribute(Link $link, bool $isExternal): void - { - $options = [ - 'nofollow' => $this->config->get('external_link/nofollow'), - 'noopener' => $this->config->get('external_link/noopener'), - 'noreferrer' => $this->config->get('external_link/noreferrer'), - ]; - - foreach ($options as $type => $option) { - switch (true) { - case $option === self::APPLY_ALL: - case $isExternal && $option === self::APPLY_EXTERNAL: - case ! $isExternal && $option === self::APPLY_INTERNAL: - $link->data->append('attributes/rel', $type); - } - } - - // No rel attributes? Mark the attribute as 'false' so LinkRenderer doesn't add defaults - if (! $link->data->has('attributes/rel')) { - $link->data->set('attributes/rel', false); - } - } - - /** - * @internal This method is only public so we can easily test it. DO NOT USE THIS OUTSIDE OF THIS EXTENSION! - * - * @param non-empty-string|list<non-empty-string> $compareTo - */ - public static function hostMatches(string $host, $compareTo): bool - { - 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 401613a..0000000 --- a/vendor/league/commonmark/src/Extension/Footnote/Event/AnonymousFootnotesListener.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\Event; - -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\Node\Block\Paragraph; -use League\CommonMark\Node\Inline\Text; -use League\CommonMark\Reference\Reference; -use League\Config\ConfigurationAwareInterface; -use League\Config\ConfigurationInterface; - -final class AnonymousFootnotesListener implements ConfigurationAwareInterface -{ - private ConfigurationInterface $config; - - public function onDocumentParsed(DocumentParsedEvent $event): void - { - $document = $event->getDocument(); - foreach ($document->iterator() as $node) { - if (! $node instanceof FootnoteRef || ($text = $node->getContent()) === null) { - continue; - } - - // Anonymous footnote needs to create a footnote from its content - $existingReference = $node->getReference(); - $newReference = new Reference( - $existingReference->getLabel(), - '#' . $this->config->get('footnote/ref_id_prefix') . $existingReference->getLabel(), - $existingReference->getTitle() - ); - - $paragraph = new Paragraph(); - $paragraph->appendChild(new Text($text)); - $paragraph->appendChild(new FootnoteBackref($newReference)); - - $footnote = new Footnote($newReference); - $footnote->appendChild($paragraph); - - $document->appendChild($footnote); - } - } - - public function setConfiguration(ConfigurationInterface $configuration): void - { - $this->config = $configuration; - } -} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Event/FixOrphanedFootnotesAndRefsListener.php b/vendor/league/commonmark/src/Extension/Footnote/Event/FixOrphanedFootnotesAndRefsListener.php deleted file mode 100644 index a0295b5..0000000 --- a/vendor/league/commonmark/src/Extension/Footnote/Event/FixOrphanedFootnotesAndRefsListener.php +++ /dev/null @@ -1,68 +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\Extension\Footnote\Event; - -use League\CommonMark\Event\DocumentParsedEvent; -use League\CommonMark\Extension\Footnote\Node\Footnote; -use League\CommonMark\Extension\Footnote\Node\FootnoteRef; -use League\CommonMark\Node\Block\Document; -use League\CommonMark\Node\Inline\Text; - -final class FixOrphanedFootnotesAndRefsListener -{ - public function onDocumentParsed(DocumentParsedEvent $event): void - { - $document = $event->getDocument(); - $map = $this->buildMapOfKnownFootnotesAndRefs($document); - - foreach ($map['_flat'] as $node) { - if ($node instanceof FootnoteRef && ! isset($map[Footnote::class][$node->getReference()->getLabel()])) { - // Found an orphaned FootnoteRef without a corresponding Footnote - // Restore the original footnote ref text - $node->replaceWith(new Text(\sprintf('[^%s]', $node->getReference()->getLabel()))); - } - - // phpcs:disable SlevomatCodingStandard.ControlStructures.EarlyExit.EarlyExitNotUsed - if ($node instanceof Footnote && ! isset($map[FootnoteRef::class][$node->getReference()->getLabel()])) { - // Found an orphaned Footnote without a corresponding FootnoteRef - // Remove the footnote - $node->detach(); - } - } - } - - /** @phpstan-ignore-next-line */ - private function buildMapOfKnownFootnotesAndRefs(Document $document): array // @phpcs:ignore - { - $map = [ - Footnote::class => [], - FootnoteRef::class => [], - '_flat' => [], - ]; - - foreach ($document->iterator() as $node) { - if ($node instanceof Footnote) { - $map[Footnote::class][$node->getReference()->getLabel()] = true; - - $map['_flat'][] = $node; - } elseif ($node instanceof FootnoteRef) { - $map[FootnoteRef::class][$node->getReference()->getLabel()] = true; - - $map['_flat'][] = $node; - } - } - - return $map; - } -} 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 ae8d00b..0000000 --- a/vendor/league/commonmark/src/Extension/Footnote/Event/GatherFootnotesListener.php +++ /dev/null @@ -1,106 +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\Footnote; -use League\CommonMark\Extension\Footnote\Node\FootnoteBackref; -use League\CommonMark\Extension\Footnote\Node\FootnoteContainer; -use League\CommonMark\Node\Block\Document; -use League\CommonMark\Node\NodeIterator; -use League\CommonMark\Reference\Reference; -use League\Config\ConfigurationAwareInterface; -use League\Config\ConfigurationInterface; - -final class GatherFootnotesListener implements ConfigurationAwareInterface -{ - private ConfigurationInterface $config; - - public function onDocumentParsed(DocumentParsedEvent $event): void - { - $document = $event->getDocument(); - $footnotes = []; - - foreach ($document->iterator(NodeIterator::FLAG_BLOCKS_ONLY) as $node) { - if (! $node instanceof Footnote) { - continue; - } - - // Look for existing reference with footnote label - $ref = $document->getReferenceMap()->get($node->getReference()->getLabel()); - if ($ref !== null) { - // Use numeric title to get footnotes order - $footnotes[(int) $ref->getTitle()] = $node; - } else { - // Footnote call is missing, append footnote at the end - $footnotes[\PHP_INT_MAX] = $node; - } - - $key = '#' . $this->config->get('footnote/footnote_id_prefix') . $node->getReference()->getDestination(); - if ($document->data->has($key)) { - $this->createBackrefs($node, $document->data->get($key)); - } - } - - // 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; - } - - /** - * Look for all footnote refs pointing to this footnote and create each footnote backrefs. - * - * @param Footnote $node The target footnote - * @param Reference[] $backrefs References to create backrefs for - */ - private function createBackrefs(Footnote $node, array $backrefs): void - { - // Backrefs should be added to the child paragraph - $target = $node->lastChild(); - if ($target === null) { - // This should never happen, but you never know - $target = $node; - } - - foreach ($backrefs as $backref) { - $target->appendChild(new FootnoteBackref(new Reference( - $backref->getLabel(), - '#' . $this->config->get('footnote/ref_id_prefix') . $backref->getLabel(), - $backref->getTitle() - ))); - } - } - - public function setConfiguration(ConfigurationInterface $configuration): void - { - $this->config = $configuration; - } -} 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 65600fa..0000000 --- a/vendor/league/commonmark/src/Extension/Footnote/Event/NumberFootnotesListener.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\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(); - $nextCounter = 1; - $usedLabels = []; - $usedCounters = []; - - foreach ($document->iterator() as $node) { - 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 .= '__' . ++$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()->add($newReference); - - /* - * Store created references in document for - * creating FootnoteBackrefs - */ - $document->data->append($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 0fa8038..0000000 --- a/vendor/league/commonmark/src/Extension/Footnote/FootnoteExtension.php +++ /dev/null @@ -1,70 +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\Environment\EnvironmentBuilderInterface; -use League\CommonMark\Event\DocumentParsedEvent; -use League\CommonMark\Extension\ConfigurableExtensionInterface; -use League\CommonMark\Extension\Footnote\Event\AnonymousFootnotesListener; -use League\CommonMark\Extension\Footnote\Event\FixOrphanedFootnotesAndRefsListener; -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\FootnoteRefParser; -use League\CommonMark\Extension\Footnote\Parser\FootnoteStartParser; -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; -use League\Config\ConfigurationBuilderInterface; -use Nette\Schema\Expect; - -final class FootnoteExtension implements ConfigurableExtensionInterface -{ - public function configureSchema(ConfigurationBuilderInterface $builder): void - { - $builder->addSchema('footnote', Expect::structure([ - 'backref_class' => Expect::string('footnote-backref'), - 'backref_symbol' => Expect::string('↩'), - 'container_add_hr' => Expect::bool(true), - 'container_class' => Expect::string('footnotes'), - 'ref_class' => Expect::string('footnote-ref'), - 'ref_id_prefix' => Expect::string('fnref:'), - 'footnote_class' => Expect::string('footnote'), - 'footnote_id_prefix' => Expect::string('fn:'), - ])); - } - - public function register(EnvironmentBuilderInterface $environment): void - { - $environment->addBlockStartParser(new FootnoteStartParser(), 51); - $environment->addInlineParser(new AnonymousFootnoteRefParser(), 35); - $environment->addInlineParser(new FootnoteRefParser(), 51); - - $environment->addRenderer(FootnoteContainer::class, new FootnoteContainerRenderer()); - $environment->addRenderer(Footnote::class, new FootnoteRenderer()); - $environment->addRenderer(FootnoteRef::class, new FootnoteRefRenderer()); - $environment->addRenderer(FootnoteBackref::class, new FootnoteBackrefRenderer()); - - $environment->addEventListener(DocumentParsedEvent::class, [new AnonymousFootnotesListener(), 'onDocumentParsed'], 40); - $environment->addEventListener(DocumentParsedEvent::class, [new FixOrphanedFootnotesAndRefsListener(), 'onDocumentParsed'], 30); - $environment->addEventListener(DocumentParsedEvent::class, [new NumberFootnotesListener(), 'onDocumentParsed'], 20); - $environment->addEventListener(DocumentParsedEvent::class, [new GatherFootnotesListener(), 'onDocumentParsed'], 10); - } -} 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 c3f77ca..0000000 --- a/vendor/league/commonmark/src/Extension/Footnote/Node/Footnote.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\Node\Block\AbstractBlock; -use League\CommonMark\Reference\ReferenceInterface; -use League\CommonMark\Reference\ReferenceableInterface; - -final class Footnote extends AbstractBlock implements ReferenceableInterface -{ - /** @psalm-readonly */ - private ReferenceInterface $reference; - - public function __construct(ReferenceInterface $reference) - { - parent::__construct(); - - $this->reference = $reference; - } - - public function getReference(): ReferenceInterface - { - return $this->reference; - } -} 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 f56daa5..0000000 --- a/vendor/league/commonmark/src/Extension/Footnote/Node/FootnoteBackref.php +++ /dev/null @@ -1,40 +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\Node\Inline\AbstractInline; -use League\CommonMark\Reference\ReferenceInterface; -use League\CommonMark\Reference\ReferenceableInterface; - -/** - * Link from the footnote on the bottom of the document back to the reference - */ -final class FootnoteBackref extends AbstractInline implements ReferenceableInterface -{ - /** @psalm-readonly */ - private ReferenceInterface $reference; - - public function __construct(ReferenceInterface $reference) - { - parent::__construct(); - - $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 af4ee35..0000000 --- a/vendor/league/commonmark/src/Extension/Footnote/Node/FootnoteContainer.php +++ /dev/null @@ -1,21 +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\Node\Block\AbstractBlock; - -final class FootnoteContainer extends AbstractBlock -{ -} 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 429a1dc..0000000 --- a/vendor/league/commonmark/src/Extension/Footnote/Node/FootnoteRef.php +++ /dev/null @@ -1,57 +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\Node\Inline\AbstractInline; -use League\CommonMark\Reference\ReferenceInterface; -use League\CommonMark\Reference\ReferenceableInterface; - -final class FootnoteRef extends AbstractInline implements ReferenceableInterface -{ - private ReferenceInterface $reference; - - /** @psalm-readonly */ - private ?string $content = null; - - /** - * @param array<mixed> $data - */ - public function __construct(ReferenceInterface $reference, ?string $content = null, array $data = []) - { - parent::__construct(); - - $this->reference = $reference; - $this->content = $content; - - if (\count($data) > 0) { - $this->data->import($data); - } - } - - public function getReference(): ReferenceInterface - { - return $this->reference; - } - - public function setReference(ReferenceInterface $reference): void - { - $this->reference = $reference; - } - - 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 4ed93da..0000000 --- a/vendor/league/commonmark/src/Extension/Footnote/Parser/AnonymousFootnoteRefParser.php +++ /dev/null @@ -1,66 +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\Environment\EnvironmentAwareInterface; -use League\CommonMark\Environment\EnvironmentInterface; -use League\CommonMark\Extension\Footnote\Node\FootnoteRef; -use League\CommonMark\Normalizer\TextNormalizerInterface; -use League\CommonMark\Parser\Inline\InlineParserInterface; -use League\CommonMark\Parser\Inline\InlineParserMatch; -use League\CommonMark\Parser\InlineParserContext; -use League\CommonMark\Reference\Reference; -use League\Config\ConfigurationInterface; - -final class AnonymousFootnoteRefParser implements InlineParserInterface, EnvironmentAwareInterface -{ - private ConfigurationInterface $config; - - /** @psalm-readonly-allow-private-mutation */ - private TextNormalizerInterface $slugNormalizer; - - public function getMatchDefinition(): InlineParserMatch - { - return InlineParserMatch::regex('\^\[([^\]]+)\]'); - } - - public function parse(InlineParserContext $inlineContext): bool - { - $inlineContext->getCursor()->advanceBy($inlineContext->getFullMatchLength()); - - [$label] = $inlineContext->getSubMatches(); - $reference = $this->createReference($label); - $inlineContext->getContainer()->appendChild(new FootnoteRef($reference, $label)); - - return true; - } - - private function createReference(string $label): Reference - { - $refLabel = $this->slugNormalizer->normalize($label, ['length' => 20]); - - return new Reference( - $refLabel, - '#' . $this->config->get('footnote/footnote_id_prefix') . $refLabel, - $label - ); - } - - public function setEnvironment(EnvironmentInterface $environment): void - { - $this->config = $environment->getConfiguration(); - $this->slugNormalizer = $environment->getSlugNormalizer(); - } -} 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 2192546..0000000 --- a/vendor/league/commonmark/src/Extension/Footnote/Parser/FootnoteParser.php +++ /dev/null @@ -1,68 +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\Footnote; -use League\CommonMark\Node\Block\AbstractBlock; -use League\CommonMark\Parser\Block\AbstractBlockContinueParser; -use League\CommonMark\Parser\Block\BlockContinue; -use League\CommonMark\Parser\Block\BlockContinueParserInterface; -use League\CommonMark\Parser\Cursor; -use League\CommonMark\Reference\ReferenceInterface; - -final class FootnoteParser extends AbstractBlockContinueParser -{ - /** @psalm-readonly */ - private Footnote $block; - - /** @psalm-readonly-allow-private-mutation */ - private ?int $indentation = null; - - public function __construct(ReferenceInterface $reference) - { - $this->block = new Footnote($reference); - } - - public function getBlock(): Footnote - { - return $this->block; - } - - public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue - { - if ($cursor->isBlank()) { - return BlockContinue::at($cursor); - } - - if ($cursor->isIndented()) { - $this->indentation ??= $cursor->getIndent(); - $cursor->advanceBy($this->indentation, true); - - return BlockContinue::at($cursor); - } - - return BlockContinue::none(); - } - - public function isContainer(): bool - { - return true; - } - - public function canContain(AbstractBlock $childBlock): bool - { - return true; - } -} 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 4032abd..0000000 --- a/vendor/league/commonmark/src/Extension/Footnote/Parser/FootnoteRefParser.php +++ /dev/null @@ -1,57 +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\Parser\Inline\InlineParserInterface; -use League\CommonMark\Parser\Inline\InlineParserMatch; -use League\CommonMark\Parser\InlineParserContext; -use League\CommonMark\Reference\Reference; -use League\Config\ConfigurationAwareInterface; -use League\Config\ConfigurationInterface; - -final class FootnoteRefParser implements InlineParserInterface, ConfigurationAwareInterface -{ - private ConfigurationInterface $config; - - public function getMatchDefinition(): InlineParserMatch - { - return InlineParserMatch::regex('\[\^([^\s\]]+)\]'); - } - - public function parse(InlineParserContext $inlineContext): bool - { - $inlineContext->getCursor()->advanceBy($inlineContext->getFullMatchLength()); - - [$label] = $inlineContext->getSubMatches(); - $inlineContext->getContainer()->appendChild(new FootnoteRef($this->createReference($label))); - - return true; - } - - private function createReference(string $label): Reference - { - return new Reference( - $label, - '#' . $this->config->get('footnote/footnote_id_prefix') . $label, - $label - ); - } - - public function setConfiguration(ConfigurationInterface $configuration): void - { - $this->config = $configuration; - } -} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Parser/FootnoteStartParser.php b/vendor/league/commonmark/src/Extension/Footnote/Parser/FootnoteStartParser.php deleted file mode 100644 index 734e678..0000000 --- a/vendor/league/commonmark/src/Extension/Footnote/Parser/FootnoteStartParser.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\Parser; - -use League\CommonMark\Parser\Block\BlockStart; -use League\CommonMark\Parser\Block\BlockStartParserInterface; -use League\CommonMark\Parser\Cursor; -use League\CommonMark\Parser\MarkdownParserStateInterface; -use League\CommonMark\Reference\Reference; -use League\CommonMark\Util\RegexHelper; - -final class FootnoteStartParser implements BlockStartParserInterface -{ - public function tryStart(Cursor $cursor, MarkdownParserStateInterface $parserState): ?BlockStart - { - if ($cursor->isIndented() || $parserState->getLastMatchedBlockParser()->canHaveLazyContinuationLines()) { - return BlockStart::none(); - } - - $match = RegexHelper::matchFirst( - '/^\[\^([^\s^\]]+)\]\:(?:\s|$)/', - $cursor->getLine(), - $cursor->getNextNonSpacePosition() - ); - - if (! $match) { - return BlockStart::none(); - } - - $cursor->advanceToNextNonSpaceOrTab(); - $cursor->advanceBy(\strlen($match[0])); - $str = $cursor->getRemainder(); - \preg_replace('/^\[\^([^\s^\]]+)\]\:(?:\s|$)/', '', $str); - - if (\preg_match('/^\[\^([^\s^\]]+)\]\:(?:\s|$)/', $match[0], $matches) !== 1) { - return BlockStart::none(); - } - - $reference = new Reference($matches[1], $matches[1], $matches[1]); - $footnoteParser = new FootnoteParser($reference); - - return BlockStart::of($footnoteParser)->at($cursor); - } -} 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 3b7bc3c..0000000 --- a/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteBackrefRenderer.php +++ /dev/null @@ -1,81 +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\Extension\Footnote\Node\FootnoteBackref; -use League\CommonMark\Node\Node; -use League\CommonMark\Renderer\ChildNodeRendererInterface; -use League\CommonMark\Renderer\NodeRendererInterface; -use League\CommonMark\Util\HtmlElement; -use League\CommonMark\Xml\XmlNodeRendererInterface; -use League\Config\ConfigurationAwareInterface; -use League\Config\ConfigurationInterface; - -final class FootnoteBackrefRenderer implements NodeRendererInterface, XmlNodeRendererInterface, ConfigurationAwareInterface -{ - public const DEFAULT_SYMBOL = '↩'; - - private ConfigurationInterface $config; - - /** - * @param FootnoteBackref $node - * - * {@inheritDoc} - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function render(Node $node, ChildNodeRendererInterface $childRenderer): string - { - FootnoteBackref::assertInstanceOf($node); - - $attrs = $node->data->getData('attributes'); - - $attrs->append('class', $this->config->get('footnote/backref_class')); - $attrs->set('rev', 'footnote'); - $attrs->set('href', \mb_strtolower($node->getReference()->getDestination(), 'UTF-8')); - $attrs->set('role', 'doc-backlink'); - - $symbol = $this->config->get('footnote/backref_symbol'); - \assert(\is_string($symbol)); - - return ' ' . new HtmlElement('a', $attrs->export(), \htmlspecialchars($symbol), true); - } - - public function setConfiguration(ConfigurationInterface $configuration): void - { - $this->config = $configuration; - } - - public function getXmlTagName(Node $node): string - { - return 'footnote_backref'; - } - - /** - * @param FootnoteBackref $node - * - * @return array<string, scalar> - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function getXmlAttributes(Node $node): array - { - FootnoteBackref::assertInstanceOf($node); - - return [ - 'reference' => $node->getReference()->getLabel(), - ]; - } -} 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 74d35ef..0000000 --- a/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteContainerRenderer.php +++ /dev/null @@ -1,71 +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\Extension\Footnote\Node\FootnoteContainer; -use League\CommonMark\Node\Node; -use League\CommonMark\Renderer\ChildNodeRendererInterface; -use League\CommonMark\Renderer\NodeRendererInterface; -use League\CommonMark\Util\HtmlElement; -use League\CommonMark\Xml\XmlNodeRendererInterface; -use League\Config\ConfigurationAwareInterface; -use League\Config\ConfigurationInterface; - -final class FootnoteContainerRenderer implements NodeRendererInterface, XmlNodeRendererInterface, ConfigurationAwareInterface -{ - private ConfigurationInterface $config; - - /** - * @param FootnoteContainer $node - * - * {@inheritDoc} - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable - { - FootnoteContainer::assertInstanceOf($node); - - $attrs = $node->data->getData('attributes'); - - $attrs->append('class', $this->config->get('footnote/container_class')); - $attrs->set('role', 'doc-endnotes'); - - $contents = new HtmlElement('ol', [], $childRenderer->renderNodes($node->children())); - if ($this->config->get('footnote/container_add_hr')) { - $contents = [new HtmlElement('hr', [], null, true), $contents]; - } - - return new HtmlElement('div', $attrs->export(), $contents); - } - - public function setConfiguration(ConfigurationInterface $configuration): void - { - $this->config = $configuration; - } - - public function getXmlTagName(Node $node): string - { - return 'footnote_container'; - } - - /** - * @return array<string, scalar> - */ - public function getXmlAttributes(Node $node): array - { - return []; - } -} 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 c0c07d7..0000000 --- a/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteRefRenderer.php +++ /dev/null @@ -1,87 +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\Extension\Footnote\Node\FootnoteRef; -use League\CommonMark\Node\Node; -use League\CommonMark\Renderer\ChildNodeRendererInterface; -use League\CommonMark\Renderer\NodeRendererInterface; -use League\CommonMark\Util\HtmlElement; -use League\CommonMark\Xml\XmlNodeRendererInterface; -use League\Config\ConfigurationAwareInterface; -use League\Config\ConfigurationInterface; - -final class FootnoteRefRenderer implements NodeRendererInterface, XmlNodeRendererInterface, ConfigurationAwareInterface -{ - private ConfigurationInterface $config; - - /** - * @param FootnoteRef $node - * - * {@inheritDoc} - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable - { - FootnoteRef::assertInstanceOf($node); - - $attrs = $node->data->getData('attributes'); - $attrs->append('class', $this->config->get('footnote/ref_class')); - $attrs->set('href', \mb_strtolower($node->getReference()->getDestination(), 'UTF-8')); - $attrs->set('role', 'doc-noteref'); - - $idPrefix = $this->config->get('footnote/ref_id_prefix'); - - return new HtmlElement( - 'sup', - [ - 'id' => $idPrefix . \mb_strtolower($node->getReference()->getLabel(), 'UTF-8'), - ], - new HtmlElement( - 'a', - $attrs->export(), - $node->getReference()->getTitle() - ), - true - ); - } - - public function setConfiguration(ConfigurationInterface $configuration): void - { - $this->config = $configuration; - } - - public function getXmlTagName(Node $node): string - { - return 'footnote_ref'; - } - - /** - * @param FootnoteRef $node - * - * @return array<string, scalar> - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function getXmlAttributes(Node $node): array - { - FootnoteRef::assertInstanceOf($node); - - return [ - 'reference' => $node->getReference()->getLabel(), - ]; - } -} 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 cdd027e..0000000 --- a/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteRenderer.php +++ /dev/null @@ -1,80 +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\Extension\Footnote\Node\Footnote; -use League\CommonMark\Node\Node; -use League\CommonMark\Renderer\ChildNodeRendererInterface; -use League\CommonMark\Renderer\NodeRendererInterface; -use League\CommonMark\Util\HtmlElement; -use League\CommonMark\Xml\XmlNodeRendererInterface; -use League\Config\ConfigurationAwareInterface; -use League\Config\ConfigurationInterface; - -final class FootnoteRenderer implements NodeRendererInterface, XmlNodeRendererInterface, ConfigurationAwareInterface -{ - private ConfigurationInterface $config; - - /** - * @param Footnote $node - * - * {@inheritDoc} - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable - { - Footnote::assertInstanceOf($node); - - $attrs = $node->data->getData('attributes'); - - $attrs->append('class', $this->config->get('footnote/footnote_class')); - $attrs->set('id', $this->config->get('footnote/footnote_id_prefix') . \mb_strtolower($node->getReference()->getLabel(), 'UTF-8')); - $attrs->set('role', 'doc-endnote'); - - return new HtmlElement( - 'li', - $attrs->export(), - $childRenderer->renderNodes($node->children()), - true - ); - } - - public function setConfiguration(ConfigurationInterface $configuration): void - { - $this->config = $configuration; - } - - public function getXmlTagName(Node $node): string - { - return 'footnote'; - } - - /** - * @param Footnote $node - * - * @return array<string, scalar> - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function getXmlAttributes(Node $node): array - { - Footnote::assertInstanceOf($node); - - return [ - 'reference' => $node->getReference()->getLabel(), - ]; - } -} diff --git a/vendor/league/commonmark/src/Extension/FrontMatter/Data/FrontMatterDataParserInterface.php b/vendor/league/commonmark/src/Extension/FrontMatter/Data/FrontMatterDataParserInterface.php deleted file mode 100644 index 6e9db40..0000000 --- a/vendor/league/commonmark/src/Extension/FrontMatter/Data/FrontMatterDataParserInterface.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\Extension\FrontMatter\Data; - -use League\CommonMark\Extension\FrontMatter\Exception\InvalidFrontMatterException; - -interface FrontMatterDataParserInterface -{ - /** - * @return mixed|null The parsed data (which may be null, if the input represents a null value) - * - * @throws InvalidFrontMatterException if parsing fails - */ - public function parse(string $frontMatter); -} diff --git a/vendor/league/commonmark/src/Extension/FrontMatter/Data/LibYamlFrontMatterParser.php b/vendor/league/commonmark/src/Extension/FrontMatter/Data/LibYamlFrontMatterParser.php deleted file mode 100644 index b7194f4..0000000 --- a/vendor/league/commonmark/src/Extension/FrontMatter/Data/LibYamlFrontMatterParser.php +++ /dev/null @@ -1,47 +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\Extension\FrontMatter\Data; - -use League\CommonMark\Exception\MissingDependencyException; -use League\CommonMark\Extension\FrontMatter\Exception\InvalidFrontMatterException; - -final class LibYamlFrontMatterParser implements FrontMatterDataParserInterface -{ - public static function capable(): ?LibYamlFrontMatterParser - { - if (! \extension_loaded('yaml')) { - return null; - } - - return new LibYamlFrontMatterParser(); - } - - /** - * {@inheritDoc} - */ - public function parse(string $frontMatter) - { - if (! \extension_loaded('yaml')) { - throw new MissingDependencyException('Failed to parse yaml: "ext-yaml" extension is missing'); - } - - $result = @\yaml_parse($frontMatter); - - if ($result === false) { - throw new InvalidFrontMatterException('Failed to parse front matter'); - } - - return $result; - } -} diff --git a/vendor/league/commonmark/src/Extension/FrontMatter/Data/SymfonyYamlFrontMatterParser.php b/vendor/league/commonmark/src/Extension/FrontMatter/Data/SymfonyYamlFrontMatterParser.php deleted file mode 100644 index 8d99d33..0000000 --- a/vendor/league/commonmark/src/Extension/FrontMatter/Data/SymfonyYamlFrontMatterParser.php +++ /dev/null @@ -1,39 +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\Extension\FrontMatter\Data; - -use League\CommonMark\Exception\MissingDependencyException; -use League\CommonMark\Extension\FrontMatter\Exception\InvalidFrontMatterException; -use Symfony\Component\Yaml\Exception\ParseException; -use Symfony\Component\Yaml\Yaml; - -final class SymfonyYamlFrontMatterParser implements FrontMatterDataParserInterface -{ - /** - * {@inheritDoc} - */ - public function parse(string $frontMatter) - { - if (! \class_exists(Yaml::class)) { - throw new MissingDependencyException('Failed to parse yaml: "symfony/yaml" library is missing'); - } - - try { - /** @psalm-suppress ReservedWord */ - return Yaml::parse($frontMatter); - } catch (ParseException $ex) { - throw InvalidFrontMatterException::wrap($ex); - } - } -} diff --git a/vendor/league/commonmark/src/Extension/FrontMatter/Exception/InvalidFrontMatterException.php b/vendor/league/commonmark/src/Extension/FrontMatter/Exception/InvalidFrontMatterException.php deleted file mode 100644 index ffe0c28..0000000 --- a/vendor/league/commonmark/src/Extension/FrontMatter/Exception/InvalidFrontMatterException.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. - */ - -declare(strict_types=1); - -namespace League\CommonMark\Extension\FrontMatter\Exception; - -use League\CommonMark\Exception\CommonMarkException; - -class InvalidFrontMatterException extends \RuntimeException implements CommonMarkException -{ - public static function wrap(\Throwable $t): self - { - return new InvalidFrontMatterException('Failed to parse front matter: ' . $t->getMessage(), 0, $t); - } -} diff --git a/vendor/league/commonmark/src/Extension/FrontMatter/FrontMatterExtension.php b/vendor/league/commonmark/src/Extension/FrontMatter/FrontMatterExtension.php deleted file mode 100644 index 019ecb4..0000000 --- a/vendor/league/commonmark/src/Extension/FrontMatter/FrontMatterExtension.php +++ /dev/null @@ -1,46 +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\Extension\FrontMatter; - -use League\CommonMark\Environment\EnvironmentBuilderInterface; -use League\CommonMark\Event\DocumentPreParsedEvent; -use League\CommonMark\Event\DocumentRenderedEvent; -use League\CommonMark\Extension\ExtensionInterface; -use League\CommonMark\Extension\FrontMatter\Data\FrontMatterDataParserInterface; -use League\CommonMark\Extension\FrontMatter\Data\LibYamlFrontMatterParser; -use League\CommonMark\Extension\FrontMatter\Data\SymfonyYamlFrontMatterParser; -use League\CommonMark\Extension\FrontMatter\Listener\FrontMatterPostRenderListener; -use League\CommonMark\Extension\FrontMatter\Listener\FrontMatterPreParser; - -final class FrontMatterExtension implements ExtensionInterface -{ - /** @psalm-readonly */ - private FrontMatterParserInterface $frontMatterParser; - - public function __construct(?FrontMatterDataParserInterface $dataParser = null) - { - $this->frontMatterParser = new FrontMatterParser($dataParser ?? LibYamlFrontMatterParser::capable() ?? new SymfonyYamlFrontMatterParser()); - } - - public function getFrontMatterParser(): FrontMatterParserInterface - { - return $this->frontMatterParser; - } - - public function register(EnvironmentBuilderInterface $environment): void - { - $environment->addEventListener(DocumentPreParsedEvent::class, new FrontMatterPreParser($this->frontMatterParser)); - $environment->addEventListener(DocumentRenderedEvent::class, new FrontMatterPostRenderListener(), -500); - } -} diff --git a/vendor/league/commonmark/src/Extension/FrontMatter/FrontMatterParser.php b/vendor/league/commonmark/src/Extension/FrontMatter/FrontMatterParser.php deleted file mode 100644 index 69c41d1..0000000 --- a/vendor/league/commonmark/src/Extension/FrontMatter/FrontMatterParser.php +++ /dev/null @@ -1,64 +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\Extension\FrontMatter; - -use League\CommonMark\Extension\FrontMatter\Data\FrontMatterDataParserInterface; -use League\CommonMark\Extension\FrontMatter\Exception\InvalidFrontMatterException; -use League\CommonMark\Extension\FrontMatter\Input\MarkdownInputWithFrontMatter; -use League\CommonMark\Parser\Cursor; - -final class FrontMatterParser implements FrontMatterParserInterface -{ - /** @psalm-readonly */ - private FrontMatterDataParserInterface $frontMatterParser; - - private const REGEX_FRONT_MATTER = '/^---\\R.*?\\R---\\R/s'; - - public function __construct(FrontMatterDataParserInterface $frontMatterParser) - { - $this->frontMatterParser = $frontMatterParser; - } - - /** - * @throws InvalidFrontMatterException if the front matter cannot be parsed - */ - public function parse(string $markdownContent): MarkdownInputWithFrontMatter - { - $cursor = new Cursor($markdownContent); - - // Locate the front matter - $frontMatter = $cursor->match(self::REGEX_FRONT_MATTER); - if ($frontMatter === null) { - return new MarkdownInputWithFrontMatter($markdownContent); - } - - // Trim the last line (ending ---s and newline) - $frontMatter = \preg_replace('/---\R$/', '', $frontMatter); - if ($frontMatter === null) { - return new MarkdownInputWithFrontMatter($markdownContent); - } - - // Parse the resulting YAML data - $data = $this->frontMatterParser->parse($frontMatter); - - // Advance through any remaining newlines which separated the front matter from the Markdown text - $trailingNewlines = $cursor->match('/^\R+/'); - - // Calculate how many lines the Markdown is offset from the front matter by counting the number of newlines - // Don't forget to add 1 because we stripped one out when trimming the trailing delims - $lineOffset = \preg_match_all('/\R/', $frontMatter . $trailingNewlines) + 1; - - return new MarkdownInputWithFrontMatter($cursor->getRemainder(), $lineOffset, $data); - } -} diff --git a/vendor/league/commonmark/src/Extension/FrontMatter/FrontMatterParserInterface.php b/vendor/league/commonmark/src/Extension/FrontMatter/FrontMatterParserInterface.php deleted file mode 100644 index 197a33b..0000000 --- a/vendor/league/commonmark/src/Extension/FrontMatter/FrontMatterParserInterface.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. - */ - -declare(strict_types=1); - -namespace League\CommonMark\Extension\FrontMatter; - -use League\CommonMark\Extension\FrontMatter\Input\MarkdownInputWithFrontMatter; - -interface FrontMatterParserInterface -{ - public function parse(string $markdownContent): MarkdownInputWithFrontMatter; -} diff --git a/vendor/league/commonmark/src/Extension/FrontMatter/FrontMatterProviderInterface.php b/vendor/league/commonmark/src/Extension/FrontMatter/FrontMatterProviderInterface.php deleted file mode 100644 index b5a7278..0000000 --- a/vendor/league/commonmark/src/Extension/FrontMatter/FrontMatterProviderInterface.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. - */ - -declare(strict_types=1); - -namespace League\CommonMark\Extension\FrontMatter; - -interface FrontMatterProviderInterface -{ - /** - * @return mixed|null - */ - public function getFrontMatter(); -} diff --git a/vendor/league/commonmark/src/Extension/FrontMatter/Input/MarkdownInputWithFrontMatter.php b/vendor/league/commonmark/src/Extension/FrontMatter/Input/MarkdownInputWithFrontMatter.php deleted file mode 100644 index 86c982b..0000000 --- a/vendor/league/commonmark/src/Extension/FrontMatter/Input/MarkdownInputWithFrontMatter.php +++ /dev/null @@ -1,43 +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\Extension\FrontMatter\Input; - -use League\CommonMark\Extension\FrontMatter\FrontMatterProviderInterface; -use League\CommonMark\Input\MarkdownInput; - -final class MarkdownInputWithFrontMatter extends MarkdownInput implements FrontMatterProviderInterface -{ - /** @var mixed|null */ - private $frontMatter; - - /** - * @param string $content Markdown content without the raw front matter - * @param int $lineOffset Line offset (based on number of front matter lines removed) - * @param mixed|null $frontMatter Parsed front matter - */ - public function __construct(string $content, int $lineOffset = 0, $frontMatter = null) - { - parent::__construct($content, $lineOffset); - - $this->frontMatter = $frontMatter; - } - - /** - * {@inheritDoc} - */ - public function getFrontMatter() - { - return $this->frontMatter; - } -} diff --git a/vendor/league/commonmark/src/Extension/FrontMatter/Listener/FrontMatterPostRenderListener.php b/vendor/league/commonmark/src/Extension/FrontMatter/Listener/FrontMatterPostRenderListener.php deleted file mode 100644 index 14b7191..0000000 --- a/vendor/league/commonmark/src/Extension/FrontMatter/Listener/FrontMatterPostRenderListener.php +++ /dev/null @@ -1,35 +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\Extension\FrontMatter\Listener; - -use League\CommonMark\Event\DocumentRenderedEvent; -use League\CommonMark\Extension\FrontMatter\Output\RenderedContentWithFrontMatter; - -final class FrontMatterPostRenderListener -{ - public function __invoke(DocumentRenderedEvent $event): void - { - if ($event->getOutput()->getDocument()->data->get('front_matter', null) === null) { - return; - } - - $frontMatter = $event->getOutput()->getDocument()->data->get('front_matter'); - - $event->replaceOutput(new RenderedContentWithFrontMatter( - $event->getOutput()->getDocument(), - $event->getOutput()->getContent(), - $frontMatter - )); - } -} diff --git a/vendor/league/commonmark/src/Extension/FrontMatter/Listener/FrontMatterPreParser.php b/vendor/league/commonmark/src/Extension/FrontMatter/Listener/FrontMatterPreParser.php deleted file mode 100644 index b0afbee..0000000 --- a/vendor/league/commonmark/src/Extension/FrontMatter/Listener/FrontMatterPreParser.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. - */ - -declare(strict_types=1); - -namespace League\CommonMark\Extension\FrontMatter\Listener; - -use League\CommonMark\Event\DocumentPreParsedEvent; -use League\CommonMark\Extension\FrontMatter\FrontMatterParserInterface; - -final class FrontMatterPreParser -{ - private FrontMatterParserInterface $parser; - - public function __construct(FrontMatterParserInterface $parser) - { - $this->parser = $parser; - } - - public function __invoke(DocumentPreParsedEvent $event): void - { - $content = $event->getMarkdown()->getContent(); - - $parsed = $this->parser->parse($content); - - $event->getDocument()->data->set('front_matter', $parsed->getFrontMatter()); - $event->replaceMarkdown($parsed); - } -} diff --git a/vendor/league/commonmark/src/Extension/FrontMatter/Output/RenderedContentWithFrontMatter.php b/vendor/league/commonmark/src/Extension/FrontMatter/Output/RenderedContentWithFrontMatter.php deleted file mode 100644 index efaa342..0000000 --- a/vendor/league/commonmark/src/Extension/FrontMatter/Output/RenderedContentWithFrontMatter.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\Extension\FrontMatter\Output; - -use League\CommonMark\Extension\FrontMatter\FrontMatterProviderInterface; -use League\CommonMark\Node\Block\Document; -use League\CommonMark\Output\RenderedContent; - -/** - * @psalm-immutable - */ -final class RenderedContentWithFrontMatter extends RenderedContent implements FrontMatterProviderInterface -{ - /** - * @var mixed - * - * @psalm-readonly - */ - private $frontMatter; - - /** - * @param Document $document The parsed Document object - * @param string $content The final HTML - * @param mixed|null $frontMatter Any parsed front matter - */ - public function __construct(Document $document, string $content, $frontMatter) - { - parent::__construct($document, $content); - - $this->frontMatter = $frontMatter; - } - - /** - * {@inheritDoc} - */ - public function getFrontMatter() - { - return $this->frontMatter; - } -} diff --git a/vendor/league/commonmark/src/Extension/GithubFlavoredMarkdownExtension.php b/vendor/league/commonmark/src/Extension/GithubFlavoredMarkdownExtension.php deleted file mode 100644 index b3920aa..0000000 --- a/vendor/league/commonmark/src/Extension/GithubFlavoredMarkdownExtension.php +++ /dev/null @@ -1,33 +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\Extension; - -use League\CommonMark\Environment\EnvironmentBuilderInterface; -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(EnvironmentBuilderInterface $environment): void - { - $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 df9bded..0000000 --- a/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalink.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\Extension\HeadingPermalink; - -use League\CommonMark\Node\Inline\AbstractInline; - -/** - * Represents an anchor link within a heading - */ -final class HeadingPermalink extends AbstractInline -{ - /** @psalm-readonly */ - private string $slug; - - public function __construct(string $slug) - { - parent::__construct(); - - $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 96473a2..0000000 --- a/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkExtension.php +++ /dev/null @@ -1,49 +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\Extension\HeadingPermalink; - -use League\CommonMark\Environment\EnvironmentBuilderInterface; -use League\CommonMark\Event\DocumentParsedEvent; -use League\CommonMark\Extension\ConfigurableExtensionInterface; -use League\Config\ConfigurationBuilderInterface; -use Nette\Schema\Expect; - -/** - * Extension which automatically anchor links to heading elements - */ -final class HeadingPermalinkExtension implements ConfigurableExtensionInterface -{ - public function configureSchema(ConfigurationBuilderInterface $builder): void - { - $builder->addSchema('heading_permalink', Expect::structure([ - 'min_heading_level' => Expect::int()->min(1)->max(6)->default(1), - 'max_heading_level' => Expect::int()->min(1)->max(6)->default(6), - 'insert' => Expect::anyOf(HeadingPermalinkProcessor::INSERT_BEFORE, HeadingPermalinkProcessor::INSERT_AFTER, HeadingPermalinkProcessor::INSERT_NONE)->default(HeadingPermalinkProcessor::INSERT_BEFORE), - 'id_prefix' => Expect::string()->default('content'), - 'apply_id_to_heading' => Expect::bool()->default(false), - 'heading_class' => Expect::string()->default(''), - 'fragment_prefix' => Expect::string()->default('content'), - 'html_class' => Expect::string()->default('heading-permalink'), - 'title' => Expect::string()->default('Permalink'), - 'symbol' => Expect::string()->default(HeadingPermalinkRenderer::DEFAULT_SYMBOL), - 'aria_hidden' => Expect::bool()->default(true), - ])); - } - - public function register(EnvironmentBuilderInterface $environment): void - { - $environment->addEventListener(DocumentParsedEvent::class, new HeadingPermalinkProcessor(), -100); - $environment->addRenderer(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 871aa21..0000000 --- a/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkProcessor.php +++ /dev/null @@ -1,101 +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\Extension\HeadingPermalink; - -use League\CommonMark\Environment\EnvironmentAwareInterface; -use League\CommonMark\Environment\EnvironmentInterface; -use League\CommonMark\Event\DocumentParsedEvent; -use League\CommonMark\Extension\CommonMark\Node\Block\Heading; -use League\CommonMark\Node\NodeIterator; -use League\CommonMark\Node\RawMarkupContainerInterface; -use League\CommonMark\Node\StringContainerHelper; -use League\CommonMark\Normalizer\TextNormalizerInterface; -use League\Config\ConfigurationInterface; -use League\Config\Exception\InvalidConfigurationException; - -/** - * Searches the Document for Heading elements and adds HeadingPermalinks to each one - */ -final class HeadingPermalinkProcessor implements EnvironmentAwareInterface -{ - public const INSERT_BEFORE = 'before'; - public const INSERT_AFTER = 'after'; - public const INSERT_NONE = 'none'; - - /** @psalm-readonly-allow-private-mutation */ - private TextNormalizerInterface $slugNormalizer; - - /** @psalm-readonly-allow-private-mutation */ - private ConfigurationInterface $config; - - public function setEnvironment(EnvironmentInterface $environment): void - { - $this->config = $environment->getConfiguration(); - $this->slugNormalizer = $environment->getSlugNormalizer(); - } - - public function __invoke(DocumentParsedEvent $e): void - { - $min = (int) $this->config->get('heading_permalink/min_heading_level'); - $max = (int) $this->config->get('heading_permalink/max_heading_level'); - $applyToHeading = (bool) $this->config->get('heading_permalink/apply_id_to_heading'); - $idPrefix = (string) $this->config->get('heading_permalink/id_prefix'); - $slugLength = (int) $this->config->get('slug_normalizer/max_length'); - $headingClass = (string) $this->config->get('heading_permalink/heading_class'); - - if ($idPrefix !== '') { - $idPrefix .= '-'; - } - - foreach ($e->getDocument()->iterator(NodeIterator::FLAG_BLOCKS_ONLY) as $node) { - if ($node instanceof Heading && $node->getLevel() >= $min && $node->getLevel() <= $max) { - $this->addHeadingLink($node, $slugLength, $idPrefix, $applyToHeading, $headingClass); - } - } - } - - private function addHeadingLink(Heading $heading, int $slugLength, string $idPrefix, bool $applyToHeading, string $headingClass): void - { - $text = StringContainerHelper::getChildText($heading, [RawMarkupContainerInterface::class]); - $slug = $this->slugNormalizer->normalize($text, [ - 'node' => $heading, - 'length' => $slugLength, - ]); - - if ($applyToHeading) { - $heading->data->set('attributes/id', $idPrefix . $slug); - } - - if ($headingClass !== '') { - $heading->data->append('attributes/class', $headingClass); - } - - $headingLinkAnchor = new HeadingPermalink($slug); - - switch ($this->config->get('heading_permalink/insert')) { - case self::INSERT_BEFORE: - $heading->prependChild($headingLinkAnchor); - - return; - case self::INSERT_AFTER: - $heading->appendChild($headingLinkAnchor); - - return; - case self::INSERT_NONE: - return; - default: - throw new InvalidConfigurationException("Invalid configuration value for heading_permalink/insert; expected 'before', 'after', or 'none'"); - } - } -} 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 59a86a1..0000000 --- a/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkRenderer.php +++ /dev/null @@ -1,106 +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\Extension\HeadingPermalink; - -use League\CommonMark\Node\Node; -use League\CommonMark\Renderer\ChildNodeRendererInterface; -use League\CommonMark\Renderer\NodeRendererInterface; -use League\CommonMark\Util\HtmlElement; -use League\CommonMark\Xml\XmlNodeRendererInterface; -use League\Config\ConfigurationAwareInterface; -use League\Config\ConfigurationInterface; - -/** - * Renders the HeadingPermalink elements - */ -final class HeadingPermalinkRenderer implements NodeRendererInterface, XmlNodeRendererInterface, ConfigurationAwareInterface -{ - public const DEFAULT_SYMBOL = '¶'; - - /** @psalm-readonly-allow-private-mutation */ - private ConfigurationInterface $config; - - public function setConfiguration(ConfigurationInterface $configuration): void - { - $this->config = $configuration; - } - - /** - * @param HeadingPermalink $node - * - * {@inheritDoc} - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable - { - HeadingPermalink::assertInstanceOf($node); - - $slug = $node->getSlug(); - - $fragmentPrefix = (string) $this->config->get('heading_permalink/fragment_prefix'); - if ($fragmentPrefix !== '') { - $fragmentPrefix .= '-'; - } - - $attrs = $node->data->getData('attributes'); - $appendId = ! $this->config->get('heading_permalink/apply_id_to_heading'); - - if ($appendId) { - $idPrefix = (string) $this->config->get('heading_permalink/id_prefix'); - - if ($idPrefix !== '') { - $idPrefix .= '-'; - } - - $attrs->set('id', $idPrefix . $slug); - } - - $attrs->set('href', '#' . $fragmentPrefix . $slug); - $attrs->append('class', $this->config->get('heading_permalink/html_class')); - - $hidden = $this->config->get('heading_permalink/aria_hidden'); - if ($hidden) { - $attrs->set('aria-hidden', 'true'); - } - - $attrs->set('title', $this->config->get('heading_permalink/title')); - - $symbol = $this->config->get('heading_permalink/symbol'); - \assert(\is_string($symbol)); - - return new HtmlElement('a', $attrs->export(), \htmlspecialchars($symbol), false); - } - - public function getXmlTagName(Node $node): string - { - return 'heading_permalink'; - } - - /** - * @param HeadingPermalink $node - * - * @return array<string, scalar> - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function getXmlAttributes(Node $node): array - { - HeadingPermalink::assertInstanceOf($node); - - return [ - 'slug' => $node->getSlug(), - ]; - } -} 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 403e948..0000000 --- a/vendor/league/commonmark/src/Extension/InlinesOnly/ChildRenderer.php +++ /dev/null @@ -1,35 +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\Extension\InlinesOnly; - -use League\CommonMark\Node\Block\Document; -use League\CommonMark\Node\Node; -use League\CommonMark\Renderer\ChildNodeRendererInterface; -use League\CommonMark\Renderer\NodeRendererInterface; - -/** - * Simply renders child elements as-is, adding newlines as needed. - */ -final class ChildRenderer implements NodeRendererInterface -{ - public function render(Node $node, ChildNodeRendererInterface $childRenderer): string - { - $out = $childRenderer->renderNodes($node->children()); - if (! $node instanceof Document) { - $out .= $childRenderer->getBlockSeparator(); - } - - 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 7777510..0000000 --- a/vendor/league/commonmark/src/Extension/InlinesOnly/InlinesOnlyExtension.php +++ /dev/null @@ -1,73 +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\Extension\InlinesOnly; - -use League\CommonMark as Core; -use League\CommonMark\Environment\EnvironmentBuilderInterface; -use League\CommonMark\Extension\CommonMark; -use League\CommonMark\Extension\CommonMark\Delimiter\Processor\EmphasisDelimiterProcessor; -use League\CommonMark\Extension\ConfigurableExtensionInterface; -use League\Config\ConfigurationBuilderInterface; -use Nette\Schema\Expect; - -final class InlinesOnlyExtension implements ConfigurableExtensionInterface -{ - public function configureSchema(ConfigurationBuilderInterface $builder): void - { - $builder->addSchema('commonmark', Expect::structure([ - 'use_asterisk' => Expect::bool(true), - 'use_underscore' => Expect::bool(true), - 'enable_strong' => Expect::bool(true), - 'enable_em' => Expect::bool(true), - ])); - } - - // phpcs:disable Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma,Squiz.WhiteSpace.SemicolonSpacing.Incorrect - public function register(EnvironmentBuilderInterface $environment): void - { - $childRenderer = new ChildRenderer(); - - $environment - ->addInlineParser(new Core\Parser\Inline\NewlineParser(), 200) - ->addInlineParser(new CommonMark\Parser\Inline\BacktickParser(), 150) - ->addInlineParser(new CommonMark\Parser\Inline\EscapableParser(), 80) - ->addInlineParser(new CommonMark\Parser\Inline\EntityParser(), 70) - ->addInlineParser(new CommonMark\Parser\Inline\AutolinkParser(), 50) - ->addInlineParser(new CommonMark\Parser\Inline\HtmlInlineParser(), 40) - ->addInlineParser(new CommonMark\Parser\Inline\CloseBracketParser(), 30) - ->addInlineParser(new CommonMark\Parser\Inline\OpenBracketParser(), 20) - ->addInlineParser(new CommonMark\Parser\Inline\BangParser(), 10) - - ->addRenderer(Core\Node\Block\Document::class, $childRenderer, 0) - ->addRenderer(Core\Node\Block\Paragraph::class, $childRenderer, 0) - - ->addRenderer(CommonMark\Node\Inline\Code::class, new CommonMark\Renderer\Inline\CodeRenderer(), 0) - ->addRenderer(CommonMark\Node\Inline\Emphasis::class, new CommonMark\Renderer\Inline\EmphasisRenderer(), 0) - ->addRenderer(CommonMark\Node\Inline\HtmlInline::class, new CommonMark\Renderer\Inline\HtmlInlineRenderer(), 0) - ->addRenderer(CommonMark\Node\Inline\Image::class, new CommonMark\Renderer\Inline\ImageRenderer(), 0) - ->addRenderer(CommonMark\Node\Inline\Link::class, new CommonMark\Renderer\Inline\LinkRenderer(), 0) - ->addRenderer(Core\Node\Inline\Newline::class, new Core\Renderer\Inline\NewlineRenderer(), 0) - ->addRenderer(CommonMark\Node\Inline\Strong::class, new CommonMark\Renderer\Inline\StrongRenderer(), 0) - ->addRenderer(Core\Node\Inline\Text::class, new Core\Renderer\Inline\TextRenderer(), 0) - ; - - if ($environment->getConfiguration()->get('commonmark/use_asterisk')) { - $environment->addDelimiterProcessor(new EmphasisDelimiterProcessor('*')); - } - - if ($environment->getConfiguration()->get('commonmark/use_underscore')) { - $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 d0b6292..0000000 --- a/vendor/league/commonmark/src/Extension/Mention/Generator/CallbackGenerator.php +++ /dev/null @@ -1,54 +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\Extension\Mention\Generator; - -use League\CommonMark\Exception\LogicException; -use League\CommonMark\Extension\Mention\Mention; -use League\CommonMark\Node\Inline\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; - } - - /** - * @throws LogicException - */ - public function generateMention(Mention $mention): ?AbstractInline - { - $result = \call_user_func($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 LogicException('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 30d4a51..0000000 --- a/vendor/league/commonmark/src/Extension/Mention/Generator/MentionGeneratorInterface.php +++ /dev/null @@ -1,22 +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\Extension\Mention\Generator; - -use League\CommonMark\Extension\Mention\Mention; -use League\CommonMark\Node\Inline\AbstractInline; - -interface MentionGeneratorInterface -{ - 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 5d92897..0000000 --- a/vendor/league/commonmark/src/Extension/Mention/Generator/StringTemplateLinkGenerator.php +++ /dev/null @@ -1,34 +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\Extension\Mention\Generator; - -use League\CommonMark\Extension\Mention\Mention; -use League\CommonMark\Node\Inline\AbstractInline; - -final class StringTemplateLinkGenerator implements MentionGeneratorInterface -{ - private string $urlTemplate; - - public function __construct(string $urlTemplate) - { - $this->urlTemplate = $urlTemplate; - } - - public function generateMention(Mention $mention): ?AbstractInline - { - $mention->setUrl(\sprintf($this->urlTemplate, $mention->getIdentifier())); - - return $mention; - } -} 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 74eaee4..0000000 --- a/vendor/league/commonmark/src/Extension/Mention/Mention.php +++ /dev/null @@ -1,93 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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\Extension\CommonMark\Node\Inline\Link; -use League\CommonMark\Node\Inline\Text; - -class Mention extends Link -{ - private string $name; - - private string $prefix; - - private string $identifier; - - public function __construct(string $name, string $prefix, string $identifier, ?string $label = null) - { - $this->name = $name; - $this->prefix = $prefix; - $this->identifier = $identifier; - - parent::__construct('', $label ?? \sprintf('%s%s', $prefix, $identifier)); - } - - public function getLabel(): ?string - { - if (($labelNode = $this->findLabelNode()) === null) { - return null; - } - - return $labelNode->getLiteral(); - } - - public function getIdentifier(): string - { - return $this->identifier; - } - - public function getName(): ?string - { - return $this->name; - } - - public function getPrefix(): string - { - return $this->prefix; - } - - public function hasUrl(): bool - { - return $this->url !== ''; - } - - /** - * @return $this - */ - public function setLabel(string $label): self - { - if (($labelNode = $this->findLabelNode()) === null) { - $labelNode = new Text(); - $this->prependChild($labelNode); - } - - $labelNode->setLiteral($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 c848c26..0000000 --- a/vendor/league/commonmark/src/Extension/Mention/MentionExtension.php +++ /dev/null @@ -1,61 +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\Extension\Mention; - -use League\CommonMark\Environment\EnvironmentBuilderInterface; -use League\CommonMark\Extension\ConfigurableExtensionInterface; -use League\CommonMark\Extension\Mention\Generator\MentionGeneratorInterface; -use League\Config\ConfigurationBuilderInterface; -use League\Config\Exception\InvalidConfigurationException; -use Nette\Schema\Expect; - -final class MentionExtension implements ConfigurableExtensionInterface -{ - public function configureSchema(ConfigurationBuilderInterface $builder): void - { - $isAValidPartialRegex = static function (string $regex): bool { - $regex = '/' . $regex . '/i'; - - return @\preg_match($regex, '') !== false; - }; - - $builder->addSchema('mentions', Expect::arrayOf( - Expect::structure([ - 'prefix' => Expect::string()->required(), - 'pattern' => Expect::string()->assert($isAValidPartialRegex, 'Pattern must not include starting/ending delimiters (like "/")')->required(), - 'generator' => Expect::anyOf( - Expect::type(MentionGeneratorInterface::class), - Expect::string(), - Expect::type('callable') - )->required(), - ]) - )); - } - - public function register(EnvironmentBuilderInterface $environment): void - { - $mentions = $environment->getConfiguration()->get('mentions'); - foreach ($mentions as $name => $mention) { - if ($mention['generator'] instanceof MentionGeneratorInterface) { - $environment->addInlineParser(new MentionParser($name, $mention['prefix'], $mention['pattern'], $mention['generator'])); - } elseif (\is_string($mention['generator'])) { - $environment->addInlineParser(MentionParser::createWithStringTemplate($name, $mention['prefix'], $mention['pattern'], $mention['generator'])); - } elseif (\is_callable($mention['generator'])) { - $environment->addInlineParser(MentionParser::createWithCallback($name, $mention['prefix'], $mention['pattern'], $mention['generator'])); - } else { - throw new InvalidConfigurationException(\sprintf('The "generator" provided for the "%s" MentionParser configuration must be a string template, callable, or an object that implements %s.', $name, 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 a81c787..0000000 --- a/vendor/league/commonmark/src/Extension/Mention/MentionParser.php +++ /dev/null @@ -1,87 +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\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\Parser\Inline\InlineParserInterface; -use League\CommonMark\Parser\Inline\InlineParserMatch; -use League\CommonMark\Parser\InlineParserContext; - -final class MentionParser implements InlineParserInterface -{ - /** @psalm-readonly */ - private string $name; - - /** @psalm-readonly */ - private string $prefix; - - /** @psalm-readonly */ - private string $identifierPattern; - - /** @psalm-readonly */ - private MentionGeneratorInterface $mentionGenerator; - - public function __construct(string $name, string $prefix, string $identifierPattern, MentionGeneratorInterface $mentionGenerator) - { - $this->name = $name; - $this->prefix = $prefix; - $this->identifierPattern = $identifierPattern; - $this->mentionGenerator = $mentionGenerator; - } - - public function getMatchDefinition(): InlineParserMatch - { - return InlineParserMatch::join( - InlineParserMatch::string($this->prefix), - InlineParserMatch::regex($this->identifierPattern) - ); - } - - public function parse(InlineParserContext $inlineContext): bool - { - $cursor = $inlineContext->getCursor(); - - // The prefix 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; - } - - [$prefix, $identifier] = $inlineContext->getSubMatches(); - - $mention = $this->mentionGenerator->generateMention(new Mention($this->name, $prefix, $identifier)); - - if ($mention === null) { - return false; - } - - $cursor->advanceBy($inlineContext->getFullMatchLength()); - $inlineContext->getContainer()->appendChild($mention); - - return true; - } - - public static function createWithStringTemplate(string $name, string $prefix, string $mentionRegex, string $urlTemplate): MentionParser - { - return new self($name, $prefix, $mentionRegex, new StringTemplateLinkGenerator($urlTemplate)); - } - - public static function createWithCallback(string $name, string $prefix, string $mentionRegex, callable $callback): MentionParser - { - return new self($name, $prefix, $mentionRegex, new CallbackGenerator($callback)); - } -} diff --git a/vendor/league/commonmark/src/Extension/SmartPunct/DashParser.php b/vendor/league/commonmark/src/Extension/SmartPunct/DashParser.php deleted file mode 100644 index cf0e1af..0000000 --- a/vendor/league/commonmark/src/Extension/SmartPunct/DashParser.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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\Node\Inline\Text; -use League\CommonMark\Parser\Inline\InlineParserInterface; -use League\CommonMark\Parser\Inline\InlineParserMatch; -use League\CommonMark\Parser\InlineParserContext; - -final class DashParser implements InlineParserInterface -{ - private const EN_DASH = '–'; - private const EM_DASH = '—'; - - public function getMatchDefinition(): InlineParserMatch - { - return InlineParserMatch::regex('(?<!-)(-{2,})'); - } - - public function parse(InlineParserContext $inlineContext): bool - { - $count = $inlineContext->getFullMatchLength(); - $inlineContext->getCursor()->advanceBy($count); - - $enCount = 0; - $emCount = 0; - if ($count % 3 === 0) { // If divisible by 3, use all em dashes - $emCount = (int) ($count / 3); - } elseif ($count % 2 === 0) { // If divisible by 2, use all en dashes - $enCount = (int) ($count / 2); - } elseif ($count % 3 === 2) { // If 2 extra dashes, use en dash for last 2; em dashes for rest - $emCount = (int) (($count - 2) / 3); - $enCount = 1; - } else { // Use en dashes for last 4 hyphens; em dashes for rest - $emCount = (int) (($count - 4) / 3); - $enCount = 2; - } - - $inlineContext->getContainer()->appendChild(new Text( - \str_repeat(self::EM_DASH, $emCount) . \str_repeat(self::EN_DASH, $enCount) - )); - - return true; - } -} diff --git a/vendor/league/commonmark/src/Extension/SmartPunct/EllipsesParser.php b/vendor/league/commonmark/src/Extension/SmartPunct/EllipsesParser.php deleted file mode 100644 index 9f5b3bd..0000000 --- a/vendor/league/commonmark/src/Extension/SmartPunct/EllipsesParser.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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\Node\Inline\Text; -use League\CommonMark\Parser\Inline\InlineParserInterface; -use League\CommonMark\Parser\Inline\InlineParserMatch; -use League\CommonMark\Parser\InlineParserContext; - -final class EllipsesParser implements InlineParserInterface -{ - public function getMatchDefinition(): InlineParserMatch - { - return InlineParserMatch::oneOf('...', '. . .'); - } - - public function parse(InlineParserContext $inlineContext): bool - { - $inlineContext->getCursor()->advanceBy($inlineContext->getFullMatchLength()); - $inlineContext->getContainer()->appendChild(new Text('…')); - - return true; - } -} 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 dee9759..0000000 --- a/vendor/league/commonmark/src/Extension/SmartPunct/Quote.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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\Node\Inline\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 31ba8c7..0000000 --- a/vendor/league/commonmark/src/Extension/SmartPunct/QuoteParser.php +++ /dev/null @@ -1,98 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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\Parser\Inline\InlineParserInterface; -use League\CommonMark\Parser\Inline\InlineParserMatch; -use League\CommonMark\Parser\InlineParserContext; -use League\CommonMark\Util\RegexHelper; - -final class QuoteParser implements InlineParserInterface -{ - /** - * @deprecated This constant is no longer used and will be removed in a future major release - */ - public const DOUBLE_QUOTES = [Quote::DOUBLE_QUOTE, Quote::DOUBLE_QUOTE_OPENER, Quote::DOUBLE_QUOTE_CLOSER]; - - /** - * @deprecated This constant is no longer used and will be removed in a future major release - */ - public const SINGLE_QUOTES = [Quote::SINGLE_QUOTE, Quote::SINGLE_QUOTE_OPENER, Quote::SINGLE_QUOTE_CLOSER]; - - public function getMatchDefinition(): InlineParserMatch - { - return InlineParserMatch::oneOf(Quote::SINGLE_QUOTE, Quote::DOUBLE_QUOTE); - } - - /** - * Normalizes any quote characters found and manually adds them to the delimiter stack - */ - public function parse(InlineParserContext $inlineContext): bool - { - $char = $inlineContext->getFullMatch(); - $cursor = $inlineContext->getCursor(); - $index = $cursor->getPosition(); - - $charBefore = $cursor->peek(-1); - if ($charBefore === null) { - $charBefore = "\n"; - } - - $cursor->advance(); - - $charAfter = $cursor->getCurrentCharacter(); - if ($charAfter === null) { - $charAfter = "\n"; - } - - [$leftFlanking, $rightFlanking] = $this->determineFlanking($charBefore, $charAfter); - $canOpen = $leftFlanking && ! $rightFlanking; - $canClose = $rightFlanking; - - $node = new Quote($char, ['delim' => true]); - $inlineContext->getContainer()->appendChild($node); - - // Add entry to stack to this opener - $inlineContext->getDelimiterStack()->push(new Delimiter($char, 1, $node, $canOpen, $canClose, $index)); - - return true; - } - - /** - * @return bool[] - */ - private function determineFlanking(string $charBefore, string $charAfter): array - { - $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 1fc30d4..0000000 --- a/vendor/league/commonmark/src/Extension/SmartPunct/QuoteProcessor.php +++ /dev/null @@ -1,82 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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\Node\Inline\AbstractStringContainer; - -final class QuoteProcessor implements DelimiterProcessorInterface -{ - /** @psalm-readonly */ - private string $normalizedCharacter; - - /** @psalm-readonly */ - private string $openerCharacter; - - /** @psalm-readonly */ - private string $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): void - { - $opener->insertAfter(new Quote($this->openerCharacter)); - $closer->insertBefore(new Quote($this->closerCharacter)); - } - - /** - * Create a double-quote processor - */ - 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 - */ - 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/ReplaceUnpairedQuotesListener.php b/vendor/league/commonmark/src/Extension/SmartPunct/ReplaceUnpairedQuotesListener.php deleted file mode 100644 index 3536452..0000000 --- a/vendor/league/commonmark/src/Extension/SmartPunct/ReplaceUnpairedQuotesListener.php +++ /dev/null @@ -1,43 +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\Extension\SmartPunct; - -use League\CommonMark\Event\DocumentParsedEvent; -use League\CommonMark\Node\Inline\AdjacentTextMerger; -use League\CommonMark\Node\Inline\Text; -use League\CommonMark\Node\Query; - -/** - * Identifies any lingering Quote nodes that were missing pairs and converts them into Text nodes - */ -final class ReplaceUnpairedQuotesListener -{ - public function __invoke(DocumentParsedEvent $event): void - { - $query = (new Query())->where(Query::type(Quote::class)); - foreach ($query->findAll($event->getDocument()) as $quote) { - \assert($quote instanceof Quote); - - $literal = $quote->getLiteral(); - if ($literal === Quote::SINGLE_QUOTE) { - $literal = Quote::SINGLE_QUOTE_CLOSER; - } elseif ($literal === Quote::DOUBLE_QUOTE) { - $literal = Quote::DOUBLE_QUOTE_OPENER; - } - - $quote->replaceWith($new = new Text($literal)); - AdjacentTextMerger::mergeWithDirectlyAdjacentNodes($new); - } - } -} 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 8524ca1..0000000 --- a/vendor/league/commonmark/src/Extension/SmartPunct/SmartPunctExtension.php +++ /dev/null @@ -1,64 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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\Environment\EnvironmentBuilderInterface; -use League\CommonMark\Event\DocumentParsedEvent; -use League\CommonMark\Extension\ConfigurableExtensionInterface; -use League\CommonMark\Node\Block\Document; -use League\CommonMark\Node\Block\Paragraph; -use League\CommonMark\Node\Inline\Text; -use League\CommonMark\Renderer\Block as CoreBlockRenderer; -use League\CommonMark\Renderer\Inline as CoreInlineRenderer; -use League\Config\ConfigurationBuilderInterface; -use Nette\Schema\Expect; - -final class SmartPunctExtension implements ConfigurableExtensionInterface -{ - public function configureSchema(ConfigurationBuilderInterface $builder): void - { - $builder->addSchema('smartpunct', Expect::structure([ - 'double_quote_opener' => Expect::string(Quote::DOUBLE_QUOTE_OPENER), - 'double_quote_closer' => Expect::string(Quote::DOUBLE_QUOTE_CLOSER), - 'single_quote_opener' => Expect::string(Quote::SINGLE_QUOTE_OPENER), - 'single_quote_closer' => Expect::string(Quote::SINGLE_QUOTE_CLOSER), - ])); - } - - public function register(EnvironmentBuilderInterface $environment): void - { - $environment - ->addInlineParser(new QuoteParser(), 10) - ->addInlineParser(new DashParser(), 0) - ->addInlineParser(new EllipsesParser(), 0) - - ->addDelimiterProcessor(QuoteProcessor::createDoubleQuoteProcessor( - $environment->getConfiguration()->get('smartpunct/double_quote_opener'), - $environment->getConfiguration()->get('smartpunct/double_quote_closer') - )) - ->addDelimiterProcessor(QuoteProcessor::createSingleQuoteProcessor( - $environment->getConfiguration()->get('smartpunct/single_quote_opener'), - $environment->getConfiguration()->get('smartpunct/single_quote_closer') - )) - - ->addEventListener(DocumentParsedEvent::class, new ReplaceUnpairedQuotesListener()) - - ->addRenderer(Document::class, new CoreBlockRenderer\DocumentRenderer(), 0) - ->addRenderer(Paragraph::class, new CoreBlockRenderer\ParagraphRenderer(), 0) - ->addRenderer(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 20ad161..0000000 --- a/vendor/league/commonmark/src/Extension/Strikethrough/Strikethrough.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * 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\Node\Inline\AbstractInline; -use League\CommonMark\Node\Inline\DelimitedInterface; - -final class Strikethrough extends AbstractInline implements DelimitedInterface -{ - private string $delimiter; - - public function __construct(string $delimiter = '~~') - { - parent::__construct(); - - $this->delimiter = $delimiter; - } - - public function getOpeningDelimiter(): string - { - return $this->delimiter; - } - - public function getClosingDelimiter(): string - { - return $this->delimiter; - } -} 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 a6c8d38..0000000 --- a/vendor/league/commonmark/src/Extension/Strikethrough/StrikethroughDelimiterProcessor.php +++ /dev/null @@ -1,69 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * 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\CacheableDelimiterProcessorInterface; -use League\CommonMark\Node\Inline\AbstractStringContainer; - -final class StrikethroughDelimiterProcessor implements CacheableDelimiterProcessorInterface -{ - public function getOpeningCharacter(): string - { - return '~'; - } - - public function getClosingCharacter(): string - { - return '~'; - } - - public function getMinLength(): int - { - return 1; - } - - public function getDelimiterUse(DelimiterInterface $opener, DelimiterInterface $closer): int - { - if ($opener->getLength() > 2 && $closer->getLength() > 2) { - return 0; - } - - if ($opener->getLength() !== $closer->getLength()) { - return 0; - } - - // $opener and $closer are the same length so we just return one of them - return $opener->getLength(); - } - - public function process(AbstractStringContainer $opener, AbstractStringContainer $closer, int $delimiterUse): void - { - $strikethrough = new Strikethrough(\str_repeat('~', $delimiterUse)); - - $tmp = $opener->next(); - while ($tmp !== null && $tmp !== $closer) { - $next = $tmp->next(); - $strikethrough->appendChild($tmp); - $tmp = $next; - } - - $opener->insertAfter($strikethrough); - } - - public function getCacheKey(DelimiterInterface $closer): string - { - return '~' . $closer->getLength(); - } -} 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 96ffe7a..0000000 --- a/vendor/league/commonmark/src/Extension/Strikethrough/StrikethroughExtension.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> 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\Environment\EnvironmentBuilderInterface; -use League\CommonMark\Extension\ExtensionInterface; - -final class StrikethroughExtension implements ExtensionInterface -{ - public function register(EnvironmentBuilderInterface $environment): void - { - $environment->addDelimiterProcessor(new StrikethroughDelimiterProcessor()); - $environment->addRenderer(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 a50b895..0000000 --- a/vendor/league/commonmark/src/Extension/Strikethrough/StrikethroughRenderer.php +++ /dev/null @@ -1,50 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * 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\Node\Node; -use League\CommonMark\Renderer\ChildNodeRendererInterface; -use League\CommonMark\Renderer\NodeRendererInterface; -use League\CommonMark\Util\HtmlElement; -use League\CommonMark\Xml\XmlNodeRendererInterface; - -final class StrikethroughRenderer implements NodeRendererInterface, XmlNodeRendererInterface -{ - /** - * @param Strikethrough $node - * - * {@inheritDoc} - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable - { - Strikethrough::assertInstanceOf($node); - - return new HtmlElement('del', $node->data->get('attributes'), $childRenderer->renderNodes($node->children())); - } - - public function getXmlTagName(Node $node): string - { - return 'strikethrough'; - } - - /** - * {@inheritDoc} - */ - public function getXmlAttributes(Node $node): array - { - return []; - } -} 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 2fe441d..0000000 --- a/vendor/league/commonmark/src/Extension/Table/Table.php +++ /dev/null @@ -1,22 +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\Node\Block\AbstractBlock; - -final class Table extends AbstractBlock -{ -} 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 6ed359a..0000000 --- a/vendor/league/commonmark/src/Extension/Table/TableCell.php +++ /dev/null @@ -1,99 +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\Node\Block\AbstractBlock; - -final class TableCell extends AbstractBlock -{ - public const TYPE_HEADER = 'header'; - public const TYPE_DATA = 'data'; - - public const ALIGN_LEFT = 'left'; - public const ALIGN_RIGHT = 'right'; - public const ALIGN_CENTER = 'center'; - - /** - * @psalm-var self::TYPE_* - * @phpstan-var self::TYPE_* - * - * @psalm-readonly-allow-private-mutation - */ - private string $type = self::TYPE_DATA; - - /** - * @psalm-var self::ALIGN_*|null - * @phpstan-var self::ALIGN_*|null - * - * @psalm-readonly-allow-private-mutation - */ - private ?string $align = null; - - /** - * @psalm-param self::TYPE_* $type - * @psalm-param self::ALIGN_*|null $align - * - * @phpstan-param self::TYPE_* $type - * @phpstan-param self::ALIGN_*|null $align - */ - public function __construct(string $type = self::TYPE_DATA, ?string $align = null) - { - parent::__construct(); - - $this->type = $type; - $this->align = $align; - } - - /** - * @psalm-return self::TYPE_* - * - * @phpstan-return self::TYPE_* - */ - public function getType(): string - { - return $this->type; - } - - /** - * @psalm-param self::TYPE_* $type - * - * @phpstan-param self::TYPE_* $type - */ - public function setType(string $type): void - { - $this->type = $type; - } - - /** - * @psalm-return self::ALIGN_*|null - * - * @phpstan-return self::ALIGN_*|null - */ - public function getAlign(): ?string - { - return $this->align; - } - - /** - * @psalm-param self::ALIGN_*|null $align - * - * @phpstan-param self::ALIGN_*|null $align - */ - public function setAlign(?string $align): void - { - $this->align = $align; - } -} 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 99512c3..0000000 --- a/vendor/league/commonmark/src/Extension/Table/TableCellRenderer.php +++ /dev/null @@ -1,89 +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\Extension\Attributes\Util\AttributesHelper; -use League\CommonMark\Node\Node; -use League\CommonMark\Renderer\ChildNodeRendererInterface; -use League\CommonMark\Renderer\NodeRendererInterface; -use League\CommonMark\Util\HtmlElement; -use League\CommonMark\Xml\XmlNodeRendererInterface; - -final class TableCellRenderer implements NodeRendererInterface, XmlNodeRendererInterface -{ - private const DEFAULT_ATTRIBUTES = [ - TableCell::ALIGN_LEFT => ['align' => 'left'], - TableCell::ALIGN_CENTER => ['align' => 'center'], - TableCell::ALIGN_RIGHT => ['align' => 'right'], - ]; - - /** @var array<TableCell::ALIGN_*, array<string, string|string[]|bool>> */ - private array $alignmentAttributes; - - /** - * @param array<TableCell::ALIGN_*, array<string, string|string[]|bool>> $alignmentAttributes - */ - public function __construct(array $alignmentAttributes = self::DEFAULT_ATTRIBUTES) - { - $this->alignmentAttributes = $alignmentAttributes; - } - - /** - * @param TableCell $node - * - * {@inheritDoc} - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable - { - TableCell::assertInstanceOf($node); - - $attrs = $node->data->get('attributes'); - if (($alignment = $node->getAlign()) !== null) { - $attrs = AttributesHelper::mergeAttributes($attrs, $this->alignmentAttributes[$alignment]); - } - - $tag = $node->getType() === TableCell::TYPE_HEADER ? 'th' : 'td'; - - return new HtmlElement($tag, $attrs, $childRenderer->renderNodes($node->children())); - } - - public function getXmlTagName(Node $node): string - { - return 'table_cell'; - } - - /** - * @param TableCell $node - * - * @return array<string, scalar> - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function getXmlAttributes(Node $node): array - { - TableCell::assertInstanceOf($node); - - $ret = ['type' => $node->getType()]; - - if (($align = $node->getAlign()) !== null) { - $ret['align'] = $align; - } - - return $ret; - } -} 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 0a8db3e..0000000 --- a/vendor/league/commonmark/src/Extension/Table/TableExtension.php +++ /dev/null @@ -1,63 +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\Environment\EnvironmentBuilderInterface; -use League\CommonMark\Extension\ConfigurableExtensionInterface; -use League\CommonMark\Renderer\HtmlDecorator; -use League\Config\ConfigurationBuilderInterface; -use Nette\Schema\Expect; - -final class TableExtension implements ConfigurableExtensionInterface -{ - public function configureSchema(ConfigurationBuilderInterface $builder): void - { - $attributeArraySchema = Expect::arrayOf( - Expect::type('string|string[]|bool'), // attribute value(s) - 'string' // attribute name - )->mergeDefaults(false); - - $builder->addSchema('table', Expect::structure([ - 'wrap' => Expect::structure([ - 'enabled' => Expect::bool()->default(false), - 'tag' => Expect::string()->default('div'), - 'attributes' => Expect::arrayOf(Expect::string()), - ]), - 'alignment_attributes' => Expect::structure([ - 'left' => (clone $attributeArraySchema)->default(['align' => 'left']), - 'center' => (clone $attributeArraySchema)->default(['align' => 'center']), - 'right' => (clone $attributeArraySchema)->default(['align' => 'right']), - ]), - 'max_autocompleted_cells' => Expect::int()->min(0)->default(TableParser::DEFAULT_MAX_AUTOCOMPLETED_CELLS), - ])); - } - - public function register(EnvironmentBuilderInterface $environment): void - { - $tableRenderer = new TableRenderer(); - if ($environment->getConfiguration()->get('table/wrap/enabled')) { - $tableRenderer = new HtmlDecorator($tableRenderer, $environment->getConfiguration()->get('table/wrap/tag'), $environment->getConfiguration()->get('table/wrap/attributes')); - } - - $environment - ->addBlockStartParser(new TableStartParser($environment->getConfiguration()->get('table/max_autocompleted_cells'))) - - ->addRenderer(Table::class, $tableRenderer) - ->addRenderer(TableSection::class, new TableSectionRenderer()) - ->addRenderer(TableRow::class, new TableRowRenderer()) - ->addRenderer(TableCell::class, new TableCellRenderer($environment->getConfiguration()->get('table/alignment_attributes'))); - } -} 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 a005f8a..0000000 --- a/vendor/league/commonmark/src/Extension/Table/TableParser.php +++ /dev/null @@ -1,212 +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\Parser\Block\AbstractBlockContinueParser; -use League\CommonMark\Parser\Block\BlockContinue; -use League\CommonMark\Parser\Block\BlockContinueParserInterface; -use League\CommonMark\Parser\Block\BlockContinueParserWithInlinesInterface; -use League\CommonMark\Parser\Cursor; -use League\CommonMark\Parser\InlineParserEngineInterface; -use League\CommonMark\Util\ArrayCollection; - -final class TableParser extends AbstractBlockContinueParser implements BlockContinueParserWithInlinesInterface -{ - /** - * @internal - */ - public const DEFAULT_MAX_AUTOCOMPLETED_CELLS = 10_000; - - /** @psalm-readonly */ - private Table $block; - - /** - * @var ArrayCollection<string> - * - * @psalm-readonly-allow-private-mutation - */ - private ArrayCollection $bodyLines; - - /** - * @var array<int, string|null> - * @psalm-var array<int, TableCell::ALIGN_*|null> - * @phpstan-var array<int, TableCell::ALIGN_*|null> - * - * @psalm-readonly - */ - private array $columns; - - /** - * @var array<int, string> - * - * @psalm-readonly-allow-private-mutation - */ - private array $headerCells; - - /** @psalm-readonly-allow-private-mutation */ - private bool $nextIsSeparatorLine = true; - - private int $remainingAutocompletedCells; - - /** - * @param array<int, string|null> $columns - * @param array<int, string> $headerCells - * - * @psalm-param array<int, TableCell::ALIGN_*|null> $columns - * - * @phpstan-param array<int, TableCell::ALIGN_*|null> $columns - */ - public function __construct(array $columns, array $headerCells, int $remainingAutocompletedCells = self::DEFAULT_MAX_AUTOCOMPLETED_CELLS) - { - $this->block = new Table(); - $this->bodyLines = new ArrayCollection(); - $this->columns = $columns; - $this->headerCells = $headerCells; - $this->remainingAutocompletedCells = $remainingAutocompletedCells; - } - - public function canHaveLazyContinuationLines(): bool - { - return true; - } - - public function getBlock(): Table - { - return $this->block; - } - - public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue - { - if (\strpos($cursor->getLine(), '|') === false) { - return BlockContinue::none(); - } - - return BlockContinue::at($cursor); - } - - public function addLine(string $line): void - { - if ($this->nextIsSeparatorLine) { - $this->nextIsSeparatorLine = false; - } else { - $this->bodyLines[] = $line; - } - } - - public function parseInlines(InlineParserEngineInterface $inlineParser): void - { - $headerColumns = \count($this->headerCells); - - $head = new TableSection(TableSection::TYPE_HEAD); - $this->block->appendChild($head); - - $headerRow = new TableRow(); - $head->appendChild($headerRow); - for ($i = 0; $i < $headerColumns; $i++) { - $cell = $this->headerCells[$i]; - $tableCell = $this->parseCell($cell, $i, $inlineParser); - $tableCell->setType(TableCell::TYPE_HEADER); - $headerRow->appendChild($tableCell); - } - - $body = null; - foreach ($this->bodyLines as $rowLine) { - $cells = self::split($rowLine); - $row = new TableRow(); - - // Body can not have more columns than head - for ($i = 0; $i < $headerColumns; $i++) { - // It can have less columns though, in which case we'll autocomplete the empty ones (up to some limit) - if (! isset($cells[$i]) && $this->remainingAutocompletedCells-- <= 0) { - // Too many cells were auto-completed, so we'll just stop here - return; - } - - $cell = $cells[$i] ?? ''; - $tableCell = $this->parseCell($cell, $i, $inlineParser); - $row->appendChild($tableCell); - } - - if ($body === null) { - // It's valid to have a table without body. In that case, don't add an empty TableBody node. - $body = new TableSection(); - $this->block->appendChild($body); - } - - $body->appendChild($row); - } - } - - private function parseCell(string $cell, int $column, InlineParserEngineInterface $inlineParser): TableCell - { - $tableCell = new TableCell(TableCell::TYPE_DATA, $this->columns[$column] ?? null); - - if ($cell !== '') { - $inlineParser->parse(\trim($cell), $tableCell); - } - - return $tableCell; - } - - /** - * @internal - * - * @return array<int, string> - */ - public static function split(string $line): array - { - $cursor = new Cursor(\trim($line)); - - if ($cursor->getCurrentCharacter() === '|') { - $cursor->advanceBy(1); - } - - $cells = []; - $sb = ''; - - while (! $cursor->isAtEnd()) { - switch ($c = $cursor->getCurrentCharacter()) { - 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; - } -} 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 7799e22..0000000 --- a/vendor/league/commonmark/src/Extension/Table/TableRenderer.php +++ /dev/null @@ -1,58 +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\Node\Node; -use League\CommonMark\Renderer\ChildNodeRendererInterface; -use League\CommonMark\Renderer\NodeRendererInterface; -use League\CommonMark\Util\HtmlElement; -use League\CommonMark\Xml\XmlNodeRendererInterface; - -final class TableRenderer implements NodeRendererInterface, XmlNodeRendererInterface -{ - /** - * @param Table $node - * - * {@inheritDoc} - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable - { - Table::assertInstanceOf($node); - - $attrs = $node->data->get('attributes'); - - $separator = $childRenderer->getInnerSeparator(); - - $children = $childRenderer->renderNodes($node->children()); - - return new HtmlElement('table', $attrs, $separator . \trim($children) . $separator); - } - - public function getXmlTagName(Node $node): string - { - return 'table'; - } - - /** - * {@inheritDoc} - */ - public function getXmlAttributes(Node $node): array - { - return []; - } -} 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 cd6ac99..0000000 --- a/vendor/league/commonmark/src/Extension/Table/TableRow.php +++ /dev/null @@ -1,22 +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\Node\Block\AbstractBlock; - -final class TableRow extends 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 dee72d2..0000000 --- a/vendor/league/commonmark/src/Extension/Table/TableRowRenderer.php +++ /dev/null @@ -1,56 +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\Node\Node; -use League\CommonMark\Renderer\ChildNodeRendererInterface; -use League\CommonMark\Renderer\NodeRendererInterface; -use League\CommonMark\Util\HtmlElement; -use League\CommonMark\Xml\XmlNodeRendererInterface; - -final class TableRowRenderer implements NodeRendererInterface, XmlNodeRendererInterface -{ - /** - * @param TableRow $node - * - * {@inheritDoc} - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable - { - TableRow::assertInstanceOf($node); - - $attrs = $node->data->get('attributes'); - - $separator = $childRenderer->getInnerSeparator(); - - return new HtmlElement('tr', $attrs, $separator . $childRenderer->renderNodes($node->children()) . $separator); - } - - public function getXmlTagName(Node $node): string - { - return 'table_row'; - } - - /** - * {@inheritDoc} - */ - public function getXmlAttributes(Node $node): array - { - return []; - } -} 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 9edd63b..0000000 --- a/vendor/league/commonmark/src/Extension/Table/TableSection.php +++ /dev/null @@ -1,64 +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\Node\Block\AbstractBlock; - -final class TableSection extends AbstractBlock -{ - public const TYPE_HEAD = 'head'; - public const TYPE_BODY = 'body'; - - /** - * @psalm-var self::TYPE_* - * @phpstan-var self::TYPE_* - * - * @psalm-readonly - */ - private string $type; - - /** - * @psalm-param self::TYPE_* $type - * - * @phpstan-param self::TYPE_* $type - */ - public function __construct(string $type = self::TYPE_BODY) - { - parent::__construct(); - - $this->type = $type; - } - - /** - * @psalm-return self::TYPE_* - * - * @phpstan-return self::TYPE_* - */ - public function getType(): string - { - return $this->type; - } - - public function isHead(): bool - { - return $this->type === self::TYPE_HEAD; - } - - public function isBody(): bool - { - return $this->type === self::TYPE_BODY; - } -} 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 cccf06c..0000000 --- a/vendor/league/commonmark/src/Extension/Table/TableSectionRenderer.php +++ /dev/null @@ -1,70 +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\Node\Node; -use League\CommonMark\Renderer\ChildNodeRendererInterface; -use League\CommonMark\Renderer\NodeRendererInterface; -use League\CommonMark\Util\HtmlElement; -use League\CommonMark\Xml\XmlNodeRendererInterface; - -final class TableSectionRenderer implements NodeRendererInterface, XmlNodeRendererInterface -{ - /** - * @param TableSection $node - * - * {@inheritDoc} - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function render(Node $node, ChildNodeRendererInterface $childRenderer) - { - TableSection::assertInstanceOf($node); - - if (! $node->hasChildren()) { - return ''; - } - - $attrs = $node->data->get('attributes'); - - $separator = $childRenderer->getInnerSeparator(); - - $tag = $node->getType() === TableSection::TYPE_HEAD ? 'thead' : 'tbody'; - - return new HtmlElement($tag, $attrs, $separator . $childRenderer->renderNodes($node->children()) . $separator); - } - - public function getXmlTagName(Node $node): string - { - return 'table_section'; - } - - /** - * @param TableSection $node - * - * @return array<string, scalar> - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function getXmlAttributes(Node $node): array - { - TableSection::assertInstanceOf($node); - - return [ - 'type' => $node->getType(), - ]; - } -} diff --git a/vendor/league/commonmark/src/Extension/Table/TableStartParser.php b/vendor/league/commonmark/src/Extension/Table/TableStartParser.php deleted file mode 100644 index 7411951..0000000 --- a/vendor/league/commonmark/src/Extension/Table/TableStartParser.php +++ /dev/null @@ -1,165 +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\Parser\Block\BlockStart; -use League\CommonMark\Parser\Block\BlockStartParserInterface; -use League\CommonMark\Parser\Block\ParagraphParser; -use League\CommonMark\Parser\Cursor; -use League\CommonMark\Parser\MarkdownParserStateInterface; - -final class TableStartParser implements BlockStartParserInterface -{ - private int $maxAutocompletedCells; - - public function __construct(int $maxAutocompletedCells = TableParser::DEFAULT_MAX_AUTOCOMPLETED_CELLS) - { - $this->maxAutocompletedCells = $maxAutocompletedCells; - } - - public function tryStart(Cursor $cursor, MarkdownParserStateInterface $parserState): ?BlockStart - { - $paragraph = $parserState->getParagraphContent(); - if ($paragraph === null || \strpos($paragraph, '|') === false) { - return BlockStart::none(); - } - - $columns = self::parseSeparator($cursor); - if (\count($columns) === 0) { - return BlockStart::none(); - } - - $lastLineBreak = \strrpos($paragraph, "\n"); - $lastLine = $lastLineBreak === false ? $paragraph : \substr($paragraph, $lastLineBreak + 1); - - $headerCells = TableParser::split($lastLine); - if (\count($headerCells) > \count($columns)) { - return BlockStart::none(); - } - - $cursor->advanceToEnd(); - - $parsers = []; - - if ($lastLineBreak !== false) { - $p = new ParagraphParser(); - $p->addLine(\substr($paragraph, 0, $lastLineBreak)); - $parsers[] = $p; - } - - $parsers[] = new TableParser($columns, $headerCells, $this->maxAutocompletedCells); - - return BlockStart::of(...$parsers) - ->at($cursor) - ->replaceActiveBlockParser(); - } - - /** - * @return array<int, string|null> - * - * @psalm-return array<int, TableCell::ALIGN_*|null> - * - * @phpstan-return array<int, TableCell::ALIGN_*|null> - */ - private static function parseSeparator(Cursor $cursor): array - { - $columns = []; - $pipes = 0; - $valid = false; - - while (! $cursor->isAtEnd()) { - switch ($c = $cursor->getCurrentCharacter()) { - 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 && \count($columns) > 0) { - // 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->getCurrentCharacter() === ':') { - $right = true; - $cursor->advanceBy(1); - } - - $columns[] = self::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; - } - - /** - * @psalm-return TableCell::ALIGN_*|null - * - * @phpstan-return TableCell::ALIGN_*|null - * - * @psalm-pure - */ - private static function getAlignment(bool $left, bool $right): ?string - { - if ($left && $right) { - return TableCell::ALIGN_CENTER; - } - - if ($left) { - return TableCell::ALIGN_LEFT; - } - - if ($right) { - return TableCell::ALIGN_RIGHT; - } - - return null; - } -} 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 e040d86..0000000 --- a/vendor/league/commonmark/src/Extension/TableOfContents/Node/TableOfContents.php +++ /dev/null @@ -1,20 +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\Extension\TableOfContents\Node; - -use League\CommonMark\Extension\CommonMark\Node\Block\ListBlock; - -final class TableOfContents extends ListBlock -{ -} 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 6d6db10..0000000 --- a/vendor/league/commonmark/src/Extension/TableOfContents/Node/TableOfContentsPlaceholder.php +++ /dev/null @@ -1,20 +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\Extension\TableOfContents\Node; - -use League\CommonMark\Node\Block\AbstractBlock; - -final class TableOfContentsPlaceholder extends AbstractBlock -{ -} 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 f5bb9a4..0000000 --- a/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/AsIsNormalizerStrategy.php +++ /dev/null @@ -1,72 +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\Extension\TableOfContents\Normalizer; - -use League\CommonMark\Extension\CommonMark\Node\Block\ListBlock; -use League\CommonMark\Extension\CommonMark\Node\Block\ListItem; -use League\CommonMark\Extension\TableOfContents\Node\TableOfContents; - -final class AsIsNormalizerStrategy implements NormalizerStrategyInterface -{ - /** @psalm-readonly-allow-private-mutation */ - private ListBlock $parentListBlock; - - /** @psalm-readonly-allow-private-mutation */ - private int $parentLevel = 1; - - /** @psalm-readonly-allow-private-mutation */ - private ?ListItem $lastListItem = null; - - 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 - $search = $this->parentListBlock; - while ($search = $search->parent()) { - if ($search instanceof ListBlock) { - $this->parentListBlock = $search; - break; - } - } - - $this->parentLevel--; - } - - $this->parentListBlock->appendChild($listItemToAdd); - - $this->lastListItem = $listItemToAdd; - } -} 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 8e805ae..0000000 --- a/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/FlatNormalizerStrategy.php +++ /dev/null @@ -1,33 +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\Extension\TableOfContents\Normalizer; - -use League\CommonMark\Extension\CommonMark\Node\Block\ListItem; -use League\CommonMark\Extension\TableOfContents\Node\TableOfContents; - -final class FlatNormalizerStrategy implements NormalizerStrategyInterface -{ - /** @psalm-readonly */ - private TableOfContents $toc; - - public function __construct(TableOfContents $toc) - { - $this->toc = $toc; - } - - public function addItem(int $level, ListItem $listItemToAdd): void - { - $this->toc->appendChild($listItemToAdd); - } -} 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 f30afb1..0000000 --- a/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/NormalizerStrategyInterface.php +++ /dev/null @@ -1,21 +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\Extension\TableOfContents\Normalizer; - -use League\CommonMark\Extension\CommonMark\Node\Block\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 1b2197f..0000000 --- a/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/RelativeNormalizerStrategy.php +++ /dev/null @@ -1,67 +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\Extension\TableOfContents\Normalizer; - -use League\CommonMark\Extension\CommonMark\Node\Block\ListBlock; -use League\CommonMark\Extension\CommonMark\Node\Block\ListItem; -use League\CommonMark\Extension\TableOfContents\Node\TableOfContents; - -final class RelativeNormalizerStrategy implements NormalizerStrategyInterface -{ - /** @psalm-readonly */ - private TableOfContents $toc; - - /** - * @var array<int, ListItem> - * - * @psalm-readonly-allow-private-mutation - */ - private array $listItemStack = []; - - public function __construct(TableOfContents $toc) - { - $this->toc = $toc; - } - - public function addItem(int $level, ListItem $listItemToAdd): void - { - $previousLevel = \array_key_last($this->listItemStack); - - // Pop the stack if we're too deep - while ($previousLevel !== null && $level < $previousLevel) { - \array_pop($this->listItemStack); - $previousLevel = \array_key_last($this->listItemStack); - } - - $lastListItem = \end($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; - } -} 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 7fe2b09..0000000 --- a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsBuilder.php +++ /dev/null @@ -1,106 +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\Extension\TableOfContents; - -use League\CommonMark\Event\DocumentParsedEvent; -use League\CommonMark\Extension\CommonMark\Node\Block\Heading; -use League\CommonMark\Extension\HeadingPermalink\HeadingPermalink; -use League\CommonMark\Extension\TableOfContents\Node\TableOfContents; -use League\CommonMark\Extension\TableOfContents\Node\TableOfContentsPlaceholder; -use League\CommonMark\Node\Block\Document; -use League\CommonMark\Node\NodeIterator; -use League\Config\ConfigurationAwareInterface; -use League\Config\ConfigurationInterface; -use League\Config\Exception\InvalidConfigurationException; - -final class TableOfContentsBuilder implements ConfigurationAwareInterface -{ - public const POSITION_TOP = 'top'; - public const POSITION_BEFORE_HEADINGS = 'before-headings'; - public const POSITION_PLACEHOLDER = 'placeholder'; - - /** @psalm-readonly-allow-private-mutation */ - private ConfigurationInterface $config; - - public function onDocumentParsed(DocumentParsedEvent $event): void - { - $document = $event->getDocument(); - - $generator = new TableOfContentsGenerator( - (string) $this->config->get('table_of_contents/style'), - (string) $this->config->get('table_of_contents/normalize'), - (int) $this->config->get('table_of_contents/min_heading_level'), - (int) $this->config->get('table_of_contents/max_heading_level'), - (string) $this->config->get('heading_permalink/fragment_prefix'), - ); - - $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'); - if ($class !== null) { - $toc->data->append('attributes/class', $class); - } - - // Add the TOC to the Document - $position = $this->config->get('table_of_contents/position'); - 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 InvalidConfigurationException::forConfigOption('table_of_contents/position', $position); - } - } - - private function insertBeforeFirstLinkedHeading(Document $document, TableOfContents $toc): void - { - foreach ($document->iterator(NodeIterator::FLAG_BLOCKS_ONLY) as $node) { - if (! $node instanceof Heading) { - continue; - } - - foreach ($node->children() as $child) { - if ($child instanceof HeadingPermalink) { - $node->insertBefore($toc); - - return; - } - } - } - } - - private function replacePlaceholders(Document $document, TableOfContents $toc): void - { - foreach ($document->iterator(NodeIterator::FLAG_BLOCKS_ONLY) as $node) { - // Add the block once we find a placeholder - if (! $node instanceof TableOfContentsPlaceholder) { - continue; - } - - $node->replaceWith(clone $toc); - } - } - - public function setConfiguration(ConfigurationInterface $configuration): void - { - $this->config = $configuration; - } -} 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 9c8223b..0000000 --- a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsExtension.php +++ /dev/null @@ -1,53 +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\Extension\TableOfContents; - -use League\CommonMark\Environment\EnvironmentBuilderInterface; -use League\CommonMark\Event\DocumentParsedEvent; -use League\CommonMark\Extension\CommonMark\Node\Block\ListBlock; -use League\CommonMark\Extension\CommonMark\Renderer\Block\ListBlockRenderer; -use League\CommonMark\Extension\ConfigurableExtensionInterface; -use League\CommonMark\Extension\TableOfContents\Node\TableOfContents; -use League\CommonMark\Extension\TableOfContents\Node\TableOfContentsPlaceholder; -use League\Config\ConfigurationBuilderInterface; -use Nette\Schema\Expect; - -final class TableOfContentsExtension implements ConfigurableExtensionInterface -{ - public function configureSchema(ConfigurationBuilderInterface $builder): void - { - $builder->addSchema('table_of_contents', Expect::structure([ - 'position' => Expect::anyOf(TableOfContentsBuilder::POSITION_BEFORE_HEADINGS, TableOfContentsBuilder::POSITION_PLACEHOLDER, TableOfContentsBuilder::POSITION_TOP)->default(TableOfContentsBuilder::POSITION_TOP), - 'style' => Expect::anyOf(ListBlock::TYPE_BULLET, ListBlock::TYPE_ORDERED)->default(ListBlock::TYPE_BULLET), - 'normalize' => Expect::anyOf(TableOfContentsGenerator::NORMALIZE_RELATIVE, TableOfContentsGenerator::NORMALIZE_FLAT, TableOfContentsGenerator::NORMALIZE_DISABLED)->default(TableOfContentsGenerator::NORMALIZE_RELATIVE), - 'min_heading_level' => Expect::int()->min(1)->max(6)->default(1), - 'max_heading_level' => Expect::int()->min(1)->max(6)->default(6), - 'html_class' => Expect::string()->default('table-of-contents'), - 'placeholder' => Expect::anyOf(Expect::string(), Expect::null())->default(null), - ])); - } - - public function register(EnvironmentBuilderInterface $environment): void - { - $environment->addRenderer(TableOfContents::class, new TableOfContentsRenderer(new ListBlockRenderer())); - $environment->addEventListener(DocumentParsedEvent::class, [new TableOfContentsBuilder(), 'onDocumentParsed'], -150); - - // phpcs:ignore SlevomatCodingStandard.ControlStructures.EarlyExit.EarlyExitNotUsed - if ($environment->getConfiguration()->get('table_of_contents/position') === TableOfContentsBuilder::POSITION_PLACEHOLDER) { - $environment->addBlockStartParser(TableOfContentsPlaceholderParser::blockStartParser(), 200); - // If a placeholder cannot be replaced with a TOC element this renderer will ensure the parser won't error out - $environment->addRenderer(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 f0df96b..0000000 --- a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsGenerator.php +++ /dev/null @@ -1,168 +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\Extension\TableOfContents; - -use League\CommonMark\Extension\CommonMark\Node\Block\Heading; -use League\CommonMark\Extension\CommonMark\Node\Block\ListBlock; -use League\CommonMark\Extension\CommonMark\Node\Block\ListData; -use League\CommonMark\Extension\CommonMark\Node\Block\ListItem; -use League\CommonMark\Extension\CommonMark\Node\Inline\Link; -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\Node\Block\Document; -use League\CommonMark\Node\NodeIterator; -use League\CommonMark\Node\RawMarkupContainerInterface; -use League\CommonMark\Node\StringContainerHelper; -use League\Config\Exception\InvalidConfigurationException; - -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'; - - /** @psalm-readonly */ - private string $style; - - /** @psalm-readonly */ - private string $normalizationStrategy; - - /** @psalm-readonly */ - private int $minHeadingLevel; - - /** @psalm-readonly */ - private int $maxHeadingLevel; - - /** @psalm-readonly */ - private string $fragmentPrefix; - - public function __construct(string $style, string $normalizationStrategy, int $minHeadingLevel, int $maxHeadingLevel, string $fragmentPrefix) - { - $this->style = $style; - $this->normalizationStrategy = $normalizationStrategy; - $this->minHeadingLevel = $minHeadingLevel; - $this->maxHeadingLevel = $maxHeadingLevel; - $this->fragmentPrefix = $fragmentPrefix; - - if ($fragmentPrefix !== '') { - $this->fragmentPrefix .= '-'; - } - } - - 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 ??= $heading; - - // Keep track of the start and end lines - $toc->setStartLine($firstHeading->getStartLine()); - $toc->setEndLine($heading->getEndLine()); - - // Create the new link - $link = new Link('#' . $this->fragmentPrefix . $headingLink->getSlug(), StringContainerHelper::getChildText($heading, [RawMarkupContainerInterface::class])); - - $listItem = new ListItem($toc->getListData()); - $listItem->setStartLine($heading->getStartLine()); - $listItem->setEndLine($heading->getEndLine()); - $listItem->appendChild($link); - - // 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 InvalidConfigurationException(\sprintf('Invalid table of contents list style: "%s"', $this->style)); - } - - $toc = new TableOfContents($listData); - - $toc->setStartLine($document->getStartLine()); - $toc->setEndLine($document->getEndLine()); - - return $toc; - } - - /** - * @return iterable<HeadingPermalink> - */ - private function getHeadingLinks(Document $document): iterable - { - foreach ($document->iterator(NodeIterator::FLAG_BLOCKS_ONLY) as $node) { - if (! $node instanceof Heading) { - continue; - } - - foreach ($node->children() as $child) { - if ($child instanceof HeadingPermalink) { - yield $child; - } - } - } - } - - 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 InvalidConfigurationException(\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 64ecb8e..0000000 --- a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsGeneratorInterface.php +++ /dev/null @@ -1,22 +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\Extension\TableOfContents; - -use League\CommonMark\Extension\TableOfContents\Node\TableOfContents; -use League\CommonMark\Node\Block\Document; - -interface TableOfContentsGeneratorInterface -{ - public function generate(Document $document): ?TableOfContents; -} 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 b27ddee..0000000 --- a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsPlaceholderParser.php +++ /dev/null @@ -1,74 +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\Extension\TableOfContents; - -use League\CommonMark\Extension\TableOfContents\Node\TableOfContentsPlaceholder; -use League\CommonMark\Parser\Block\AbstractBlockContinueParser; -use League\CommonMark\Parser\Block\BlockContinue; -use League\CommonMark\Parser\Block\BlockContinueParserInterface; -use League\CommonMark\Parser\Block\BlockStart; -use League\CommonMark\Parser\Block\BlockStartParserInterface; -use League\CommonMark\Parser\Cursor; -use League\CommonMark\Parser\MarkdownParserStateInterface; -use League\Config\ConfigurationAwareInterface; -use League\Config\ConfigurationInterface; - -final class TableOfContentsPlaceholderParser extends AbstractBlockContinueParser -{ - /** @psalm-readonly */ - private TableOfContentsPlaceholder $block; - - public function __construct() - { - $this->block = new TableOfContentsPlaceholder(); - } - - public function getBlock(): TableOfContentsPlaceholder - { - return $this->block; - } - - public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue - { - return BlockContinue::none(); - } - - public static function blockStartParser(): BlockStartParserInterface - { - return new class () implements BlockStartParserInterface, ConfigurationAwareInterface { - /** @psalm-readonly-allow-private-mutation */ - private ConfigurationInterface $config; - - public function tryStart(Cursor $cursor, MarkdownParserStateInterface $parserState): ?BlockStart - { - $placeholder = $this->config->get('table_of_contents/placeholder'); - if ($placeholder === null) { - return BlockStart::none(); - } - - // The placeholder must be the only thing on the line - if ($cursor->match('/^' . \preg_quote($placeholder, '/') . '$/') === null) { - return BlockStart::none(); - } - - return BlockStart::of(new TableOfContentsPlaceholderParser())->at($cursor); - } - - public function setConfiguration(ConfigurationInterface $configuration): void - { - $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 0366cb9..0000000 --- a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsPlaceholderRenderer.php +++ /dev/null @@ -1,40 +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\Extension\TableOfContents; - -use League\CommonMark\Node\Node; -use League\CommonMark\Renderer\ChildNodeRendererInterface; -use League\CommonMark\Renderer\NodeRendererInterface; -use League\CommonMark\Xml\XmlNodeRendererInterface; - -final class TableOfContentsPlaceholderRenderer implements NodeRendererInterface, XmlNodeRendererInterface -{ - public function render(Node $node, ChildNodeRendererInterface $childRenderer): string - { - return '<!-- table of contents -->'; - } - - public function getXmlTagName(Node $node): string - { - return 'table_of_contents_placeholder'; - } - - /** - * @return array<string, scalar> - */ - public function getXmlAttributes(Node $node): array - { - return []; - } -} diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsRenderer.php b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsRenderer.php deleted file mode 100644 index da1b698..0000000 --- a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsRenderer.php +++ /dev/null @@ -1,56 +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\Extension\TableOfContents; - -use League\CommonMark\Node\Node; -use League\CommonMark\Renderer\ChildNodeRendererInterface; -use League\CommonMark\Renderer\NodeRendererInterface; -use League\CommonMark\Xml\XmlNodeRendererInterface; - -final class TableOfContentsRenderer implements NodeRendererInterface, XmlNodeRendererInterface -{ - /** @var NodeRendererInterface&XmlNodeRendererInterface */ - private $innerRenderer; - - /** - * @psalm-param NodeRendererInterface&XmlNodeRendererInterface $innerRenderer - * - * @phpstan-param NodeRendererInterface&XmlNodeRendererInterface $innerRenderer - */ - public function __construct(NodeRendererInterface $innerRenderer) - { - $this->innerRenderer = $innerRenderer; - } - - /** - * {@inheritDoc} - */ - public function render(Node $node, ChildNodeRendererInterface $childRenderer) - { - return $this->innerRenderer->render($node, $childRenderer); - } - - public function getXmlTagName(Node $node): string - { - return 'table_of_contents'; - } - - /** - * @return array<string, scalar> - */ - public function getXmlAttributes(Node $node): array - { - return $this->innerRenderer->getXmlAttributes($node); - } -} 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 bf4b0d2..0000000 --- a/vendor/league/commonmark/src/Extension/TaskList/TaskListExtension.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\Extension\TaskList; - -use League\CommonMark\Environment\EnvironmentBuilderInterface; -use League\CommonMark\Extension\ExtensionInterface; - -final class TaskListExtension implements ExtensionInterface -{ - public function register(EnvironmentBuilderInterface $environment): void - { - $environment->addInlineParser(new TaskListItemMarkerParser(), 35); - $environment->addRenderer(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 125ae40..0000000 --- a/vendor/league/commonmark/src/Extension/TaskList/TaskListItemMarker.php +++ /dev/null @@ -1,39 +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\Extension\TaskList; - -use League\CommonMark\Node\Inline\AbstractInline; - -final class TaskListItemMarker extends AbstractInline -{ - /** @psalm-readonly-allow-private-mutation */ - private bool $checked; - - public function __construct(bool $isCompleted) - { - parent::__construct(); - - $this->checked = $isCompleted; - } - - public function isChecked(): bool - { - return $this->checked; - } - - public function setChecked(bool $checked): void - { - $this->checked = $checked; - } -} 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 30e2731..0000000 --- a/vendor/league/commonmark/src/Extension/TaskList/TaskListItemMarkerParser.php +++ /dev/null @@ -1,55 +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\Extension\TaskList; - -use League\CommonMark\Extension\CommonMark\Node\Block\ListItem; -use League\CommonMark\Node\Block\Paragraph; -use League\CommonMark\Parser\Inline\InlineParserInterface; -use League\CommonMark\Parser\Inline\InlineParserMatch; -use League\CommonMark\Parser\InlineParserContext; - -final class TaskListItemMarkerParser implements InlineParserInterface -{ - public function getMatchDefinition(): InlineParserMatch - { - return InlineParserMatch::oneOf('[ ]', '[x]'); - } - - 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(); - - $cursor->advanceBy(3); - - if ($cursor->getNextNonSpaceCharacter() === null) { - $cursor->restoreState($oldState); - - return false; - } - - $isChecked = $inlineContext->getFullMatch() !== '[ ]'; - - $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 a1eb745..0000000 --- a/vendor/league/commonmark/src/Extension/TaskList/TaskListItemMarkerRenderer.php +++ /dev/null @@ -1,70 +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\Extension\TaskList; - -use League\CommonMark\Node\Node; -use League\CommonMark\Renderer\ChildNodeRendererInterface; -use League\CommonMark\Renderer\NodeRendererInterface; -use League\CommonMark\Util\HtmlElement; -use League\CommonMark\Xml\XmlNodeRendererInterface; - -final class TaskListItemMarkerRenderer implements NodeRendererInterface, XmlNodeRendererInterface -{ - /** - * @param TaskListItemMarker $node - * - * {@inheritDoc} - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable - { - TaskListItemMarker::assertInstanceOf($node); - - $attrs = $node->data->get('attributes'); - $checkbox = new HtmlElement('input', $attrs, '', true); - - if ($node->isChecked()) { - $checkbox->setAttribute('checked', ''); - } - - $checkbox->setAttribute('disabled', ''); - $checkbox->setAttribute('type', 'checkbox'); - - return $checkbox; - } - - public function getXmlTagName(Node $node): string - { - return 'task_list_item_marker'; - } - - /** - * @param TaskListItemMarker $node - * - * @return array<string, scalar> - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function getXmlAttributes(Node $node): array - { - TaskListItemMarker::assertInstanceOf($node); - - if ($node->isChecked()) { - return ['checked' => 'checked']; - } - - return []; - } -} diff --git a/vendor/league/commonmark/src/GithubFlavoredMarkdownConverter.php b/vendor/league/commonmark/src/GithubFlavoredMarkdownConverter.php deleted file mode 100644 index f2524b2..0000000 --- a/vendor/league/commonmark/src/GithubFlavoredMarkdownConverter.php +++ /dev/null @@ -1,45 +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\Environment\Environment; -use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension; -use League\CommonMark\Extension\GithubFlavoredMarkdownExtension; - -/** - * Converts GitHub Flavored Markdown to HTML. - */ -final class GithubFlavoredMarkdownConverter extends MarkdownConverter -{ - /** - * Create a new Markdown converter pre-configured for GFM - * - * @param array<string, mixed> $config - */ - public function __construct(array $config = []) - { - $environment = new Environment($config); - $environment->addExtension(new CommonMarkCoreExtension()); - $environment->addExtension(new GithubFlavoredMarkdownExtension()); - - parent::__construct($environment); - } - - public function getEnvironment(): Environment - { - \assert($this->environment instanceof Environment); - - return $this->environment; - } -} diff --git a/vendor/league/commonmark/src/Input/MarkdownInput.php b/vendor/league/commonmark/src/Input/MarkdownInput.php deleted file mode 100644 index bbe1618..0000000 --- a/vendor/league/commonmark/src/Input/MarkdownInput.php +++ /dev/null @@ -1,102 +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\Input; - -use League\CommonMark\Exception\UnexpectedEncodingException; - -class MarkdownInput implements MarkdownInputInterface -{ - /** - * @var array<int, string>|null - * - * @psalm-readonly-allow-private-mutation - */ - private ?array $lines = null; - - /** @psalm-readonly-allow-private-mutation */ - private string $content; - - /** @psalm-readonly-allow-private-mutation */ - private ?int $lineCount = null; - - /** @psalm-readonly */ - private int $lineOffset; - - public function __construct(string $content, int $lineOffset = 0) - { - if (! \mb_check_encoding($content, 'UTF-8')) { - throw new UnexpectedEncodingException('Unexpected encoding - UTF-8 or ASCII was expected'); - } - - // Strip any leading UTF-8 BOM - if (\substr($content, 0, 3) === "\xEF\xBB\xBF") { - $content = \substr($content, 3); - } - - $this->content = $content; - $this->lineOffset = $lineOffset; - } - - public function getContent(): string - { - return $this->content; - } - - /** - * {@inheritDoc} - */ - public function getLines(): iterable - { - $this->splitLinesIfNeeded(); - - \assert($this->lines !== null); - - /** @psalm-suppress PossiblyNullIterator */ - foreach ($this->lines as $i => $line) { - yield $this->lineOffset + $i + 1 => $line; - } - } - - public function getLineCount(): int - { - $this->splitLinesIfNeeded(); - - \assert($this->lineCount !== null); - - 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 bb8d6f1..0000000 --- a/vendor/league/commonmark/src/Input/MarkdownInputInterface.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\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/MarkdownConverter.php b/vendor/league/commonmark/src/MarkdownConverter.php deleted file mode 100644 index 037ecff..0000000 --- a/vendor/league/commonmark/src/MarkdownConverter.php +++ /dev/null @@ -1,93 +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\Environment\EnvironmentInterface; -use League\CommonMark\Exception\CommonMarkException; -use League\CommonMark\Output\RenderedContentInterface; -use League\CommonMark\Parser\MarkdownParser; -use League\CommonMark\Parser\MarkdownParserInterface; -use League\CommonMark\Renderer\HtmlRenderer; -use League\CommonMark\Renderer\MarkdownRendererInterface; - -class MarkdownConverter implements ConverterInterface, MarkdownConverterInterface -{ - /** @psalm-readonly */ - protected EnvironmentInterface $environment; - - /** @psalm-readonly */ - protected MarkdownParserInterface $markdownParser; - - /** @psalm-readonly */ - protected MarkdownRendererInterface $htmlRenderer; - - public function __construct(EnvironmentInterface $environment) - { - $this->environment = $environment; - - $this->markdownParser = new MarkdownParser($environment); - $this->htmlRenderer = new HtmlRenderer($environment); - } - - public function getEnvironment(): EnvironmentInterface - { - return $this->environment; - } - - /** - * Converts Markdown to HTML. - * - * @param string $input The Markdown to convert - * - * @return RenderedContentInterface Rendered HTML - * - * @throws CommonMarkException - */ - public function convert(string $input): RenderedContentInterface - { - $documentAST = $this->markdownParser->parse($input); - - return $this->htmlRenderer->renderDocument($documentAST); - } - - /** - * Converts Markdown to HTML. - * - * @deprecated since 2.2; use {@link convert()} instead - * - * @param string $markdown The Markdown to convert - * - * @return RenderedContentInterface Rendered HTML - * - * @throws CommonMarkException - */ - public function convertToHtml(string $markdown): RenderedContentInterface - { - \trigger_deprecation('league/commonmark', '2.2.0', 'Calling "convertToHtml()" on a %s class is deprecated, use "convert()" instead.', self::class); - - return $this->convert($markdown); - } - - /** - * Converts CommonMark to HTML. - * - * @see MarkdownConverter::convert() - * - * @throws CommonMarkException - */ - public function __invoke(string $markdown): RenderedContentInterface - { - return $this->convert($markdown); - } -} diff --git a/vendor/league/commonmark/src/MarkdownConverterInterface.php b/vendor/league/commonmark/src/MarkdownConverterInterface.php deleted file mode 100644 index a52a286..0000000 --- a/vendor/league/commonmark/src/MarkdownConverterInterface.php +++ /dev/null @@ -1,34 +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\CommonMarkException; -use League\CommonMark\Output\RenderedContentInterface; - -/** - * Interface for a service which converts Markdown to HTML. - * - * @deprecated since 2.2; use {@link ConverterInterface} instead - */ -interface MarkdownConverterInterface -{ - /** - * Converts Markdown to HTML. - * - * @deprecated since 2.2; use {@link ConverterInterface::convert()} instead - * - * @throws CommonMarkException - */ - public function convertToHtml(string $markdown): RenderedContentInterface; -} diff --git a/vendor/league/commonmark/src/Node/Block/AbstractBlock.php b/vendor/league/commonmark/src/Node/Block/AbstractBlock.php deleted file mode 100644 index 417f89b..0000000 --- a/vendor/league/commonmark/src/Node/Block/AbstractBlock.php +++ /dev/null @@ -1,64 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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\Block; - -use League\CommonMark\Exception\InvalidArgumentException; -use League\CommonMark\Node\Node; - -/** - * Block-level element - * - * @method parent() ?AbstractBlock - */ -abstract class AbstractBlock extends Node -{ - protected ?int $startLine = null; - - protected ?int $endLine = null; - - protected function setParent(?Node $node = null): void - { - if ($node && ! $node instanceof self) { - throw new InvalidArgumentException('Parent of block must also be block (cannot be inline)'); - } - - parent::setParent($node); - } - - public function setStartLine(?int $startLine): void - { - $this->startLine = $startLine; - if ($this->endLine === null) { - $this->endLine = $startLine; - } - } - - public function getStartLine(): ?int - { - return $this->startLine; - } - - public function setEndLine(?int $endLine): void - { - $this->endLine = $endLine; - } - - public function getEndLine(): ?int - { - return $this->endLine; - } -} diff --git a/vendor/league/commonmark/src/Node/Block/Document.php b/vendor/league/commonmark/src/Node/Block/Document.php deleted file mode 100644 index ee7ee44..0000000 --- a/vendor/league/commonmark/src/Node/Block/Document.php +++ /dev/null @@ -1,56 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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\Block; - -use League\CommonMark\Parser\Cursor; -use League\CommonMark\Reference\ReferenceMap; -use League\CommonMark\Reference\ReferenceMapInterface; - -class Document extends AbstractBlock -{ - /** @psalm-readonly */ - protected ReferenceMapInterface $referenceMap; - - public function __construct(?ReferenceMapInterface $referenceMap = null) - { - parent::__construct(); - - $this->setStartLine(1); - - $this->referenceMap = $referenceMap ?? new ReferenceMap(); - } - - 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/Node/Block/Paragraph.php b/vendor/league/commonmark/src/Node/Block/Paragraph.php deleted file mode 100644 index d06d84e..0000000 --- a/vendor/league/commonmark/src/Node/Block/Paragraph.php +++ /dev/null @@ -1,23 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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\Block; - -class Paragraph extends AbstractBlock -{ - /** @internal */ - public bool $onlyContainsLinkReferenceDefinitions = false; -} diff --git a/vendor/league/commonmark/src/Node/Block/TightBlockInterface.php b/vendor/league/commonmark/src/Node/Block/TightBlockInterface.php deleted file mode 100644 index 21a5868..0000000 --- a/vendor/league/commonmark/src/Node/Block/TightBlockInterface.php +++ /dev/null @@ -1,21 +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\Node\Block; - -interface TightBlockInterface -{ - public function isTight(): bool; - - public function setTight(bool $tight): void; -} diff --git a/vendor/league/commonmark/src/Node/Inline/AbstractInline.php b/vendor/league/commonmark/src/Node/Inline/AbstractInline.php deleted file mode 100644 index d3705b4..0000000 --- a/vendor/league/commonmark/src/Node/Inline/AbstractInline.php +++ /dev/null @@ -1,23 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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\Inline; - -use League\CommonMark\Node\Node; - -abstract class AbstractInline extends Node -{ -} diff --git a/vendor/league/commonmark/src/Node/Inline/AbstractStringContainer.php b/vendor/league/commonmark/src/Node/Inline/AbstractStringContainer.php deleted file mode 100644 index f0aab84..0000000 --- a/vendor/league/commonmark/src/Node/Inline/AbstractStringContainer.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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\Inline; - -use League\CommonMark\Node\StringContainerInterface; - -abstract class AbstractStringContainer extends AbstractInline implements StringContainerInterface -{ - protected string $literal = ''; - - /** - * @param array<string, mixed> $data - */ - public function __construct(string $contents = '', array $data = []) - { - parent::__construct(); - - $this->literal = $contents; - if (\count($data) > 0) { - $this->data->import($data); - } - } - - public function getLiteral(): string - { - return $this->literal; - } - - public function setLiteral(string $literal): void - { - $this->literal = $literal; - } -} diff --git a/vendor/league/commonmark/src/Node/Inline/AdjacentTextMerger.php b/vendor/league/commonmark/src/Node/Inline/AdjacentTextMerger.php deleted file mode 100644 index 43922d4..0000000 --- a/vendor/league/commonmark/src/Node/Inline/AdjacentTextMerger.php +++ /dev/null @@ -1,105 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * 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\Node\Inline; - -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; - } - - /** @psalm-suppress PossiblyNullArgument */ - 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; - } - - /** @psalm-suppress PossiblyNullArgument */ - self::mergeTextNodesInclusive($fromNode->next(), $toNode->previous()); - } - - public static function mergeWithDirectlyAdjacentNodes(Text $node): void - { - $start = ($previous = $node->previous()) instanceof Text ? $previous : $node; - $end = ($next = $node->next()) instanceof Text ? $next : $node; - - self::mergeIfNeeded($start, $end); - } - - 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->getLiteral(); - - $node = $first->next(); - $stop = $last->next(); - while ($node !== $stop && $node instanceof Text) { - $s .= $node->getLiteral(); - $unlink = $node; - $node = $node->next(); - $unlink->detach(); - } - - $first->setLiteral($s); - } -} diff --git a/vendor/league/commonmark/src/Node/Inline/DelimitedInterface.php b/vendor/league/commonmark/src/Node/Inline/DelimitedInterface.php deleted file mode 100644 index 89773fa..0000000 --- a/vendor/league/commonmark/src/Node/Inline/DelimitedInterface.php +++ /dev/null @@ -1,21 +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\Node\Inline; - -interface DelimitedInterface -{ - public function getOpeningDelimiter(): string; - - public function getClosingDelimiter(): string; -} diff --git a/vendor/league/commonmark/src/Node/Inline/Newline.php b/vendor/league/commonmark/src/Node/Inline/Newline.php deleted file mode 100644 index 68790de..0000000 --- a/vendor/league/commonmark/src/Node/Inline/Newline.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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\Inline; - -final class Newline extends AbstractInline -{ - // Any changes to these constants should be reflected in .phpstorm.meta.php - public const HARDBREAK = 0; - public const SOFTBREAK = 1; - - /** @psalm-readonly */ - private int $type; - - public function __construct(int $breakType = self::HARDBREAK) - { - parent::__construct(); - - $this->type = $breakType; - } - - /** @psalm-immutable */ - public function getType(): int - { - return $this->type; - } -} diff --git a/vendor/league/commonmark/src/Node/Inline/Text.php b/vendor/league/commonmark/src/Node/Inline/Text.php deleted file mode 100644 index 31387f9..0000000 --- a/vendor/league/commonmark/src/Node/Inline/Text.php +++ /dev/null @@ -1,25 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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\Inline; - -final class Text extends AbstractStringContainer -{ - public function append(string $literal): void - { - $this->literal .= $literal; - } -} diff --git a/vendor/league/commonmark/src/Node/Node.php b/vendor/league/commonmark/src/Node/Node.php deleted file mode 100644 index 484b39c..0000000 --- a/vendor/league/commonmark/src/Node/Node.php +++ /dev/null @@ -1,262 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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; - -use Dflydev\DotAccessData\Data; -use League\CommonMark\Exception\InvalidArgumentException; - -abstract class Node -{ - /** @psalm-readonly */ - public Data $data; - - /** @psalm-readonly-allow-private-mutation */ - protected int $depth = 0; - - /** @psalm-readonly-allow-private-mutation */ - protected ?Node $parent = null; - - /** @psalm-readonly-allow-private-mutation */ - protected ?Node $previous = null; - - /** @psalm-readonly-allow-private-mutation */ - protected ?Node $next = null; - - /** @psalm-readonly-allow-private-mutation */ - protected ?Node $firstChild = null; - - /** @psalm-readonly-allow-private-mutation */ - protected ?Node $lastChild = null; - - public function __construct() - { - $this->data = new Data([ - 'attributes' => [], - ]); - } - - public function previous(): ?Node - { - return $this->previous; - } - - public function next(): ?Node - { - return $this->next; - } - - public function parent(): ?Node - { - return $this->parent; - } - - protected function setParent(?Node $node = null): void - { - $this->parent = $node; - $this->depth = $node === null ? 0 : $node->depth + 1; - } - - /** - * Inserts the $sibling node after $this - */ - public function insertAfter(Node $sibling): void - { - $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 - */ - public function insertBefore(Node $sibling): void - { - $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; - } - } - - public function replaceWith(Node $replacement): void - { - $replacement->detach(); - $this->insertAfter($replacement); - $this->detach(); - } - - public function detach(): void - { - 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; - } - - public function hasChildren(): bool - { - return $this->firstChild !== null; - } - - 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; $current !== null; $current = $current->next) { - $children[] = $current; - } - - return $children; - } - - public function appendChild(Node $child): void - { - 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 - */ - public function prependChild(Node $child): void - { - 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 - */ - public function detachChildren(): void - { - 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 - */ - public function replaceChildren(iterable $children): void - { - $this->detachChildren(); - foreach ($children as $item) { - $this->appendChild($item); - } - } - - public function getDepth(): int - { - return $this->depth; - } - - public function walker(): NodeWalker - { - return new NodeWalker($this); - } - - public function iterator(int $flags = 0): NodeIterator - { - return new NodeIterator($this, $flags); - } - - /** - * 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); - } - } - - public static function assertInstanceOf(Node $node): void - { - if (! $node instanceof static) { - throw new InvalidArgumentException(\sprintf('Incompatible node type: expected %s, got %s', static::class, \get_class($node))); - } - } -} diff --git a/vendor/league/commonmark/src/Node/NodeIterator.php b/vendor/league/commonmark/src/Node/NodeIterator.php deleted file mode 100644 index 3d295ef..0000000 --- a/vendor/league/commonmark/src/Node/NodeIterator.php +++ /dev/null @@ -1,58 +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\Node; - -use League\CommonMark\Node\Block\AbstractBlock; - -/** - * @implements \IteratorAggregate<int, Node> - */ -final class NodeIterator implements \IteratorAggregate -{ - public const FLAG_BLOCKS_ONLY = 1; - - private Node $node; - private bool $blocksOnly; - - public function __construct(Node $node, int $flags = 0) - { - $this->node = $node; - $this->blocksOnly = ($flags & self::FLAG_BLOCKS_ONLY) === self::FLAG_BLOCKS_ONLY; - } - - /** - * @return \Generator<int, Node> - */ - public function getIterator(): \Generator - { - $stack = [$this->node]; - $index = 0; - - while ($stack) { - $node = \array_pop($stack); - - yield $index++ => $node; - - // Push all children onto the stack in reverse order - $child = $node->lastChild(); - while ($child !== null) { - if (! $this->blocksOnly || $child instanceof AbstractBlock) { - $stack[] = $child; - } - - $child = $child->previous(); - } - } - } -} diff --git a/vendor/league/commonmark/src/Node/NodeWalker.php b/vendor/league/commonmark/src/Node/NodeWalker.php deleted file mode 100644 index 6f922e8..0000000 --- a/vendor/league/commonmark/src/Node/NodeWalker.php +++ /dev/null @@ -1,80 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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; - -use League\CommonMark\Node\Block\AbstractBlock; - -final class NodeWalker -{ - /** @psalm-readonly */ - private Node $root; - - /** @psalm-readonly-allow-private-mutation */ - private ?Node $current = null; - - /** @psalm-readonly-allow-private-mutation */ - private bool $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) - */ - public function next(): ?NodeWalkerEvent - { - $current = $this->current; - $entering = $this->entering; - if ($current === null) { - return null; - } - - if ($entering && ($current instanceof AbstractBlock || $current->hasChildren())) { - if ($current->firstChild()) { - $this->current = $current->firstChild(); - $this->entering = true; - } else { - $this->entering = false; - } - } elseif ($current === $this->root) { - $this->current = null; - } elseif ($current->next() === null) { - $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 - */ - public function resumeAt(Node $node, bool $entering = true): void - { - $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 773ec3a..0000000 --- a/vendor/league/commonmark/src/Node/NodeWalkerEvent.php +++ /dev/null @@ -1,42 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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 -{ - /** @psalm-readonly */ - private Node $node; - - /** @psalm-readonly */ - private bool $isEntering; - - public function __construct(Node $node, bool $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/Node/Query.php b/vendor/league/commonmark/src/Node/Query.php deleted file mode 100644 index 7e76fe3..0000000 --- a/vendor/league/commonmark/src/Node/Query.php +++ /dev/null @@ -1,139 +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\Node; - -use League\CommonMark\Node\Query\AndExpr; -use League\CommonMark\Node\Query\OrExpr; - -final class Query -{ - /** @var callable(Node): bool $condition */ - private $condition; - - public function __construct() - { - $this->condition = new AndExpr(); - } - - public function where(callable ...$conditions): self - { - return $this->andWhere(...$conditions); - } - - public function andWhere(callable ...$conditions): self - { - if ($this->condition instanceof AndExpr) { - foreach ($conditions as $condition) { - $this->condition->add($condition); - } - } else { - $this->condition = new AndExpr($this->condition, ...$conditions); - } - - return $this; - } - - public function orWhere(callable ...$conditions): self - { - if ($this->condition instanceof OrExpr) { - foreach ($conditions as $condition) { - $this->condition->add($condition); - } - } else { - $this->condition = new OrExpr($this->condition, ...$conditions); - } - - return $this; - } - - public function findOne(Node $node): ?Node - { - foreach ($node->iterator() as $n) { - if (\call_user_func($this->condition, $n)) { - return $n; - } - } - - return null; - } - - /** - * @return iterable<Node> - */ - public function findAll(Node $node, ?int $limit = PHP_INT_MAX): iterable - { - $resultCount = 0; - - foreach ($node->iterator() as $n) { - if ($resultCount >= $limit) { - break; - } - - if (! \call_user_func($this->condition, $n)) { - continue; - } - - ++$resultCount; - - yield $n; - } - } - - /** - * @return callable(Node): bool - */ - public static function type(string $class): callable - { - return static fn (Node $node): bool => $node instanceof $class; - } - - /** - * @psalm-param ?callable(Node): bool $condition - * - * @return callable(Node): bool - */ - public static function hasChild(?callable $condition = null): callable - { - return static function (Node $node) use ($condition): bool { - foreach ($node->children() as $child) { - if ($condition === null || $condition($child)) { - return true; - } - } - - return false; - }; - } - - /** - * @psalm-param ?callable(Node): bool $condition - * - * @return callable(Node): bool - */ - public static function hasParent(?callable $condition = null): callable - { - return static function (Node $node) use ($condition): bool { - $parent = $node->parent(); - if ($parent === null) { - return false; - } - - if ($condition === null) { - return true; - } - - return $condition($parent); - }; - } -} diff --git a/vendor/league/commonmark/src/Node/Query/AndExpr.php b/vendor/league/commonmark/src/Node/Query/AndExpr.php deleted file mode 100644 index d2cd615..0000000 --- a/vendor/league/commonmark/src/Node/Query/AndExpr.php +++ /dev/null @@ -1,55 +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\Node\Query; - -use League\CommonMark\Node\Node; - -/** - * @internal - */ -final class AndExpr implements ExpressionInterface -{ - /** - * @var callable[] - * @psalm-var list<callable(Node): bool> - */ - private array $conditions; - - /** - * @psalm-param callable(Node): bool $expressions - */ - public function __construct(callable ...$expressions) - { - $this->conditions = \array_values($expressions); - } - - /** - * @param callable(Node): bool $expression - */ - public function add(callable $expression): void - { - $this->conditions[] = $expression; - } - - public function __invoke(Node $node): bool - { - foreach ($this->conditions as $condition) { - if (! $condition($node)) { - return false; - } - } - - return true; - } -} diff --git a/vendor/league/commonmark/src/Node/Query/ExpressionInterface.php b/vendor/league/commonmark/src/Node/Query/ExpressionInterface.php deleted file mode 100644 index 2bbbc7f..0000000 --- a/vendor/league/commonmark/src/Node/Query/ExpressionInterface.php +++ /dev/null @@ -1,21 +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\Node\Query; - -use League\CommonMark\Node\Node; - -interface ExpressionInterface -{ - public function __invoke(Node $node): bool; -} diff --git a/vendor/league/commonmark/src/Node/Query/OrExpr.php b/vendor/league/commonmark/src/Node/Query/OrExpr.php deleted file mode 100644 index b0baad8..0000000 --- a/vendor/league/commonmark/src/Node/Query/OrExpr.php +++ /dev/null @@ -1,55 +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\Node\Query; - -use League\CommonMark\Node\Node; - -/** - * @internal - */ -final class OrExpr implements ExpressionInterface -{ - /** - * @var callable[] - * @psalm-var list<callable(Node): bool> - */ - private array $conditions; - - /** - * @psalm-param callable(Node): bool $expressions - */ - public function __construct(callable ...$expressions) - { - $this->conditions = \array_values($expressions); - } - - /** - * @param callable(Node): bool $expression - */ - public function add(callable $expression): void - { - $this->conditions[] = $expression; - } - - public function __invoke(Node $node): bool - { - foreach ($this->conditions as $condition) { - if ($condition($node)) { - return true; - } - } - - return false; - } -} diff --git a/vendor/league/commonmark/src/Node/RawMarkupContainerInterface.php b/vendor/league/commonmark/src/Node/RawMarkupContainerInterface.php deleted file mode 100644 index 1545285..0000000 --- a/vendor/league/commonmark/src/Node/RawMarkupContainerInterface.php +++ /dev/null @@ -1,21 +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\Node; - -/** - * Interface for a node which contains raw, unprocessed markup (like HTML) - */ -interface RawMarkupContainerInterface extends StringContainerInterface -{ -} diff --git a/vendor/league/commonmark/src/Node/StringContainerHelper.php b/vendor/league/commonmark/src/Node/StringContainerHelper.php deleted file mode 100644 index 8e1ec34..0000000 --- a/vendor/league/commonmark/src/Node/StringContainerHelper.php +++ /dev/null @@ -1,54 +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\Node; - -final class StringContainerHelper -{ - /** - * Extract text literals from all descendant nodes - * - * @param Node $node Parent node - * @param array<string> $excludeTypes Optional list of node class types to exclude - * - * @return string Concatenated literals - */ - public static function getChildText(Node $node, array $excludeTypes = []): string - { - $text = ''; - - foreach ($node->iterator() as $child) { - if ($child instanceof StringContainerInterface && ! self::isOneOf($child, $excludeTypes)) { - $text .= $child->getLiteral(); - } - } - - return $text; - } - - /** - * @param string[] $classesOrInterfacesToCheck - * - * @psalm-pure - */ - private static function isOneOf(object $object, array $classesOrInterfacesToCheck): bool - { - foreach ($classesOrInterfacesToCheck as $type) { - if ($object instanceof $type) { - return true; - } - } - - return false; - } -} diff --git a/vendor/league/commonmark/src/Node/StringContainerInterface.php b/vendor/league/commonmark/src/Node/StringContainerInterface.php deleted file mode 100644 index 23564ae..0000000 --- a/vendor/league/commonmark/src/Node/StringContainerInterface.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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; - -/** - * Interface for a node which directly contains line(s) of text - */ -interface StringContainerInterface -{ - public function setLiteral(string $literal): void; - - public function getLiteral(): string; -} diff --git a/vendor/league/commonmark/src/Normalizer/SlugNormalizer.php b/vendor/league/commonmark/src/Normalizer/SlugNormalizer.php deleted file mode 100644 index 7cfb960..0000000 --- a/vendor/league/commonmark/src/Normalizer/SlugNormalizer.php +++ /dev/null @@ -1,57 +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; - -use League\Config\ConfigurationAwareInterface; -use League\Config\ConfigurationInterface; - -/** - * Creates URL-friendly strings based on the given string input - */ -final class SlugNormalizer implements TextNormalizerInterface, ConfigurationAwareInterface -{ - /** @psalm-allow-private-mutation */ - private int $defaultMaxLength = 255; - - public function setConfiguration(ConfigurationInterface $configuration): void - { - $this->defaultMaxLength = $configuration->get('slug_normalizer/max_length'); - } - - /** - * {@inheritDoc} - * - * @psalm-immutable - */ - public function normalize(string $text, array $context = []): string - { - // Add any requested prefix - $slug = ($context['prefix'] ?? '') . $text; - // Trim whitespace - $slug = \trim($slug); - // Convert to lowercase - $slug = \mb_strtolower($slug, 'UTF-8'); - // 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; - // Trim to requested length if given - if ($length = $context['length'] ?? $this->defaultMaxLength) { - $slug = \mb_substr($slug, 0, $length, 'UTF-8'); - } - - // @phpstan-ignore-next-line Because it thinks mb_substr() returns false on PHP 7.4 - 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 43eb117..0000000 --- a/vendor/league/commonmark/src/Normalizer/TextNormalizer.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. - */ - -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 - * - * @psalm-immutable - */ -final class TextNormalizer implements TextNormalizerInterface -{ - /** - * {@inheritDoc} - * - * @psalm-pure - */ - public function normalize(string $text, array $context = []): string - { - // Collapse internal whitespace to single space and remove - // leading/trailing whitespace - $text = \preg_replace('/[ \t\r\n]+/', ' ', \trim($text)); - \assert(\is_string($text)); - - // Is it strictly ASCII? If so, we can use strtolower() instead (faster) - if (\mb_check_encoding($text, 'ASCII')) { - return \strtolower($text); - } - - 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 f476234..0000000 --- a/vendor/league/commonmark/src/Normalizer/TextNormalizerInterface.php +++ /dev/null @@ -1,33 +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 array<string, mixed> $context Additional context about the text being normalized (optional) - * - * $context may include (but is not required to include) the following: - * - `prefix` - A string prefix to prepend to each normalized result - * - `length` - The requested maximum length - * - `node` - The node we're normalizing text for - * - * Implementations do not have to use or respect any information within that $context - */ - public function normalize(string $text, array $context = []): string; -} diff --git a/vendor/league/commonmark/src/Normalizer/UniqueSlugNormalizer.php b/vendor/league/commonmark/src/Normalizer/UniqueSlugNormalizer.php deleted file mode 100644 index 591f19f..0000000 --- a/vendor/league/commonmark/src/Normalizer/UniqueSlugNormalizer.php +++ /dev/null @@ -1,56 +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; - -// phpcs:disable Squiz.Strings.DoubleQuoteUsage.ContainsVar -final class UniqueSlugNormalizer implements UniqueSlugNormalizerInterface -{ - private TextNormalizerInterface $innerNormalizer; - /** @var array<string, bool> */ - private array $alreadyUsed = []; - - public function __construct(TextNormalizerInterface $innerNormalizer) - { - $this->innerNormalizer = $innerNormalizer; - } - - public function clearHistory(): void - { - $this->alreadyUsed = []; - } - - /** - * {@inheritDoc} - * - * @psalm-allow-private-mutation - */ - public function normalize(string $text, array $context = []): string - { - $normalized = $this->innerNormalizer->normalize($text, $context); - - // If it's not unique, add an incremental number to the end until we get a unique version - if (\array_key_exists($normalized, $this->alreadyUsed)) { - $suffix = 0; - do { - ++$suffix; - } while (\array_key_exists("$normalized-$suffix", $this->alreadyUsed)); - - $normalized = "$normalized-$suffix"; - } - - $this->alreadyUsed[$normalized] = true; - - return $normalized; - } -} diff --git a/vendor/league/commonmark/src/Normalizer/UniqueSlugNormalizerInterface.php b/vendor/league/commonmark/src/Normalizer/UniqueSlugNormalizerInterface.php deleted file mode 100644 index 642edeb..0000000 --- a/vendor/league/commonmark/src/Normalizer/UniqueSlugNormalizerInterface.php +++ /dev/null @@ -1,28 +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; - -interface UniqueSlugNormalizerInterface extends TextNormalizerInterface -{ - public const DISABLED = false; - public const PER_ENVIRONMENT = 'environment'; - public const PER_DOCUMENT = 'document'; - - /** - * Called by the Environment whenever the configured scope changes - * - * Currently, this will only be called PER_DOCUMENT. - */ - public function clearHistory(): void; -} diff --git a/vendor/league/commonmark/src/Output/RenderedContent.php b/vendor/league/commonmark/src/Output/RenderedContent.php deleted file mode 100644 index 4bf612d..0000000 --- a/vendor/league/commonmark/src/Output/RenderedContent.php +++ /dev/null @@ -1,49 +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\Output; - -use League\CommonMark\Node\Block\Document; - -class RenderedContent implements RenderedContentInterface, \Stringable -{ - /** @psalm-readonly */ - private Document $document; - - /** @psalm-readonly */ - private string $content; - - public function __construct(Document $document, string $content) - { - $this->document = $document; - $this->content = $content; - } - - public function getDocument(): Document - { - return $this->document; - } - - public function getContent(): string - { - return $this->content; - } - - /** - * @psalm-mutation-free - */ - public function __toString(): string - { - return $this->content; - } -} diff --git a/vendor/league/commonmark/src/Output/RenderedContentInterface.php b/vendor/league/commonmark/src/Output/RenderedContentInterface.php deleted file mode 100644 index 2179b1b..0000000 --- a/vendor/league/commonmark/src/Output/RenderedContentInterface.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. - */ - -declare(strict_types=1); - -namespace League\CommonMark\Output; - -use League\CommonMark\Node\Block\Document; - -interface RenderedContentInterface extends \Stringable -{ - /** - * @psalm-mutation-free - */ - public function getDocument(): Document; - - /** - * @psalm-mutation-free - */ - public function getContent(): string; -} diff --git a/vendor/league/commonmark/src/Parser/Block/AbstractBlockContinueParser.php b/vendor/league/commonmark/src/Parser/Block/AbstractBlockContinueParser.php deleted file mode 100644 index 889532e..0000000 --- a/vendor/league/commonmark/src/Parser/Block/AbstractBlockContinueParser.php +++ /dev/null @@ -1,47 +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\Parser\Block; - -use League\CommonMark\Node\Block\AbstractBlock; - -/** - * Base class for a block parser - * - * Slightly more convenient to extend from vs. implementing the interface - */ -abstract class AbstractBlockContinueParser implements BlockContinueParserInterface -{ - public function isContainer(): bool - { - return false; - } - - public function canHaveLazyContinuationLines(): bool - { - return false; - } - - public function canContain(AbstractBlock $childBlock): bool - { - return false; - } - - public function addLine(string $line): void - { - } - - public function closeBlock(): void - { - } -} diff --git a/vendor/league/commonmark/src/Parser/Block/BlockContinue.php b/vendor/league/commonmark/src/Parser/Block/BlockContinue.php deleted file mode 100644 index 4b5f37d..0000000 --- a/vendor/league/commonmark/src/Parser/Block/BlockContinue.php +++ /dev/null @@ -1,73 +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\Parser\Block; - -use League\CommonMark\Parser\Cursor; -use League\CommonMark\Parser\CursorState; - -/** - * Result object for continuing parsing of a block; see static methods for constructors. - * - * @psalm-immutable - */ -final class BlockContinue -{ - /** @psalm-readonly */ - private ?CursorState $cursorState = null; - - /** @psalm-readonly */ - private bool $finalize; - - private function __construct(?CursorState $cursorState = null, bool $finalize = false) - { - $this->cursorState = $cursorState; - $this->finalize = $finalize; - } - - public function getCursorState(): ?CursorState - { - return $this->cursorState; - } - - public function isFinalize(): bool - { - return $this->finalize; - } - - /** - * Signal that we cannot continue here - * - * @return null - */ - public static function none(): ?self - { - return null; - } - - /** - * Signal that we're continuing at the given position - */ - public static function at(Cursor $cursor): self - { - return new self($cursor->saveState(), false); - } - - /** - * Signal that we want to finalize and close the block - */ - public static function finished(): self - { - return new self(null, true); - } -} diff --git a/vendor/league/commonmark/src/Parser/Block/BlockContinueParserInterface.php b/vendor/league/commonmark/src/Parser/Block/BlockContinueParserInterface.php deleted file mode 100644 index b6e5472..0000000 --- a/vendor/league/commonmark/src/Parser/Block/BlockContinueParserInterface.php +++ /dev/null @@ -1,64 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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\Parser\Block; - -use League\CommonMark\Node\Block\AbstractBlock; -use League\CommonMark\Parser\Cursor; - -/** - * Interface for a block continuation parser - * - * A block continue parser can only handle a single block instance. The current block being parsed is stored within this parser and - * can be returned once parsing has completed. If you need to parse multiple block continuations, instantiate a new parser for each one. - */ -interface BlockContinueParserInterface -{ - /** - * Return the current block being parsed by this parser - */ - public function getBlock(): AbstractBlock; - - /** - * Return whether we are parsing a container block - */ - public function isContainer(): bool; - - /** - * Return whether we are interested in possibly lazily parsing any subsequent lines - */ - public function canHaveLazyContinuationLines(): bool; - - /** - * Determine whether the current block being parsed can contain the given child block - */ - public function canContain(AbstractBlock $childBlock): bool; - - /** - * Attempt to parse the given line - */ - public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue; - - /** - * Add the given line of text to the current block - */ - public function addLine(string $line): void; - - /** - * Close and finalize the current block - */ - public function closeBlock(): void; -} diff --git a/vendor/league/commonmark/src/Parser/Block/BlockContinueParserWithInlinesInterface.php b/vendor/league/commonmark/src/Parser/Block/BlockContinueParserWithInlinesInterface.php deleted file mode 100644 index 6f826c9..0000000 --- a/vendor/league/commonmark/src/Parser/Block/BlockContinueParserWithInlinesInterface.php +++ /dev/null @@ -1,24 +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\Parser\Block; - -use League\CommonMark\Parser\InlineParserEngineInterface; - -interface BlockContinueParserWithInlinesInterface extends BlockContinueParserInterface -{ - /** - * Parse any inlines inside of the current block - */ - public function parseInlines(InlineParserEngineInterface $inlineParser): void; -} diff --git a/vendor/league/commonmark/src/Parser/Block/BlockStart.php b/vendor/league/commonmark/src/Parser/Block/BlockStart.php deleted file mode 100644 index 5576622..0000000 --- a/vendor/league/commonmark/src/Parser/Block/BlockStart.php +++ /dev/null @@ -1,124 +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\Parser\Block; - -use League\CommonMark\Parser\Cursor; -use League\CommonMark\Parser\CursorState; - -/** - * Result object for starting parsing of a block; see static methods for constructors - */ -final class BlockStart -{ - /** - * @var BlockContinueParserInterface[] - * - * @psalm-readonly - */ - private array $blockParsers; - - /** @psalm-readonly-allow-private-mutation */ - private ?CursorState $cursorState = null; - - /** @psalm-readonly-allow-private-mutation */ - private bool $replaceActiveBlockParser = false; - - private bool $isAborting = false; - - private function __construct(BlockContinueParserInterface ...$blockParsers) - { - $this->blockParsers = $blockParsers; - } - - /** - * @return BlockContinueParserInterface[] - */ - public function getBlockParsers(): iterable - { - return $this->blockParsers; - } - - public function getCursorState(): ?CursorState - { - return $this->cursorState; - } - - public function isReplaceActiveBlockParser(): bool - { - return $this->replaceActiveBlockParser; - } - - /** - * @internal - */ - public function isAborting(): bool - { - return $this->isAborting; - } - - /** - * Signal that we want to parse at the given cursor position - * - * @return $this - */ - public function at(Cursor $cursor): self - { - $this->cursorState = $cursor->saveState(); - - return $this; - } - - /** - * Signal that we want to replace the active block parser with this one - * - * @return $this - */ - public function replaceActiveBlockParser(): self - { - $this->replaceActiveBlockParser = true; - - return $this; - } - - /** - * Signal that we cannot parse whatever is here - * - * @return null - */ - public static function none(): ?self - { - return null; - } - - /** - * Signal that we'd like to register the given parser(s) so they can parse the current block - */ - public static function of(BlockContinueParserInterface ...$blockParsers): self - { - return new self(...$blockParsers); - } - - /** - * Signal that the block parsing process should be aborted (no other block starts should be checked) - * - * @internal - */ - public static function abort(): self - { - $ret = new self(); - $ret->isAborting = true; - - return $ret; - } -} diff --git a/vendor/league/commonmark/src/Parser/Block/BlockStartParserInterface.php b/vendor/league/commonmark/src/Parser/Block/BlockStartParserInterface.php deleted file mode 100644 index 90ed781..0000000 --- a/vendor/league/commonmark/src/Parser/Block/BlockStartParserInterface.php +++ /dev/null @@ -1,33 +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\Parser\Block; - -use League\CommonMark\Parser\Cursor; -use League\CommonMark\Parser\MarkdownParserStateInterface; - -/** - * Interface for a block parser which identifies block starts. - */ -interface BlockStartParserInterface -{ - /** - * Check whether we should handle the block at the current position - * - * @param Cursor $cursor A cloned copy of the cursor at the current parsing location - * @param MarkdownParserStateInterface $parserState Additional information about the state of the Markdown parser - * - * @return BlockStart|null The BlockStart that has been identified, or null if the block doesn't match here - */ - public function tryStart(Cursor $cursor, MarkdownParserStateInterface $parserState): ?BlockStart; -} diff --git a/vendor/league/commonmark/src/Parser/Block/DocumentBlockParser.php b/vendor/league/commonmark/src/Parser/Block/DocumentBlockParser.php deleted file mode 100644 index c03c24e..0000000 --- a/vendor/league/commonmark/src/Parser/Block/DocumentBlockParser.php +++ /dev/null @@ -1,80 +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\Parser\Block; - -use League\CommonMark\Node\Block\AbstractBlock; -use League\CommonMark\Node\Block\Document; -use League\CommonMark\Node\Block\Paragraph; -use League\CommonMark\Parser\Cursor; -use League\CommonMark\Reference\ReferenceMapInterface; - -/** - * Parser implementation which ensures everything is added to the root-level Document - */ -final class DocumentBlockParser extends AbstractBlockContinueParser -{ - /** @psalm-readonly */ - private Document $document; - - public function __construct(ReferenceMapInterface $referenceMap) - { - $this->document = new Document($referenceMap); - } - - public function getBlock(): Document - { - return $this->document; - } - - public function isContainer(): bool - { - return true; - } - - public function canContain(AbstractBlock $childBlock): bool - { - return true; - } - - public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue - { - return BlockContinue::at($cursor); - } - - public function closeBlock(): void - { - $this->removeLinkReferenceDefinitions(); - } - - private function removeLinkReferenceDefinitions(): void - { - $emptyNodes = []; - - $walker = $this->document->walker(); - while ($event = $walker->next()) { - $node = $event->getNode(); - // TODO for v3: It would be great if we could find an alternate way to identify such paragraphs. - // Unfortunately, we can't simply check for empty paragraphs here because inlines haven't been processed yet, - // meaning all paragraphs will appear blank here, and we don't have a way to check the status of the reference parser - // which is attached to the (already-closed) paragraph parser. - if ($event->isEntering() && $node instanceof Paragraph && $node->onlyContainsLinkReferenceDefinitions) { - $emptyNodes[] = $node; - } - } - - foreach ($emptyNodes as $node) { - $node->detach(); - } - } -} diff --git a/vendor/league/commonmark/src/Parser/Block/ParagraphParser.php b/vendor/league/commonmark/src/Parser/Block/ParagraphParser.php deleted file mode 100644 index f9312be..0000000 --- a/vendor/league/commonmark/src/Parser/Block/ParagraphParser.php +++ /dev/null @@ -1,85 +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\Parser\Block; - -use League\CommonMark\Node\Block\Paragraph; -use League\CommonMark\Parser\Cursor; -use League\CommonMark\Parser\InlineParserEngineInterface; -use League\CommonMark\Reference\ReferenceInterface; -use League\CommonMark\Reference\ReferenceParser; - -final class ParagraphParser extends AbstractBlockContinueParser implements BlockContinueParserWithInlinesInterface -{ - /** @psalm-readonly */ - private Paragraph $block; - - /** @psalm-readonly */ - private ReferenceParser $referenceParser; - - public function __construct() - { - $this->block = new Paragraph(); - $this->referenceParser = new ReferenceParser(); - } - - public function canHaveLazyContinuationLines(): bool - { - return true; - } - - public function getBlock(): Paragraph - { - return $this->block; - } - - public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue - { - if ($cursor->isBlank()) { - return BlockContinue::none(); - } - - return BlockContinue::at($cursor); - } - - public function addLine(string $line): void - { - $this->referenceParser->parse($line); - } - - public function closeBlock(): void - { - $this->block->onlyContainsLinkReferenceDefinitions = $this->referenceParser->hasReferences() && $this->referenceParser->getParagraphContent() === ''; - } - - public function parseInlines(InlineParserEngineInterface $inlineParser): void - { - $content = $this->getContentString(); - if ($content !== '') { - $inlineParser->parse($content, $this->block); - } - } - - public function getContentString(): string - { - return $this->referenceParser->getParagraphContent(); - } - - /** - * @return ReferenceInterface[] - */ - public function getReferences(): iterable - { - return $this->referenceParser->getReferences(); - } -} diff --git a/vendor/league/commonmark/src/Parser/Block/SkipLinesStartingWithLettersParser.php b/vendor/league/commonmark/src/Parser/Block/SkipLinesStartingWithLettersParser.php deleted file mode 100644 index 95d8bd2..0000000 --- a/vendor/league/commonmark/src/Parser/Block/SkipLinesStartingWithLettersParser.php +++ /dev/null @@ -1,45 +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\Parser\Block; - -use League\CommonMark\Parser\Cursor; -use League\CommonMark\Parser\MarkdownParserStateInterface; -use League\CommonMark\Util\RegexHelper; - -/** - * @internal - * - * This "parser" is actually a performance optimization. - * - * Most lines in a typical Markdown document probably won't match a block start. This is especially true for lines starting - * with letters - nothing in the core CommonMark spec or our supported extensions will match those lines as blocks. Therefore, - * if we can identify those lines and skip block start parsing, we can optimize performance by ~10%. - * - * Previously this optimization was hard-coded in the MarkdownParser but did not allow users to override this behavior. - * By implementing this optimization as a block parser instead, users wanting custom blocks starting with letters - * can instead register their block parser with a higher priority to ensure their parser is always called first. - */ -final class SkipLinesStartingWithLettersParser implements BlockStartParserInterface -{ - public function tryStart(Cursor $cursor, MarkdownParserStateInterface $parserState): ?BlockStart - { - if (! $cursor->isIndented() && RegexHelper::isLetter($cursor->getNextNonSpaceCharacter())) { - $cursor->advanceToNextNonSpaceOrTab(); - - return BlockStart::abort(); - } - - return BlockStart::none(); - } -} diff --git a/vendor/league/commonmark/src/Parser/Cursor.php b/vendor/league/commonmark/src/Parser/Cursor.php deleted file mode 100644 index 598cd75..0000000 --- a/vendor/league/commonmark/src/Parser/Cursor.php +++ /dev/null @@ -1,494 +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\Parser; - -use League\CommonMark\Exception\UnexpectedEncodingException; - -class Cursor -{ - public const INDENT_LEVEL = 4; - - /** @psalm-readonly */ - private string $line; - - /** @psalm-readonly */ - private int $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 int $currentPosition = 0; - - private int $column = 0; - - private int $indent = 0; - - private int $previousPosition = 0; - - private ?int $nextNonSpaceCache = null; - - private bool $partiallyConsumedTab = false; - - /** - * @var int|false - * - * @psalm-readonly - */ - private $lastTabPosition; - - /** @psalm-readonly */ - private bool $isMultibyte; - - /** @var array<int, string> */ - private array $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->lastTabPosition = $this->isMultibyte ? \mb_strrpos($line, "\t", 0, 'UTF-8') : \strrpos($line, "\t"); - } - - /** - * Returns the position of the next character which is not a space (or tab) - */ - public function getNextNonSpacePosition(): int - { - if ($this->nextNonSpaceCache !== null) { - return $this->nextNonSpaceCache; - } - - if ($this->currentPosition >= $this->length) { - return $this->length; - } - - $cols = $this->column; - - for ($i = $this->currentPosition; $i < $this->length; $i++) { - // This if-else was copied out of getCharacter() for performance reasons - if ($this->isMultibyte) { - $c = $this->charCache[$i] ??= \mb_substr($this->line, $i, 1, 'UTF-8'); - } else { - $c = $this->line[$i]; - } - - if ($c === ' ') { - $cols++; - } elseif ($c === "\t") { - $cols += 4 - ($cols % 4); - } else { - break; - } - } - - $this->indent = $cols - $this->column; - - return $this->nextNonSpaceCache = $i; - } - - /** - * Returns the next character which isn't a space (or tab) - */ - public function getNextNonSpaceCharacter(): ?string - { - $index = $this->getNextNonSpacePosition(); - if ($index >= $this->length) { - return null; - } - - if ($this->isMultibyte) { - return $this->charCache[$index] ??= \mb_substr($this->line, $index, 1, 'UTF-8'); - } - - return $this->line[$index]; - } - - /** - * Calculates the current indent (number of spaces after current position) - */ - public function getIndent(): int - { - if ($this->nextNonSpaceCache === null) { - $this->getNextNonSpacePosition(); - } - - return $this->indent; - } - - /** - * Whether the cursor is indented to INDENT_LEVEL - */ - public function isIndented(): bool - { - if ($this->nextNonSpaceCache === null) { - $this->getNextNonSpacePosition(); - } - - return $this->indent >= self::INDENT_LEVEL; - } - - 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) { - return $this->charCache[$index] ??= \mb_substr($this->line, $index, 1, 'UTF-8'); - } - - return $this->line[$index]; - } - - /** - * Slightly-optimized version of getCurrent(null) - */ - public function getCurrentCharacter(): ?string - { - if ($this->currentPosition >= $this->length) { - return null; - } - - if ($this->isMultibyte) { - return $this->charCache[$this->currentPosition] ??= \mb_substr($this->line, $this->currentPosition, 1, 'UTF-8'); - } - - return $this->line[$this->currentPosition]; - } - - /** - * Returns the next character (or null, if none) without advancing forwards - */ - public function peek(int $offset = 1): ?string - { - return $this->getCharacter($this->currentPosition + $offset); - } - - /** - * Whether the remainder is blank - */ - public function isBlank(): bool - { - return $this->nextNonSpaceCache === $this->length || $this->getNextNonSpacePosition() === $this->length; - } - - /** - * Move the cursor forwards - */ - public function advance(): void - { - $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 - */ - public function advanceBy(int $characters, bool $advanceByColumns = false): void - { - $this->previousPosition = $this->currentPosition; - $this->nextNonSpaceCache = null; - - if ($this->currentPosition >= $this->length || $characters === 0) { - return; - } - - // Optimization to avoid tab handling logic if we have no tabs - if ($this->lastTabPosition === false || $this->currentPosition > $this->lastTabPosition) { - $length = \min($characters, $this->length - $this->currentPosition); - $this->partiallyConsumedTab = false; - $this->currentPosition += $length; - $this->column += $length; - - return; - } - - $nextFewChars = $this->isMultibyte ? - \mb_substr($this->line, $this->currentPosition, $characters, 'UTF-8') : - \substr($this->line, $this->currentPosition, $characters); - - if ($characters === 1) { - $asArray = [$nextFewChars]; - } elseif ($this->isMultibyte) { - /** @var string[] $asArray */ - $asArray = \mb_str_split($nextFewChars, 1, 'UTF-8'); - } else { - $asArray = \str_split($nextFewChars); - } - - foreach ($asArray as $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 - */ - public function advanceBySpaceOrTab(): bool - { - $character = $this->getCurrentCharacter(); - - 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->nextNonSpaceCache ?? $this->getNextNonSpacePosition(); - if ($newPosition === $this->currentPosition) { - return 0; - } - - $this->advanceBy($newPosition - $this->currentPosition); - $this->partiallyConsumedTab = false; - - // We've just advanced to where that non-space is, - // so any subsequent calls to find the next one will - // always return the current position. - $this->nextNonSpaceCache = $this->currentPosition; - $this->indent = 0; - - 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 - { - $currentCharacter = $this->getCurrentCharacter(); - - // Optimization: Avoid the regex if we know there are no spaces or newlines - if ($currentCharacter !== ' ' && $currentCharacter !== "\n") { - $this->previousPosition = $this->currentPosition; - - return 0; - } - - $matches = []; - \preg_match('/^ *(?:\n *)?/', $this->getRemainder(), $matches, \PREG_OFFSET_CAPTURE); - - // [0][0] contains the matched text - // [0][1] contains the index of that match - \assert(isset($matches[0])); - $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 - * - * @psalm-param non-empty-string $regex - */ - 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. - */ - public function saveState(): CursorState - { - return new CursorState([ - $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(). - */ - public function restoreState(CursorState $state): void - { - [ - $this->currentPosition, - $this->previousPosition, - $this->nextNonSpaceCache, - $this->indent, - $this->column, - $this->partiallyConsumedTab, - ] = $state->toArray(); - } - - public function getPosition(): int - { - return $this->currentPosition; - } - - public function getPreviousText(): string - { - if ($this->isMultibyte) { - return \mb_substr($this->line, $this->previousPosition, $this->currentPosition - $this->previousPosition, 'UTF-8'); - } - - return \substr($this->line, $this->previousPosition, $this->currentPosition - $this->previousPosition); - } - - public function getSubstring(int $start, ?int $length = null): string - { - if ($this->isMultibyte) { - return \mb_substr($this->line, $start, $length, 'UTF-8'); - } - - if ($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/Parser/CursorState.php b/vendor/league/commonmark/src/Parser/CursorState.php deleted file mode 100644 index 4a6c2d9..0000000 --- a/vendor/league/commonmark/src/Parser/CursorState.php +++ /dev/null @@ -1,56 +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\Parser; - -/** - * Encapsulates the current state of a cursor in case you need to rollback later. - * - * WARNING: Do not attempt to use this class for ANYTHING except for - * type hinting and passing this object back into restoreState(). - * The constructor, methods, and inner contents may change in any - * future release without warning! - * - * @internal - * - * @psalm-immutable - */ -final class CursorState -{ - /** - * @var array<int, mixed> - * - * @psalm-readonly - */ - private array $state; - - /** - * @internal - * - * @param array<int, mixed> $state - */ - public function __construct(array $state) - { - $this->state = $state; - } - - /** - * @internal - * - * @return array<int, mixed> - */ - public function toArray(): array - { - return $this->state; - } -} diff --git a/vendor/league/commonmark/src/Parser/Inline/InlineParserInterface.php b/vendor/league/commonmark/src/Parser/Inline/InlineParserInterface.php deleted file mode 100644 index fd13435..0000000 --- a/vendor/league/commonmark/src/Parser/Inline/InlineParserInterface.php +++ /dev/null @@ -1,23 +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\Parser\Inline; - -use League\CommonMark\Parser\InlineParserContext; - -interface InlineParserInterface -{ - public function getMatchDefinition(): InlineParserMatch; - - public function parse(InlineParserContext $inlineContext): bool; -} diff --git a/vendor/league/commonmark/src/Parser/Inline/InlineParserMatch.php b/vendor/league/commonmark/src/Parser/Inline/InlineParserMatch.php deleted file mode 100644 index e433ed2..0000000 --- a/vendor/league/commonmark/src/Parser/Inline/InlineParserMatch.php +++ /dev/null @@ -1,87 +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\Parser\Inline; - -use League\CommonMark\Exception\InvalidArgumentException; - -final class InlineParserMatch -{ - private string $regex; - - private bool $caseSensitive; - - private function __construct(string $regex, bool $caseSensitive = false) - { - $this->regex = $regex; - $this->caseSensitive = $caseSensitive; - } - - public function caseSensitive(): self - { - $this->caseSensitive = true; - - return $this; - } - - /** - * @internal - * - * @psalm-return non-empty-string - */ - public function getRegex(): string - { - return '/' . $this->regex . '/' . ($this->caseSensitive ? '' : 'i'); - } - - /** - * Match the given string (case-insensitive) - */ - public static function string(string $str): self - { - return new self(\preg_quote($str, '/')); - } - - /** - * Match any of the given strings (case-insensitive) - */ - public static function oneOf(string ...$str): self - { - return new self(\implode('|', \array_map(static fn (string $str): string => \preg_quote($str, '/'), $str))); - } - - /** - * Match a partial regular expression without starting/ending delimiters, anchors, or flags - */ - public static function regex(string $regex): self - { - return new self($regex); - } - - public static function join(self ...$definitions): self - { - $regex = ''; - $caseSensitive = null; - foreach ($definitions as $definition) { - $regex .= '(' . $definition->regex . ')'; - - if ($caseSensitive === null) { - $caseSensitive = $definition->caseSensitive; - } elseif ($caseSensitive !== $definition->caseSensitive) { - throw new InvalidArgumentException('Case-sensitive and case-insensitive definitions cannot be combined'); - } - } - - return new self($regex, $caseSensitive ?? false); - } -} diff --git a/vendor/league/commonmark/src/Parser/Inline/NewlineParser.php b/vendor/league/commonmark/src/Parser/Inline/NewlineParser.php deleted file mode 100644 index eb10d91..0000000 --- a/vendor/league/commonmark/src/Parser/Inline/NewlineParser.php +++ /dev/null @@ -1,53 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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\Parser\Inline; - -use League\CommonMark\Node\Inline\Newline; -use League\CommonMark\Node\Inline\Text; -use League\CommonMark\Parser\InlineParserContext; - -final class NewlineParser implements InlineParserInterface -{ - public function getMatchDefinition(): InlineParserMatch - { - return InlineParserMatch::regex('\\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->getLiteral(), ' '); - $spaces = \strlen($lastInline->getLiteral()) - \strlen($trimmed); - if ($spaces) { - $lastInline->setLiteral($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/Parser/InlineParserContext.php b/vendor/league/commonmark/src/Parser/InlineParserContext.php deleted file mode 100644 index 9372904..0000000 --- a/vendor/league/commonmark/src/Parser/InlineParserContext.php +++ /dev/null @@ -1,120 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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\Parser; - -use League\CommonMark\Delimiter\DelimiterStack; -use League\CommonMark\Node\Block\AbstractBlock; -use League\CommonMark\Reference\ReferenceMapInterface; - -final class InlineParserContext -{ - /** @psalm-readonly */ - private AbstractBlock $container; - - /** @psalm-readonly */ - private ReferenceMapInterface $referenceMap; - - /** @psalm-readonly */ - private Cursor $cursor; - - /** @psalm-readonly */ - private DelimiterStack $delimiterStack; - - /** - * @var string[] - * @psalm-var non-empty-array<string> - * - * @psalm-readonly-allow-private-mutation - */ - private array $matches; - - public function __construct(Cursor $contents, AbstractBlock $container, ReferenceMapInterface $referenceMap, int $maxDelimitersPerLine = PHP_INT_MAX) - { - $this->referenceMap = $referenceMap; - $this->container = $container; - $this->cursor = $contents; - $this->delimiterStack = new DelimiterStack($maxDelimitersPerLine); - } - - 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; - } - - /** - * @return string The full text that matched the InlineParserMatch definition - */ - public function getFullMatch(): string - { - return $this->matches[0]; - } - - /** - * @return int The length of the full match (in characters, not bytes) - */ - public function getFullMatchLength(): int - { - return \mb_strlen($this->matches[0], 'UTF-8'); - } - - /** - * @return string[] Similar to preg_match(), index 0 will contain the full match, and any other array elements will be captured sub-matches - * - * @psalm-return non-empty-array<string> - */ - public function getMatches(): array - { - return $this->matches; - } - - /** - * @return string[] - */ - public function getSubMatches(): array - { - return \array_slice($this->matches, 1); - } - - /** - * @param string[] $matches - * - * @psalm-param non-empty-array<string> $matches - */ - public function withMatches(array $matches): InlineParserContext - { - $ctx = clone $this; - - $ctx->matches = $matches; - - return $ctx; - } -} diff --git a/vendor/league/commonmark/src/Parser/InlineParserEngine.php b/vendor/league/commonmark/src/Parser/InlineParserEngine.php deleted file mode 100644 index 6a26979..0000000 --- a/vendor/league/commonmark/src/Parser/InlineParserEngine.php +++ /dev/null @@ -1,177 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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\Parser; - -use League\CommonMark\Environment\EnvironmentInterface; -use League\CommonMark\Node\Block\AbstractBlock; -use League\CommonMark\Node\Inline\AdjacentTextMerger; -use League\CommonMark\Node\Inline\Text; -use League\CommonMark\Parser\Inline\InlineParserInterface; -use League\CommonMark\Reference\ReferenceMapInterface; - -/** - * @internal - */ -final class InlineParserEngine implements InlineParserEngineInterface -{ - /** @psalm-readonly */ - private EnvironmentInterface $environment; - - /** @psalm-readonly */ - private ReferenceMapInterface $referenceMap; - - /** - * @var array<int, InlineParserInterface|string|bool> - * @psalm-var list<array{0: InlineParserInterface, 1: non-empty-string, 2: bool}> - * @phpstan-var array<int, array{0: InlineParserInterface, 1: non-empty-string, 2: bool}> - */ - private array $parsers = []; - - public function __construct(EnvironmentInterface $environment, ReferenceMapInterface $referenceMap) - { - $this->environment = $environment; - $this->referenceMap = $referenceMap; - - foreach ($environment->getInlineParsers() as $parser) { - \assert($parser instanceof InlineParserInterface); - $regex = $parser->getMatchDefinition()->getRegex(); - - $this->parsers[] = [$parser, $regex, \strlen($regex) !== \mb_strlen($regex, 'UTF-8')]; - } - } - - public function parse(string $contents, AbstractBlock $block): void - { - $contents = \trim($contents); - $cursor = new Cursor($contents); - - $inlineParserContext = new InlineParserContext($cursor, $block, $this->referenceMap, $this->environment->getConfiguration()->get('max_delimiters_per_line')); - - // Have all parsers look at the line to determine what they might want to parse and what positions they exist at - foreach ($this->matchParsers($contents) as $matchPosition => $parsers) { - $currentPosition = $cursor->getPosition(); - // We've already gone past this point - if ($currentPosition > $matchPosition) { - continue; - } - - // We've skipped over some uninteresting text that should be added as a plain text node - if ($currentPosition < $matchPosition) { - $cursor->advanceBy($matchPosition - $currentPosition); - $this->addPlainText($cursor->getPreviousText(), $block); - } - - // We're now at a potential start - see which of the current parsers can handle it - $parsed = false; - foreach ($parsers as [$parser, $matches]) { - \assert($parser instanceof InlineParserInterface); - if ($parser->parse($inlineParserContext->withMatches($matches))) { - // A parser has successfully handled the text at the given position; don't consider any others at this position - $parsed = true; - break; - } - } - - if ($parsed) { - continue; - } - - // Despite potentially being interested, nothing actually parsed text here, so add the current character and continue onwards - $this->addPlainText((string) $cursor->getCurrentCharacter(), $block); - $cursor->advance(); - } - - // Add any remaining text that wasn't parsed - if (! $cursor->isAtEnd()) { - $this->addPlainText($cursor->getRemainder(), $block); - } - - // Process any delimiters that were found - $delimiterStack = $inlineParserContext->getDelimiterStack(); - $delimiterStack->processDelimiters(null, $this->environment->getDelimiterProcessors()); - $delimiterStack->removeAll(); - - // Combine adjacent text notes into one - AdjacentTextMerger::mergeChildNodes($block); - } - - private function addPlainText(string $text, AbstractBlock $container): void - { - $lastInline = $container->lastChild(); - if ($lastInline instanceof Text && ! $lastInline->data->has('delim')) { - $lastInline->append($text); - } else { - $container->appendChild(new Text($text)); - } - } - - /** - * Given the current line, ask all the parsers which parts of the text they would be interested in parsing. - * - * The resulting array provides a list of character positions, which parsers are interested in trying to parse - * the text at those points, and (for convenience/optimization) what the matching text happened to be. - * - * @return array<array<int, InlineParserInterface|string>> - * - * @psalm-return array<int, list<array{0: InlineParserInterface, 1: non-empty-array<string>}>> - * - * @phpstan-return array<int, array<int, array{0: InlineParserInterface, 1: non-empty-array<string>}>> - */ - private function matchParsers(string $contents): array - { - $contents = \trim($contents); - $isMultibyte = ! \mb_check_encoding($contents, 'ASCII'); - - $ret = []; - - foreach ($this->parsers as [$parser, $regex, $isRegexMultibyte]) { - if ($isMultibyte || $isRegexMultibyte) { - $regex .= 'u'; - } - - // See if the parser's InlineParserMatch regex matched against any part of the string - if (! \preg_match_all($regex, $contents, $matches, \PREG_OFFSET_CAPTURE | \PREG_SET_ORDER)) { - continue; - } - - // For each part that matched... - foreach ($matches as $match) { - if ($isMultibyte) { - // PREG_OFFSET_CAPTURE always returns the byte offset, not the char offset, which is annoying - $offset = \mb_strlen(\substr($contents, 0, $match[0][1]), 'UTF-8'); - } else { - $offset = \intval($match[0][1]); - } - - // Remove the offsets, keeping only the matched text - $m = \array_column($match, 0); - - if ($m === []) { - continue; - } - - // Add this match to the list of character positions to stop at - $ret[$offset][] = [$parser, $m]; - } - } - - // Sort matches by position so we visit them in order - \ksort($ret); - - return $ret; - } -} diff --git a/vendor/league/commonmark/src/Parser/InlineParserEngineInterface.php b/vendor/league/commonmark/src/Parser/InlineParserEngineInterface.php deleted file mode 100644 index 8a0986d..0000000 --- a/vendor/league/commonmark/src/Parser/InlineParserEngineInterface.php +++ /dev/null @@ -1,27 +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\Parser; - -use League\CommonMark\Node\Block\AbstractBlock; - -/** - * Parser for inline content (text, links, emphasized text, etc). - */ -interface InlineParserEngineInterface -{ - /** - * Parse the given contents as inlines and insert them into the given block - */ - public function parse(string $contents, AbstractBlock $block): void; -} diff --git a/vendor/league/commonmark/src/Parser/MarkdownParser.php b/vendor/league/commonmark/src/Parser/MarkdownParser.php deleted file mode 100644 index 904c7c4..0000000 --- a/vendor/league/commonmark/src/Parser/MarkdownParser.php +++ /dev/null @@ -1,356 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) - * - (c) John MacFarlane - * - * Additional code based on commonmark-java (https://github.com/commonmark/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\Parser; - -use League\CommonMark\Environment\EnvironmentInterface; -use League\CommonMark\Event\DocumentParsedEvent; -use League\CommonMark\Event\DocumentPreParsedEvent; -use League\CommonMark\Exception\CommonMarkException; -use League\CommonMark\Input\MarkdownInput; -use League\CommonMark\Node\Block\Document; -use League\CommonMark\Node\Block\Paragraph; -use League\CommonMark\Parser\Block\BlockContinueParserInterface; -use League\CommonMark\Parser\Block\BlockContinueParserWithInlinesInterface; -use League\CommonMark\Parser\Block\BlockStart; -use League\CommonMark\Parser\Block\BlockStartParserInterface; -use League\CommonMark\Parser\Block\DocumentBlockParser; -use League\CommonMark\Parser\Block\ParagraphParser; -use League\CommonMark\Reference\MemoryLimitedReferenceMap; -use League\CommonMark\Reference\ReferenceInterface; -use League\CommonMark\Reference\ReferenceMap; - -final class MarkdownParser implements MarkdownParserInterface -{ - /** @psalm-readonly */ - private EnvironmentInterface $environment; - - /** @psalm-readonly-allow-private-mutation */ - private int $maxNestingLevel; - - /** @psalm-readonly-allow-private-mutation */ - private ReferenceMap $referenceMap; - - /** @psalm-readonly-allow-private-mutation */ - private int $lineNumber = 0; - - /** @psalm-readonly-allow-private-mutation */ - private Cursor $cursor; - - /** - * @var array<int, BlockContinueParserInterface> - * - * @psalm-readonly-allow-private-mutation - */ - private array $activeBlockParsers = []; - - /** - * @var array<int, BlockContinueParserWithInlinesInterface> - * - * @psalm-readonly-allow-private-mutation - */ - private array $closedBlockParsers = []; - - public function __construct(EnvironmentInterface $environment) - { - $this->environment = $environment; - } - - private function initialize(): void - { - $this->referenceMap = new ReferenceMap(); - $this->lineNumber = 0; - $this->activeBlockParsers = []; - $this->closedBlockParsers = []; - - $this->maxNestingLevel = $this->environment->getConfiguration()->get('max_nesting_level'); - } - - /** - * @throws CommonMarkException - */ - public function parse(string $input): Document - { - $this->initialize(); - - $documentParser = new DocumentBlockParser($this->referenceMap); - $this->activateBlockParser($documentParser); - - $preParsedEvent = new DocumentPreParsedEvent($documentParser->getBlock(), new MarkdownInput($input)); - $this->environment->dispatch($preParsedEvent); - $markdownInput = $preParsedEvent->getMarkdown(); - - foreach ($markdownInput->getLines() as $lineNumber => $line) { - $this->lineNumber = $lineNumber; - $this->parseLine($line); - } - - // finalizeAndProcess - $this->closeBlockParsers(\count($this->activeBlockParsers), $this->lineNumber); - $this->processInlines(\strlen($input)); - - $this->environment->dispatch(new DocumentParsedEvent($documentParser->getBlock())); - - return $documentParser->getBlock(); - } - - /** - * Analyze a line of text and update the document appropriately. We parse markdown text by calling this on each - * line of input, then finalizing the document. - */ - private function parseLine(string $line): void - { - // replace NUL characters for security - $line = \str_replace("\0", "\u{FFFD}", $line); - - $this->cursor = new Cursor($line); - - $matches = $this->parseBlockContinuation(); - if ($matches === null) { - return; - } - - $unmatchedBlocks = \count($this->activeBlockParsers) - $matches; - $blockParser = $this->activeBlockParsers[$matches - 1]; - $startedNewBlock = false; - - // Unless last matched container is a code block, try new container starts, - // adding children to the last matched container: - $tryBlockStarts = $blockParser->getBlock() instanceof Paragraph || $blockParser->isContainer(); - while ($tryBlockStarts) { - // this is a little performance optimization - if ($this->cursor->isBlank()) { - $this->cursor->advanceToEnd(); - break; - } - - if ($blockParser->getBlock()->getDepth() >= $this->maxNestingLevel) { - break; - } - - $blockStart = $this->findBlockStart($blockParser); - if ($blockStart === null || $blockStart->isAborting()) { - $this->cursor->advanceToNextNonSpaceOrTab(); - break; - } - - if (($state = $blockStart->getCursorState()) !== null) { - $this->cursor->restoreState($state); - } - - $startedNewBlock = true; - - // We're starting a new block. If we have any previous blocks that need to be closed, we need to do it now. - if ($unmatchedBlocks > 0) { - $this->closeBlockParsers($unmatchedBlocks, $this->lineNumber - 1); - $unmatchedBlocks = 0; - } - - $oldBlockLineStart = null; - if ($blockStart->isReplaceActiveBlockParser()) { - $oldBlockLineStart = $this->prepareActiveBlockParserForReplacement(); - } - - foreach ($blockStart->getBlockParsers() as $newBlockParser) { - $blockParser = $this->addChild($newBlockParser, $oldBlockLineStart); - $tryBlockStarts = $newBlockParser->isContainer(); - } - } - - // What remains at the offset is a text line. Add the text to the appropriate block. - - // First check for a lazy paragraph continuation: - if (! $startedNewBlock && ! $this->cursor->isBlank() && $this->getActiveBlockParser()->canHaveLazyContinuationLines()) { - $this->getActiveBlockParser()->addLine($this->cursor->getRemainder()); - } else { - // finalize any blocks not matched - if ($unmatchedBlocks > 0) { - $this->closeBlockParsers($unmatchedBlocks, $this->lineNumber - 1); - } - - if (! $blockParser->isContainer()) { - $this->getActiveBlockParser()->addLine($this->cursor->getRemainder()); - } elseif (! $this->cursor->isBlank()) { - $this->addChild(new ParagraphParser()); - $this->getActiveBlockParser()->addLine($this->cursor->getRemainder()); - } - } - } - - private function parseBlockContinuation(): ?int - { - // For each containing block, try to parse the associated line start. - // The document will always match, so we can skip the first block parser and start at 1 matches - $matches = 1; - for ($i = 1; $i < \count($this->activeBlockParsers); $i++) { - $blockParser = $this->activeBlockParsers[$i]; - $blockContinue = $blockParser->tryContinue(clone $this->cursor, $this->getActiveBlockParser()); - if ($blockContinue === null) { - break; - } - - if ($blockContinue->isFinalize()) { - $this->closeBlockParsers(\count($this->activeBlockParsers) - $i, $this->lineNumber); - - return null; - } - - if (($state = $blockContinue->getCursorState()) !== null) { - $this->cursor->restoreState($state); - } - - $matches++; - } - - return $matches; - } - - private function findBlockStart(BlockContinueParserInterface $lastMatchedBlockParser): ?BlockStart - { - $matchedBlockParser = new MarkdownParserState($this->getActiveBlockParser(), $lastMatchedBlockParser); - - foreach ($this->environment->getBlockStartParsers() as $blockStartParser) { - \assert($blockStartParser instanceof BlockStartParserInterface); - if (($result = $blockStartParser->tryStart(clone $this->cursor, $matchedBlockParser)) !== null) { - return $result; - } - } - - return null; - } - - private function closeBlockParsers(int $count, int $endLineNumber): void - { - for ($i = 0; $i < $count; $i++) { - $blockParser = $this->deactivateBlockParser(); - $this->finalize($blockParser, $endLineNumber); - - // phpcs:disable SlevomatCodingStandard.ControlStructures.EarlyExit.EarlyExitNotUsed - if ($blockParser instanceof BlockContinueParserWithInlinesInterface) { - // Remember for inline parsing - $this->closedBlockParsers[] = $blockParser; - } - } - } - - /** - * Finalize a block. Close it and do any necessary postprocessing, e.g. creating string_content from strings, - * setting the 'tight' or 'loose' status of a list, and parsing the beginnings of paragraphs for reference - * definitions. - */ - private function finalize(BlockContinueParserInterface $blockParser, int $endLineNumber): void - { - if ($blockParser instanceof ParagraphParser) { - $this->updateReferenceMap($blockParser->getReferences()); - } - - $blockParser->getBlock()->setEndLine($endLineNumber); - $blockParser->closeBlock(); - } - - /** - * Walk through a block & children recursively, parsing string content into inline content where appropriate. - */ - private function processInlines(int $inputSize): void - { - $p = new InlineParserEngine($this->environment, new MemoryLimitedReferenceMap($this->referenceMap, $inputSize)); - - foreach ($this->closedBlockParsers as $blockParser) { - $blockParser->parseInlines($p); - } - } - - /** - * Add block of type tag as a child of the tip. If the tip can't accept children, close and finalize it and try - * its parent, and so on til we find a block that can accept children. - */ - private function addChild(BlockContinueParserInterface $blockParser, ?int $startLineNumber = null): BlockContinueParserInterface - { - $blockParser->getBlock()->setStartLine($startLineNumber ?? $this->lineNumber); - - while (! $this->getActiveBlockParser()->canContain($blockParser->getBlock())) { - $this->closeBlockParsers(1, ($startLineNumber ?? $this->lineNumber) - 1); - } - - $this->getActiveBlockParser()->getBlock()->appendChild($blockParser->getBlock()); - $this->activateBlockParser($blockParser); - - return $blockParser; - } - - private function activateBlockParser(BlockContinueParserInterface $blockParser): void - { - $this->activeBlockParsers[] = $blockParser; - } - - /** - * @throws ParserLogicException - */ - private function deactivateBlockParser(): BlockContinueParserInterface - { - $popped = \array_pop($this->activeBlockParsers); - if ($popped === null) { - throw new ParserLogicException('The last block parser should not be deactivated'); - } - - return $popped; - } - - /** - * @return int|null The line number where the old block started - */ - private function prepareActiveBlockParserForReplacement(): ?int - { - // Note that we don't want to parse inlines or finalize this block, as it's getting replaced. - $old = $this->deactivateBlockParser(); - - if ($old instanceof ParagraphParser) { - $this->updateReferenceMap($old->getReferences()); - } - - $old->getBlock()->detach(); - - return $old->getBlock()->getStartLine(); - } - - /** - * @param ReferenceInterface[] $references - */ - private function updateReferenceMap(iterable $references): void - { - foreach ($references as $reference) { - if (! $this->referenceMap->contains($reference->getLabel())) { - $this->referenceMap->add($reference); - } - } - } - - /** - * @throws ParserLogicException - */ - public function getActiveBlockParser(): BlockContinueParserInterface - { - $active = \end($this->activeBlockParsers); - if ($active === false) { - throw new ParserLogicException('No active block parsers are available'); - } - - return $active; - } -} diff --git a/vendor/league/commonmark/src/Parser/MarkdownParserInterface.php b/vendor/league/commonmark/src/Parser/MarkdownParserInterface.php deleted file mode 100644 index e0a6be4..0000000 --- a/vendor/league/commonmark/src/Parser/MarkdownParserInterface.php +++ /dev/null @@ -1,25 +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\Parser; - -use League\CommonMark\Exception\CommonMarkException; -use League\CommonMark\Node\Block\Document; - -interface MarkdownParserInterface -{ - /** - * @throws CommonMarkException - */ - public function parse(string $input): Document; -} diff --git a/vendor/league/commonmark/src/Parser/MarkdownParserState.php b/vendor/league/commonmark/src/Parser/MarkdownParserState.php deleted file mode 100644 index 79abd42..0000000 --- a/vendor/league/commonmark/src/Parser/MarkdownParserState.php +++ /dev/null @@ -1,57 +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\Parser; - -use League\CommonMark\Parser\Block\BlockContinueParserInterface; -use League\CommonMark\Parser\Block\ParagraphParser; - -/** - * @internal You should rely on the interface instead - */ -final class MarkdownParserState implements MarkdownParserStateInterface -{ - /** @psalm-readonly */ - private BlockContinueParserInterface $activeBlockParser; - - /** @psalm-readonly */ - private BlockContinueParserInterface $lastMatchedBlockParser; - - public function __construct(BlockContinueParserInterface $activeBlockParser, BlockContinueParserInterface $lastMatchedBlockParser) - { - $this->activeBlockParser = $activeBlockParser; - $this->lastMatchedBlockParser = $lastMatchedBlockParser; - } - - public function getActiveBlockParser(): BlockContinueParserInterface - { - return $this->activeBlockParser; - } - - public function getLastMatchedBlockParser(): BlockContinueParserInterface - { - return $this->lastMatchedBlockParser; - } - - public function getParagraphContent(): ?string - { - if (! $this->lastMatchedBlockParser instanceof ParagraphParser) { - return null; - } - - $paragraphParser = $this->lastMatchedBlockParser; - $content = $paragraphParser->getContentString(); - - return $content === '' ? null : $content; - } -} diff --git a/vendor/league/commonmark/src/Parser/MarkdownParserStateInterface.php b/vendor/league/commonmark/src/Parser/MarkdownParserStateInterface.php deleted file mode 100644 index 21a9d3a..0000000 --- a/vendor/league/commonmark/src/Parser/MarkdownParserStateInterface.php +++ /dev/null @@ -1,36 +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\Parser; - -use League\CommonMark\Parser\Block\BlockContinueParserInterface; - -interface MarkdownParserStateInterface -{ - /** - * Returns the deepest open block parser - */ - public function getActiveBlockParser(): BlockContinueParserInterface; - - /** - * Open block parser that was last matched during the continue phase. This is different from the currently active - * block parser, as an unmatched block is only closed when a new block is started. - */ - public function getLastMatchedBlockParser(): BlockContinueParserInterface; - - /** - * Returns the current content of the paragraph if the matched block is a paragraph. The content can be multiple - * lines separated by newlines. - */ - public function getParagraphContent(): ?string; -} diff --git a/vendor/league/commonmark/src/Parser/ParserLogicException.php b/vendor/league/commonmark/src/Parser/ParserLogicException.php deleted file mode 100644 index 592b1a2..0000000 --- a/vendor/league/commonmark/src/Parser/ParserLogicException.php +++ /dev/null @@ -1,20 +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\Parser; - -use League\CommonMark\Exception\CommonMarkException; - -class ParserLogicException extends \LogicException implements CommonMarkException -{ -} diff --git a/vendor/league/commonmark/src/Reference/MemoryLimitedReferenceMap.php b/vendor/league/commonmark/src/Reference/MemoryLimitedReferenceMap.php deleted file mode 100644 index d47bd6a..0000000 --- a/vendor/league/commonmark/src/Reference/MemoryLimitedReferenceMap.php +++ /dev/null @@ -1,68 +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\Reference; - -final class MemoryLimitedReferenceMap implements ReferenceMapInterface -{ - private ReferenceMapInterface $decorated; - - private const MINIMUM_SIZE = 100_000; - - private int $remaining; - - public function __construct(ReferenceMapInterface $decorated, int $maxSize) - { - $this->decorated = $decorated; - $this->remaining = \max(self::MINIMUM_SIZE, $maxSize); - } - - public function add(ReferenceInterface $reference): void - { - $this->decorated->add($reference); - } - - public function contains(string $label): bool - { - return $this->decorated->contains($label); - } - - public function get(string $label): ?ReferenceInterface - { - $reference = $this->decorated->get($label); - if ($reference === null) { - return null; - } - - // Check for expansion limit - $this->remaining -= \strlen($reference->getDestination()) + \strlen($reference->getTitle()); - if ($this->remaining < 0) { - return null; - } - - return $reference; - } - - /** - * @return \Traversable<string, ReferenceInterface> - */ - public function getIterator(): \Traversable - { - return $this->decorated->getIterator(); - } - - public function count(): int - { - return $this->decorated->count(); - } -} diff --git a/vendor/league/commonmark/src/Reference/Reference.php b/vendor/league/commonmark/src/Reference/Reference.php deleted file mode 100644 index a0d571d..0000000 --- a/vendor/league/commonmark/src/Reference/Reference.php +++ /dev/null @@ -1,54 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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; - -/** - * @psalm-immutable - */ -final class Reference implements ReferenceInterface -{ - /** @psalm-readonly */ - private string $label; - - /** @psalm-readonly */ - private string $destination; - - /** @psalm-readonly */ - private string $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; - } -} diff --git a/vendor/league/commonmark/src/Reference/ReferenceInterface.php b/vendor/league/commonmark/src/Reference/ReferenceInterface.php deleted file mode 100644 index 244b354..0000000 --- a/vendor/league/commonmark/src/Reference/ReferenceInterface.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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 97a167d..0000000 --- a/vendor/league/commonmark/src/Reference/ReferenceMap.php +++ /dev/null @@ -1,85 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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 -{ - /** @psalm-readonly */ - private TextNormalizer $normalizer; - - /** - * @var array<string, ReferenceInterface> - * - * @psalm-readonly-allow-private-mutation - */ - private array $references = []; - - public function __construct() - { - $this->normalizer = new TextNormalizer(); - } - - public function add(ReferenceInterface $reference): void - { - // Normalize the key - $key = $this->normalizer->normalize($reference->getLabel()); - // Store the reference - $this->references[$key] = $reference; - } - - public function contains(string $label): bool - { - if ($this->references === []) { - return false; - } - - $label = $this->normalizer->normalize($label); - - return isset($this->references[$label]); - } - - public function get(string $label): ?ReferenceInterface - { - if ($this->references === []) { - return null; - } - - $label = $this->normalizer->normalize($label); - - return $this->references[$label] ?? null; - } - - /** - * @return \Traversable<string, ReferenceInterface> - */ - public function getIterator(): \Traversable - { - foreach ($this->references as $normalizedLabel => $reference) { - yield $normalizedLabel => $reference; - } - } - - public function count(): int - { - return \count($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 71daa19..0000000 --- a/vendor/league/commonmark/src/Reference/ReferenceMapInterface.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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 - * - * @phpstan-extends \IteratorAggregate<ReferenceInterface> - */ -interface ReferenceMapInterface extends \IteratorAggregate, \Countable -{ - public function add(ReferenceInterface $reference): void; - - public function contains(string $label): bool; - - public function get(string $label): ?ReferenceInterface; -} diff --git a/vendor/league/commonmark/src/Reference/ReferenceParser.php b/vendor/league/commonmark/src/Reference/ReferenceParser.php deleted file mode 100644 index c01dd21..0000000 --- a/vendor/league/commonmark/src/Reference/ReferenceParser.php +++ /dev/null @@ -1,324 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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\Parser\Cursor; -use League\CommonMark\Util\LinkParserHelper; - -final class ReferenceParser -{ - // Looking for the start of a definition, i.e. `[` - private const START_DEFINITION = 0; - // Looking for and parsing the label, i.e. `[foo]` within `[foo]` - private const LABEL = 1; - // Parsing the destination, i.e. `/url` in `[foo]: /url` - private const DESTINATION = 2; - // Looking for the start of a title, i.e. the first `"` in `[foo]: /url "title"` - private const START_TITLE = 3; - // Parsing the content of the title, i.e. `title` in `[foo]: /url "title"` - private const TITLE = 4; - // End state, no matter what kind of lines we add, they won't be references - private const PARAGRAPH = 5; - - /** @psalm-readonly-allow-private-mutation */ - private string $paragraph = ''; - - /** - * @var array<int, ReferenceInterface> - * - * @psalm-readonly-allow-private-mutation - */ - private array $references = []; - - /** @psalm-readonly-allow-private-mutation */ - private int $state = self::START_DEFINITION; - - /** @psalm-readonly-allow-private-mutation */ - private ?string $label = null; - - /** @psalm-readonly-allow-private-mutation */ - private ?string $destination = null; - - /** - * @var string string - * - * @psalm-readonly-allow-private-mutation - */ - private string $title = ''; - - /** @psalm-readonly-allow-private-mutation */ - private ?string $titleDelimiter = null; - - /** @psalm-readonly-allow-private-mutation */ - private bool $referenceValid = false; - - public function getParagraphContent(): string - { - return $this->paragraph; - } - - /** - * @return ReferenceInterface[] - */ - public function getReferences(): iterable - { - $this->finishReference(); - - return $this->references; - } - - public function hasReferences(): bool - { - return $this->references !== []; - } - - public function parse(string $line): void - { - if ($this->paragraph !== '') { - $this->paragraph .= "\n"; - } - - $this->paragraph .= $line; - - $cursor = new Cursor($line); - while (! $cursor->isAtEnd()) { - $result = false; - switch ($this->state) { - case self::PARAGRAPH: - // We're in a paragraph now. Link reference definitions can only appear at the beginning, so once - // we're in a paragraph, there's no going back. - return; - case self::START_DEFINITION: - $result = $this->parseStartDefinition($cursor); - break; - case self::LABEL: - $result = $this->parseLabel($cursor); - break; - case self::DESTINATION: - $result = $this->parseDestination($cursor); - break; - case self::START_TITLE: - $result = $this->parseStartTitle($cursor); - break; - case self::TITLE: - $result = $this->parseTitle($cursor); - break; - default: - // this should never happen - break; - } - - if (! $result) { - $this->state = self::PARAGRAPH; - - return; - } - } - } - - private function parseStartDefinition(Cursor $cursor): bool - { - $cursor->advanceToNextNonSpaceOrTab(); - if ($cursor->isAtEnd() || $cursor->getCurrentCharacter() !== '[') { - return false; - } - - $this->state = self::LABEL; - $this->label = ''; - - $cursor->advance(); - if ($cursor->isAtEnd()) { - $this->label .= "\n"; - } - - return true; - } - - private function parseLabel(Cursor $cursor): bool - { - $cursor->advanceToNextNonSpaceOrTab(); - - $partialLabel = LinkParserHelper::parsePartialLinkLabel($cursor); - if ($partialLabel === null) { - return false; - } - - \assert($this->label !== null); - $this->label .= $partialLabel; - - if ($cursor->isAtEnd()) { - // label might continue on next line - $this->label .= "\n"; - - return true; - } - - if ($cursor->getCurrentCharacter() !== ']') { - return false; - } - - $cursor->advance(); - - // end of label - if ($cursor->getCurrentCharacter() !== ':') { - return false; - } - - $cursor->advance(); - - // spec: A link label can have at most 999 characters inside the square brackets - if (\mb_strlen($this->label, 'UTF-8') > 999) { - return false; - } - - // spec: A link label must contain at least one non-whitespace character - if (\trim($this->label) === '') { - return false; - } - - $cursor->advanceToNextNonSpaceOrTab(); - - $this->state = self::DESTINATION; - - return true; - } - - private function parseDestination(Cursor $cursor): bool - { - $cursor->advanceToNextNonSpaceOrTab(); - - $destination = LinkParserHelper::parseLinkDestination($cursor); - if ($destination === null) { - return false; - } - - $this->destination = $destination; - - $advanced = $cursor->advanceToNextNonSpaceOrTab(); - if ($cursor->isAtEnd()) { - // Destination was at end of line, so this is a valid reference for sure (and maybe a title). - // If not at end of line, wait for title to be valid first. - $this->referenceValid = true; - $this->paragraph = ''; - } elseif ($advanced === 0) { - // spec: The title must be separated from the link destination by whitespace - return false; - } - - $this->state = self::START_TITLE; - - return true; - } - - private function parseStartTitle(Cursor $cursor): bool - { - $cursor->advanceToNextNonSpaceOrTab(); - if ($cursor->isAtEnd()) { - $this->state = self::START_DEFINITION; - - return true; - } - - $this->titleDelimiter = null; - switch ($c = $cursor->getCurrentCharacter()) { - case '"': - case "'": - $this->titleDelimiter = $c; - break; - case '(': - $this->titleDelimiter = ')'; - break; - default: - // no title delimter found - break; - } - - if ($this->titleDelimiter !== null) { - $this->state = self::TITLE; - $cursor->advance(); - if ($cursor->isAtEnd()) { - $this->title .= "\n"; - } - } else { - $this->finishReference(); - // There might be another reference instead, try that for the same character. - $this->state = self::START_DEFINITION; - } - - return true; - } - - private function parseTitle(Cursor $cursor): bool - { - \assert($this->titleDelimiter !== null); - $title = LinkParserHelper::parsePartialLinkTitle($cursor, $this->titleDelimiter); - - if ($title === null) { - // Invalid title, stop - return false; - } - - // Did we find the end delimiter? - $endDelimiterFound = false; - if (\substr($title, -1) === $this->titleDelimiter) { - $endDelimiterFound = true; - // Chop it off - $title = \substr($title, 0, -1); - } - - $this->title .= $title; - - if (! $endDelimiterFound && $cursor->isAtEnd()) { - // Title still going, continue on next line - $this->title .= "\n"; - - return true; - } - - // We either hit the end delimiter or some extra whitespace - $cursor->advanceToNextNonSpaceOrTab(); - if (! $cursor->isAtEnd()) { - // spec: No further non-whitespace characters may occur on the line. - return false; - } - - $this->referenceValid = true; - $this->finishReference(); - $this->paragraph = ''; - - // See if there's another definition - $this->state = self::START_DEFINITION; - - return true; - } - - private function finishReference(): void - { - if (! $this->referenceValid) { - return; - } - - /** @psalm-suppress PossiblyNullArgument -- these can't possibly be null if we're in this state */ - $this->references[] = new Reference($this->label, $this->destination, $this->title); - - $this->label = null; - $this->referenceValid = false; - $this->destination = null; - $this->title = ''; - $this->titleDelimiter = null; - } -} diff --git a/vendor/league/commonmark/src/Reference/ReferenceableInterface.php b/vendor/league/commonmark/src/Reference/ReferenceableInterface.php deleted file mode 100644 index b45f379..0000000 --- a/vendor/league/commonmark/src/Reference/ReferenceableInterface.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. - */ - -declare(strict_types=1); - -namespace League\CommonMark\Reference; - -interface ReferenceableInterface -{ - public function getReference(): ReferenceInterface; -} diff --git a/vendor/league/commonmark/src/Renderer/Block/DocumentRenderer.php b/vendor/league/commonmark/src/Renderer/Block/DocumentRenderer.php deleted file mode 100644 index 3262691..0000000 --- a/vendor/league/commonmark/src/Renderer/Block/DocumentRenderer.php +++ /dev/null @@ -1,57 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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\Renderer\Block; - -use League\CommonMark\Node\Block\Document; -use League\CommonMark\Node\Node; -use League\CommonMark\Renderer\ChildNodeRendererInterface; -use League\CommonMark\Renderer\NodeRendererInterface; -use League\CommonMark\Xml\XmlNodeRendererInterface; - -final class DocumentRenderer implements NodeRendererInterface, XmlNodeRendererInterface -{ - /** - * @param Document $node - * - * {@inheritDoc} - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function render(Node $node, ChildNodeRendererInterface $childRenderer): string - { - Document::assertInstanceOf($node); - - $wholeDoc = $childRenderer->renderNodes($node->children()); - - return $wholeDoc === '' ? '' : $wholeDoc . "\n"; - } - - public function getXmlTagName(Node $node): string - { - return 'document'; - } - - /** - * {@inheritDoc} - */ - public function getXmlAttributes(Node $node): array - { - return [ - 'xmlns' => 'http://commonmark.org/xml/1.0', - ]; - } -} diff --git a/vendor/league/commonmark/src/Renderer/Block/ParagraphRenderer.php b/vendor/league/commonmark/src/Renderer/Block/ParagraphRenderer.php deleted file mode 100644 index 934eac2..0000000 --- a/vendor/league/commonmark/src/Renderer/Block/ParagraphRenderer.php +++ /dev/null @@ -1,74 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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\Renderer\Block; - -use League\CommonMark\Node\Block\Paragraph; -use League\CommonMark\Node\Block\TightBlockInterface; -use League\CommonMark\Node\Node; -use League\CommonMark\Renderer\ChildNodeRendererInterface; -use League\CommonMark\Renderer\NodeRendererInterface; -use League\CommonMark\Util\HtmlElement; -use League\CommonMark\Xml\XmlNodeRendererInterface; - -final class ParagraphRenderer implements NodeRendererInterface, XmlNodeRendererInterface -{ - /** - * @param Paragraph $node - * - * {@inheritDoc} - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function render(Node $node, ChildNodeRendererInterface $childRenderer) - { - Paragraph::assertInstanceOf($node); - - if ($this->inTightList($node)) { - return $childRenderer->renderNodes($node->children()); - } - - $attrs = $node->data->get('attributes'); - - return new HtmlElement('p', $attrs, $childRenderer->renderNodes($node->children())); - } - - public function getXmlTagName(Node $node): string - { - return 'paragraph'; - } - - /** - * {@inheritDoc} - */ - public function getXmlAttributes(Node $node): array - { - return []; - } - - private function inTightList(Paragraph $node): bool - { - // Only check up to two (2) levels above this for tightness - $i = 2; - while (($node = $node->parent()) && $i--) { - if ($node instanceof TightBlockInterface) { - return $node->isTight(); - } - } - - return false; - } -} diff --git a/vendor/league/commonmark/src/Renderer/ChildNodeRendererInterface.php b/vendor/league/commonmark/src/Renderer/ChildNodeRendererInterface.php deleted file mode 100644 index 8e866b5..0000000 --- a/vendor/league/commonmark/src/Renderer/ChildNodeRendererInterface.php +++ /dev/null @@ -1,31 +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\Renderer; - -use League\CommonMark\Node\Node; - -/** - * Renders multiple nodes by delegating to the individual node renderers and adding spacing where needed - */ -interface ChildNodeRendererInterface -{ - /** - * @param Node[] $nodes - */ - public function renderNodes(iterable $nodes): string; - - public function getBlockSeparator(): string; - - public function getInnerSeparator(): string; -} diff --git a/vendor/league/commonmark/src/Renderer/DocumentRendererInterface.php b/vendor/league/commonmark/src/Renderer/DocumentRendererInterface.php deleted file mode 100644 index dd34dd6..0000000 --- a/vendor/league/commonmark/src/Renderer/DocumentRendererInterface.php +++ /dev/null @@ -1,28 +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\Renderer; - -use League\CommonMark\Node\Block\Document; -use League\CommonMark\Output\RenderedContentInterface; - -/** - * Renders a parsed Document AST - */ -interface DocumentRendererInterface extends MarkdownRendererInterface -{ - /** - * Render the given Document node (and all of its children) - */ - public function renderDocument(Document $document): RenderedContentInterface; -} diff --git a/vendor/league/commonmark/src/Renderer/HtmlDecorator.php b/vendor/league/commonmark/src/Renderer/HtmlDecorator.php deleted file mode 100644 index 46a38d9..0000000 --- a/vendor/league/commonmark/src/Renderer/HtmlDecorator.php +++ /dev/null @@ -1,45 +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\Renderer; - -use League\CommonMark\Node\Node; -use League\CommonMark\Util\HtmlElement; - -final class HtmlDecorator implements NodeRendererInterface -{ - private NodeRendererInterface $inner; - private string $tag; - /** @var array<string, string|string[]|bool> */ - private array $attributes; - private bool $selfClosing; - - /** - * @param array<string, string|string[]|bool> $attributes - */ - public function __construct(NodeRendererInterface $inner, string $tag, array $attributes = [], bool $selfClosing = false) - { - $this->inner = $inner; - $this->tag = $tag; - $this->attributes = $attributes; - $this->selfClosing = $selfClosing; - } - - /** - * {@inheritDoc} - */ - public function render(Node $node, ChildNodeRendererInterface $childRenderer) - { - return new HtmlElement($this->tag, $this->attributes, $this->inner->render($node, $childRenderer), $this->selfClosing); - } -} diff --git a/vendor/league/commonmark/src/Renderer/HtmlRenderer.php b/vendor/league/commonmark/src/Renderer/HtmlRenderer.php deleted file mode 100644 index 2e05cfb..0000000 --- a/vendor/league/commonmark/src/Renderer/HtmlRenderer.php +++ /dev/null @@ -1,100 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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\Renderer; - -use League\CommonMark\Environment\EnvironmentInterface; -use League\CommonMark\Event\DocumentPreRenderEvent; -use League\CommonMark\Event\DocumentRenderedEvent; -use League\CommonMark\Node\Block\AbstractBlock; -use League\CommonMark\Node\Block\Document; -use League\CommonMark\Node\Node; -use League\CommonMark\Output\RenderedContent; -use League\CommonMark\Output\RenderedContentInterface; - -final class HtmlRenderer implements DocumentRendererInterface, ChildNodeRendererInterface -{ - /** @psalm-readonly */ - private EnvironmentInterface $environment; - - public function __construct(EnvironmentInterface $environment) - { - $this->environment = $environment; - } - - public function renderDocument(Document $document): RenderedContentInterface - { - $this->environment->dispatch(new DocumentPreRenderEvent($document, 'html')); - - $output = new RenderedContent($document, (string) $this->renderNode($document)); - - $event = new DocumentRenderedEvent($output); - $this->environment->dispatch($event); - - return $event->getOutput(); - } - - /** - * {@inheritDoc} - */ - public function renderNodes(iterable $nodes): string - { - $output = ''; - - $isFirstItem = true; - - foreach ($nodes as $node) { - if (! $isFirstItem && $node instanceof AbstractBlock) { - $output .= $this->getBlockSeparator(); - } - - $output .= $this->renderNode($node); - - $isFirstItem = false; - } - - return $output; - } - - /** - * @return \Stringable|string - * - * @throws NoMatchingRendererException - */ - private function renderNode(Node $node) - { - $renderers = $this->environment->getRenderersForClass(\get_class($node)); - - foreach ($renderers as $renderer) { - \assert($renderer instanceof NodeRendererInterface); - if (($result = $renderer->render($node, $this)) !== null) { - return $result; - } - } - - throw new NoMatchingRendererException('Unable to find corresponding renderer for node type ' . \get_class($node)); - } - - public function getBlockSeparator(): string - { - return $this->environment->getConfiguration()->get('renderer/block_separator'); - } - - public function getInnerSeparator(): string - { - return $this->environment->getConfiguration()->get('renderer/inner_separator'); - } -} diff --git a/vendor/league/commonmark/src/Renderer/Inline/NewlineRenderer.php b/vendor/league/commonmark/src/Renderer/Inline/NewlineRenderer.php deleted file mode 100644 index f64cc58..0000000 --- a/vendor/league/commonmark/src/Renderer/Inline/NewlineRenderer.php +++ /dev/null @@ -1,76 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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\Renderer\Inline; - -use League\CommonMark\Node\Inline\Newline; -use League\CommonMark\Node\Node; -use League\CommonMark\Renderer\ChildNodeRendererInterface; -use League\CommonMark\Renderer\NodeRendererInterface; -use League\CommonMark\Xml\XmlNodeRendererInterface; -use League\Config\ConfigurationAwareInterface; -use League\Config\ConfigurationInterface; - -final class NewlineRenderer implements NodeRendererInterface, XmlNodeRendererInterface, ConfigurationAwareInterface -{ - /** @psalm-readonly-allow-private-mutation */ - private ConfigurationInterface $config; - - public function setConfiguration(ConfigurationInterface $configuration): void - { - $this->config = $configuration; - } - - /** - * @param Newline $node - * - * {@inheritDoc} - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function render(Node $node, ChildNodeRendererInterface $childRenderer): string - { - Newline::assertInstanceOf($node); - - if ($node->getType() === Newline::HARDBREAK) { - return "<br />\n"; - } - - return $this->config->get('renderer/soft_break'); - } - - /** - * @param Newline $node - * - * {@inheritDoc} - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function getXmlTagName(Node $node): string - { - Newline::assertInstanceOf($node); - - return $node->getType() === Newline::SOFTBREAK ? 'softbreak' : 'linebreak'; - } - - /** - * {@inheritDoc} - */ - public function getXmlAttributes(Node $node): array - { - return []; - } -} diff --git a/vendor/league/commonmark/src/Renderer/Inline/TextRenderer.php b/vendor/league/commonmark/src/Renderer/Inline/TextRenderer.php deleted file mode 100644 index 40ad02a..0000000 --- a/vendor/league/commonmark/src/Renderer/Inline/TextRenderer.php +++ /dev/null @@ -1,54 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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\Renderer\Inline; - -use League\CommonMark\Node\Inline\Text; -use League\CommonMark\Node\Node; -use League\CommonMark\Renderer\ChildNodeRendererInterface; -use League\CommonMark\Renderer\NodeRendererInterface; -use League\CommonMark\Util\Xml; -use League\CommonMark\Xml\XmlNodeRendererInterface; - -final class TextRenderer implements NodeRendererInterface, XmlNodeRendererInterface -{ - /** - * @param Text $node - * - * {@inheritDoc} - * - * @psalm-suppress MoreSpecificImplementedParamType - */ - public function render(Node $node, ChildNodeRendererInterface $childRenderer): string - { - Text::assertInstanceOf($node); - - return Xml::escape($node->getLiteral()); - } - - public function getXmlTagName(Node $node): string - { - return 'text'; - } - - /** - * {@inheritDoc} - */ - public function getXmlAttributes(Node $node): array - { - return []; - } -} diff --git a/vendor/league/commonmark/src/Renderer/MarkdownRendererInterface.php b/vendor/league/commonmark/src/Renderer/MarkdownRendererInterface.php deleted file mode 100644 index 83af8cd..0000000 --- a/vendor/league/commonmark/src/Renderer/MarkdownRendererInterface.php +++ /dev/null @@ -1,30 +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\Renderer; - -use League\CommonMark\Node\Block\Document; -use League\CommonMark\Output\RenderedContentInterface; - -/** - * Renders a parsed Document AST - * - * @deprecated since 2.3; use {@link DocumentRendererInterface} instead - */ -interface MarkdownRendererInterface -{ - /** - * Render the given Document node (and all of its children) - */ - public function renderDocument(Document $document): RenderedContentInterface; -} diff --git a/vendor/league/commonmark/src/Renderer/NoMatchingRendererException.php b/vendor/league/commonmark/src/Renderer/NoMatchingRendererException.php deleted file mode 100644 index 14fe493..0000000 --- a/vendor/league/commonmark/src/Renderer/NoMatchingRendererException.php +++ /dev/null @@ -1,20 +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\Renderer; - -use League\CommonMark\Exception\LogicException; - -class NoMatchingRendererException extends LogicException -{ -} diff --git a/vendor/league/commonmark/src/Renderer/NodeRendererInterface.php b/vendor/league/commonmark/src/Renderer/NodeRendererInterface.php deleted file mode 100644 index 5d40582..0000000 --- a/vendor/league/commonmark/src/Renderer/NodeRendererInterface.php +++ /dev/null @@ -1,27 +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\Renderer; - -use League\CommonMark\Exception\InvalidArgumentException; -use League\CommonMark\Node\Node; - -interface NodeRendererInterface -{ - /** - * @return \Stringable|string|null - * - * @throws InvalidArgumentException if the wrong type of Node is provided - */ - public function render(Node $node, ChildNodeRendererInterface $childRenderer); -} diff --git a/vendor/league/commonmark/src/Util/ArrayCollection.php b/vendor/league/commonmark/src/Util/ArrayCollection.php deleted file mode 100644 index 7210770..0000000 --- a/vendor/league/commonmark/src/Util/ArrayCollection.php +++ /dev/null @@ -1,173 +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\Util; - -/** - * Array collection - * - * Provides a wrapper around a standard PHP array. - * - * @internal - * - * @phpstan-template T - * @phpstan-implements \IteratorAggregate<int, T> - * @phpstan-implements \ArrayAccess<int, T> - */ -final class ArrayCollection implements \IteratorAggregate, \Countable, \ArrayAccess -{ - /** - * @var array<int, mixed> - * @phpstan-var array<int, T> - */ - private array $elements; - - /** - * Constructor - * - * @param array<int|string, mixed> $elements - * - * @phpstan-param array<int, T> $elements - */ - public function __construct(array $elements = []) - { - $this->elements = $elements; - } - - /** - * @return mixed|false - * - * @phpstan-return T|false - */ - public function first() - { - return \reset($this->elements); - } - - /** - * @return mixed|false - * - * @phpstan-return T|false - */ - public function last() - { - return \end($this->elements); - } - - /** - * Retrieve an external iterator - * - * @return \ArrayIterator<int, mixed> - * - * @phpstan-return \ArrayIterator<int, T> - */ - #[\ReturnTypeWillChange] - public function getIterator(): \ArrayIterator - { - return new \ArrayIterator($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 - * - * {@inheritDoc} - * - * @phpstan-param int $offset - */ - public function offsetExists($offset): bool - { - return \array_key_exists($offset, $this->elements); - } - - /** - * Offset to retrieve - * - * {@inheritDoc} - * - * @phpstan-param int $offset - * - * @phpstan-return T|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->elements[$offset] ?? null; - } - - /** - * Offset to set - * - * {@inheritDoc} - * - * @phpstan-param int|null $offset - * @phpstan-param T $value - */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value): void - { - if ($offset === null) { - $this->elements[] = $value; - } else { - $this->elements[$offset] = $value; - } - } - - /** - * Offset to unset - * - * {@inheritDoc} - * - * @phpstan-param int $offset - */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset): void - { - if (! \array_key_exists($offset, $this->elements)) { - return; - } - - unset($this->elements[$offset]); - } - - /** - * Returns a subset of the array - * - * @return array<int, mixed> - * - * @phpstan-return array<int, T> - */ - public function slice(int $offset, ?int $length = null): array - { - return \array_slice($this->elements, $offset, $length, true); - } - - /** - * @return array<int, mixed> - * - * @phpstan-return array<int, T> - */ - public function toArray(): array - { - return $this->elements; - } -} diff --git a/vendor/league/commonmark/src/Util/Html5EntityDecoder.php b/vendor/league/commonmark/src/Util/Html5EntityDecoder.php deleted file mode 100644 index 52550a0..0000000 --- a/vendor/league/commonmark/src/Util/Html5EntityDecoder.php +++ /dev/null @@ -1,75 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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; - -/** - * @psalm-immutable - */ -final class Html5EntityDecoder -{ - /** - * @psalm-pure - */ - 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 - * - * @psalm-pure - */ - private static function fromDecimal($number): string - { - // Only convert code points within planes 0-2, excluding NULL - // phpcs:ignore Generic.PHP.ForbiddenFunctions.Found - 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; - } - - /** - * @psalm-pure - */ - private static function fromHex(string $hexChars): string - { - return self::fromDecimal(\hexdec($hexChars)); - } -} diff --git a/vendor/league/commonmark/src/Util/HtmlElement.php b/vendor/league/commonmark/src/Util/HtmlElement.php deleted file mode 100644 index 51fa6de..0000000 --- a/vendor/league/commonmark/src/Util/HtmlElement.php +++ /dev/null @@ -1,160 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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 HtmlElement implements \Stringable -{ - /** @psalm-readonly */ - private string $tagName; - - /** @var array<string, string|bool> */ - private array $attributes = []; - - /** @var \Stringable|\Stringable[]|string */ - private $contents; - - /** @psalm-readonly */ - private bool $selfClosing; - - /** - * @param string $tagName Name of the HTML tag - * @param array<string, string|string[]|bool> $attributes Array of attributes (values should be unescaped) - * @param \Stringable|\Stringable[]|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->selfClosing = $selfClosing; - - foreach ($attributes as $name => $value) { - $this->setAttribute($name, $value); - } - - $this->setContents($contents ?? ''); - } - - /** @psalm-immutable */ - public function getTagName(): string - { - return $this->tagName; - } - - /** - * @return array<string, string|bool> - * - * @psalm-immutable - */ - public function getAllAttributes(): array - { - return $this->attributes; - } - - /** - * @return string|bool|null - * - * @psalm-immutable - */ - public function getAttribute(string $key) - { - return $this->attributes[$key] ?? null; - } - - /** - * @param string|string[]|bool $value - */ - public function setAttribute(string $key, $value = true): self - { - if (\is_array($value)) { - $this->attributes[$key] = \implode(' ', \array_unique($value)); - } else { - $this->attributes[$key] = $value; - } - - return $this; - } - - /** - * @return \Stringable|\Stringable[]|string - * - * @psalm-immutable - */ - 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 \Stringable|\Stringable[]|string $contents - * - * @return $this - */ - public function setContents($contents): self - { - $this->contents = $contents ?? ''; // @phpstan-ignore-line - - return $this; - } - - /** @psalm-immutable */ - public function __toString(): string - { - $result = '<' . $this->tagName; - - foreach ($this->attributes as $key => $value) { - if ($value === true) { - $result .= ' ' . $key; - } elseif ($value === false) { - continue; - } else { - $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; - } - - /** @psalm-immutable */ - 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/Util/HtmlFilter.php b/vendor/league/commonmark/src/Util/HtmlFilter.php deleted file mode 100644 index b1e0555..0000000 --- a/vendor/league/commonmark/src/Util/HtmlFilter.php +++ /dev/null @@ -1,55 +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\Util; - -use League\CommonMark\Exception\InvalidArgumentException; - -/** - * @psalm-immutable - */ -final class HtmlFilter -{ - // Return the entire string as-is - public const ALLOW = 'allow'; - // Escape the entire string so any HTML/JS won't be interpreted as such - public const ESCAPE = 'escape'; - // Return an empty string - public const STRIP = 'strip'; - - /** - * Runs the given HTML through the given filter - * - * @param string $html HTML input to be filtered - * @param string $filter One of the HtmlFilter constants - * - * @return string Filtered HTML - * - * @throws InvalidArgumentException when an invalid $filter is given - * - * @psalm-pure - */ - public static function filter(string $html, string $filter): string - { - switch ($filter) { - case self::STRIP: - return ''; - case self::ESCAPE: - return \htmlspecialchars($html, \ENT_NOQUOTES); - case self::ALLOW: - return $html; - default: - throw new InvalidArgumentException(\sprintf('Invalid filter provided: "%s"', $filter)); - } - } -} diff --git a/vendor/league/commonmark/src/Util/LinkParserHelper.php b/vendor/league/commonmark/src/Util/LinkParserHelper.php deleted file mode 100644 index 3e76c28..0000000 --- a/vendor/league/commonmark/src/Util/LinkParserHelper.php +++ /dev/null @@ -1,165 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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\Parser\Cursor; - -/** - * @psalm-immutable - */ -final class LinkParserHelper -{ - /** - * Attempt to parse link destination - * - * @return string|null The string, or null if no match - */ - public static function parseLinkDestination(Cursor $cursor): ?string - { - if ($cursor->getCurrentCharacter() === '<') { - return self::parseDestinationBraces($cursor); - } - - $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; - } - - public static function parsePartialLinkLabel(Cursor $cursor): ?string - { - return $cursor->match('/^(?:[^\\\\\[\]]++|\\\\.?)*+/'); - } - - /** - * Attempt to parse link title (sans quotes) - * - * @return string|null 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; - } - - public static function parsePartialLinkTitle(Cursor $cursor, string $endDelimiter): ?string - { - $endDelimiter = \preg_quote($endDelimiter, '/'); - $regex = \sprintf('/(%s|[^%s\x00])*(?:%s)?/', RegexHelper::PARTIAL_ESCAPED_CHAR, $endDelimiter, $endDelimiter); - if (($partialTitle = $cursor->match($regex)) === null) { - return null; - } - - return RegexHelper::unescape($partialTitle); - } - - private static function manuallyParseLinkDestination(Cursor $cursor): ?string - { - $remainder = $cursor->getRemainder(); - $openParens = 0; - $len = \strlen($remainder); - for ($i = 0; $i < $len; $i++) { - $c = $remainder[$i]; - if ($c === '\\' && $i + 1 < $len && RegexHelper::isEscapable($remainder[$i + 1])) { - $i++; - } elseif ($c === '(') { - $openParens++; - // Limit to 32 nested parens for pathological cases - if ($openParens > 32) { - return null; - } - } elseif ($c === ')') { - if ($openParens < 1) { - break; - } - - $openParens--; - } elseif (\ord($c) <= 32 && RegexHelper::isWhitespace($c)) { - break; - } - } - - if ($openParens !== 0) { - return null; - } - - if ($i === 0 && (! isset($c) || $c !== ')')) { - return null; - } - - $destination = \substr($remainder, 0, $i); - $cursor->advanceBy(\mb_strlen($destination, 'UTF-8')); - - return $destination; - } - - /** @var \WeakReference<Cursor>|null */ - private static ?\WeakReference $lastCursor = null; - private static bool $lastCursorLacksClosingBrace = false; - - private static function parseDestinationBraces(Cursor $cursor): ?string - { - // Optimization: If we've previously parsed this cursor and returned `null`, we know - // that no closing brace exists, so we can skip the regex entirely. This helps avoid - // certain pathological cases where the regex engine can take a very long time to - // determine that no match exists. - if (self::$lastCursor !== null && self::$lastCursor->get() === $cursor) { - if (self::$lastCursorLacksClosingBrace) { - return null; - } - } else { - self::$lastCursor = \WeakReference::create($cursor); - } - - if ($res = $cursor->match(RegexHelper::REGEX_LINK_DESTINATION_BRACES)) { - self::$lastCursorLacksClosingBrace = false; - - // Chop off surrounding <..>: - return UrlEncoder::unescapeAndEncode( - RegexHelper::unescape(\substr($res, 1, -1)) - ); - } - - self::$lastCursorLacksClosingBrace = true; - - return null; - } -} diff --git a/vendor/league/commonmark/src/Util/PrioritizedList.php b/vendor/league/commonmark/src/Util/PrioritizedList.php deleted file mode 100644 index 77ec24a..0000000 --- a/vendor/league/commonmark/src/Util/PrioritizedList.php +++ /dev/null @@ -1,73 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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 array $list = []; - - /** - * @var \Traversable<mixed>|null - * @phpstan-var \Traversable<T>|null - */ - private ?\Traversable $optimized = null; - - /** - * @param mixed $item - * - * @phpstan-param T $item - */ - public function add($item, int $priority): void - { - $this->list[$priority][] = $item; - $this->optimized = null; - } - - /** - * @return \Traversable<int, mixed> - * - * @phpstan-return \Traversable<int, T> - */ - #[\ReturnTypeWillChange] - public function getIterator(): \Traversable - { - 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 603631f..0000000 --- a/vendor/league/commonmark/src/Util/RegexHelper.php +++ /dev/null @@ -1,243 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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\InvalidArgumentException; -use League\CommonMark\Extension\CommonMark\Node\Block\HtmlBlock; - -/** - * Provides regular expressions and utilities for parsing Markdown - * - * All of the PARTIAL_ regex constants assume that they'll be used in case-insensitive searches - * All other complete regexes provided by this class (either via constants or methods) will have case-insensitivity enabled. - * - * @phpcs:disable Generic.Strings.UnnecessaryStringConcat.Found - * - * @psalm-immutable - */ -final class RegexHelper -{ - // Partial regular expressions (wrap with `/` on each side and add the case-insensitive `i` flag 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-z][a-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|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)'; - public const PARTIAL_ATTRIBUTENAME = '[a-z_:][a-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 = '<!-->|<!--->|<!--[\s\S]*?-->'; - public const PARTIAL_PROCESSINGINSTRUCTION = '[<][?][\s\S]*?[?][>]'; - public const PARTIAL_DECLARATION = '<![A-Za-z]+' . '[^>]*>'; - 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 = '/^[!"#$%&\'()*+,\-.\\/:;<=>?@\\[\\]\\\\^_`{|}~\p{P}\p{S}]/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_UNICODE_WHITESPACE_CHAR = '/^\pZ|\s/u'; - public const REGEX_THEMATIC_BREAK = '/^(?:\*[ \t]*){3,}$|^(?:_[ \t]*){3,}$|^(?:-[ \t]*){3,}$/'; - public const REGEX_LINK_DESTINATION_BRACES = '/^(?:<(?:[^<>\\n\\\\\\x00]|\\\\.)*>)/'; - - /** - * @psalm-pure - */ - public static function isEscapable(string $character): bool - { - return \preg_match('/' . self::PARTIAL_ESCAPABLE . '/', $character) === 1; - } - - public static function isWhitespace(string $character): bool - { - /** @psalm-suppress InvalidLiteralArgument */ - return $character !== '' && \strpos(" \t\n\x0b\x0c\x0d", $character) !== false; - } - - /** - * @psalm-pure - */ - public static function isLetter(?string $character): bool - { - if ($character === null) { - return false; - } - - return \preg_match('/[\pL]/u', $character) === 1; - } - - /** - * Attempt to match a regex in string s at offset offset - * - * @psalm-param non-empty-string $regex - * - * @return int|null Index of match, or null - * - * @psalm-pure - */ - 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 which only returns the first set of matches - * - * @psalm-param non-empty-string $pattern - * - * @return string[]|null - * - * @psalm-pure - */ - public static function matchFirst(string $pattern, string $subject, int $offset = 0): ?array - { - if ($offset !== 0) { - $subject = \substr($subject, $offset); - } - - \preg_match_all($pattern, $subject, $matches, \PREG_SET_ORDER); - - if ($matches === []) { - return null; - } - - return $matches[0] ?: null; - } - - /** - * Replace backslash escapes with literal characters - * - * @psalm-pure - */ - public static function unescape(string $string): string - { - $allEscapedChar = '/\\\\(' . self::PARTIAL_ESCAPABLE . ')/'; - - $escaped = \preg_replace($allEscapedChar, '$1', $string); - \assert(\is_string($escaped)); - - return \preg_replace_callback('/' . self::PARTIAL_ENTITY . '/i', static fn ($e) => Html5EntityDecoder::decode($e[0]), $escaped); - } - - /** - * @internal - * - * @param int $type HTML block type - * - * @psalm-param HtmlBlock::TYPE_* $type - * - * @phpstan-param HtmlBlock::TYPE_* $type - * - * @psalm-return non-empty-string - * - * @throws InvalidArgumentException if an invalid type is given - * - * @psalm-pure - */ - 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]/i'; - case HtmlBlock::TYPE_5_CDATA: - return '/^<!\[CDATA\[/i'; - 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'; - default: - throw new InvalidArgumentException('Invalid HTML block type'); - } - } - - /** - * @internal - * - * @param int $type HTML block type - * - * @psalm-param HtmlBlock::TYPE_* $type - * - * @phpstan-param HtmlBlock::TYPE_* $type - * - * @psalm-return non-empty-string - * - * @throws InvalidArgumentException if an invalid type is given - * - * @psalm-pure - */ - 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 '/\]\]>/'; - default: - throw new InvalidArgumentException('Invalid HTML block type'); - } - } - - /** - * @psalm-pure - */ - 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/SpecReader.php b/vendor/league/commonmark/src/Util/SpecReader.php deleted file mode 100644 index faee204..0000000 --- a/vendor/league/commonmark/src/Util/SpecReader.php +++ /dev/null @@ -1,72 +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\Util; - -use League\CommonMark\Exception\IOException; - -/** - * Reads in a CommonMark spec document and extracts the input/output examples for testing against them - */ -final class SpecReader -{ - private function __construct() - { - } - - /** - * @return iterable<string, array{input: string, output: string, type: string, section: string, number: int}> - */ - public static function read(string $data): iterable - { - // Normalize newlines for platform independence - $data = \preg_replace('/\r\n?/', "\n", $data); - \assert($data !== null); - $data = \preg_replace('/<!-- END TESTS -->.*$/', '', $data); - \assert($data !== null); - \preg_match_all('/^`{32} (example ?\w*)\n([\s\S]*?)^\.\n([\s\S]*?)^`{32}$|^#{1,6} *(.*)$/m', $data, $matches, PREG_SET_ORDER); - - $currentSection = 'Example'; - $exampleNumber = 0; - - foreach ($matches as $match) { - \assert(isset($match[1], $match[2], $match[3])); - if (isset($match[4])) { - $currentSection = $match[4]; - continue; - } - - yield \trim($currentSection . ' #' . $exampleNumber) => [ - 'input' => \str_replace('→', "\t", $match[2]), - 'output' => \str_replace('→', "\t", $match[3]), - 'type' => $match[1], - 'section' => $currentSection, - 'number' => $exampleNumber++, - ]; - } - } - - /** - * @return iterable<string, array{input: string, output: string, type: string, section: string, number: int}> - * - * @throws IOException if the file cannot be loaded - */ - public static function readFile(string $filename): iterable - { - if (($data = \file_get_contents($filename)) === false) { - throw new IOException(\sprintf('Failed to load spec from %s', $filename)); - } - - return self::read($data); - } -} diff --git a/vendor/league/commonmark/src/Util/UrlEncoder.php b/vendor/league/commonmark/src/Util/UrlEncoder.php deleted file mode 100644 index bba1af3..0000000 --- a/vendor/league/commonmark/src/Util/UrlEncoder.php +++ /dev/null @@ -1,69 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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; - -/** - * @psalm-immutable - */ -final class UrlEncoder -{ - private const ENCODE_CACHE = ['%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']; - - /** - * @throws UnexpectedEncodingException if a non-UTF-8-compatible encoding is used - * - * @psalm-pure - */ - 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; - } - - if (! \mb_check_encoding($uri, 'UTF-8')) { - throw new UnexpectedEncodingException('Unexpected encoding - UTF-8 or ASCII was expected'); - } - - $result = ''; - - $chars = \mb_str_split($uri, 1, 'UTF-8'); - - $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::ENCODE_CACHE[\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 8f9e84d..0000000 --- a/vendor/league/commonmark/src/Util/Xml.php +++ /dev/null @@ -1,33 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/commonmark package. - * - * (c) Colin O'Dell <colinodell@gmail.com> - * - * Original code based on the 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 - * - * @psalm-immutable - */ -final class Xml -{ - /** - * @psalm-pure - */ - public static function escape(string $string): string - { - return \str_replace(['&', '<', '>', '"'], ['&', '<', '>', '"'], $string); - } -} diff --git a/vendor/league/commonmark/src/Xml/FallbackNodeXmlRenderer.php b/vendor/league/commonmark/src/Xml/FallbackNodeXmlRenderer.php deleted file mode 100644 index 48aa3c8..0000000 --- a/vendor/league/commonmark/src/Xml/FallbackNodeXmlRenderer.php +++ /dev/null @@ -1,85 +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\Xml; - -use League\CommonMark\Node\Block\AbstractBlock; -use League\CommonMark\Node\Inline\AbstractInline; -use League\CommonMark\Node\Node; - -/** - * @internal - */ -final class FallbackNodeXmlRenderer implements XmlNodeRendererInterface -{ - /** - * @var array<string, string> - * - * @psalm-allow-private-mutation - */ - private array $classCache = []; - - /** - * @psalm-allow-private-mutation - */ - public function getXmlTagName(Node $node): string - { - $className = \get_class($node); - if (isset($this->classCache[$className])) { - return $this->classCache[$className]; - } - - $type = $node instanceof AbstractBlock ? 'block' : 'inline'; - $shortName = \strtolower((new \ReflectionClass($node))->getShortName()); - - return $this->classCache[$className] = \sprintf('custom_%s_%s', $type, $shortName); - } - - /** - * {@inheritDoc} - */ - public function getXmlAttributes(Node $node): array - { - $attrs = []; - foreach ($node->data->export() as $k => $v) { - if (self::isValueUsable($v)) { - $attrs[$k] = $v; - } - } - - $reflClass = new \ReflectionClass($node); - foreach ($reflClass->getProperties() as $property) { - if (\in_array($property->getDeclaringClass()->getName(), [Node::class, AbstractBlock::class, AbstractInline::class], true)) { - continue; - } - - $property->setAccessible(true); - $value = $property->getValue($node); - if (self::isValueUsable($value)) { - $attrs[$property->getName()] = $value; - } - } - - return $attrs; - } - - /** - * @param mixed $var - * - * @psalm-pure - */ - private static function isValueUsable($var): bool - { - return \is_string($var) || \is_int($var) || \is_float($var) || \is_bool($var); - } -} diff --git a/vendor/league/commonmark/src/Xml/MarkdownToXmlConverter.php b/vendor/league/commonmark/src/Xml/MarkdownToXmlConverter.php deleted file mode 100644 index 538ad98..0000000 --- a/vendor/league/commonmark/src/Xml/MarkdownToXmlConverter.php +++ /dev/null @@ -1,59 +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\Xml; - -use League\CommonMark\ConverterInterface; -use League\CommonMark\Environment\EnvironmentInterface; -use League\CommonMark\Exception\CommonMarkException; -use League\CommonMark\Output\RenderedContentInterface; -use League\CommonMark\Parser\MarkdownParser; -use League\CommonMark\Parser\MarkdownParserInterface; -use League\CommonMark\Renderer\DocumentRendererInterface; - -final class MarkdownToXmlConverter implements ConverterInterface -{ - /** @psalm-readonly */ - private MarkdownParserInterface $parser; - - /** @psalm-readonly */ - private DocumentRendererInterface $renderer; - - public function __construct(EnvironmentInterface $environment) - { - $this->parser = new MarkdownParser($environment); - $this->renderer = new XmlRenderer($environment); - } - - /** - * Converts Markdown to XML - * - * @throws CommonMarkException - */ - public function convert(string $input): RenderedContentInterface - { - return $this->renderer->renderDocument($this->parser->parse($input)); - } - - /** - * Converts CommonMark to HTML. - * - * @see MarkdownToXmlConverter::convert() - * - * @throws CommonMarkException - */ - public function __invoke(string $input): RenderedContentInterface - { - return $this->convert($input); - } -} diff --git a/vendor/league/commonmark/src/Xml/XmlNodeRendererInterface.php b/vendor/league/commonmark/src/Xml/XmlNodeRendererInterface.php deleted file mode 100644 index aafc9f1..0000000 --- a/vendor/league/commonmark/src/Xml/XmlNodeRendererInterface.php +++ /dev/null @@ -1,28 +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\Xml; - -use League\CommonMark\Node\Node; - -interface XmlNodeRendererInterface -{ - public function getXmlTagName(Node $node): string; - - /** - * @return array<string, string|int|float|bool> - * - * @psalm-return array<string, scalar> - */ - public function getXmlAttributes(Node $node): array; -} diff --git a/vendor/league/commonmark/src/Xml/XmlRenderer.php b/vendor/league/commonmark/src/Xml/XmlRenderer.php deleted file mode 100644 index 2973dd7..0000000 --- a/vendor/league/commonmark/src/Xml/XmlRenderer.php +++ /dev/null @@ -1,135 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace League\CommonMark\Xml; - -use League\CommonMark\Environment\EnvironmentInterface; -use League\CommonMark\Event\DocumentPreRenderEvent; -use League\CommonMark\Exception\InvalidArgumentException; -use League\CommonMark\Node\Block\Document; -use League\CommonMark\Node\Node; -use League\CommonMark\Node\StringContainerInterface; -use League\CommonMark\Output\RenderedContent; -use League\CommonMark\Output\RenderedContentInterface; -use League\CommonMark\Renderer\DocumentRendererInterface; -use League\CommonMark\Util\Xml; - -final class XmlRenderer implements DocumentRendererInterface -{ - private const INDENTATION = ' '; - - private EnvironmentInterface $environment; - - private XmlNodeRendererInterface $fallbackRenderer; - - /** @var array<class-string, XmlNodeRendererInterface> */ - private array $rendererCache = []; - - public function __construct(EnvironmentInterface $environment) - { - $this->environment = $environment; - $this->fallbackRenderer = new FallbackNodeXmlRenderer(); - } - - public function renderDocument(Document $document): RenderedContentInterface - { - $this->environment->dispatch(new DocumentPreRenderEvent($document, 'xml')); - - $xml = '<?xml version="1.0" encoding="UTF-8"?>'; - - $indent = 0; - $walker = $document->walker(); - while ($event = $walker->next()) { - $node = $event->getNode(); - - $closeImmediately = ! $node->hasChildren(); - $selfClosing = $closeImmediately && ! $node instanceof StringContainerInterface; - - $renderer = $this->findXmlRenderer($node); - $tagName = $renderer->getXmlTagName($node); - - if ($event->isEntering()) { - $attrs = $renderer->getXmlAttributes($node); - - $xml .= "\n" . \str_repeat(self::INDENTATION, $indent); - $xml .= self::tag($tagName, $attrs, $selfClosing); - - if ($node instanceof StringContainerInterface) { - $xml .= Xml::escape($node->getLiteral()); - } - - if ($closeImmediately && ! $selfClosing) { - $xml .= self::tag('/' . $tagName); - } - - if (! $closeImmediately) { - $indent++; - } - } elseif (! $closeImmediately) { - $indent--; - $xml .= "\n" . \str_repeat(self::INDENTATION, $indent); - $xml .= self::tag('/' . $tagName); - } - } - - return new RenderedContent($document, $xml . "\n"); - } - - /** - * @param array<string, string|int|float|bool> $attrs - */ - private static function tag(string $name, array $attrs = [], bool $selfClosing = \false): string - { - $result = '<' . $name; - foreach ($attrs as $key => $value) { - $result .= \sprintf(' %s="%s"', $key, self::convertAndEscape($value)); - } - - if ($selfClosing) { - $result .= ' /'; - } - - $result .= '>'; - - return $result; - } - - /** - * @param string|int|float|bool $value - */ - private static function convertAndEscape($value): string - { - if (\is_string($value)) { - return Xml::escape($value); - } - - if (\is_int($value) || \is_float($value)) { - return (string) $value; - } - - if (\is_bool($value)) { - return $value ? 'true' : 'false'; - } - - // @phpstan-ignore-next-line - throw new InvalidArgumentException('$value must be a string, int, float, or bool'); - } - - private function findXmlRenderer(Node $node): XmlNodeRendererInterface - { - $class = \get_class($node); - - if (\array_key_exists($class, $this->rendererCache)) { - return $this->rendererCache[$class]; - } - - foreach ($this->environment->getRenderersForClass($class) as $renderer) { - if ($renderer instanceof XmlNodeRendererInterface) { - return $this->rendererCache[$class] = $renderer; - } - } - - return $this->rendererCache[$class] = $this->fallbackRenderer; - } -} diff --git a/vendor/league/config/CHANGELOG.md b/vendor/league/config/CHANGELOG.md deleted file mode 100644 index 9a7813a..0000000 --- a/vendor/league/config/CHANGELOG.md +++ /dev/null @@ -1,42 +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.2.0] - 2022-12-11 - -### Changed - -- Values can now be set prior to the corresponding schema being registered. -- `exists()` and `get()` now only trigger validation for the relevant schema, not the entire config at once. - -## [1.1.1] - 2021-08-14 - -### Changed - - - Bumped the minimum version of dflydev/dot-access-data for PHP 8.1 support - -## [1.1.0] - 2021-06-19 - -### Changed - -- Bumped the minimum PHP version to 7.4+ -- Bumped the minimum version of nette/schema to 1.2.0 - -## [1.0.1] - 2021-05-31 - -### Fixed - -- Fixed the `ConfigurationExceptionInterface` marker interface not extending `Throwable` (#2) - -## [1.0.0] - 2021-05-31 - -Initial release! 🎉 - -[unreleased]: https://github.com/thephpleague/config/compare/v1.2.0...main -[1.2.0]: https://github.com/thephpleague/config/compare/v1.1.1...v.1.2.0 -[1.1.1]: https://github.com/thephpleague/config/compare/v1.1.0...v1.1.1 -[1.1.0]: https://github.com/thephpleague/config/compare/v1.0.1...v1.1.0 -[1.0.1]: https://github.com/thephpleague/config/compare/v1.0.0...v1.0.1 -[1.0.0]: https://github.com/thephpleague/config/releases/tag/v1.0.0 diff --git a/vendor/league/config/LICENSE.md b/vendor/league/config/LICENSE.md deleted file mode 100644 index 1a444a1..0000000 --- a/vendor/league/config/LICENSE.md +++ /dev/null @@ -1,28 +0,0 @@ -BSD 3-Clause License - -Copyright (c) 2022, Colin O'Dell. All rights reserved. - -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/config/README.md b/vendor/league/config/README.md deleted file mode 100644 index 2304746..0000000 --- a/vendor/league/config/README.md +++ /dev/null @@ -1,153 +0,0 @@ -# league/config - -[![Latest Version](https://img.shields.io/packagist/v/league/config.svg?style=flat-square)](https://packagist.org/packages/league/config) -[![Total Downloads](https://img.shields.io/packagist/dt/league/config.svg?style=flat-square)](https://packagist.org/packages/league/config) -[![Software License](https://img.shields.io/badge/License-BSD--3-brightgreen.svg?style=flat-square)](LICENSE) -[![Build Status](https://img.shields.io/github/workflow/status/thephpleague/config/Tests/main.svg?style=flat-square)](https://github.com/thephpleague/config/actions?query=workflow%3ATests+branch%3Amain) -[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/thephpleague/config.svg?style=flat-square)](https://scrutinizer-ci.com/g/thephpleague/config/code-structure) -[![Quality Score](https://img.shields.io/scrutinizer/g/thephpleague/config.svg?style=flat-square)](https://scrutinizer-ci.com/g/thephpleague/config) -[![Sponsor development of this project](https://img.shields.io/badge/sponsor%20this%20package-%E2%9D%A4-ff69b4.svg?style=flat-square)](https://www.colinodell.com/sponsor) - -**league/config** helps you define nested configuration arrays with strict schemas and access configuration values with dot notation. It was created by [Colin O'Dell][@colinodell]. - -## 📦 Installation - -This project requires PHP 7.4 or higher. To install it via [Composer] simply run: - -```bash -composer require league/config -``` - -## 🧰️ Basic Usage - -The `Configuration` class provides everything you need to define the configuration structure and fetch values: - -```php -use League\Config\Configuration; -use Nette\Schema\Expect; - -// Define your configuration schema -$config = new Configuration([ - 'database' => Expect::structure([ - 'driver' => Expect::anyOf('mysql', 'postgresql', 'sqlite')->required(), - 'host' => Expect::string()->default('localhost'), - 'port' => Expect::int()->min(1)->max(65535), - 'ssl' => Expect::bool(), - 'database' => Expect::string()->required(), - 'username' => Expect::string()->required(), - 'password' => Expect::string()->nullable(), - ]), - 'logging' => Expect::structure([ - 'enabled' => Expect::bool()->default($_ENV['DEBUG'] == true), - 'file' => Expect::string()->deprecated("use logging.path instead"), - 'path' => Expect::string()->assert(function ($path) { return \is_writeable($path); })->required(), - ]), -]); - -// Set the values, either all at once with `merge()`: -$config->merge([ - 'database' => [ - 'driver' => 'mysql', - 'port' => 3306, - 'database' => 'mydb', - 'username' => 'user', - 'password' => 'secret', - ], -]); - -// Or one-at-a-time with `set()`: -$config->set('logging.path', '/var/log/myapp.log'); - -// You can now retrieve those values with `get()`. -// Validation and defaults will be applied for you automatically -$config->get('database'); // Fetches the entire "database" section as an array -$config->get('database.driver'); // Fetch a specific nested value with dot notation -$config->get('database/driver'); // Fetch a specific nested value with slash notation -$config->get('database.host'); // Returns the default value "localhost" -$config->get('logging.path'); // Guaranteed to be writeable thanks to the assertion in the schema - -// If validation fails an `InvalidConfigurationException` will be thrown: -$config->set('database.driver', 'mongodb'); -$config->get('database.driver'); // InvalidConfigurationException - -// Attempting to fetch a non-existent key will result in an `InvalidConfigurationException` -$config->get('foo.bar'); - -// You could avoid this by checking whether that item exists: -$config->exists('foo.bar'); // Returns `false` -``` - -## 📓 Documentation - -Full documentation can be found at [config.thephpleague.com][docs]. - -## 💭 Philosophy - -This library aims to provide a **simple yet opinionated** approach to configuration with the following goals: - -- The configuration should operate on **arrays with nested values** which are easily accessible -- The configuration structure should be **defined with strict schemas** defining the overall structure, allowed types, and allowed values -- Schemas should be defined using a **simple, fluent interface** -- You should be able to **add and combine schemas but never modify existing ones** -- Both the configuration values and the schema should be **defined and managed with PHP code** -- Schemas should be **immutable**; they should never change once they are set -- Configuration values should never define or influence the schemas - -As a result, this library will likely **never** support features like: - -- Loading and/or exporting configuration values or schemas using YAML, XML, or other files -- Parsing configuration values from a command line or other user interface -- Dynamically changing the schema, allowed values, or default values based on other configuration values - -If you need that functionality you should check out other libraries like: - -- [symfony/config] -- [symfony/options-resolver] -- [hassankhan/config] -- [consolidation/config] -- [laminas/laminas-config] - -## 🏷️ Versioning - -[SemVer](http://semver.org/) is followed closely. Minor and patch releases should not introduce breaking changes to the codebase. - -Any classes or methods marked `@internal` are not intended for use outside 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.0` -> `1.1`) is released, the previous one (`1.0`) will continue to receive security and critical bug fixes for *at least* 3 months. - -When a new **major** version is released (e.g. `1.1` -> `2.0`), the previous one (`1.1`) 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.) - -## 👷‍️ Contributing - -Contributions to this library are **welcome**! We only ask that you adhere to our [contributor guidelines] and avoid making changes that conflict with our Philosophy above. - -## 🧪 Testing - -```bash -composer test -``` - -## 📄 License - -**league/config** is licensed under the BSD-3 license. See the [`LICENSE.md`][license] file for more details. - -## 🗺️ Who Uses It? - -This project is used by [league/commonmark][league-commonmark]. - -[docs]: https://config.thephpleague.com/ -[@colinodell]: https://www.twitter.com/colinodell -[Composer]: https://getcomposer.org/ -[PHP League]: https://thephpleague.com -[symfony/config]: https://symfony.com/doc/current/components/config.html -[symfony/options-resolver]: https://symfony.com/doc/current/components/options_resolver.html -[hassankhan/config]: https://github.com/hassankhan/config -[consolidation/config]: https://github.com/consolidation/config -[laminas/laminas-config]: https://docs.laminas.dev/laminas-config/ -[contributor guidelines]: https://github.com/thephpleague/config/blob/main/.github/CONTRIBUTING.md -[license]: https://github.com/thephpleague/config/blob/main/LICENSE.md -[league-commonmark]: https://commonmark.thephpleague.com diff --git a/vendor/league/config/composer.json b/vendor/league/config/composer.json deleted file mode 100644 index 3cd8d87..0000000 --- a/vendor/league/config/composer.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "league/config", - "type": "library", - "description": "Define configuration arrays with strict schemas and access values with dot notation", - "keywords": ["configuration","config","schema","array","nested","dot","dot-access"], - "homepage": "https://config.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://config.thephpleague.com/", - "issues": "https://github.com/thephpleague/config/issues", - "rss": "https://github.com/thephpleague/config/releases.atom", - "source": "https://github.com/thephpleague/config" - }, - "require": { - "php": "^7.4 || ^8.0", - "dflydev/dot-access-data": "^3.0.1", - "nette/schema": "^1.2" - }, - "require-dev": { - "phpstan/phpstan": "^1.8.2", - "phpunit/phpunit": "^9.5.5", - "scrutinizer/ocular": "^1.8.1", - "unleashedtech/php-coding-standard": "^3.1", - "vimeo/psalm": "^4.7.3" - }, - "minimum-stability": "dev", - "prefer-stable": true, - "autoload": { - "psr-4": { - "League\\Config\\": "src" - } - }, - "autoload-dev": { - "psr-4": { - "League\\Config\\Tests\\": "tests" - } - }, - "scripts": { - "phpcs": "phpcs", - "phpstan": "phpstan analyse", - "phpunit": "phpunit --no-coverage", - "psalm": "psalm", - "test": [ - "@phpcs", - "@phpstan", - "@psalm", - "@phpunit" - ] - }, - "extra": { - "branch-alias": { - "dev-main": "1.2-dev" - } - }, - "config": { - "sort-packages": true, - "allow-plugins": { - "dealerdirect/phpcodesniffer-composer-installer": true - } - } -} diff --git a/vendor/league/config/src/Configuration.php b/vendor/league/config/src/Configuration.php deleted file mode 100644 index 6294367..0000000 --- a/vendor/league/config/src/Configuration.php +++ /dev/null @@ -1,255 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/config 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\Config; - -use Dflydev\DotAccessData\Data; -use Dflydev\DotAccessData\DataInterface; -use Dflydev\DotAccessData\Exception\DataException; -use Dflydev\DotAccessData\Exception\InvalidPathException; -use Dflydev\DotAccessData\Exception\MissingPathException; -use League\Config\Exception\UnknownOptionException; -use League\Config\Exception\ValidationException; -use Nette\Schema\Expect; -use Nette\Schema\Processor; -use Nette\Schema\Schema; -use Nette\Schema\ValidationException as NetteValidationException; - -final class Configuration implements ConfigurationBuilderInterface, ConfigurationInterface -{ - /** @psalm-readonly */ - private Data $userConfig; - - /** - * @var array<string, Schema> - * - * @psalm-allow-private-mutation - */ - private array $configSchemas = []; - - /** @psalm-allow-private-mutation */ - private Data $finalConfig; - - /** - * @var array<string, mixed> - * - * @psalm-allow-private-mutation - */ - private array $cache = []; - - /** @psalm-readonly */ - private ConfigurationInterface $reader; - - /** - * @param array<string, Schema> $baseSchemas - */ - public function __construct(array $baseSchemas = []) - { - $this->configSchemas = $baseSchemas; - $this->userConfig = new Data(); - $this->finalConfig = new Data(); - - $this->reader = new ReadOnlyConfiguration($this); - } - - /** - * Registers a new configuration schema at the given top-level key - * - * @psalm-allow-private-mutation - */ - public function addSchema(string $key, Schema $schema): void - { - $this->invalidate(); - - $this->configSchemas[$key] = $schema; - } - - /** - * {@inheritDoc} - * - * @psalm-allow-private-mutation - */ - public function merge(array $config = []): void - { - $this->invalidate(); - - $this->userConfig->import($config, DataInterface::REPLACE); - } - - /** - * {@inheritDoc} - * - * @psalm-allow-private-mutation - */ - public function set(string $key, $value): void - { - $this->invalidate(); - - try { - $this->userConfig->set($key, $value); - } catch (DataException $ex) { - throw new UnknownOptionException($ex->getMessage(), $key, (int) $ex->getCode(), $ex); - } - } - - /** - * {@inheritDoc} - * - * @psalm-external-mutation-free - */ - public function get(string $key) - { - if (\array_key_exists($key, $this->cache)) { - return $this->cache[$key]; - } - - try { - $this->build(self::getTopLevelKey($key)); - - return $this->cache[$key] = $this->finalConfig->get($key); - } catch (InvalidPathException | MissingPathException $ex) { - throw new UnknownOptionException($ex->getMessage(), $key, (int) $ex->getCode(), $ex); - } - } - - /** - * {@inheritDoc} - * - * @psalm-external-mutation-free - */ - public function exists(string $key): bool - { - if (\array_key_exists($key, $this->cache)) { - return true; - } - - try { - $this->build(self::getTopLevelKey($key)); - - return $this->finalConfig->has($key); - } catch (InvalidPathException | UnknownOptionException $ex) { - return false; - } - } - - /** - * @psalm-mutation-free - */ - public function reader(): ConfigurationInterface - { - return $this->reader; - } - - /** - * @psalm-external-mutation-free - */ - private function invalidate(): void - { - $this->cache = []; - $this->finalConfig = new Data(); - } - - /** - * Applies the schema against the configuration to return the final configuration - * - * @throws ValidationException|UnknownOptionException|InvalidPathException - * - * @psalm-allow-private-mutation - */ - private function build(string $topLevelKey): void - { - if ($this->finalConfig->has($topLevelKey)) { - return; - } - - if (! isset($this->configSchemas[$topLevelKey])) { - throw new UnknownOptionException(\sprintf('Missing config schema for "%s"', $topLevelKey), $topLevelKey); - } - - try { - $userData = [$topLevelKey => $this->userConfig->get($topLevelKey)]; - } catch (DataException $ex) { - $userData = []; - } - - try { - $schema = $this->configSchemas[$topLevelKey]; - $processor = new Processor(); - - $processed = $processor->process(Expect::structure([$topLevelKey => $schema]), $userData); - - $this->raiseAnyDeprecationNotices($processor->getWarnings()); - - $this->finalConfig->import((array) self::convertStdClassesToArrays($processed)); - } catch (NetteValidationException $ex) { - throw new ValidationException($ex); - } - } - - /** - * Recursively converts stdClass instances to arrays - * - * @phpstan-template T - * - * @param T $data - * - * @return mixed - * - * @phpstan-return ($data is \stdClass ? array<string, mixed> : T) - * - * @psalm-pure - */ - private static function convertStdClassesToArrays($data) - { - if ($data instanceof \stdClass) { - $data = (array) $data; - } - - if (\is_array($data)) { - foreach ($data as $k => $v) { - $data[$k] = self::convertStdClassesToArrays($v); - } - } - - return $data; - } - - /** - * @param string[] $warnings - */ - private function raiseAnyDeprecationNotices(array $warnings): void - { - foreach ($warnings as $warning) { - @\trigger_error($warning, \E_USER_DEPRECATED); - } - } - - /** - * @throws InvalidPathException - */ - private static function getTopLevelKey(string $path): string - { - if (\strlen($path) === 0) { - throw new InvalidPathException('Path cannot be an empty string'); - } - - $path = \str_replace(['.', '/'], '.', $path); - - $firstDelimiter = \strpos($path, '.'); - if ($firstDelimiter === false) { - return $path; - } - - return \substr($path, 0, $firstDelimiter); - } -} diff --git a/vendor/league/config/src/ConfigurationAwareInterface.php b/vendor/league/config/src/ConfigurationAwareInterface.php deleted file mode 100644 index ec5d7b3..0000000 --- a/vendor/league/config/src/ConfigurationAwareInterface.php +++ /dev/null @@ -1,22 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/config 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\Config; - -/** - * Implement this class to facilitate setter injection of the configuration where needed - */ -interface ConfigurationAwareInterface -{ - public function setConfiguration(ConfigurationInterface $configuration): void; -} diff --git a/vendor/league/config/src/ConfigurationBuilderInterface.php b/vendor/league/config/src/ConfigurationBuilderInterface.php deleted file mode 100644 index e9c5ed6..0000000 --- a/vendor/league/config/src/ConfigurationBuilderInterface.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/config 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\Config; - -/** - * An interface that provides the ability to set both the schema and configuration values - */ -interface ConfigurationBuilderInterface extends MutableConfigurationInterface, SchemaBuilderInterface -{ -} diff --git a/vendor/league/config/src/ConfigurationInterface.php b/vendor/league/config/src/ConfigurationInterface.php deleted file mode 100644 index 534bd9f..0000000 --- a/vendor/league/config/src/ConfigurationInterface.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/config 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\Config; - -use League\Config\Exception\UnknownOptionException; -use League\Config\Exception\ValidationException; - -/** - * Interface for reading configuration values - */ -interface ConfigurationInterface -{ - /** - * @param string $key Configuration option path/key - * - * @psalm-param non-empty-string $key - * - * @return mixed - * - * @throws ValidationException if the schema failed to validate the given input - * @throws UnknownOptionException if the requested key does not exist or is malformed - */ - public function get(string $key); - - /** - * @param string $key Configuration option path/key - * - * @psalm-param non-empty-string $key - * - * @return bool Whether the given option exists - * - * @throws ValidationException if the schema failed to validate the given input - */ - public function exists(string $key): bool; -} diff --git a/vendor/league/config/src/ConfigurationProviderInterface.php b/vendor/league/config/src/ConfigurationProviderInterface.php deleted file mode 100644 index 7af6148..0000000 --- a/vendor/league/config/src/ConfigurationProviderInterface.php +++ /dev/null @@ -1,22 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/config 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\Config; - -/** - * Interface for a service which provides a readable configuration object - */ -interface ConfigurationProviderInterface -{ - public function getConfiguration(): ConfigurationInterface; -} diff --git a/vendor/league/config/src/Exception/ConfigurationExceptionInterface.php b/vendor/league/config/src/Exception/ConfigurationExceptionInterface.php deleted file mode 100644 index db9ee78..0000000 --- a/vendor/league/config/src/Exception/ConfigurationExceptionInterface.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/config 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\Config\Exception; - -/** - * Marker interface for any/all exceptions thrown by this library - */ -interface ConfigurationExceptionInterface extends \Throwable -{ -} diff --git a/vendor/league/config/src/Exception/InvalidConfigurationException.php b/vendor/league/config/src/Exception/InvalidConfigurationException.php deleted file mode 100644 index f2a6b69..0000000 --- a/vendor/league/config/src/Exception/InvalidConfigurationException.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/config 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\Config\Exception; - -class InvalidConfigurationException extends \UnexpectedValueException implements ConfigurationExceptionInterface -{ - /** - * @param string $option Name/path of the option - * @param mixed $valueGiven The invalid option that was provided - * @param ?string $description Additional text describing the issue (optional) - */ - public static function forConfigOption(string $option, $valueGiven, ?string $description = null): self - { - $message = \sprintf('Invalid config option for "%s": %s', $option, self::getDebugValue($valueGiven)); - if ($description !== null) { - $message .= \sprintf(' (%s)', $description); - } - - return new self($message); - } - - /** - * @param mixed $value - * - * @psalm-pure - */ - private static function getDebugValue($value): string - { - if (\is_object($value)) { - return \get_class($value); - } - - return \print_r($value, true); - } -} diff --git a/vendor/league/config/src/Exception/UnknownOptionException.php b/vendor/league/config/src/Exception/UnknownOptionException.php deleted file mode 100644 index 5afba12..0000000 --- a/vendor/league/config/src/Exception/UnknownOptionException.php +++ /dev/null @@ -1,33 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/config 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\Config\Exception; - -use Throwable; - -final class UnknownOptionException extends \InvalidArgumentException implements ConfigurationExceptionInterface -{ - private string $path; - - public function __construct(string $message, string $path, int $code = 0, ?Throwable $previous = null) - { - parent::__construct($message, $code, $previous); - - $this->path = $path; - } - - public function getPath(): string - { - return $this->path; - } -} diff --git a/vendor/league/config/src/Exception/ValidationException.php b/vendor/league/config/src/Exception/ValidationException.php deleted file mode 100644 index b43e2f5..0000000 --- a/vendor/league/config/src/Exception/ValidationException.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/config 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\Config\Exception; - -use Nette\Schema\ValidationException as NetteException; - -final class ValidationException extends InvalidConfigurationException -{ - /** @var string[] */ - private array $messages; - - public function __construct(NetteException $innerException) - { - parent::__construct($innerException->getMessage(), (int) $innerException->getCode(), $innerException); - - $this->messages = $innerException->getMessages(); - } - - /** - * @return string[] - */ - public function getMessages(): array - { - return $this->messages; - } -} diff --git a/vendor/league/config/src/MutableConfigurationInterface.php b/vendor/league/config/src/MutableConfigurationInterface.php deleted file mode 100644 index 2d4b2ee..0000000 --- a/vendor/league/config/src/MutableConfigurationInterface.php +++ /dev/null @@ -1,34 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/config 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\Config; - -use League\Config\Exception\UnknownOptionException; - -/** - * Interface for setting/merging user-defined configuration values into the configuration object - */ -interface MutableConfigurationInterface -{ - /** - * @param mixed $value - * - * @throws UnknownOptionException if $key contains a nested path which doesn't point to an array value - */ - public function set(string $key, $value): void; - - /** - * @param array<string, mixed> $config - */ - public function merge(array $config = []): void; -} diff --git a/vendor/league/config/src/ReadOnlyConfiguration.php b/vendor/league/config/src/ReadOnlyConfiguration.php deleted file mode 100644 index 58e6171..0000000 --- a/vendor/league/config/src/ReadOnlyConfiguration.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/config 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\Config; - -/** - * Provides read-only access to a given Configuration object - */ -final class ReadOnlyConfiguration implements ConfigurationInterface -{ - private Configuration $config; - - public function __construct(Configuration $config) - { - $this->config = $config; - } - - /** - * {@inheritDoc} - */ - public function get(string $key) - { - return $this->config->get($key); - } - - public function exists(string $key): bool - { - return $this->config->exists($key); - } -} diff --git a/vendor/league/config/src/SchemaBuilderInterface.php b/vendor/league/config/src/SchemaBuilderInterface.php deleted file mode 100644 index 3a19807..0000000 --- a/vendor/league/config/src/SchemaBuilderInterface.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the league/config 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\Config; - -use Nette\Schema\Schema; - -/** - * Interface that allows new schemas to be added to a configuration - */ -interface SchemaBuilderInterface -{ - /** - * Registers a new configuration schema at the given top-level key - */ - public function addSchema(string $key, Schema $schema): void; -} diff --git a/vendor/mnapoli/front-yaml/.gitattributes b/vendor/mnapoli/front-yaml/.gitattributes deleted file mode 100644 index b96632e..0000000 --- a/vendor/mnapoli/front-yaml/.gitattributes +++ /dev/null @@ -1,5 +0,0 @@ -# Auto detect text files and perform LF normalization -* text=auto - -tests/ export-ignore -.github/ export-ignore diff --git a/vendor/mnapoli/front-yaml/.gitignore b/vendor/mnapoli/front-yaml/.gitignore deleted file mode 100644 index 051d915..0000000 --- a/vendor/mnapoli/front-yaml/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -vendor/* -composer.phar -composer.lock - -.phpunit.result.cache \ No newline at end of file diff --git a/vendor/mnapoli/front-yaml/LICENSE b/vendor/mnapoli/front-yaml/LICENSE deleted file mode 100644 index f402bb1..0000000 --- a/vendor/mnapoli/front-yaml/LICENSE +++ /dev/null @@ -1,18 +0,0 @@ -FrontYAML - -Copyright (C) 2021 Matthieu Napoli - -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/mnapoli/front-yaml/README.md b/vendor/mnapoli/front-yaml/README.md deleted file mode 100644 index 14fecfe..0000000 --- a/vendor/mnapoli/front-yaml/README.md +++ /dev/null @@ -1,77 +0,0 @@ -# FrontYAML - -An implementation of YAML Front matter for PHP. It can parse both YAML **and** Markdown. - -[![Total Downloads](https://poser.pugx.org/mnapoli/front-yaml/downloads.svg)](https://packagist.org/packages/mnapoli/front-yaml) - -## Installation - -Require the project with Composer: - -``` -composer require mnapoli/front-yaml -``` - -## Usage - -```php -$parser = new Mni\FrontYAML\Parser; - -$document = $parser->parse($str); - -$yaml = $document->getYAML(); -$html = $document->getContent(); -``` - -If you don't want the Markdown to be parsed (maybe because it is not Markdown): - -```php -$document = $parser->parse($str, false); -``` - -## Example - -The following file: - -```markdown ---- -foo: bar ---- -This is **strong**. -``` - -Will give: - -```php -var_export($document->getYAML()); -// array("foo" => "bar") - -var_export($document->getContent()); -// "<p>This is <strong>strong</strong></p>" -``` - -## YAML and Markdown parsers - -```php -$parser = new Mni\FrontYAML\Parser($yamlParser, $markdownParser); -``` - -This library uses dependency injection and abstraction to allow you to provide your own YAML or Markdown parser. - -```php -interface YAMLParser -{ - public function parse($yaml); -} -``` - -FrontYAML uses by default [Symfony's YAML parser](http://symfony.com/doc/current/components/yaml/introduction.html). - -```php -interface MarkdownParser -{ - public function parse($markdown); -} -``` - -FrontYAML uses by default the [League CommonMark parser](https://github.com/thephpleague/commonmark). diff --git a/vendor/mnapoli/front-yaml/composer.json b/vendor/mnapoli/front-yaml/composer.json deleted file mode 100644 index aaa7372..0000000 --- a/vendor/mnapoli/front-yaml/composer.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "mnapoli/front-yaml", - "license": "MIT", - "autoload": { - "psr-4": { - "Mni\\FrontYAML\\": "src/" - } - }, - "autoload-dev": { - "psr-4": { - "Mni\\FrontYAML\\Test\\": "tests/" - } - }, - "require": { - "php": "^7.4|^8.0", - "symfony/yaml": "^4.0|^5.0|^6.0|^7.0", - "league/commonmark": "^2.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" - } -} diff --git a/vendor/mnapoli/front-yaml/phpunit.xml.dist b/vendor/mnapoli/front-yaml/phpunit.xml.dist deleted file mode 100644 index 93a96e8..0000000 --- a/vendor/mnapoli/front-yaml/phpunit.xml.dist +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - phpunit -c phpunit.xml ---> -<phpunit backupGlobals="false" - backupStaticAttributes="false" - colors="true" - convertErrorsToExceptions="true" - convertNoticesToExceptions="true" - convertWarningsToExceptions="true" - processIsolation="false" - stopOnFailure="false" - bootstrap="vendor/autoload.php"> - - <testsuites> - <testsuite name="Tests"> - <directory>./tests/</directory> - </testsuite> - </testsuites> - -</phpunit> diff --git a/vendor/mnapoli/front-yaml/src/Bridge/CommonMark/CommonMarkParser.php b/vendor/mnapoli/front-yaml/src/Bridge/CommonMark/CommonMarkParser.php deleted file mode 100644 index b1fc2c0..0000000 --- a/vendor/mnapoli/front-yaml/src/Bridge/CommonMark/CommonMarkParser.php +++ /dev/null @@ -1,25 +0,0 @@ -<?php declare(strict_types=1); - -namespace Mni\FrontYAML\Bridge\CommonMark; - -use League\CommonMark\CommonMarkConverter; -use League\CommonMark\MarkdownConverterInterface; -use Mni\FrontYAML\Markdown\MarkdownParser; - -/** - * Bridge to the League CommonMark parser - */ -class CommonMarkParser implements MarkdownParser -{ - private MarkdownConverterInterface $parser; - - public function __construct(MarkdownConverterInterface $commonMarkConverter = null) - { - $this->parser = $commonMarkConverter ?: new CommonMarkConverter; - } - - public function parse(string $markdown): string - { - return $this->parser->convertToHtml($markdown)->getContent(); - } -} diff --git a/vendor/mnapoli/front-yaml/src/Bridge/Symfony/SymfonyYAMLParser.php b/vendor/mnapoli/front-yaml/src/Bridge/Symfony/SymfonyYAMLParser.php deleted file mode 100644 index bf22d88..0000000 --- a/vendor/mnapoli/front-yaml/src/Bridge/Symfony/SymfonyYAMLParser.php +++ /dev/null @@ -1,24 +0,0 @@ -<?php declare(strict_types=1); - -namespace Mni\FrontYAML\Bridge\Symfony; - -use Mni\FrontYAML\YAML\YAMLParser; -use Symfony\Component\Yaml\Parser; - -/** - * Bridge to the Symfony YAML parser - */ -class SymfonyYAMLParser implements YAMLParser -{ - private Parser $parser; - - public function __construct() - { - $this->parser = new Parser; - } - - public function parse(string $yaml) - { - return $this->parser->parse($yaml); - } -} diff --git a/vendor/mnapoli/front-yaml/src/Document.php b/vendor/mnapoli/front-yaml/src/Document.php deleted file mode 100644 index 4af4e8d..0000000 --- a/vendor/mnapoli/front-yaml/src/Document.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php declare(strict_types=1); - -namespace Mni\FrontYAML; - -class Document -{ - /** @var mixed */ - private $yaml; - - private string $content; - - /** - * @param mixed $yaml YAML content. - * @param string $content Content of the document. - */ - public function __construct($yaml, string $content) - { - $this->yaml = $yaml; - $this->content = $content; - } - - /** - * @return mixed YAML content. - */ - public function getYAML() - { - return $this->yaml; - } - - /** - * @return string Content of the document. - */ - public function getContent(): string - { - return $this->content; - } -} diff --git a/vendor/mnapoli/front-yaml/src/Markdown/MarkdownParser.php b/vendor/mnapoli/front-yaml/src/Markdown/MarkdownParser.php deleted file mode 100644 index f5dd7b9..0000000 --- a/vendor/mnapoli/front-yaml/src/Markdown/MarkdownParser.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php declare(strict_types=1); - -namespace Mni\FrontYAML\Markdown; - -/** - * Interface of a Markdown parser - */ -interface MarkdownParser -{ - /** - * Parses a Markdown string to HTML. - * - * @param string $markdown Markdown document. - * - * @return string HTML document. - */ - public function parse(string $markdown): string; -} diff --git a/vendor/mnapoli/front-yaml/src/Parser.php b/vendor/mnapoli/front-yaml/src/Parser.php deleted file mode 100644 index 2aa7fd4..0000000 --- a/vendor/mnapoli/front-yaml/src/Parser.php +++ /dev/null @@ -1,71 +0,0 @@ -<?php declare(strict_types=1); - -namespace Mni\FrontYAML; - -use Mni\FrontYAML\Bridge\CommonMark\CommonMarkParser; -use Mni\FrontYAML\Bridge\Symfony\SymfonyYAMLParser; -use Mni\FrontYAML\Markdown\MarkdownParser; -use Mni\FrontYAML\YAML\YAMLParser; - -/** - * YAML Front matter parser - */ -class Parser -{ - /** - * @var YAMLParser - */ - private $yamlParser; - - /** - * @var MarkdownParser - */ - private $markdownParser; - - private array $startSep; - - private array $endSep; - - /** - * @param string|string[] $startSep - * @param string|string[] $endSep - */ - public function __construct( - ?YAMLParser $yamlParser = null, - ?MarkdownParser $markdownParser = null, - $startSep = '---', - $endSep = '---' - ) { - $this->yamlParser = $yamlParser ?: new SymfonyYAMLParser; - $this->markdownParser = $markdownParser ?: new CommonMarkParser; - $this->startSep = array_filter((array) $startSep, 'is_string') ?: ['---']; - $this->endSep = array_filter((array) $endSep, 'is_string') ?: ['---']; - } - - /** - * Parse a string containing the YAML front matter and the markdown. - * - * @param bool $parseMarkdown Should the Markdown be turned into HTML? - */ - public function parse(string $str, bool $parseMarkdown = true): Document - { - $yaml = null; - - $quote = static function ($str) { - return preg_quote($str, "~"); - }; - - $regex = '~^(' - .implode('|', array_map($quote, $this->startSep)) # $matches[1] start separator - ."){1}[\r\n|\n]*(.*?)[\r\n|\n]+(" # $matches[2] between separators - .implode('|', array_map($quote, $this->endSep)) # $matches[3] end separator - ."){1}[\r\n|\n]*(.*)$~s"; # $matches[4] document content - - if (preg_match($regex, $str, $matches) === 1) { // There is a Front matter - $yaml = trim($matches[2]) !== '' ? $this->yamlParser->parse(trim($matches[2])) : null; - $str = ltrim($matches[4]); - } - - return new Document($yaml, $parseMarkdown ? $this->markdownParser->parse($str) : $str); - } -} diff --git a/vendor/mnapoli/front-yaml/src/YAML/YAMLParser.php b/vendor/mnapoli/front-yaml/src/YAML/YAMLParser.php deleted file mode 100644 index 0b4c6c2..0000000 --- a/vendor/mnapoli/front-yaml/src/YAML/YAMLParser.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php declare(strict_types=1); - -namespace Mni\FrontYAML\YAML; - -/** - * Interface of a YAML parser - */ -interface YAMLParser -{ - /** - * Parses a YAML string. - * - * @return mixed - */ - public function parse(string $yaml); -} diff --git a/vendor/nette/schema/composer.json b/vendor/nette/schema/composer.json deleted file mode 100644 index 56b8452..0000000 --- a/vendor/nette/schema/composer.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "nette/schema", - "description": "📐 Nette Schema: validating data structures against a given Schema.", - "keywords": ["nette", "config"], - "homepage": "https://nette.org", - "license": ["BSD-3-Clause", "GPL-2.0-only", "GPL-3.0-only"], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "require": { - "php": "8.1 - 8.4", - "nette/utils": "^4.0" - }, - "require-dev": { - "nette/tester": "^2.5.2", - "tracy/tracy": "^2.8", - "phpstan/phpstan-nette": "^1.0" - }, - "autoload": { - "classmap": ["src/"] - }, - "minimum-stability": "dev", - "scripts": { - "phpstan": "phpstan analyse", - "tester": "tester tests -s" - }, - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - } -} diff --git a/vendor/nette/schema/license.md b/vendor/nette/schema/license.md deleted file mode 100644 index cf741bd..0000000 --- a/vendor/nette/schema/license.md +++ /dev/null @@ -1,60 +0,0 @@ -Licenses -======== - -Good news! You may use Nette Framework under the terms of either -the New BSD License or the GNU General Public License (GPL) version 2 or 3. - -The BSD License is recommended for most projects. It is easy to understand and it -places almost no restrictions on what you can do with the framework. If the GPL -fits better to your project, you can use the framework under this license. - -You don't have to notify anyone which license you are using. You can freely -use Nette Framework in commercial projects as long as the copyright header -remains intact. - -Please be advised that the name "Nette Framework" is a protected trademark and its -usage has some limitations. So please do not use word "Nette" in the name of your -project or top-level domain, and choose a name that stands on its own merits. -If your stuff is good, it will not take long to establish a reputation for yourselves. - - -New BSD License ---------------- - -Copyright (c) 2004, 2014 David Grudl (https://davidgrudl.com) -All rights reserved. - -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 "Nette Framework" 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 owner 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. - - -GNU General Public License --------------------------- - -GPL licenses are very very long, so instead of including them here we offer -you URLs with full text: - -- [GPL version 2](http://www.gnu.org/licenses/gpl-2.0.html) -- [GPL version 3](http://www.gnu.org/licenses/gpl-3.0.html) diff --git a/vendor/nette/schema/readme.md b/vendor/nette/schema/readme.md deleted file mode 100644 index 5ee1382..0000000 --- a/vendor/nette/schema/readme.md +++ /dev/null @@ -1,537 +0,0 @@ -Nette Schema -************ - -[![Downloads this Month](https://img.shields.io/packagist/dm/nette/schema.svg)](https://packagist.org/packages/nette/schema) -[![Tests](https://github.com/nette/schema/workflows/Tests/badge.svg?branch=master)](https://github.com/nette/schema/actions) -[![Coverage Status](https://coveralls.io/repos/github/nette/schema/badge.svg?branch=master)](https://coveralls.io/github/nette/schema?branch=master) -[![Latest Stable Version](https://poser.pugx.org/nette/schema/v/stable)](https://github.com/nette/schema/releases) -[![License](https://img.shields.io/badge/license-New%20BSD-blue.svg)](https://github.com/nette/schema/blob/master/license.md) - - -Introduction -============ - -A practical library for validation and normalization of data structures against a given schema with a smart & easy-to-understand API. - -Documentation can be found on the [website](https://doc.nette.org/schema). - -Installation: - -```shell -composer require nette/schema -``` - -It requires PHP version 8.1 and supports PHP up to 8.4. - - -[Support Me](https://github.com/sponsors/dg) --------------------------------------------- - -Do you like Nette Schema? Are you looking forward to the new features? - -[![Buy me a coffee](https://files.nette.org/icons/donation-3.svg)](https://github.com/sponsors/dg) - -Thank you! - - -Basic Usage ------------ - -In variable `$schema` we have a validation schema (what exactly this means and how to create it we will say later) and in variable `$data` we have a data structure that we want to validate and normalize. This can be, for example, data sent by the user through an API, configuration file, etc. - -The task is handled by the [Nette\Schema\Processor](https://api.nette.org/schema/master/Nette/Schema/Processor.html) class, which processes the input and either returns normalized data or throws an [Nette\Schema\ValidationException](https://api.nette.org/schema/master/Nette/Schema/ValidationException.html) exception on error. - -```php -$processor = new Nette\Schema\Processor; - -try { - $normalized = $processor->process($schema, $data); -} catch (Nette\Schema\ValidationException $e) { - echo 'Data is invalid: ' . $e->getMessage(); -} -``` - -Method `$e->getMessages()` returns array of all message strings and `$e->getMessageObjects()` return all messages as [Nette\Schema\Message](https://api.nette.org/schema/master/Nette/Schema/Message.html) objects. - - -Defining Schema ---------------- - -And now let's create a schema. The class [Nette\Schema\Expect](https://api.nette.org/schema/master/Nette/Schema/Expect.html) is used to define it, we actually define expectations of what the data should look like. Let's say that the input data must be a structure (e.g. an array) containing elements `processRefund` of type bool and `refundAmount` of type int. - -```php -use Nette\Schema\Expect; - -$schema = Expect::structure([ - 'processRefund' => Expect::bool(), - 'refundAmount' => Expect::int(), -]); -``` - -We believe that the schema definition looks clear, even if you see it for the very first time. - -Lets send the following data for validation: - -```php -$data = [ - 'processRefund' => true, - 'refundAmount' => 17, -]; - -$normalized = $processor->process($schema, $data); // OK, it passes -``` - -The output, i.e. the value `$normalized`, is the object `stdClass`. If we want the output to be an array, we add a cast to schema `Expect::structure([...])->castTo('array')`. - -All elements of the structure are optional and have a default value `null`. Example: - -```php -$data = [ - 'refundAmount' => 17, -]; - -$normalized = $processor->process($schema, $data); // OK, it passes -// $normalized = {'processRefund' => null, 'refundAmount' => 17} -``` - -The fact that the default value is `null` does not mean that it would be accepted in the input data `'processRefund' => null`. No, the input must be boolean, i.e. only `true` or `false`. We would have to explicitly allow `null` via `Expect::bool()->nullable()`. - -An item can be made mandatory using `Expect::bool()->required()`. We change the default value to `false` using `Expect::bool()->default(false)` or shortly using `Expect::bool(false)`. - -And what if we wanted to accept `1` and `0` besides booleans? Then we list the allowed values, which we will also normalize to boolean: - -```php -$schema = Expect::structure([ - 'processRefund' => Expect::anyOf(true, false, 1, 0)->castTo('bool'), - 'refundAmount' => Expect::int(), -]); - -$normalized = $processor->process($schema, $data); -is_bool($normalized->processRefund); // true -``` - -Now you know the basics of how the schema is defined and how the individual elements of the structure behave. We will now show what all the other elements can be used in defining a schema. - - -Data Types: type() ------------------- - -All standard PHP data types can be listed in the schema: - -```php -Expect::string($default = null) -Expect::int($default = null) -Expect::float($default = null) -Expect::bool($default = null) -Expect::null() -Expect::array($default = []) -``` - -And then all types [supported by the Validators](https://doc.nette.org/validators#toc-validation-rules) via `Expect::type('scalar')` or abbreviated `Expect::scalar()`. Also class or interface names are accepted, e.g. `Expect::type('AddressEntity')`. - -You can also use union notation: - -```php -Expect::type('bool|string|array') -``` - -The default value is always `null` except for `array` and `list`, where it is an empty array. (A list is an array indexed in ascending order of numeric keys from zero, that is, a non-associative array). - - -Array of Values: arrayOf() listOf() ------------------------------------ - -The array is too general structure, it is more useful to specify exactly what elements it can contain. For example, an array whose elements can only be strings: - -```php -$schema = Expect::arrayOf('string'); - -$processor->process($schema, ['hello', 'world']); // OK -$processor->process($schema, ['a' => 'hello', 'b' => 'world']); // OK -$processor->process($schema, ['key' => 123]); // ERROR: 123 is not a string -``` - -The second parameter can be used to specify keys (since version 1.2): - -```php -$schema = Expect::arrayOf('string', 'int'); - -$processor->process($schema, ['hello', 'world']); // OK -$processor->process($schema, ['a' => 'hello']); // ERROR: 'a' is not int -``` - -The list is an indexed array: - -```php -$schema = Expect::listOf('string'); - -$processor->process($schema, ['a', 'b']); // OK -$processor->process($schema, ['a', 123]); // ERROR: 123 is not a string -$processor->process($schema, ['key' => 'a']); // ERROR: is not a list -$processor->process($schema, [1 => 'a', 0 => 'b']); // ERROR: is not a list -``` - -The parameter can also be a schema, so we can write: - -```php -Expect::arrayOf(Expect::bool()) -``` - -The default value is an empty array. If you specify a default value, it will be merged with the passed data. This can be disabled using `mergeDefaults(false)`. - - -Enumeration: anyOf() --------------------- - -`anyOf()` is a set of values ​​or schemas that a value can be. Here's how to write an array of elements that can be either `'a'`, `true`, or `null`: - -```php -$schema = Expect::listOf( - Expect::anyOf('a', true, null), -); - -$processor->process($schema, ['a', true, null, 'a']); // OK -$processor->process($schema, ['a', false]); // ERROR: false does not belong there -``` - -The enumeration elements can also be schemas: - -```php -$schema = Expect::listOf( - Expect::anyOf(Expect::string(), true, null), -); - -$processor->process($schema, ['foo', true, null, 'bar']); // OK -$processor->process($schema, [123]); // ERROR -``` - -The `anyOf()` method accepts variants as individual parameters, not as array. To pass it an array of values, use the unpacking operator `anyOf(...$variants)`. - -The default value is `null`. Use the `firstIsDefault()` method to make the first element the default: - -```php -// default is 'hello' -Expect::anyOf(Expect::string('hello'), true, null)->firstIsDefault(); -``` - - -Structures ----------- - -Structures are objects with defined keys. Each of these key => value pairs is referred to as a "property": - -Structures accept arrays and objects and return objects `stdClass` (unless you change it with `castTo('array')`, etc.). - -By default, all properties are optional and have a default value of `null`. You can define mandatory properties using `required()`: - -```php -$schema = Expect::structure([ - 'required' => Expect::string()->required(), - 'optional' => Expect::string(), // the default value is null -]); - -$processor->process($schema, ['optional' => '']); -// ERROR: option 'required' is missing - -$processor->process($schema, ['required' => 'foo']); -// OK, returns {'required' => 'foo', 'optional' => null} -``` - -If you do not want to output properties with only a default value, use `skipDefaults()`: - -```php -$schema = Expect::structure([ - 'required' => Expect::string()->required(), - 'optional' => Expect::string(), -])->skipDefaults(); - -$processor->process($schema, ['required' => 'foo']); -// OK, returns {'required' => 'foo'} -``` - -Although `null` is the default value of the `optional` property, it is not allowed in the input data (the value must be a string). Properties accepting `null` are defined using `nullable()`: - -```php -$schema = Expect::structure([ - 'optional' => Expect::string(), - 'nullable' => Expect::string()->nullable(), -]); - -$processor->process($schema, ['optional' => null]); -// ERROR: 'optional' expects to be string, null given. - -$processor->process($schema, ['nullable' => null]); -// OK, returns {'optional' => null, 'nullable' => null} -``` - -By default, there can be no extra items in the input data: - -```php -$schema = Expect::structure([ - 'key' => Expect::string(), -]); - -$processor->process($schema, ['additional' => 1]); -// ERROR: Unexpected item 'additional' -``` - -Which we can change with `otherItems()`. As a parameter, we will specify the schema for each extra element: - -```php -$schema = Expect::structure([ - 'key' => Expect::string(), -])->otherItems(Expect::int()); - -$processor->process($schema, ['additional' => 1]); // OK -$processor->process($schema, ['additional' => true]); // ERROR -``` - - -Deprecations ------------- - -You can deprecate property using the `deprecated([string $message])` method. Deprecation notices are returned by `$processor->getWarnings()`: - -```php -$schema = Expect::structure([ - 'old' => Expect::int()->deprecated('The item %path% is deprecated'), -]); - -$processor->process($schema, ['old' => 1]); // OK -$processor->getWarnings(); // ["The item 'old' is deprecated"] -``` - - -Ranges: min() max() -------------------- - -Use `min()` and `max()` to limit the number of elements for arrays: - -```php -// array, at least 10 items, maximum 20 items -Expect::array()->min(10)->max(20); -``` - -For strings, limit their length: - -```php -// string, at least 10 characters long, maximum 20 characters -Expect::string()->min(10)->max(20); -``` - -For numbers, limit their value: - -```php -// integer, between 10 and 20 inclusive -Expect::int()->min(10)->max(20); -``` - -Of course, it is possible to mention only `min()`, or only `max()`: - -```php -// string, maximum 20 characters -Expect::string()->max(20); -``` - - -Regular Expressions: pattern() ------------------------------- - -Using `pattern()`, you can specify a regular expression which the **whole** input string must match (i.e. as if it were wrapped in characters `^` a `$`): - -```php -// just 9 digits -Expect::string()->pattern('\d{9}'); -``` - - -Custom Assertions: assert() ---------------------------- - -You can add any other restrictions using `assert(callable $fn)`. - -```php -$countIsEven = fn($v) => count($v) % 2 === 0; - -$schema = Expect::arrayOf('string') - ->assert($countIsEven); // the count must be even - -$processor->process($schema, ['a', 'b']); // OK -$processor->process($schema, ['a', 'b', 'c']); // ERROR: 3 is not even -``` - -Or - -```php -Expect::string()->assert('is_file'); // the file must exist -``` - -You can add your own description for each assertion. It will be part of the error message. - -```php -$schema = Expect::arrayOf('string') - ->assert($countIsEven, 'Even items in array'); - -$processor->process($schema, ['a', 'b', 'c']); -// Failed assertion "Even items in array" for item with value array. -``` - -The method can be called repeatedly to add multiple constraints. It can be intermixed with calls to `transform()` and `castTo()`. - - -Transformation: transform() ---------------------------- - -Successfully validated data can be modified using a custom function: - -```php -// conversion to uppercase: -Expect::string()->transform(fn(string $s) => strtoupper($s)); -``` - -The method can be called repeatedly to add multiple transformations. It can be intermixed with calls to `assert()` and `castTo()`. The operations will be executed in the order in which they are declared: - -```php -Expect::type('string|int') - ->castTo('string') - ->assert('ctype_lower', 'All characters must be lowercased') - ->transform(fn(string $s) => strtoupper($s)); // conversion to uppercase -``` - -The `transform()` method can both transform and validate the value simultaneously. This is often simpler and less redundant than chaining `transform()` and `assert()`. For this purpose, the function receives a [Nette\Schema\Context](https://api.nette.org/schema/master/Nette/Schema/Context.html) object with an `addError()` method, which can be used to add information about validation issues: - -```php -Expect::string() - ->transform(function (string $s, Nette\Schema\Context $context) { - if (!ctype_lower($s)) { - $context->addError('All characters must be lowercased', 'my.case.error'); - return null; - } - - return strtoupper($s); - }); -``` - - -Casting: castTo() ------------------ - -Successfully validated data can be cast: - -```php -Expect::scalar()->castTo('string'); -``` - -In addition to native PHP types, you can also cast to classes. It distinguishes whether it is a simple class without a constructor or a class with a constructor. If the class has no constructor, an instance of it is created and all elements of the structure are written to its properties: - -```php -class Info -{ - public bool $processRefund; - public int $refundAmount; -} - -Expect::structure([ - 'processRefund' => Expect::bool(), - 'refundAmount' => Expect::int(), -])->castTo(Info::class); - -// creates '$obj = new Info' and writes to $obj->processRefund and $obj->refundAmount -``` - -If the class has a constructor, the elements of the structure are passed as named parameters to the constructor: - -```php -class Info -{ - public function __construct( - public bool $processRefund, - public int $refundAmount, - ) { - } -} - -// creates $obj = new Info(processRefund: ..., refundAmount: ...) -``` - -Casting combined with a scalar parameter creates an object and passes the value as the sole parameter to the constructor: - -```php -Expect::string()->castTo(DateTime::class); -// creates new DateTime(...) -``` - - -Normalization: before() ------------------------ - -Prior to the validation itself, the data can be normalized using the method `before()`. As an example, let's have an element that must be an array of strings (eg `['a', 'b', 'c']`), but receives input in the form of a string `a b c`: - -```php -$explode = fn($v) => explode(' ', $v); - -$schema = Expect::arrayOf('string') - ->before($explode); - -$normalized = $processor->process($schema, 'a b c'); -// OK, returns ['a', 'b', 'c'] -``` - - -Mapping to Objects: from() --------------------------- - -You can generate structure schema from the class. Example: - -```php -class Config -{ - /** @var string */ - public $name; - /** @var string|null */ - public $password; - /** @var bool */ - public $admin = false; -} - -$schema = Expect::from(new Config); - -$data = [ - 'name' => 'jeff', -]; - -$normalized = $processor->process($schema, $data); -// $normalized instanceof Config -// $normalized = {'name' => 'jeff', 'password' => null, 'admin' => false} -``` - -If you are using PHP 7.4 or higher, you can use native types: - -```php -class Config -{ - public string $name; - public ?string $password; - public bool $admin = false; -} - -$schema = Expect::from(new Config); -``` - -Anonymous classes are also supported: - -```php -$schema = Expect::from(new class { - public string $name; - public ?string $password; - public bool $admin = false; -}); -``` - -Because the information obtained from the class definition may not be sufficient, you can add a custom schema for the elements with the second parameter: - -```php -$schema = Expect::from(new Config, [ - 'name' => Expect::string()->pattern('\w:.*'), -]); -``` diff --git a/vendor/nette/schema/src/Schema/Context.php b/vendor/nette/schema/src/Schema/Context.php deleted file mode 100644 index 0f51265..0000000 --- a/vendor/nette/schema/src/Schema/Context.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Schema; - - -final class Context -{ - public bool $skipDefaults = false; - - /** @var string[] */ - public array $path = []; - - public bool $isKey = false; - - /** @var Message[] */ - public array $errors = []; - - /** @var Message[] */ - public array $warnings = []; - - /** @var array[] */ - public array $dynamics = []; - - - public function addError(string $message, string $code, array $variables = []): Message - { - $variables['isKey'] = $this->isKey; - return $this->errors[] = new Message($message, $code, $this->path, $variables); - } - - - public function addWarning(string $message, string $code, array $variables = []): Message - { - return $this->warnings[] = new Message($message, $code, $this->path, $variables); - } - - - /** @return \Closure(): bool */ - public function createChecker(): \Closure - { - $count = count($this->errors); - return fn(): bool => $count === count($this->errors); - } -} diff --git a/vendor/nette/schema/src/Schema/DynamicParameter.php b/vendor/nette/schema/src/Schema/DynamicParameter.php deleted file mode 100644 index 8dd6105..0000000 --- a/vendor/nette/schema/src/Schema/DynamicParameter.php +++ /dev/null @@ -1,15 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Schema; - - -interface DynamicParameter -{ -} diff --git a/vendor/nette/schema/src/Schema/Elements/AnyOf.php b/vendor/nette/schema/src/Schema/Elements/AnyOf.php deleted file mode 100644 index 6c9d0ce..0000000 --- a/vendor/nette/schema/src/Schema/Elements/AnyOf.php +++ /dev/null @@ -1,147 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Schema\Elements; - -use Nette; -use Nette\Schema\Context; -use Nette\Schema\Helpers; -use Nette\Schema\Schema; - - -final class AnyOf implements Schema -{ - use Base; - - private array $set; - - - public function __construct(mixed ...$set) - { - if (!$set) { - throw new Nette\InvalidStateException('The enumeration must not be empty.'); - } - - $this->set = $set; - } - - - public function firstIsDefault(): self - { - $this->default = $this->set[0]; - return $this; - } - - - public function nullable(): self - { - $this->set[] = null; - return $this; - } - - - public function dynamic(): self - { - $this->set[] = new Type(Nette\Schema\DynamicParameter::class); - return $this; - } - - - /********************* processing ****************d*g**/ - - - public function normalize(mixed $value, Context $context): mixed - { - return $this->doNormalize($value, $context); - } - - - public function merge(mixed $value, mixed $base): mixed - { - if (is_array($value) && isset($value[Helpers::PreventMerging])) { - unset($value[Helpers::PreventMerging]); - return $value; - } - - return Helpers::merge($value, $base); - } - - - public function complete(mixed $value, Context $context): mixed - { - $isOk = $context->createChecker(); - $value = $this->findAlternative($value, $context); - $isOk() && $value = $this->doTransform($value, $context); - return $isOk() ? $value : null; - } - - - private function findAlternative(mixed $value, Context $context): mixed - { - $expecteds = $innerErrors = []; - foreach ($this->set as $item) { - if ($item instanceof Schema) { - $dolly = new Context; - $dolly->path = $context->path; - $res = $item->complete($item->normalize($value, $dolly), $dolly); - if (!$dolly->errors) { - $context->warnings = array_merge($context->warnings, $dolly->warnings); - return $res; - } - - foreach ($dolly->errors as $error) { - if ($error->path !== $context->path || empty($error->variables['expected'])) { - $innerErrors[] = $error; - } else { - $expecteds[] = $error->variables['expected']; - } - } - } else { - if ($item === $value) { - return $value; - } - - $expecteds[] = Nette\Schema\Helpers::formatValue($item); - } - } - - if ($innerErrors) { - $context->errors = array_merge($context->errors, $innerErrors); - } else { - $context->addError( - 'The %label% %path% expects to be %expected%, %value% given.', - Nette\Schema\Message::TypeMismatch, - [ - 'value' => $value, - 'expected' => implode('|', array_unique($expecteds)), - ], - ); - } - - return null; - } - - - public function completeDefault(Context $context): mixed - { - if ($this->required) { - $context->addError( - 'The mandatory item %path% is missing.', - Nette\Schema\Message::MissingItem, - ); - return null; - } - - if ($this->default instanceof Schema) { - return $this->default->completeDefault($context); - } - - return $this->default; - } -} diff --git a/vendor/nette/schema/src/Schema/Elements/Base.php b/vendor/nette/schema/src/Schema/Elements/Base.php deleted file mode 100644 index 1dfda8a..0000000 --- a/vendor/nette/schema/src/Schema/Elements/Base.php +++ /dev/null @@ -1,162 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Schema\Elements; - -use Nette; -use Nette\Schema\Context; -use Nette\Schema\Helpers; - - -/** - * @internal - */ -trait Base -{ - private bool $required = false; - private mixed $default = null; - - /** @var ?callable */ - private $before; - - /** @var callable[] */ - private array $transforms = []; - private ?string $deprecated = null; - - - public function default(mixed $value): self - { - $this->default = $value; - return $this; - } - - - public function required(bool $state = true): self - { - $this->required = $state; - return $this; - } - - - public function before(callable $handler): self - { - $this->before = $handler; - return $this; - } - - - public function castTo(string $type): self - { - return $this->transform(Helpers::getCastStrategy($type)); - } - - - public function transform(callable $handler): self - { - $this->transforms[] = $handler; - return $this; - } - - - public function assert(callable $handler, ?string $description = null): self - { - $expected = $description ?: (is_string($handler) ? "$handler()" : '#' . count($this->transforms)); - return $this->transform(function ($value, Context $context) use ($handler, $description, $expected) { - if ($handler($value)) { - return $value; - } - $context->addError( - 'Failed assertion ' . ($description ? "'%assertion%'" : '%assertion%') . ' for %label% %path% with value %value%.', - Nette\Schema\Message::FailedAssertion, - ['value' => $value, 'assertion' => $expected], - ); - }); - } - - - /** Marks as deprecated */ - public function deprecated(string $message = 'The item %path% is deprecated.'): self - { - $this->deprecated = $message; - return $this; - } - - - public function completeDefault(Context $context): mixed - { - if ($this->required) { - $context->addError( - 'The mandatory item %path% is missing.', - Nette\Schema\Message::MissingItem, - ); - return null; - } - - return $this->default; - } - - - public function doNormalize(mixed $value, Context $context): mixed - { - if ($this->before) { - $value = ($this->before)($value); - } - - return $value; - } - - - private function doDeprecation(Context $context): void - { - if ($this->deprecated !== null) { - $context->addWarning( - $this->deprecated, - Nette\Schema\Message::Deprecated, - ); - } - } - - - private function doTransform(mixed $value, Context $context): mixed - { - $isOk = $context->createChecker(); - foreach ($this->transforms as $handler) { - $value = $handler($value, $context); - if (!$isOk()) { - return null; - } - } - return $value; - } - - - /** @deprecated use Nette\Schema\Validators::validateType() */ - private function doValidate(mixed $value, string $expected, Context $context): bool - { - $isOk = $context->createChecker(); - Helpers::validateType($value, $expected, $context); - return $isOk(); - } - - - /** @deprecated use Nette\Schema\Validators::validateRange() */ - private static function doValidateRange(mixed $value, array $range, Context $context, string $types = ''): bool - { - $isOk = $context->createChecker(); - Helpers::validateRange($value, $range, $context, $types); - return $isOk(); - } - - - /** @deprecated use doTransform() */ - private function doFinalize(mixed $value, Context $context): mixed - { - return $this->doTransform($value, $context); - } -} diff --git a/vendor/nette/schema/src/Schema/Elements/Structure.php b/vendor/nette/schema/src/Schema/Elements/Structure.php deleted file mode 100644 index 66e501a..0000000 --- a/vendor/nette/schema/src/Schema/Elements/Structure.php +++ /dev/null @@ -1,210 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Schema\Elements; - -use Nette; -use Nette\Schema\Context; -use Nette\Schema\Helpers; -use Nette\Schema\Schema; - - -final class Structure implements Schema -{ - use Base; - - /** @var Schema[] */ - private array $items; - - /** for array|list */ - private ?Schema $otherItems = null; - - /** @var array{?int, ?int} */ - private array $range = [null, null]; - private bool $skipDefaults = false; - - - /** - * @param Schema[] $shape - */ - public function __construct(array $shape) - { - (function (Schema ...$items) {})(...array_values($shape)); - $this->items = $shape; - $this->castTo('object'); - $this->required = true; - } - - - public function default(mixed $value): self - { - throw new Nette\InvalidStateException('Structure cannot have default value.'); - } - - - public function min(?int $min): self - { - $this->range[0] = $min; - return $this; - } - - - public function max(?int $max): self - { - $this->range[1] = $max; - return $this; - } - - - public function otherItems(string|Schema $type = 'mixed'): self - { - $this->otherItems = $type instanceof Schema ? $type : new Type($type); - return $this; - } - - - public function skipDefaults(bool $state = true): self - { - $this->skipDefaults = $state; - return $this; - } - - - public function extend(array|self $shape): self - { - $shape = $shape instanceof self ? $shape->items : $shape; - return new self(array_merge($this->items, $shape)); - } - - - public function getShape(): array - { - return $this->items; - } - - - /********************* processing ****************d*g**/ - - - public function normalize(mixed $value, Context $context): mixed - { - if ($prevent = (is_array($value) && isset($value[Helpers::PreventMerging]))) { - unset($value[Helpers::PreventMerging]); - } - - $value = $this->doNormalize($value, $context); - if (is_object($value)) { - $value = (array) $value; - } - - if (is_array($value)) { - foreach ($value as $key => $val) { - $itemSchema = $this->items[$key] ?? $this->otherItems; - if ($itemSchema) { - $context->path[] = $key; - $value[$key] = $itemSchema->normalize($val, $context); - array_pop($context->path); - } - } - - if ($prevent) { - $value[Helpers::PreventMerging] = true; - } - } - - return $value; - } - - - public function merge(mixed $value, mixed $base): mixed - { - if (is_array($value) && isset($value[Helpers::PreventMerging])) { - unset($value[Helpers::PreventMerging]); - $base = null; - } - - if (is_array($value) && is_array($base)) { - $index = $this->otherItems === null ? null : 0; - foreach ($value as $key => $val) { - if ($key === $index) { - $base[] = $val; - $index++; - } else { - $base[$key] = array_key_exists($key, $base) && ($itemSchema = $this->items[$key] ?? $this->otherItems) - ? $itemSchema->merge($val, $base[$key]) - : $val; - } - } - - return $base; - } - - return $value ?? $base; - } - - - public function complete(mixed $value, Context $context): mixed - { - if ($value === null) { - $value = []; // is unable to distinguish null from array in NEON - } - - $this->doDeprecation($context); - - $isOk = $context->createChecker(); - Helpers::validateType($value, 'array', $context); - $isOk() && Helpers::validateRange($value, $this->range, $context); - $isOk() && $this->validateItems($value, $context); - $isOk() && $value = $this->doTransform($value, $context); - return $isOk() ? $value : null; - } - - - private function validateItems(array &$value, Context $context): void - { - $items = $this->items; - if ($extraKeys = array_keys(array_diff_key($value, $items))) { - if ($this->otherItems) { - $items += array_fill_keys($extraKeys, $this->otherItems); - } else { - $keys = array_map('strval', array_keys($items)); - foreach ($extraKeys as $key) { - $hint = Nette\Utils\Helpers::getSuggestion($keys, (string) $key); - $context->addError( - 'Unexpected item %path%' . ($hint ? ", did you mean '%hint%'?" : '.'), - Nette\Schema\Message::UnexpectedItem, - ['hint' => $hint], - )->path[] = $key; - } - } - } - - foreach ($items as $itemKey => $itemVal) { - $context->path[] = $itemKey; - if (array_key_exists($itemKey, $value)) { - $value[$itemKey] = $itemVal->complete($value[$itemKey], $context); - } else { - $default = $itemVal->completeDefault($context); // checks required item - if (!$context->skipDefaults && !$this->skipDefaults) { - $value[$itemKey] = $default; - } - } - - array_pop($context->path); - } - } - - - public function completeDefault(Context $context): mixed - { - return $this->required - ? $this->complete([], $context) - : null; - } -} diff --git a/vendor/nette/schema/src/Schema/Elements/Type.php b/vendor/nette/schema/src/Schema/Elements/Type.php deleted file mode 100644 index 69d5299..0000000 --- a/vendor/nette/schema/src/Schema/Elements/Type.php +++ /dev/null @@ -1,208 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Schema\Elements; - -use Nette\Schema\Context; -use Nette\Schema\DynamicParameter; -use Nette\Schema\Helpers; -use Nette\Schema\Schema; - - -final class Type implements Schema -{ - use Base; - - private string $type; - private ?Schema $itemsValue = null; - private ?Schema $itemsKey = null; - - /** @var array{?float, ?float} */ - private array $range = [null, null]; - private ?string $pattern = null; - private bool $merge = true; - - - public function __construct(string $type) - { - $defaults = ['list' => [], 'array' => []]; - $this->type = $type; - $this->default = strpos($type, '[]') ? [] : $defaults[$type] ?? null; - } - - - public function nullable(): self - { - $this->type = 'null|' . $this->type; - return $this; - } - - - public function mergeDefaults(bool $state = true): self - { - $this->merge = $state; - return $this; - } - - - public function dynamic(): self - { - $this->type = DynamicParameter::class . '|' . $this->type; - return $this; - } - - - public function min(?float $min): self - { - $this->range[0] = $min; - return $this; - } - - - public function max(?float $max): self - { - $this->range[1] = $max; - return $this; - } - - - /** - * @internal use arrayOf() or listOf() - */ - public function items(string|Schema $valueType = 'mixed', string|Schema|null $keyType = null): self - { - $this->itemsValue = $valueType instanceof Schema - ? $valueType - : new self($valueType); - $this->itemsKey = $keyType instanceof Schema || $keyType === null - ? $keyType - : new self($keyType); - return $this; - } - - - public function pattern(?string $pattern): self - { - $this->pattern = $pattern; - return $this; - } - - - /********************* processing ****************d*g**/ - - - public function normalize(mixed $value, Context $context): mixed - { - if ($prevent = (is_array($value) && isset($value[Helpers::PreventMerging]))) { - unset($value[Helpers::PreventMerging]); - } - - $value = $this->doNormalize($value, $context); - if (is_array($value) && $this->itemsValue) { - $res = []; - foreach ($value as $key => $val) { - $context->path[] = $key; - $context->isKey = true; - $key = $this->itemsKey - ? $this->itemsKey->normalize($key, $context) - : $key; - $context->isKey = false; - $res[$key] = $this->itemsValue->normalize($val, $context); - array_pop($context->path); - } - - $value = $res; - } - - if ($prevent && is_array($value)) { - $value[Helpers::PreventMerging] = true; - } - - return $value; - } - - - public function merge(mixed $value, mixed $base): mixed - { - if (is_array($value) && isset($value[Helpers::PreventMerging])) { - unset($value[Helpers::PreventMerging]); - return $value; - } - - if (is_array($value) && is_array($base) && $this->itemsValue) { - $index = 0; - foreach ($value as $key => $val) { - if ($key === $index) { - $base[] = $val; - $index++; - } else { - $base[$key] = array_key_exists($key, $base) - ? $this->itemsValue->merge($val, $base[$key]) - : $val; - } - } - - return $base; - } - - return Helpers::merge($value, $base); - } - - - public function complete(mixed $value, Context $context): mixed - { - $merge = $this->merge; - if (is_array($value) && isset($value[Helpers::PreventMerging])) { - unset($value[Helpers::PreventMerging]); - $merge = false; - } - - if ($value === null && is_array($this->default)) { - $value = []; // is unable to distinguish null from array in NEON - } - - $this->doDeprecation($context); - - $isOk = $context->createChecker(); - Helpers::validateType($value, $this->type, $context); - $isOk() && Helpers::validateRange($value, $this->range, $context, $this->type); - $isOk() && $value !== null && $this->pattern !== null && Helpers::validatePattern($value, $this->pattern, $context); - $isOk() && is_array($value) && $this->validateItems($value, $context); - $isOk() && $merge && $value = Helpers::merge($value, $this->default); - $isOk() && $value = $this->doTransform($value, $context); - if (!$isOk()) { - return null; - } - - if ($value instanceof DynamicParameter) { - $expected = $this->type . ($this->range === [null, null] ? '' : ':' . implode('..', $this->range)); - $context->dynamics[] = [$value, str_replace(DynamicParameter::class . '|', '', $expected), $context->path]; - } - return $value; - } - - - private function validateItems(array &$value, Context $context): void - { - if (!$this->itemsValue) { - return; - } - - $res = []; - foreach ($value as $key => $val) { - $context->path[] = $key; - $context->isKey = true; - $key = $this->itemsKey ? $this->itemsKey->complete($key, $context) : $key; - $context->isKey = false; - $res[$key] = $this->itemsValue->complete($val, $context); - array_pop($context->path); - } - $value = $res; - } -} diff --git a/vendor/nette/schema/src/Schema/Expect.php b/vendor/nette/schema/src/Schema/Expect.php deleted file mode 100644 index eab3c84..0000000 --- a/vendor/nette/schema/src/Schema/Expect.php +++ /dev/null @@ -1,118 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Schema; - -use Nette; -use Nette\Schema\Elements\AnyOf; -use Nette\Schema\Elements\Structure; -use Nette\Schema\Elements\Type; - - -/** - * Schema generator. - * - * @method static Type scalar($default = null) - * @method static Type string($default = null) - * @method static Type int($default = null) - * @method static Type float($default = null) - * @method static Type bool($default = null) - * @method static Type null() - * @method static Type list($default = []) - * @method static Type mixed($default = null) - * @method static Type email($default = null) - * @method static Type unicode($default = null) - */ -final class Expect -{ - public static function __callStatic(string $name, array $args): Type - { - $type = new Type($name); - if ($args) { - $type->default($args[0]); - } - - return $type; - } - - - public static function type(string $type): Type - { - return new Type($type); - } - - - public static function anyOf(mixed ...$set): AnyOf - { - return new AnyOf(...$set); - } - - - /** - * @param Schema[] $shape - */ - public static function structure(array $shape): Structure - { - return new Structure($shape); - } - - - public static function from(object $object, array $items = []): Structure - { - $ro = new \ReflectionObject($object); - $props = $ro->hasMethod('__construct') - ? $ro->getMethod('__construct')->getParameters() - : $ro->getProperties(); - - foreach ($props as $prop) { - $item = &$items[$prop->getName()]; - if (!$item) { - $type = Helpers::getPropertyType($prop) ?? 'mixed'; - $item = new Type($type); - if ($prop instanceof \ReflectionProperty ? $prop->isInitialized($object) : $prop->isOptional()) { - $def = ($prop instanceof \ReflectionProperty ? $prop->getValue($object) : $prop->getDefaultValue()); - if (is_object($def)) { - $item = static::from($def); - } elseif ($def === null && !Nette\Utils\Validators::is(null, $type)) { - $item->required(); - } else { - $item->default($def); - } - } else { - $item->required(); - } - } - } - - return (new Structure($items))->castTo($ro->getName()); - } - - - /** - * @param mixed[] $shape - */ - public static function array(?array $shape = []): Structure|Type - { - return Nette\Utils\Arrays::first($shape ?? []) instanceof Schema - ? (new Structure($shape))->castTo('array') - : (new Type('array'))->default($shape); - } - - - public static function arrayOf(string|Schema $valueType, string|Schema|null $keyType = null): Type - { - return (new Type('array'))->items($valueType, $keyType); - } - - - public static function listOf(string|Schema $type): Type - { - return (new Type('list'))->items($type); - } -} diff --git a/vendor/nette/schema/src/Schema/Helpers.php b/vendor/nette/schema/src/Schema/Helpers.php deleted file mode 100644 index 70bf183..0000000 --- a/vendor/nette/schema/src/Schema/Helpers.php +++ /dev/null @@ -1,183 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Schema; - -use Nette; -use Nette\Utils\Reflection; - - -/** - * @internal - */ -final class Helpers -{ - use Nette\StaticClass; - - public const PreventMerging = '_prevent_merging'; - - - /** - * Merges dataset. Left has higher priority than right one. - */ - public static function merge(mixed $value, mixed $base): mixed - { - if (is_array($value) && isset($value[self::PreventMerging])) { - unset($value[self::PreventMerging]); - return $value; - } - - if (is_array($value) && is_array($base)) { - $index = 0; - foreach ($value as $key => $val) { - if ($key === $index) { - $base[] = $val; - $index++; - } else { - $base[$key] = static::merge($val, $base[$key] ?? null); - } - } - - return $base; - - } elseif ($value === null && is_array($base)) { - return $base; - - } else { - return $value; - } - } - - - public static function getPropertyType(\ReflectionProperty|\ReflectionParameter $prop): ?string - { - if ($type = Nette\Utils\Type::fromReflection($prop)) { - return (string) $type; - } elseif ( - ($prop instanceof \ReflectionProperty) - && ($type = preg_replace('#\s.*#', '', (string) self::parseAnnotation($prop, 'var'))) - ) { - $class = Reflection::getPropertyDeclaringClass($prop); - return preg_replace_callback('#[\w\\\\]+#', fn($m) => Reflection::expandClassName($m[0], $class), $type); - } - - return null; - } - - - /** - * Returns an annotation value. - * @param \ReflectionProperty $ref - */ - public static function parseAnnotation(\Reflector $ref, string $name): ?string - { - if (!Reflection::areCommentsAvailable()) { - throw new Nette\InvalidStateException('You have to enable phpDoc comments in opcode cache.'); - } - - $re = '#[\s*]@' . preg_quote($name, '#') . '(?=\s|$)(?:[ \t]+([^@\s]\S*))?#'; - if ($ref->getDocComment() && preg_match($re, trim($ref->getDocComment(), '/*'), $m)) { - return $m[1] ?? ''; - } - - return null; - } - - - public static function formatValue(mixed $value): string - { - if ($value instanceof DynamicParameter) { - return 'dynamic'; - } elseif (is_object($value)) { - return 'object ' . $value::class; - } elseif (is_string($value)) { - return "'" . Nette\Utils\Strings::truncate($value, 15, '...') . "'"; - } elseif (is_scalar($value)) { - return var_export($value, return: true); - } else { - return get_debug_type($value); - } - } - - - public static function validateType(mixed $value, string $expected, Context $context): void - { - if (!Nette\Utils\Validators::is($value, $expected)) { - $expected = str_replace(DynamicParameter::class . '|', '', $expected); - $expected = str_replace(['|', ':'], [' or ', ' in range '], $expected); - $context->addError( - 'The %label% %path% expects to be %expected%, %value% given.', - Message::TypeMismatch, - ['value' => $value, 'expected' => $expected], - ); - } - } - - - public static function validateRange(mixed $value, array $range, Context $context, string $types = ''): void - { - if (is_array($value) || is_string($value)) { - [$length, $label] = is_array($value) - ? [count($value), 'items'] - : (in_array('unicode', explode('|', $types), true) - ? [Nette\Utils\Strings::length($value), 'characters'] - : [strlen($value), 'bytes']); - - if (!self::isInRange($length, $range)) { - $context->addError( - "The length of %label% %path% expects to be in range %expected%, %length% $label given.", - Message::LengthOutOfRange, - ['value' => $value, 'length' => $length, 'expected' => implode('..', $range)], - ); - } - } elseif ((is_int($value) || is_float($value)) && !self::isInRange($value, $range)) { - $context->addError( - 'The %label% %path% expects to be in range %expected%, %value% given.', - Message::ValueOutOfRange, - ['value' => $value, 'expected' => implode('..', $range)], - ); - } - } - - - public static function isInRange(mixed $value, array $range): bool - { - return ($range[0] === null || $value >= $range[0]) - && ($range[1] === null || $value <= $range[1]); - } - - - public static function validatePattern(string $value, string $pattern, Context $context): void - { - if (!preg_match("\x01^(?:$pattern)$\x01Du", $value)) { - $context->addError( - "The %label% %path% expects to match pattern '%pattern%', %value% given.", - Message::PatternMismatch, - ['value' => $value, 'pattern' => $pattern], - ); - } - } - - - public static function getCastStrategy(string $type): \Closure - { - if (Nette\Utils\Reflection::isBuiltinType($type)) { - return static function ($value) use ($type) { - settype($value, $type); - return $value; - }; - } elseif (method_exists($type, '__construct')) { - return static fn($value) => is_array($value) || $value instanceof \stdClass - ? new $type(...(array) $value) - : new $type($value); - } else { - return static fn($value) => Nette\Utils\Arrays::toObject((array) $value, new $type); - } - } -} diff --git a/vendor/nette/schema/src/Schema/Message.php b/vendor/nette/schema/src/Schema/Message.php deleted file mode 100644 index 4e976d0..0000000 --- a/vendor/nette/schema/src/Schema/Message.php +++ /dev/null @@ -1,98 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Schema; - -use Nette; - - -final class Message -{ - /** variables: {value: mixed, expected: string} */ - public const TypeMismatch = 'schema.typeMismatch'; - - /** variables: {value: mixed, expected: string} */ - public const ValueOutOfRange = 'schema.valueOutOfRange'; - - /** variables: {value: mixed, length: int, expected: string} */ - public const LengthOutOfRange = 'schema.lengthOutOfRange'; - - /** variables: {value: string, pattern: string} */ - public const PatternMismatch = 'schema.patternMismatch'; - - /** variables: {value: mixed, assertion: string} */ - public const FailedAssertion = 'schema.failedAssertion'; - - /** no variables */ - public const MissingItem = 'schema.missingItem'; - - /** variables: {hint: string} */ - public const UnexpectedItem = 'schema.unexpectedItem'; - - /** no variables */ - public const Deprecated = 'schema.deprecated'; - - /** @deprecated use Message::TypeMismatch */ - public const TYPE_MISMATCH = self::TypeMismatch; - - /** @deprecated use Message::ValueOutOfRange */ - public const VALUE_OUT_OF_RANGE = self::ValueOutOfRange; - - /** @deprecated use Message::LengthOutOfRange */ - public const LENGTH_OUT_OF_RANGE = self::LengthOutOfRange; - - /** @deprecated use Message::PatternMismatch */ - public const PATTERN_MISMATCH = self::PatternMismatch; - - /** @deprecated use Message::FailedAssertion */ - public const FAILED_ASSERTION = self::FailedAssertion; - - /** @deprecated use Message::MissingItem */ - public const MISSING_ITEM = self::MissingItem; - - /** @deprecated use Message::UnexpectedItem */ - public const UNEXPECTED_ITEM = self::UnexpectedItem; - - /** @deprecated use Message::Deprecated */ - public const DEPRECATED = self::Deprecated; - - public string $message; - public string $code; - - /** @var string[] */ - public array $path; - - /** @var string[] */ - public array $variables; - - - public function __construct(string $message, string $code, array $path, array $variables = []) - { - $this->message = $message; - $this->code = $code; - $this->path = $path; - $this->variables = $variables; - } - - - public function toString(): string - { - $vars = $this->variables; - $vars['label'] = empty($vars['isKey']) ? 'item' : 'key of item'; - $vars['path'] = $this->path - ? "'" . implode("\u{a0}›\u{a0}", $this->path) . "'" - : null; - $vars['value'] = Helpers::formatValue($vars['value'] ?? null); - - return preg_replace_callback('~( ?)%(\w+)%~', function ($m) use ($vars) { - [, $space, $key] = $m; - return $vars[$key] === null ? '' : $space . $vars[$key]; - }, $this->message) ?? throw new Nette\InvalidStateException(preg_last_error_msg()); - } -} diff --git a/vendor/nette/schema/src/Schema/Processor.php b/vendor/nette/schema/src/Schema/Processor.php deleted file mode 100644 index 3290ba6..0000000 --- a/vendor/nette/schema/src/Schema/Processor.php +++ /dev/null @@ -1,96 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Schema; - -use Nette; - - -/** - * Schema validator. - */ -final class Processor -{ - public array $onNewContext = []; - private Context $context; - private bool $skipDefaults = false; - - - public function skipDefaults(bool $value = true): void - { - $this->skipDefaults = $value; - } - - - /** - * Normalizes and validates data. Result is a clean completed data. - * @throws ValidationException - */ - public function process(Schema $schema, mixed $data): mixed - { - $this->createContext(); - $data = $schema->normalize($data, $this->context); - $this->throwsErrors(); - $data = $schema->complete($data, $this->context); - $this->throwsErrors(); - return $data; - } - - - /** - * Normalizes and validates and merges multiple data. Result is a clean completed data. - * @throws ValidationException - */ - public function processMultiple(Schema $schema, array $dataset): mixed - { - $this->createContext(); - $flatten = null; - $first = true; - foreach ($dataset as $data) { - $data = $schema->normalize($data, $this->context); - $this->throwsErrors(); - $flatten = $first ? $data : $schema->merge($data, $flatten); - $first = false; - } - - $data = $schema->complete($flatten, $this->context); - $this->throwsErrors(); - return $data; - } - - - /** - * @return string[] - */ - public function getWarnings(): array - { - $res = []; - foreach ($this->context->warnings as $message) { - $res[] = $message->toString(); - } - - return $res; - } - - - private function throwsErrors(): void - { - if ($this->context->errors) { - throw new ValidationException(null, $this->context->errors); - } - } - - - private function createContext(): void - { - $this->context = new Context; - $this->context->skipDefaults = $this->skipDefaults; - Nette\Utils\Arrays::invoke($this->onNewContext, $this->context); - } -} diff --git a/vendor/nette/schema/src/Schema/Schema.php b/vendor/nette/schema/src/Schema/Schema.php deleted file mode 100644 index 3ded769..0000000 --- a/vendor/nette/schema/src/Schema/Schema.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Schema; - - -interface Schema -{ - /** - * Normalization. - * @return mixed - */ - function normalize(mixed $value, Context $context); - - /** - * Merging. - * @return mixed - */ - function merge(mixed $value, mixed $base); - - /** - * Validation and finalization. - * @return mixed - */ - function complete(mixed $value, Context $context); - - /** - * @return mixed - */ - function completeDefault(Context $context); -} diff --git a/vendor/nette/schema/src/Schema/ValidationException.php b/vendor/nette/schema/src/Schema/ValidationException.php deleted file mode 100644 index caae0be..0000000 --- a/vendor/nette/schema/src/Schema/ValidationException.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Schema; - -use Nette; - - -/** - * Validation error. - */ -class ValidationException extends Nette\InvalidStateException -{ - /** @var Message[] */ - private array $messages; - - - /** - * @param Message[] $messages - */ - public function __construct(?string $message, array $messages = []) - { - parent::__construct($message ?: $messages[0]->toString()); - $this->messages = $messages; - } - - - /** - * @return string[] - */ - public function getMessages(): array - { - $res = []; - foreach ($this->messages as $message) { - $res[] = $message->toString(); - } - - return $res; - } - - - /** - * @return Message[] - */ - public function getMessageObjects(): array - { - return $this->messages; - } -} diff --git a/vendor/nette/utils/.phpstorm.meta.php b/vendor/nette/utils/.phpstorm.meta.php deleted file mode 100644 index 25851af..0000000 --- a/vendor/nette/utils/.phpstorm.meta.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace PHPSTORM_META; - -override(\Nette\Utils\Arrays::get(0), elementType(0)); -override(\Nette\Utils\Arrays::getRef(0), elementType(0)); -override(\Nette\Utils\Arrays::grep(0), type(0)); -override(\Nette\Utils\Arrays::toObject(0), type(1)); - -expectedArguments(\Nette\Utils\Image::resize(), 2, \Nette\Utils\Image::ShrinkOnly, \Nette\Utils\Image::Stretch, \Nette\Utils\Image::OrSmaller, \Nette\Utils\Image::OrBigger, \Nette\Utils\Image::Cover); -expectedArguments(\Nette\Utils\Image::calculateSize(), 4, \Nette\Utils\Image::ShrinkOnly, \Nette\Utils\Image::Stretch, \Nette\Utils\Image::OrSmaller, \Nette\Utils\Image::OrBigger, \Nette\Utils\Image::Cover); diff --git a/vendor/nette/utils/composer.json b/vendor/nette/utils/composer.json deleted file mode 100644 index 74bd618..0000000 --- a/vendor/nette/utils/composer.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "name": "nette/utils", - "description": "🛠 Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.", - "keywords": ["nette", "images", "json", "password", "validation", "utility", "string", "array", "core", "slugify", "utf-8", "unicode", "paginator", "datetime"], - "homepage": "https://nette.org", - "license": ["BSD-3-Clause", "GPL-2.0-only", "GPL-3.0-only"], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "require": { - "php": "8.0 - 8.4" - }, - "require-dev": { - "nette/tester": "^2.5", - "tracy/tracy": "^2.9", - "phpstan/phpstan": "^1.0", - "jetbrains/phpstorm-attributes": "dev-master" - }, - "conflict": { - "nette/finder": "<3", - "nette/schema": "<1.2.2" - }, - "suggest": { - "ext-iconv": "to use Strings::webalize(), toAscii(), chr() and reverse()", - "ext-json": "to use Nette\\Utils\\Json", - "ext-intl": "to use Strings::webalize(), toAscii(), normalize() and compare()", - "ext-mbstring": "to use Strings::lower() etc...", - "ext-gd": "to use Image", - "ext-tokenizer": "to use Nette\\Utils\\Reflection::getUseStatements()" - }, - "autoload": { - "classmap": ["src/"] - }, - "minimum-stability": "dev", - "scripts": { - "phpstan": "phpstan analyse", - "tester": "tester tests -s" - }, - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - } -} diff --git a/vendor/nette/utils/license.md b/vendor/nette/utils/license.md deleted file mode 100644 index cf741bd..0000000 --- a/vendor/nette/utils/license.md +++ /dev/null @@ -1,60 +0,0 @@ -Licenses -======== - -Good news! You may use Nette Framework under the terms of either -the New BSD License or the GNU General Public License (GPL) version 2 or 3. - -The BSD License is recommended for most projects. It is easy to understand and it -places almost no restrictions on what you can do with the framework. If the GPL -fits better to your project, you can use the framework under this license. - -You don't have to notify anyone which license you are using. You can freely -use Nette Framework in commercial projects as long as the copyright header -remains intact. - -Please be advised that the name "Nette Framework" is a protected trademark and its -usage has some limitations. So please do not use word "Nette" in the name of your -project or top-level domain, and choose a name that stands on its own merits. -If your stuff is good, it will not take long to establish a reputation for yourselves. - - -New BSD License ---------------- - -Copyright (c) 2004, 2014 David Grudl (https://davidgrudl.com) -All rights reserved. - -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 "Nette Framework" 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 owner 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. - - -GNU General Public License --------------------------- - -GPL licenses are very very long, so instead of including them here we offer -you URLs with full text: - -- [GPL version 2](http://www.gnu.org/licenses/gpl-2.0.html) -- [GPL version 3](http://www.gnu.org/licenses/gpl-3.0.html) diff --git a/vendor/nette/utils/readme.md b/vendor/nette/utils/readme.md deleted file mode 100644 index 0038f53..0000000 --- a/vendor/nette/utils/readme.md +++ /dev/null @@ -1,55 +0,0 @@ -[![Nette Utils](https://github.com/nette/utils/assets/194960/c33fdb74-0652-4cad-ac6e-c1ce0d29e32a)](https://doc.nette.org/en/utils) - -[![Downloads this Month](https://img.shields.io/packagist/dm/nette/utils.svg)](https://packagist.org/packages/nette/utils) -[![Tests](https://github.com/nette/utils/workflows/Tests/badge.svg?branch=master)](https://github.com/nette/utils/actions) -[![Coverage Status](https://coveralls.io/repos/github/nette/utils/badge.svg?branch=master)](https://coveralls.io/github/nette/utils?branch=master) -[![Latest Stable Version](https://poser.pugx.org/nette/utils/v/stable)](https://github.com/nette/utils/releases) -[![License](https://img.shields.io/badge/license-New%20BSD-blue.svg)](https://github.com/nette/utils/blob/master/license.md) - - -Introduction ------------- - -In package nette/utils you will find a set of useful classes for everyday use: - -✅ [Arrays](https://doc.nette.org/utils/arrays)<br> -✅ [Callback](https://doc.nette.org/utils/callback) - PHP callbacks<br> -✅ [Filesystem](https://doc.nette.org/utils/filesystem) - copying, renaming, …<br> -✅ [Finder](https://doc.nette.org/utils/finder) - finds files and directories<br> -✅ [Floats](https://doc.nette.org/utils/floats) - floating point numbers<br> -✅ [Helper Functions](https://doc.nette.org/utils/helpers)<br> -✅ [HTML elements](https://doc.nette.org/utils/html-elements) - generate HTML<br> -✅ [Images](https://doc.nette.org/utils/images) - crop, resize, rotate images<br> -✅ [Iterables](https://doc.nette.org/utils/iterables) <br> -✅ [JSON](https://doc.nette.org/utils/json) - encoding and decoding<br> -✅ [Generating Random Strings](https://doc.nette.org/utils/random)<br> -✅ [Paginator](https://doc.nette.org/utils/paginator) - pagination math<br> -✅ [PHP Reflection](https://doc.nette.org/utils/reflection)<br> -✅ [Strings](https://doc.nette.org/utils/strings) - useful text functions<br> -✅ [SmartObject](https://doc.nette.org/utils/smartobject) - PHP object enhancements<br> -✅ [Type](https://doc.nette.org/utils/type) - PHP data type<br> -✅ [Validation](https://doc.nette.org/utils/validators) - validate inputs<br> - - <!----> - -Installation ------------- - -The recommended way to install is via Composer: - -``` -composer require nette/utils -``` - -Nette Utils 4.0 is compatible with PHP 8.0 to 8.4. - - <!----> - -[Support Me](https://github.com/sponsors/dg) --------------------------------------------- - -Do you like Nette Utils? Are you looking forward to the new features? - -[![Buy me a coffee](https://files.nette.org/icons/donation-3.svg)](https://github.com/sponsors/dg) - -Thank you! diff --git a/vendor/nette/utils/src/HtmlStringable.php b/vendor/nette/utils/src/HtmlStringable.php deleted file mode 100644 index d749d4e..0000000 --- a/vendor/nette/utils/src/HtmlStringable.php +++ /dev/null @@ -1,22 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette; - - -interface HtmlStringable -{ - /** - * Returns string in HTML format - */ - function __toString(): string; -} - - -interface_exists(Utils\IHtmlString::class); diff --git a/vendor/nette/utils/src/Iterators/CachingIterator.php b/vendor/nette/utils/src/Iterators/CachingIterator.php deleted file mode 100644 index 02bd740..0000000 --- a/vendor/nette/utils/src/Iterators/CachingIterator.php +++ /dev/null @@ -1,150 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Iterators; - -use Nette; - - -/** - * Smarter caching iterator. - * - * @property-read bool $first - * @property-read bool $last - * @property-read bool $empty - * @property-read bool $odd - * @property-read bool $even - * @property-read int $counter - * @property-read mixed $nextKey - * @property-read mixed $nextValue - */ -class CachingIterator extends \CachingIterator implements \Countable -{ - use Nette\SmartObject; - - private int $counter = 0; - - - public function __construct(iterable|\stdClass $iterable) - { - $iterable = $iterable instanceof \stdClass - ? new \ArrayIterator($iterable) - : Nette\Utils\Iterables::toIterator($iterable); - parent::__construct($iterable, 0); - } - - - /** - * Is the current element the first one? - */ - public function isFirst(?int $gridWidth = null): bool - { - return $this->counter === 1 || ($gridWidth && $this->counter !== 0 && (($this->counter - 1) % $gridWidth) === 0); - } - - - /** - * Is the current element the last one? - */ - public function isLast(?int $gridWidth = null): bool - { - return !$this->hasNext() || ($gridWidth && ($this->counter % $gridWidth) === 0); - } - - - /** - * Is the iterator empty? - */ - public function isEmpty(): bool - { - return $this->counter === 0; - } - - - /** - * Is the counter odd? - */ - public function isOdd(): bool - { - return $this->counter % 2 === 1; - } - - - /** - * Is the counter even? - */ - public function isEven(): bool - { - return $this->counter % 2 === 0; - } - - - /** - * Returns the counter. - */ - public function getCounter(): int - { - return $this->counter; - } - - - /** - * Returns the count of elements. - */ - public function count(): int - { - $inner = $this->getInnerIterator(); - if ($inner instanceof \Countable) { - return $inner->count(); - - } else { - throw new Nette\NotSupportedException('Iterator is not countable.'); - } - } - - - /** - * Forwards to the next element. - */ - public function next(): void - { - parent::next(); - if (parent::valid()) { - $this->counter++; - } - } - - - /** - * Rewinds the Iterator. - */ - public function rewind(): void - { - parent::rewind(); - $this->counter = parent::valid() ? 1 : 0; - } - - - /** - * Returns the next key. - */ - public function getNextKey(): mixed - { - return $this->getInnerIterator()->key(); - } - - - /** - * Returns the next element. - */ - public function getNextValue(): mixed - { - return $this->getInnerIterator()->current(); - } -} diff --git a/vendor/nette/utils/src/Iterators/Mapper.php b/vendor/nette/utils/src/Iterators/Mapper.php deleted file mode 100644 index 284da29..0000000 --- a/vendor/nette/utils/src/Iterators/Mapper.php +++ /dev/null @@ -1,33 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Iterators; - - -/** - * @deprecated use Nette\Utils\Iterables::map() - */ -class Mapper extends \IteratorIterator -{ - /** @var callable */ - private $callback; - - - public function __construct(\Traversable $iterator, callable $callback) - { - parent::__construct($iterator); - $this->callback = $callback; - } - - - public function current(): mixed - { - return ($this->callback)(parent::current(), parent::key()); - } -} diff --git a/vendor/nette/utils/src/SmartObject.php b/vendor/nette/utils/src/SmartObject.php deleted file mode 100644 index 3b2203f..0000000 --- a/vendor/nette/utils/src/SmartObject.php +++ /dev/null @@ -1,140 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette; - -use Nette\Utils\ObjectHelpers; - - -/** - * Strict class for better experience. - * - 'did you mean' hints - * - access to undeclared members throws exceptions - * - support for @property annotations - * - support for calling event handlers stored in $onEvent via onEvent() - */ -trait SmartObject -{ - /** - * @return mixed - * @throws MemberAccessException - */ - public function __call(string $name, array $args) - { - $class = static::class; - - if (ObjectHelpers::hasProperty($class, $name) === 'event') { // calling event handlers - $handlers = $this->$name ?? null; - if (is_iterable($handlers)) { - foreach ($handlers as $handler) { - $handler(...$args); - } - } elseif ($handlers !== null) { - throw new UnexpectedValueException("Property $class::$$name must be iterable or null, " . get_debug_type($handlers) . ' given.'); - } - - return null; - } - - ObjectHelpers::strictCall($class, $name); - } - - - /** - * @throws MemberAccessException - */ - public static function __callStatic(string $name, array $args) - { - ObjectHelpers::strictStaticCall(static::class, $name); - } - - - /** - * @return mixed - * @throws MemberAccessException if the property is not defined. - */ - public function &__get(string $name) - { - $class = static::class; - - if ($prop = ObjectHelpers::getMagicProperties($class)[$name] ?? null) { // property getter - if (!($prop & 0b0001)) { - throw new MemberAccessException("Cannot read a write-only property $class::\$$name."); - } - - $m = ($prop & 0b0010 ? 'get' : 'is') . ucfirst($name); - if ($prop & 0b10000) { - $trace = debug_backtrace(0, 1)[0]; // suppose this method is called from __call() - $loc = isset($trace['file'], $trace['line']) - ? " in $trace[file] on line $trace[line]" - : ''; - trigger_error("Property $class::\$$name is deprecated, use $class::$m() method$loc.", E_USER_DEPRECATED); - } - - if ($prop & 0b0100) { // return by reference - return $this->$m(); - } else { - $val = $this->$m(); - return $val; - } - } else { - ObjectHelpers::strictGet($class, $name); - } - } - - - /** - * @throws MemberAccessException if the property is not defined or is read-only - */ - public function __set(string $name, mixed $value): void - { - $class = static::class; - - if (ObjectHelpers::hasProperty($class, $name)) { // unsetted property - $this->$name = $value; - - } elseif ($prop = ObjectHelpers::getMagicProperties($class)[$name] ?? null) { // property setter - if (!($prop & 0b1000)) { - throw new MemberAccessException("Cannot write to a read-only property $class::\$$name."); - } - - $m = 'set' . ucfirst($name); - if ($prop & 0b10000) { - $trace = debug_backtrace(0, 1)[0]; // suppose this method is called from __call() - $loc = isset($trace['file'], $trace['line']) - ? " in $trace[file] on line $trace[line]" - : ''; - trigger_error("Property $class::\$$name is deprecated, use $class::$m() method$loc.", E_USER_DEPRECATED); - } - - $this->$m($value); - - } else { - ObjectHelpers::strictSet($class, $name); - } - } - - - /** - * @throws MemberAccessException - */ - public function __unset(string $name): void - { - $class = static::class; - if (!ObjectHelpers::hasProperty($class, $name)) { - throw new MemberAccessException("Cannot unset the property $class::\$$name."); - } - } - - - public function __isset(string $name): bool - { - return isset(ObjectHelpers::getMagicProperties(static::class)[$name]); - } -} diff --git a/vendor/nette/utils/src/StaticClass.php b/vendor/nette/utils/src/StaticClass.php deleted file mode 100644 index b1d8486..0000000 --- a/vendor/nette/utils/src/StaticClass.php +++ /dev/null @@ -1,34 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette; - - -/** - * Static class. - */ -trait StaticClass -{ - /** - * Class is static and cannot be instantiated. - */ - private function __construct() - { - } - - - /** - * Call to undefined static method. - * @throws MemberAccessException - */ - public static function __callStatic(string $name, array $args): mixed - { - Utils\ObjectHelpers::strictStaticCall(static::class, $name); - } -} diff --git a/vendor/nette/utils/src/Translator.php b/vendor/nette/utils/src/Translator.php deleted file mode 100644 index f973f5f..0000000 --- a/vendor/nette/utils/src/Translator.php +++ /dev/null @@ -1,25 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Localization; - - -/** - * Translator adapter. - */ -interface Translator -{ - /** - * Translates the given string. - */ - function translate(string|\Stringable $message, mixed ...$parameters): string|\Stringable; -} - - -interface_exists(ITranslator::class); diff --git a/vendor/nette/utils/src/Utils/ArrayHash.php b/vendor/nette/utils/src/Utils/ArrayHash.php deleted file mode 100644 index 349ffe0..0000000 --- a/vendor/nette/utils/src/Utils/ArrayHash.php +++ /dev/null @@ -1,106 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Utils; - -use Nette; - - -/** - * Provides objects to work as array. - * @template T - * @implements \IteratorAggregate<array-key, T> - * @implements \ArrayAccess<array-key, T> - */ -class ArrayHash extends \stdClass implements \ArrayAccess, \Countable, \IteratorAggregate -{ - /** - * Transforms array to ArrayHash. - * @param array<T> $array - */ - public static function from(array $array, bool $recursive = true): static - { - $obj = new static; - foreach ($array as $key => $value) { - $obj->$key = $recursive && is_array($value) - ? static::from($value) - : $value; - } - - return $obj; - } - - - /** - * Returns an iterator over all items. - * @return \Iterator<array-key, T> - */ - public function &getIterator(): \Iterator - { - foreach ((array) $this as $key => $foo) { - yield $key => $this->$key; - } - } - - - /** - * Returns items count. - */ - public function count(): int - { - return count((array) $this); - } - - - /** - * Replaces or appends a item. - * @param array-key $key - * @param T $value - */ - public function offsetSet($key, $value): void - { - if (!is_scalar($key)) { // prevents null - throw new Nette\InvalidArgumentException(sprintf('Key must be either a string or an integer, %s given.', get_debug_type($key))); - } - - $this->$key = $value; - } - - - /** - * Returns a item. - * @param array-key $key - * @return T - */ - #[\ReturnTypeWillChange] - public function offsetGet($key) - { - return $this->$key; - } - - - /** - * Determines whether a item exists. - * @param array-key $key - */ - public function offsetExists($key): bool - { - return isset($this->$key); - } - - - /** - * Removes the element from this list. - * @param array-key $key - */ - public function offsetUnset($key): void - { - unset($this->$key); - } -} diff --git a/vendor/nette/utils/src/Utils/ArrayList.php b/vendor/nette/utils/src/Utils/ArrayList.php deleted file mode 100644 index a402f9b..0000000 --- a/vendor/nette/utils/src/Utils/ArrayList.php +++ /dev/null @@ -1,136 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Utils; - -use Nette; - - -/** - * Provides the base class for a generic list (items can be accessed by index). - * @template T - * @implements \IteratorAggregate<int, T> - * @implements \ArrayAccess<int, T> - */ -class ArrayList implements \ArrayAccess, \Countable, \IteratorAggregate -{ - use Nette\SmartObject; - - private array $list = []; - - - /** - * Transforms array to ArrayList. - * @param list<T> $array - */ - public static function from(array $array): static - { - if (!Arrays::isList($array)) { - throw new Nette\InvalidArgumentException('Array is not valid list.'); - } - - $obj = new static; - $obj->list = $array; - return $obj; - } - - - /** - * Returns an iterator over all items. - * @return \Iterator<int, T> - */ - public function &getIterator(): \Iterator - { - foreach ($this->list as &$item) { - yield $item; - } - } - - - /** - * Returns items count. - */ - public function count(): int - { - return count($this->list); - } - - - /** - * Replaces or appends a item. - * @param int|null $index - * @param T $value - * @throws Nette\OutOfRangeException - */ - public function offsetSet($index, $value): void - { - if ($index === null) { - $this->list[] = $value; - - } elseif (!is_int($index) || $index < 0 || $index >= count($this->list)) { - throw new Nette\OutOfRangeException('Offset invalid or out of range'); - - } else { - $this->list[$index] = $value; - } - } - - - /** - * Returns a item. - * @param int $index - * @return T - * @throws Nette\OutOfRangeException - */ - public function offsetGet($index): mixed - { - if (!is_int($index) || $index < 0 || $index >= count($this->list)) { - throw new Nette\OutOfRangeException('Offset invalid or out of range'); - } - - return $this->list[$index]; - } - - - /** - * Determines whether a item exists. - * @param int $index - */ - public function offsetExists($index): bool - { - return is_int($index) && $index >= 0 && $index < count($this->list); - } - - - /** - * Removes the element at the specified position in this list. - * @param int $index - * @throws Nette\OutOfRangeException - */ - public function offsetUnset($index): void - { - if (!is_int($index) || $index < 0 || $index >= count($this->list)) { - throw new Nette\OutOfRangeException('Offset invalid or out of range'); - } - - array_splice($this->list, $index, 1); - } - - - /** - * Prepends a item. - * @param T $value - */ - public function prepend(mixed $value): void - { - $first = array_slice($this->list, 0, 1); - $this->offsetSet(0, $value); - array_splice($this->list, 1, 0, $first); - } -} diff --git a/vendor/nette/utils/src/Utils/Arrays.php b/vendor/nette/utils/src/Utils/Arrays.php deleted file mode 100644 index 00a4a8c..0000000 --- a/vendor/nette/utils/src/Utils/Arrays.php +++ /dev/null @@ -1,553 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Utils; - -use JetBrains\PhpStorm\Language; -use Nette; -use function is_array, is_int, is_object, count; - - -/** - * Array tools library. - */ -class Arrays -{ - use Nette\StaticClass; - - /** - * Returns item from array. If it does not exist, it throws an exception, unless a default value is set. - * @template T - * @param array<T> $array - * @param array-key|array-key[] $key - * @param ?T $default - * @return ?T - * @throws Nette\InvalidArgumentException if item does not exist and default value is not provided - */ - public static function get(array $array, string|int|array $key, mixed $default = null): mixed - { - foreach (is_array($key) ? $key : [$key] as $k) { - if (is_array($array) && array_key_exists($k, $array)) { - $array = $array[$k]; - } else { - if (func_num_args() < 3) { - throw new Nette\InvalidArgumentException("Missing item '$k'."); - } - - return $default; - } - } - - return $array; - } - - - /** - * Returns reference to array item. If the index does not exist, new one is created with value null. - * @template T - * @param array<T> $array - * @param array-key|array-key[] $key - * @return ?T - * @throws Nette\InvalidArgumentException if traversed item is not an array - */ - public static function &getRef(array &$array, string|int|array $key): mixed - { - foreach (is_array($key) ? $key : [$key] as $k) { - if (is_array($array) || $array === null) { - $array = &$array[$k]; - } else { - throw new Nette\InvalidArgumentException('Traversed item is not an array.'); - } - } - - return $array; - } - - - /** - * Recursively merges two fields. It is useful, for example, for merging tree structures. It behaves as - * the + operator for array, ie. it adds a key/value pair from the second array to the first one and retains - * the value from the first array in the case of a key collision. - * @template T1 - * @template T2 - * @param array<T1> $array1 - * @param array<T2> $array2 - * @return array<T1|T2> - */ - public static function mergeTree(array $array1, array $array2): array - { - $res = $array1 + $array2; - foreach (array_intersect_key($array1, $array2) as $k => $v) { - if (is_array($v) && is_array($array2[$k])) { - $res[$k] = self::mergeTree($v, $array2[$k]); - } - } - - return $res; - } - - - /** - * Returns zero-indexed position of given array key. Returns null if key is not found. - */ - public static function getKeyOffset(array $array, string|int $key): ?int - { - return Helpers::falseToNull(array_search(self::toKey($key), array_keys($array), strict: true)); - } - - - /** - * @deprecated use getKeyOffset() - */ - public static function searchKey(array $array, $key): ?int - { - return self::getKeyOffset($array, $key); - } - - - /** - * Tests an array for the presence of value. - */ - public static function contains(array $array, mixed $value): bool - { - return in_array($value, $array, true); - } - - - /** - * Returns the first item (matching the specified predicate if given). If there is no such item, it returns result of invoking $else or null. - * @template K of int|string - * @template V - * @param array<K, V> $array - * @param ?callable(V, K, array<K, V>): bool $predicate - * @return ?V - */ - public static function first(array $array, ?callable $predicate = null, ?callable $else = null): mixed - { - $key = self::firstKey($array, $predicate); - return $key === null - ? ($else ? $else() : null) - : $array[$key]; - } - - - /** - * Returns the last item (matching the specified predicate if given). If there is no such item, it returns result of invoking $else or null. - * @template K of int|string - * @template V - * @param array<K, V> $array - * @param ?callable(V, K, array<K, V>): bool $predicate - * @return ?V - */ - public static function last(array $array, ?callable $predicate = null, ?callable $else = null): mixed - { - $key = self::lastKey($array, $predicate); - return $key === null - ? ($else ? $else() : null) - : $array[$key]; - } - - - /** - * Returns the key of first item (matching the specified predicate if given) or null if there is no such item. - * @template K of int|string - * @template V - * @param array<K, V> $array - * @param ?callable(V, K, array<K, V>): bool $predicate - * @return ?K - */ - public static function firstKey(array $array, ?callable $predicate = null): int|string|null - { - if (!$predicate) { - return array_key_first($array); - } - foreach ($array as $k => $v) { - if ($predicate($v, $k, $array)) { - return $k; - } - } - return null; - } - - - /** - * Returns the key of last item (matching the specified predicate if given) or null if there is no such item. - * @template K of int|string - * @template V - * @param array<K, V> $array - * @param ?callable(V, K, array<K, V>): bool $predicate - * @return ?K - */ - public static function lastKey(array $array, ?callable $predicate = null): int|string|null - { - return $predicate - ? self::firstKey(array_reverse($array, preserve_keys: true), $predicate) - : array_key_last($array); - } - - - /** - * Inserts the contents of the $inserted array into the $array immediately after the $key. - * If $key is null (or does not exist), it is inserted at the beginning. - */ - public static function insertBefore(array &$array, string|int|null $key, array $inserted): void - { - $offset = $key === null ? 0 : (int) self::getKeyOffset($array, $key); - $array = array_slice($array, 0, $offset, preserve_keys: true) - + $inserted - + array_slice($array, $offset, count($array), preserve_keys: true); - } - - - /** - * Inserts the contents of the $inserted array into the $array before the $key. - * If $key is null (or does not exist), it is inserted at the end. - */ - public static function insertAfter(array &$array, string|int|null $key, array $inserted): void - { - if ($key === null || ($offset = self::getKeyOffset($array, $key)) === null) { - $offset = count($array) - 1; - } - - $array = array_slice($array, 0, $offset + 1, preserve_keys: true) - + $inserted - + array_slice($array, $offset + 1, count($array), preserve_keys: true); - } - - - /** - * Renames key in array. - */ - public static function renameKey(array &$array, string|int $oldKey, string|int $newKey): bool - { - $offset = self::getKeyOffset($array, $oldKey); - if ($offset === null) { - return false; - } - - $val = &$array[$oldKey]; - $keys = array_keys($array); - $keys[$offset] = $newKey; - $array = array_combine($keys, $array); - $array[$newKey] = &$val; - return true; - } - - - /** - * Returns only those array items, which matches a regular expression $pattern. - * @param string[] $array - * @return string[] - */ - public static function grep( - array $array, - #[Language('RegExp')] - string $pattern, - bool|int $invert = false, - ): array - { - $flags = $invert ? PREG_GREP_INVERT : 0; - return Strings::pcre('preg_grep', [$pattern, $array, $flags]); - } - - - /** - * Transforms multidimensional array to flat array. - */ - public static function flatten(array $array, bool $preserveKeys = false): array - { - $res = []; - $cb = $preserveKeys - ? function ($v, $k) use (&$res): void { $res[$k] = $v; } - : function ($v) use (&$res): void { $res[] = $v; }; - array_walk_recursive($array, $cb); - return $res; - } - - - /** - * Checks if the array is indexed in ascending order of numeric keys from zero, a.k.a list. - * @return ($value is list ? true : false) - */ - public static function isList(mixed $value): bool - { - return is_array($value) && (PHP_VERSION_ID < 80100 - ? !$value || array_keys($value) === range(0, count($value) - 1) - : array_is_list($value) - ); - } - - - /** - * Reformats table to associative tree. Path looks like 'field|field[]field->field=field'. - * @param string|string[] $path - */ - public static function associate(array $array, $path): array|\stdClass - { - $parts = is_array($path) - ? $path - : preg_split('#(\[\]|->|=|\|)#', $path, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); - - if (!$parts || $parts === ['->'] || $parts[0] === '=' || $parts[0] === '|') { - throw new Nette\InvalidArgumentException("Invalid path '$path'."); - } - - $res = $parts[0] === '->' ? new \stdClass : []; - - foreach ($array as $rowOrig) { - $row = (array) $rowOrig; - $x = &$res; - - for ($i = 0; $i < count($parts); $i++) { - $part = $parts[$i]; - if ($part === '[]') { - $x = &$x[]; - - } elseif ($part === '=') { - if (isset($parts[++$i])) { - $x = $row[$parts[$i]]; - $row = null; - } - } elseif ($part === '->') { - if (isset($parts[++$i])) { - if ($x === null) { - $x = new \stdClass; - } - - $x = &$x->{$row[$parts[$i]]}; - } else { - $row = is_object($rowOrig) ? $rowOrig : (object) $row; - } - } elseif ($part !== '|') { - $x = &$x[(string) $row[$part]]; - } - } - - if ($x === null) { - $x = $row; - } - } - - return $res; - } - - - /** - * Normalizes array to associative array. Replace numeric keys with their values, the new value will be $filling. - */ - public static function normalize(array $array, mixed $filling = null): array - { - $res = []; - foreach ($array as $k => $v) { - $res[is_int($k) ? $v : $k] = is_int($k) ? $filling : $v; - } - - return $res; - } - - - /** - * Returns and removes the value of an item from an array. If it does not exist, it throws an exception, - * or returns $default, if provided. - * @template T - * @param array<T> $array - * @param ?T $default - * @return ?T - * @throws Nette\InvalidArgumentException if item does not exist and default value is not provided - */ - public static function pick(array &$array, string|int $key, mixed $default = null): mixed - { - if (array_key_exists($key, $array)) { - $value = $array[$key]; - unset($array[$key]); - return $value; - - } elseif (func_num_args() < 3) { - throw new Nette\InvalidArgumentException("Missing item '$key'."); - - } else { - return $default; - } - } - - - /** - * Tests whether at least one element in the array passes the test implemented by the provided function. - * @template K of int|string - * @template V - * @param array<K, V> $array - * @param callable(V, K, array<K, V>): bool $predicate - */ - public static function some(iterable $array, callable $predicate): bool - { - foreach ($array as $k => $v) { - if ($predicate($v, $k, $array)) { - return true; - } - } - - return false; - } - - - /** - * Tests whether all elements in the array pass the test implemented by the provided function. - * @template K of int|string - * @template V - * @param array<K, V> $array - * @param callable(V, K, array<K, V>): bool $predicate - */ - public static function every(iterable $array, callable $predicate): bool - { - foreach ($array as $k => $v) { - if (!$predicate($v, $k, $array)) { - return false; - } - } - - return true; - } - - - /** - * Returns a new array containing all key-value pairs matching the given $predicate. - * @template K of int|string - * @template V - * @param array<K, V> $array - * @param callable(V, K, array<K, V>): bool $predicate - * @return array<K, V> - */ - public static function filter(array $array, callable $predicate): array - { - $res = []; - foreach ($array as $k => $v) { - if ($predicate($v, $k, $array)) { - $res[$k] = $v; - } - } - return $res; - } - - - /** - * Returns an array containing the original keys and results of applying the given transform function to each element. - * @template K of int|string - * @template V - * @template R - * @param array<K, V> $array - * @param callable(V, K, array<K, V>): R $transformer - * @return array<K, R> - */ - public static function map(iterable $array, callable $transformer): array - { - $res = []; - foreach ($array as $k => $v) { - $res[$k] = $transformer($v, $k, $array); - } - - return $res; - } - - - /** - * Returns an array containing new keys and values generated by applying the given transform function to each element. - * If the function returns null, the element is skipped. - * @template K of int|string - * @template V - * @template ResK of int|string - * @template ResV - * @param array<K, V> $array - * @param callable(V, K, array<K, V>): ?array{ResK, ResV} $transformer - * @return array<ResK, ResV> - */ - public static function mapWithKeys(array $array, callable $transformer): array - { - $res = []; - foreach ($array as $k => $v) { - $pair = $transformer($v, $k, $array); - if ($pair) { - $res[$pair[0]] = $pair[1]; - } - } - - return $res; - } - - - /** - * Invokes all callbacks and returns array of results. - * @param callable[] $callbacks - */ - public static function invoke(iterable $callbacks, ...$args): array - { - $res = []; - foreach ($callbacks as $k => $cb) { - $res[$k] = $cb(...$args); - } - - return $res; - } - - - /** - * Invokes method on every object in an array and returns array of results. - * @param object[] $objects - */ - public static function invokeMethod(iterable $objects, string $method, ...$args): array - { - $res = []; - foreach ($objects as $k => $obj) { - $res[$k] = $obj->$method(...$args); - } - - return $res; - } - - - /** - * Copies the elements of the $array array to the $object object and then returns it. - * @template T of object - * @param T $object - * @return T - */ - public static function toObject(iterable $array, object $object): object - { - foreach ($array as $k => $v) { - $object->$k = $v; - } - - return $object; - } - - - /** - * Converts value to array key. - */ - public static function toKey(mixed $value): int|string - { - return key([$value => null]); - } - - - /** - * Returns copy of the $array where every item is converted to string - * and prefixed by $prefix and suffixed by $suffix. - * @param string[] $array - * @return string[] - */ - public static function wrap(array $array, string $prefix = '', string $suffix = ''): array - { - $res = []; - foreach ($array as $k => $v) { - $res[$k] = $prefix . $v . $suffix; - } - - return $res; - } -} diff --git a/vendor/nette/utils/src/Utils/Callback.php b/vendor/nette/utils/src/Utils/Callback.php deleted file mode 100644 index 1777428..0000000 --- a/vendor/nette/utils/src/Utils/Callback.php +++ /dev/null @@ -1,137 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Utils; - -use Nette; -use function is_array, is_object, is_string; - - -/** - * PHP callable tools. - */ -final class Callback -{ - use Nette\StaticClass; - - /** - * Invokes internal PHP function with own error handler. - */ - public static function invokeSafe(string $function, array $args, callable $onError): mixed - { - $prev = set_error_handler(function ($severity, $message, $file) use ($onError, &$prev, $function): ?bool { - if ($file === __FILE__) { - $msg = ini_get('html_errors') - ? Html::htmlToText($message) - : $message; - $msg = preg_replace("#^$function\\(.*?\\): #", '', $msg); - if ($onError($msg, $severity) !== false) { - return null; - } - } - - return $prev ? $prev(...func_get_args()) : false; - }); - - try { - return $function(...$args); - } finally { - restore_error_handler(); - } - } - - - /** - * Checks that $callable is valid PHP callback. Otherwise throws exception. If the $syntax is set to true, only verifies - * that $callable has a valid structure to be used as a callback, but does not verify if the class or method actually exists. - * @return callable - * @throws Nette\InvalidArgumentException - */ - public static function check(mixed $callable, bool $syntax = false) - { - if (!is_callable($callable, $syntax)) { - throw new Nette\InvalidArgumentException( - $syntax - ? 'Given value is not a callable type.' - : sprintf("Callback '%s' is not callable.", self::toString($callable)), - ); - } - - return $callable; - } - - - /** - * Converts PHP callback to textual form. Class or method may not exists. - */ - public static function toString(mixed $callable): string - { - if ($callable instanceof \Closure) { - $inner = self::unwrap($callable); - return '{closure' . ($inner instanceof \Closure ? '}' : ' ' . self::toString($inner) . '}'); - } else { - is_callable(is_object($callable) ? [$callable, '__invoke'] : $callable, true, $textual); - return $textual; - } - } - - - /** - * Returns reflection for method or function used in PHP callback. - * @param callable $callable type check is escalated to ReflectionException - * @throws \ReflectionException if callback is not valid - */ - public static function toReflection($callable): \ReflectionMethod|\ReflectionFunction - { - if ($callable instanceof \Closure) { - $callable = self::unwrap($callable); - } - - if (is_string($callable) && str_contains($callable, '::')) { - return new ReflectionMethod(...explode('::', $callable, 2)); - } elseif (is_array($callable)) { - return new ReflectionMethod($callable[0], $callable[1]); - } elseif (is_object($callable) && !$callable instanceof \Closure) { - return new ReflectionMethod($callable, '__invoke'); - } else { - return new \ReflectionFunction($callable); - } - } - - - /** - * Checks whether PHP callback is function or static method. - */ - public static function isStatic(callable $callable): bool - { - return is_string(is_array($callable) ? $callable[0] : $callable); - } - - - /** - * Unwraps closure created by Closure::fromCallable(). - */ - public static function unwrap(\Closure $closure): callable|array - { - $r = new \ReflectionFunction($closure); - $class = $r->getClosureScopeClass()?->name; - if (str_ends_with($r->name, '}')) { - return $closure; - - } elseif (($obj = $r->getClosureThis()) && $obj::class === $class) { - return [$obj, $r->name]; - - } elseif ($class) { - return [$class, $r->name]; - - } else { - return $r->name; - } - } -} diff --git a/vendor/nette/utils/src/Utils/DateTime.php b/vendor/nette/utils/src/Utils/DateTime.php deleted file mode 100644 index 6ad6520..0000000 --- a/vendor/nette/utils/src/Utils/DateTime.php +++ /dev/null @@ -1,140 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Utils; - -use Nette; - - -/** - * DateTime. - */ -class DateTime extends \DateTime implements \JsonSerializable -{ - use Nette\SmartObject; - - /** minute in seconds */ - public const MINUTE = 60; - - /** hour in seconds */ - public const HOUR = 60 * self::MINUTE; - - /** day in seconds */ - public const DAY = 24 * self::HOUR; - - /** week in seconds */ - public const WEEK = 7 * self::DAY; - - /** average month in seconds */ - public const MONTH = 2_629_800; - - /** average year in seconds */ - public const YEAR = 31_557_600; - - - /** - * Creates a DateTime object from a string, UNIX timestamp, or other DateTimeInterface object. - * @throws \Exception if the date and time are not valid. - */ - public static function from(string|int|\DateTimeInterface|null $time): static - { - if ($time instanceof \DateTimeInterface) { - return new static($time->format('Y-m-d H:i:s.u'), $time->getTimezone()); - - } elseif (is_numeric($time)) { - if ($time <= self::YEAR) { - $time += time(); - } - - return (new static)->setTimestamp((int) $time); - - } else { // textual or null - return new static((string) $time); - } - } - - - /** - * Creates DateTime object. - * @throws Nette\InvalidArgumentException if the date and time are not valid. - */ - public static function fromParts( - int $year, - int $month, - int $day, - int $hour = 0, - int $minute = 0, - float $second = 0.0, - ): static - { - $s = sprintf('%04d-%02d-%02d %02d:%02d:%02.5F', $year, $month, $day, $hour, $minute, $second); - if ( - !checkdate($month, $day, $year) - || $hour < 0 - || $hour > 23 - || $minute < 0 - || $minute > 59 - || $second < 0 - || $second >= 60 - ) { - throw new Nette\InvalidArgumentException("Invalid date '$s'"); - } - - return new static($s); - } - - - /** - * Returns new DateTime object formatted according to the specified format. - */ - public static function createFromFormat( - string $format, - string $time, - string|\DateTimeZone|null $timezone = null, - ): static|false - { - if ($timezone === null) { - $timezone = new \DateTimeZone(date_default_timezone_get()); - - } elseif (is_string($timezone)) { - $timezone = new \DateTimeZone($timezone); - } - - $date = parent::createFromFormat($format, $time, $timezone); - return $date ? static::from($date) : false; - } - - - /** - * Returns JSON representation in ISO 8601 (used by JavaScript). - */ - public function jsonSerialize(): string - { - return $this->format('c'); - } - - - /** - * Returns the date and time in the format 'Y-m-d H:i:s'. - */ - public function __toString(): string - { - return $this->format('Y-m-d H:i:s'); - } - - - /** - * You'd better use: (clone $dt)->modify(...) - */ - public function modifyClone(string $modify = ''): static - { - $dolly = clone $this; - return $modify ? $dolly->modify($modify) : $dolly; - } -} diff --git a/vendor/nette/utils/src/Utils/FileInfo.php b/vendor/nette/utils/src/Utils/FileInfo.php deleted file mode 100644 index fb92d11..0000000 --- a/vendor/nette/utils/src/Utils/FileInfo.php +++ /dev/null @@ -1,69 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Utils; - -use Nette; - - -/** - * Represents the file or directory returned by the Finder. - * @internal do not create instances directly - */ -final class FileInfo extends \SplFileInfo -{ - private string $relativePath; - - - public function __construct(string $file, string $relativePath = '') - { - parent::__construct($file); - $this->setInfoClass(static::class); - $this->relativePath = $relativePath; - } - - - /** - * Returns the relative directory path. - */ - public function getRelativePath(): string - { - return $this->relativePath; - } - - - /** - * Returns the relative path including file name. - */ - public function getRelativePathname(): string - { - return ($this->relativePath === '' ? '' : $this->relativePath . DIRECTORY_SEPARATOR) - . $this->getBasename(); - } - - - /** - * Returns the contents of the file. - * @throws Nette\IOException - */ - public function read(): string - { - return FileSystem::read($this->getPathname()); - } - - - /** - * Writes the contents to the file. - * @throws Nette\IOException - */ - public function write(string $content): void - { - FileSystem::write($this->getPathname(), $content); - } -} diff --git a/vendor/nette/utils/src/Utils/FileSystem.php b/vendor/nette/utils/src/Utils/FileSystem.php deleted file mode 100644 index ab9a7e8..0000000 --- a/vendor/nette/utils/src/Utils/FileSystem.php +++ /dev/null @@ -1,326 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Utils; - -use Nette; - - -/** - * File system tool. - */ -final class FileSystem -{ - /** - * Creates a directory if it does not exist, including parent directories. - * @throws Nette\IOException on error occurred - */ - public static function createDir(string $dir, int $mode = 0777): void - { - if (!is_dir($dir) && !@mkdir($dir, $mode, recursive: true) && !is_dir($dir)) { // @ - dir may already exist - throw new Nette\IOException(sprintf( - "Unable to create directory '%s' with mode %s. %s", - self::normalizePath($dir), - decoct($mode), - Helpers::getLastError(), - )); - } - } - - - /** - * Copies a file or an entire directory. Overwrites existing files and directories by default. - * @throws Nette\IOException on error occurred - * @throws Nette\InvalidStateException if $overwrite is set to false and destination already exists - */ - public static function copy(string $origin, string $target, bool $overwrite = true): void - { - if (stream_is_local($origin) && !file_exists($origin)) { - throw new Nette\IOException(sprintf("File or directory '%s' not found.", self::normalizePath($origin))); - - } elseif (!$overwrite && file_exists($target)) { - throw new Nette\InvalidStateException(sprintf("File or directory '%s' already exists.", self::normalizePath($target))); - - } elseif (is_dir($origin)) { - static::createDir($target); - foreach (new \FilesystemIterator($target) as $item) { - static::delete($item->getPathname()); - } - - foreach ($iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($origin, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item) { - if ($item->isDir()) { - static::createDir($target . '/' . $iterator->getSubPathName()); - } else { - static::copy($item->getPathname(), $target . '/' . $iterator->getSubPathName()); - } - } - } else { - static::createDir(dirname($target)); - if (@stream_copy_to_stream(static::open($origin, 'rb'), static::open($target, 'wb')) === false) { // @ is escalated to exception - throw new Nette\IOException(sprintf( - "Unable to copy file '%s' to '%s'. %s", - self::normalizePath($origin), - self::normalizePath($target), - Helpers::getLastError(), - )); - } - } - } - - - /** - * Opens file and returns resource. - * @return resource - * @throws Nette\IOException on error occurred - */ - public static function open(string $path, string $mode) - { - $f = @fopen($path, $mode); // @ is escalated to exception - if (!$f) { - throw new Nette\IOException(sprintf( - "Unable to open file '%s'. %s", - self::normalizePath($path), - Helpers::getLastError(), - )); - } - return $f; - } - - - /** - * Deletes a file or an entire directory if exists. If the directory is not empty, it deletes its contents first. - * @throws Nette\IOException on error occurred - */ - public static function delete(string $path): void - { - if (is_file($path) || is_link($path)) { - $func = DIRECTORY_SEPARATOR === '\\' && is_dir($path) ? 'rmdir' : 'unlink'; - if (!@$func($path)) { // @ is escalated to exception - throw new Nette\IOException(sprintf( - "Unable to delete '%s'. %s", - self::normalizePath($path), - Helpers::getLastError(), - )); - } - } elseif (is_dir($path)) { - foreach (new \FilesystemIterator($path) as $item) { - static::delete($item->getPathname()); - } - - if (!@rmdir($path)) { // @ is escalated to exception - throw new Nette\IOException(sprintf( - "Unable to delete directory '%s'. %s", - self::normalizePath($path), - Helpers::getLastError(), - )); - } - } - } - - - /** - * Renames or moves a file or a directory. Overwrites existing files and directories by default. - * @throws Nette\IOException on error occurred - * @throws Nette\InvalidStateException if $overwrite is set to false and destination already exists - */ - public static function rename(string $origin, string $target, bool $overwrite = true): void - { - if (!$overwrite && file_exists($target)) { - throw new Nette\InvalidStateException(sprintf("File or directory '%s' already exists.", self::normalizePath($target))); - - } elseif (!file_exists($origin)) { - throw new Nette\IOException(sprintf("File or directory '%s' not found.", self::normalizePath($origin))); - - } else { - static::createDir(dirname($target)); - if (realpath($origin) !== realpath($target)) { - static::delete($target); - } - - if (!@rename($origin, $target)) { // @ is escalated to exception - throw new Nette\IOException(sprintf( - "Unable to rename file or directory '%s' to '%s'. %s", - self::normalizePath($origin), - self::normalizePath($target), - Helpers::getLastError(), - )); - } - } - } - - - /** - * Reads the content of a file. - * @throws Nette\IOException on error occurred - */ - public static function read(string $file): string - { - $content = @file_get_contents($file); // @ is escalated to exception - if ($content === false) { - throw new Nette\IOException(sprintf( - "Unable to read file '%s'. %s", - self::normalizePath($file), - Helpers::getLastError(), - )); - } - - return $content; - } - - - /** - * Reads the file content line by line. Because it reads continuously as we iterate over the lines, - * it is possible to read files larger than the available memory. - * @return \Generator<int, string> - * @throws Nette\IOException on error occurred - */ - public static function readLines(string $file, bool $stripNewLines = true): \Generator - { - return (function ($f) use ($file, $stripNewLines) { - $counter = 0; - do { - $line = Callback::invokeSafe('fgets', [$f], fn($error) => throw new Nette\IOException(sprintf( - "Unable to read file '%s'. %s", - self::normalizePath($file), - $error, - ))); - if ($line === false) { - fclose($f); - break; - } - if ($stripNewLines) { - $line = rtrim($line, "\r\n"); - } - - yield $counter++ => $line; - - } while (true); - })(static::open($file, 'r')); - } - - - /** - * Writes the string to a file. - * @throws Nette\IOException on error occurred - */ - public static function write(string $file, string $content, ?int $mode = 0666): void - { - static::createDir(dirname($file)); - if (@file_put_contents($file, $content) === false) { // @ is escalated to exception - throw new Nette\IOException(sprintf( - "Unable to write file '%s'. %s", - self::normalizePath($file), - Helpers::getLastError(), - )); - } - - if ($mode !== null && !@chmod($file, $mode)) { // @ is escalated to exception - throw new Nette\IOException(sprintf( - "Unable to chmod file '%s' to mode %s. %s", - self::normalizePath($file), - decoct($mode), - Helpers::getLastError(), - )); - } - } - - - /** - * Sets file permissions to `$fileMode` or directory permissions to `$dirMode`. - * Recursively traverses and sets permissions on the entire contents of the directory as well. - * @throws Nette\IOException on error occurred - */ - public static function makeWritable(string $path, int $dirMode = 0777, int $fileMode = 0666): void - { - if (is_file($path)) { - if (!@chmod($path, $fileMode)) { // @ is escalated to exception - throw new Nette\IOException(sprintf( - "Unable to chmod file '%s' to mode %s. %s", - self::normalizePath($path), - decoct($fileMode), - Helpers::getLastError(), - )); - } - } elseif (is_dir($path)) { - foreach (new \FilesystemIterator($path) as $item) { - static::makeWritable($item->getPathname(), $dirMode, $fileMode); - } - - if (!@chmod($path, $dirMode)) { // @ is escalated to exception - throw new Nette\IOException(sprintf( - "Unable to chmod directory '%s' to mode %s. %s", - self::normalizePath($path), - decoct($dirMode), - Helpers::getLastError(), - )); - } - } else { - throw new Nette\IOException(sprintf("File or directory '%s' not found.", self::normalizePath($path))); - } - } - - - /** - * Determines if the path is absolute. - */ - public static function isAbsolute(string $path): bool - { - return (bool) preg_match('#([a-z]:)?[/\\\\]|[a-z][a-z0-9+.-]*://#Ai', $path); - } - - - /** - * Normalizes `..` and `.` and directory separators in path. - */ - public static function normalizePath(string $path): string - { - $parts = $path === '' ? [] : preg_split('~[/\\\\]+~', $path); - $res = []; - foreach ($parts as $part) { - if ($part === '..' && $res && end($res) !== '..' && end($res) !== '') { - array_pop($res); - } elseif ($part !== '.') { - $res[] = $part; - } - } - - return $res === [''] - ? DIRECTORY_SEPARATOR - : implode(DIRECTORY_SEPARATOR, $res); - } - - - /** - * Joins all segments of the path and normalizes the result. - */ - public static function joinPaths(string ...$paths): string - { - return self::normalizePath(implode('/', $paths)); - } - - - /** - * Converts backslashes to slashes. - */ - public static function unixSlashes(string $path): string - { - return strtr($path, '\\', '/'); - } - - - /** - * Converts slashes to platform-specific directory separators. - */ - public static function platformSlashes(string $path): string - { - return DIRECTORY_SEPARATOR === '/' - ? strtr($path, '\\', '/') - : str_replace(':\\\\', '://', strtr($path, '/', '\\')); // protocol:// - } -} diff --git a/vendor/nette/utils/src/Utils/Finder.php b/vendor/nette/utils/src/Utils/Finder.php deleted file mode 100644 index a496528..0000000 --- a/vendor/nette/utils/src/Utils/Finder.php +++ /dev/null @@ -1,510 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Utils; - -use Nette; - - -/** - * Finder allows searching through directory trees using iterator. - * - * Finder::findFiles('*.php') - * ->size('> 10kB') - * ->from('.') - * ->exclude('temp'); - * - * @implements \IteratorAggregate<string, FileInfo> - */ -class Finder implements \IteratorAggregate -{ - use Nette\SmartObject; - - /** @var array<array{string, string}> */ - private array $find = []; - - /** @var string[] */ - private array $in = []; - - /** @var \Closure[] */ - private array $filters = []; - - /** @var \Closure[] */ - private array $descentFilters = []; - - /** @var array<string|self> */ - private array $appends = []; - private bool $childFirst = false; - - /** @var ?callable */ - private $sort; - private int $maxDepth = -1; - private bool $ignoreUnreadableDirs = true; - - - /** - * Begins search for files and directories matching mask. - */ - public static function find(string|array $masks = ['*']): static - { - $masks = is_array($masks) ? $masks : func_get_args(); // compatibility with variadic - return (new static)->addMask($masks, 'dir')->addMask($masks, 'file'); - } - - - /** - * Begins search for files matching mask. - */ - public static function findFiles(string|array $masks = ['*']): static - { - $masks = is_array($masks) ? $masks : func_get_args(); // compatibility with variadic - return (new static)->addMask($masks, 'file'); - } - - - /** - * Begins search for directories matching mask. - */ - public static function findDirectories(string|array $masks = ['*']): static - { - $masks = is_array($masks) ? $masks : func_get_args(); // compatibility with variadic - return (new static)->addMask($masks, 'dir'); - } - - - /** - * Finds files matching the specified masks. - */ - public function files(string|array $masks = ['*']): static - { - return $this->addMask((array) $masks, 'file'); - } - - - /** - * Finds directories matching the specified masks. - */ - public function directories(string|array $masks = ['*']): static - { - return $this->addMask((array) $masks, 'dir'); - } - - - private function addMask(array $masks, string $mode): static - { - foreach ($masks as $mask) { - $mask = FileSystem::unixSlashes($mask); - if ($mode === 'dir') { - $mask = rtrim($mask, '/'); - } - if ($mask === '' || ($mode === 'file' && str_ends_with($mask, '/'))) { - throw new Nette\InvalidArgumentException("Invalid mask '$mask'"); - } - if (str_starts_with($mask, '**/')) { - $mask = substr($mask, 3); - } - $this->find[] = [$mask, $mode]; - } - return $this; - } - - - /** - * Searches in the given directories. Wildcards are allowed. - */ - public function in(string|array $paths): static - { - $paths = is_array($paths) ? $paths : func_get_args(); // compatibility with variadic - $this->addLocation($paths, ''); - return $this; - } - - - /** - * Searches recursively from the given directories. Wildcards are allowed. - */ - public function from(string|array $paths): static - { - $paths = is_array($paths) ? $paths : func_get_args(); // compatibility with variadic - $this->addLocation($paths, '/**'); - return $this; - } - - - private function addLocation(array $paths, string $ext): void - { - foreach ($paths as $path) { - if ($path === '') { - throw new Nette\InvalidArgumentException("Invalid directory '$path'"); - } - $path = rtrim(FileSystem::unixSlashes($path), '/'); - $this->in[] = $path . $ext; - } - } - - - /** - * Lists directory's contents before the directory itself. By default, this is disabled. - */ - public function childFirst(bool $state = true): static - { - $this->childFirst = $state; - return $this; - } - - - /** - * Ignores unreadable directories. By default, this is enabled. - */ - public function ignoreUnreadableDirs(bool $state = true): static - { - $this->ignoreUnreadableDirs = $state; - return $this; - } - - - /** - * Set a compare function for sorting directory entries. The function will be called to sort entries from the same directory. - * @param callable(FileInfo, FileInfo): int $callback - */ - public function sortBy(callable $callback): static - { - $this->sort = $callback; - return $this; - } - - - /** - * Sorts files in each directory naturally by name. - */ - public function sortByName(): static - { - $this->sort = fn(FileInfo $a, FileInfo $b): int => strnatcmp($a->getBasename(), $b->getBasename()); - return $this; - } - - - /** - * Adds the specified paths or appends a new finder that returns. - */ - public function append(string|array|null $paths = null): static - { - if ($paths === null) { - return $this->appends[] = new static; - } - - $this->appends = array_merge($this->appends, (array) $paths); - return $this; - } - - - /********************* filtering ****************d*g**/ - - - /** - * Skips entries that matches the given masks relative to the ones defined with the in() or from() methods. - */ - public function exclude(string|array $masks): static - { - $masks = is_array($masks) ? $masks : func_get_args(); // compatibility with variadic - foreach ($masks as $mask) { - $mask = FileSystem::unixSlashes($mask); - if (!preg_match('~^/?(\*\*/)?(.+)(/\*\*|/\*|/|)$~D', $mask, $m)) { - throw new Nette\InvalidArgumentException("Invalid mask '$mask'"); - } - $end = $m[3]; - $re = $this->buildPattern($m[2]); - $filter = fn(FileInfo $file): bool => ($end && !$file->isDir()) - || !preg_match($re, FileSystem::unixSlashes($file->getRelativePathname())); - - $this->descentFilter($filter); - if ($end !== '/*') { - $this->filter($filter); - } - } - - return $this; - } - - - /** - * Yields only entries which satisfy the given filter. - * @param callable(FileInfo): bool $callback - */ - public function filter(callable $callback): static - { - $this->filters[] = \Closure::fromCallable($callback); - return $this; - } - - - /** - * It descends only to directories that match the specified filter. - * @param callable(FileInfo): bool $callback - */ - public function descentFilter(callable $callback): static - { - $this->descentFilters[] = \Closure::fromCallable($callback); - return $this; - } - - - /** - * Sets the maximum depth of entries. - */ - public function limitDepth(?int $depth): static - { - $this->maxDepth = $depth ?? -1; - return $this; - } - - - /** - * Restricts the search by size. $operator accepts "[operator] [size] [unit]" example: >=10kB - */ - public function size(string $operator, ?int $size = null): static - { - if (func_num_args() === 1) { // in $operator is predicate - if (!preg_match('#^(?:([=<>!]=?|<>)\s*)?((?:\d*\.)?\d+)\s*(K|M|G|)B?$#Di', $operator, $matches)) { - throw new Nette\InvalidArgumentException('Invalid size predicate format.'); - } - - [, $operator, $size, $unit] = $matches; - $units = ['' => 1, 'k' => 1e3, 'm' => 1e6, 'g' => 1e9]; - $size *= $units[strtolower($unit)]; - $operator = $operator ?: '='; - } - - return $this->filter(fn(FileInfo $file): bool => !$file->isFile() || Helpers::compare($file->getSize(), $operator, $size)); - } - - - /** - * Restricts the search by modified time. $operator accepts "[operator] [date]" example: >1978-01-23 - */ - public function date(string $operator, string|int|\DateTimeInterface|null $date = null): static - { - if (func_num_args() === 1) { // in $operator is predicate - if (!preg_match('#^(?:([=<>!]=?|<>)\s*)?(.+)$#Di', $operator, $matches)) { - throw new Nette\InvalidArgumentException('Invalid date predicate format.'); - } - - [, $operator, $date] = $matches; - $operator = $operator ?: '='; - } - - $date = DateTime::from($date)->format('U'); - return $this->filter(fn(FileInfo $file): bool => !$file->isFile() || Helpers::compare($file->getMTime(), $operator, $date)); - } - - - /********************* iterator generator ****************d*g**/ - - - /** - * Returns an array with all found files and directories. - * @return list<FileInfo> - */ - public function collect(): array - { - return iterator_to_array($this->getIterator(), preserve_keys: false); - } - - - /** @return \Generator<string, FileInfo> */ - public function getIterator(): \Generator - { - $plan = $this->buildPlan(); - foreach ($plan as $dir => $searches) { - yield from $this->traverseDir($dir, $searches); - } - - foreach ($this->appends as $item) { - if ($item instanceof self) { - yield from $item->getIterator(); - } else { - $item = FileSystem::platformSlashes($item); - yield $item => new FileInfo($item); - } - } - } - - - /** - * @param array<object{pattern: string, mode: string, recursive: bool}> $searches - * @param string[] $subdirs - * @return \Generator<string, FileInfo> - */ - private function traverseDir(string $dir, array $searches, array $subdirs = []): \Generator - { - if ($this->maxDepth >= 0 && count($subdirs) > $this->maxDepth) { - return; - } elseif (!is_dir($dir)) { - throw new Nette\InvalidStateException(sprintf("Directory '%s' does not exist.", rtrim($dir, '/\\'))); - } - - try { - $pathNames = new \FilesystemIterator($dir, \FilesystemIterator::FOLLOW_SYMLINKS | \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::UNIX_PATHS); - } catch (\UnexpectedValueException $e) { - if ($this->ignoreUnreadableDirs) { - return; - } else { - throw new Nette\InvalidStateException($e->getMessage()); - } - } - - $files = $this->convertToFiles($pathNames, implode('/', $subdirs), FileSystem::isAbsolute($dir)); - - if ($this->sort) { - $files = iterator_to_array($files); - usort($files, $this->sort); - } - - foreach ($files as $file) { - $pathName = $file->getPathname(); - $cache = $subSearch = []; - - if ($file->isDir()) { - foreach ($searches as $search) { - if ($search->recursive && $this->proveFilters($this->descentFilters, $file, $cache)) { - $subSearch[] = $search; - } - } - } - - if ($this->childFirst && $subSearch) { - yield from $this->traverseDir($pathName, $subSearch, array_merge($subdirs, [$file->getBasename()])); - } - - $relativePathname = FileSystem::unixSlashes($file->getRelativePathname()); - foreach ($searches as $search) { - if ( - $file->{'is' . $search->mode}() - && preg_match($search->pattern, $relativePathname) - && $this->proveFilters($this->filters, $file, $cache) - ) { - yield $pathName => $file; - break; - } - } - - if (!$this->childFirst && $subSearch) { - yield from $this->traverseDir($pathName, $subSearch, array_merge($subdirs, [$file->getBasename()])); - } - } - } - - - private function convertToFiles(iterable $pathNames, string $relativePath, bool $absolute): \Generator - { - foreach ($pathNames as $pathName) { - if (!$absolute) { - $pathName = preg_replace('~\.?/~A', '', $pathName); - } - $pathName = FileSystem::platformSlashes($pathName); - yield new FileInfo($pathName, $relativePath); - } - } - - - private function proveFilters(array $filters, FileInfo $file, array &$cache): bool - { - foreach ($filters as $filter) { - $res = &$cache[spl_object_id($filter)]; - $res ??= $filter($file); - if (!$res) { - return false; - } - } - - return true; - } - - - /** @return array<string, array<object{pattern: string, mode: string, recursive: bool}>> */ - private function buildPlan(): array - { - $plan = $dirCache = []; - foreach ($this->find as [$mask, $mode]) { - $splits = []; - if (FileSystem::isAbsolute($mask)) { - if ($this->in) { - throw new Nette\InvalidStateException("You cannot combine the absolute path in the mask '$mask' and the directory to search '{$this->in[0]}'."); - } - $splits[] = self::splitRecursivePart($mask); - } else { - foreach ($this->in ?: ['.'] as $in) { - $in = strtr($in, ['[' => '[[]', ']' => '[]]']); // in path, do not treat [ and ] as a pattern by glob() - $splits[] = self::splitRecursivePart($in . '/' . $mask); - } - } - - foreach ($splits as [$base, $rest, $recursive]) { - $base = $base === '' ? '.' : $base; - $dirs = $dirCache[$base] ??= strpbrk($base, '*?[') - ? glob($base, GLOB_NOSORT | GLOB_ONLYDIR | GLOB_NOESCAPE) - : [strtr($base, ['[[]' => '[', '[]]' => ']'])]; // unescape [ and ] - - if (!$dirs) { - throw new Nette\InvalidStateException(sprintf("Directory '%s' does not exist.", rtrim($base, '/\\'))); - } - - $search = (object) ['pattern' => $this->buildPattern($rest), 'mode' => $mode, 'recursive' => $recursive]; - foreach ($dirs as $dir) { - $plan[$dir][] = $search; - } - } - } - - return $plan; - } - - - /** - * Since glob() does not know ** wildcard, we divide the path into a part for glob and a part for manual traversal. - */ - private static function splitRecursivePart(string $path): array - { - $a = strrpos($path, '/'); - $parts = preg_split('~(?<=^|/)\*\*($|/)~', substr($path, 0, $a + 1), 2); - return isset($parts[1]) - ? [$parts[0], $parts[1] . substr($path, $a + 1), true] - : [$parts[0], substr($path, $a + 1), false]; - } - - - /** - * Converts wildcards to regular expression. - */ - private function buildPattern(string $mask): string - { - if ($mask === '*') { - return '##'; - } elseif (str_starts_with($mask, './')) { - $anchor = '^'; - $mask = substr($mask, 2); - } else { - $anchor = '(?:^|/)'; - } - - $pattern = strtr( - preg_quote($mask, '#'), - [ - '\*\*/' => '(.+/)?', - '\*' => '[^/]*', - '\?' => '[^/]', - '\[\!' => '[^', - '\[' => '[', - '\]' => ']', - '\-' => '-', - ], - ); - return '#' . $anchor . $pattern . '$#D' . (defined('PHP_WINDOWS_VERSION_BUILD') ? 'i' : ''); - } -} diff --git a/vendor/nette/utils/src/Utils/Floats.php b/vendor/nette/utils/src/Utils/Floats.php deleted file mode 100644 index cc2781d..0000000 --- a/vendor/nette/utils/src/Utils/Floats.php +++ /dev/null @@ -1,107 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Utils; - -use Nette; - - -/** - * Floating-point numbers comparison. - */ -class Floats -{ - use Nette\StaticClass; - - private const Epsilon = 1e-10; - - - public static function isZero(float $value): bool - { - return abs($value) < self::Epsilon; - } - - - public static function isInteger(float $value): bool - { - return abs(round($value) - $value) < self::Epsilon; - } - - - /** - * Compare two floats. If $a < $b it returns -1, if they are equal it returns 0 and if $a > $b it returns 1 - * @throws \LogicException if one of parameters is NAN - */ - public static function compare(float $a, float $b): int - { - if (is_nan($a) || is_nan($b)) { - throw new \LogicException('Trying to compare NAN'); - - } elseif (!is_finite($a) && !is_finite($b) && $a === $b) { - return 0; - } - - $diff = abs($a - $b); - if (($diff < self::Epsilon || ($diff / max(abs($a), abs($b)) < self::Epsilon))) { - return 0; - } - - return $a < $b ? -1 : 1; - } - - - /** - * Returns true if $a = $b - * @throws \LogicException if one of parameters is NAN - */ - public static function areEqual(float $a, float $b): bool - { - return self::compare($a, $b) === 0; - } - - - /** - * Returns true if $a < $b - * @throws \LogicException if one of parameters is NAN - */ - public static function isLessThan(float $a, float $b): bool - { - return self::compare($a, $b) < 0; - } - - - /** - * Returns true if $a <= $b - * @throws \LogicException if one of parameters is NAN - */ - public static function isLessThanOrEqualTo(float $a, float $b): bool - { - return self::compare($a, $b) <= 0; - } - - - /** - * Returns true if $a > $b - * @throws \LogicException if one of parameters is NAN - */ - public static function isGreaterThan(float $a, float $b): bool - { - return self::compare($a, $b) > 0; - } - - - /** - * Returns true if $a >= $b - * @throws \LogicException if one of parameters is NAN - */ - public static function isGreaterThanOrEqualTo(float $a, float $b): bool - { - return self::compare($a, $b) >= 0; - } -} diff --git a/vendor/nette/utils/src/Utils/Helpers.php b/vendor/nette/utils/src/Utils/Helpers.php deleted file mode 100644 index b3586c1..0000000 --- a/vendor/nette/utils/src/Utils/Helpers.php +++ /dev/null @@ -1,104 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Utils; - -use Nette; - - -class Helpers -{ - /** - * Executes a callback and returns the captured output as a string. - */ - public static function capture(callable $func): string - { - ob_start(function () {}); - try { - $func(); - return ob_get_clean(); - } catch (\Throwable $e) { - ob_end_clean(); - throw $e; - } - } - - - /** - * Returns the last occurred PHP error or an empty string if no error occurred. Unlike error_get_last(), - * it is nit affected by the PHP directive html_errors and always returns text, not HTML. - */ - public static function getLastError(): string - { - $message = error_get_last()['message'] ?? ''; - $message = ini_get('html_errors') ? Html::htmlToText($message) : $message; - $message = preg_replace('#^\w+\(.*?\): #', '', $message); - return $message; - } - - - /** - * Converts false to null, does not change other values. - */ - public static function falseToNull(mixed $value): mixed - { - return $value === false ? null : $value; - } - - - /** - * Returns value clamped to the inclusive range of min and max. - */ - public static function clamp(int|float $value, int|float $min, int|float $max): int|float - { - if ($min > $max) { - throw new Nette\InvalidArgumentException("Minimum ($min) is not less than maximum ($max)."); - } - - return min(max($value, $min), $max); - } - - - /** - * Looks for a string from possibilities that is most similar to value, but not the same (for 8-bit encoding). - * @param string[] $possibilities - */ - public static function getSuggestion(array $possibilities, string $value): ?string - { - $best = null; - $min = (strlen($value) / 4 + 1) * 10 + .1; - foreach (array_unique($possibilities) as $item) { - if ($item !== $value && ($len = levenshtein($item, $value, 10, 11, 10)) < $min) { - $min = $len; - $best = $item; - } - } - - return $best; - } - - - /** - * Compares two values in the same way that PHP does. Recognizes operators: >, >=, <, <=, =, ==, ===, !=, !==, <> - */ - public static function compare(mixed $left, string $operator, mixed $right): bool - { - return match ($operator) { - '>' => $left > $right, - '>=' => $left >= $right, - '<' => $left < $right, - '<=' => $left <= $right, - '=', '==' => $left == $right, - '===' => $left === $right, - '!=', '<>' => $left != $right, - '!==' => $left !== $right, - default => throw new Nette\InvalidArgumentException("Unknown operator '$operator'"), - }; - } -} diff --git a/vendor/nette/utils/src/Utils/Html.php b/vendor/nette/utils/src/Utils/Html.php deleted file mode 100644 index fc0e3ef..0000000 --- a/vendor/nette/utils/src/Utils/Html.php +++ /dev/null @@ -1,839 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Utils; - -use Nette; -use Nette\HtmlStringable; -use function is_array, is_float, is_object, is_string; - - -/** - * HTML helper. - * - * @property string|null $accept - * @property string|null $accesskey - * @property string|null $action - * @property string|null $align - * @property string|null $allow - * @property string|null $alt - * @property bool|null $async - * @property string|null $autocapitalize - * @property string|null $autocomplete - * @property bool|null $autofocus - * @property bool|null $autoplay - * @property string|null $charset - * @property bool|null $checked - * @property string|null $cite - * @property string|null $class - * @property int|null $cols - * @property int|null $colspan - * @property string|null $content - * @property bool|null $contenteditable - * @property bool|null $controls - * @property string|null $coords - * @property string|null $crossorigin - * @property string|null $data - * @property string|null $datetime - * @property string|null $decoding - * @property bool|null $default - * @property bool|null $defer - * @property string|null $dir - * @property string|null $dirname - * @property bool|null $disabled - * @property bool|null $download - * @property string|null $draggable - * @property string|null $dropzone - * @property string|null $enctype - * @property string|null $for - * @property string|null $form - * @property string|null $formaction - * @property string|null $formenctype - * @property string|null $formmethod - * @property bool|null $formnovalidate - * @property string|null $formtarget - * @property string|null $headers - * @property int|null $height - * @property bool|null $hidden - * @property float|null $high - * @property string|null $href - * @property string|null $hreflang - * @property string|null $id - * @property string|null $integrity - * @property string|null $inputmode - * @property bool|null $ismap - * @property string|null $itemprop - * @property string|null $kind - * @property string|null $label - * @property string|null $lang - * @property string|null $list - * @property bool|null $loop - * @property float|null $low - * @property float|null $max - * @property int|null $maxlength - * @property int|null $minlength - * @property string|null $media - * @property string|null $method - * @property float|null $min - * @property bool|null $multiple - * @property bool|null $muted - * @property string|null $name - * @property bool|null $novalidate - * @property bool|null $open - * @property float|null $optimum - * @property string|null $pattern - * @property string|null $ping - * @property string|null $placeholder - * @property string|null $poster - * @property string|null $preload - * @property string|null $radiogroup - * @property bool|null $readonly - * @property string|null $rel - * @property bool|null $required - * @property bool|null $reversed - * @property int|null $rows - * @property int|null $rowspan - * @property string|null $sandbox - * @property string|null $scope - * @property bool|null $selected - * @property string|null $shape - * @property int|null $size - * @property string|null $sizes - * @property string|null $slot - * @property int|null $span - * @property string|null $spellcheck - * @property string|null $src - * @property string|null $srcdoc - * @property string|null $srclang - * @property string|null $srcset - * @property int|null $start - * @property float|null $step - * @property string|null $style - * @property int|null $tabindex - * @property string|null $target - * @property string|null $title - * @property string|null $translate - * @property string|null $type - * @property string|null $usemap - * @property string|null $value - * @property int|null $width - * @property string|null $wrap - * - * @method self accept(?string $val) - * @method self accesskey(?string $val, bool $state = null) - * @method self action(?string $val) - * @method self align(?string $val) - * @method self allow(?string $val, bool $state = null) - * @method self alt(?string $val) - * @method self async(?bool $val) - * @method self autocapitalize(?string $val) - * @method self autocomplete(?string $val) - * @method self autofocus(?bool $val) - * @method self autoplay(?bool $val) - * @method self charset(?string $val) - * @method self checked(?bool $val) - * @method self cite(?string $val) - * @method self class(?string $val, bool $state = null) - * @method self cols(?int $val) - * @method self colspan(?int $val) - * @method self content(?string $val) - * @method self contenteditable(?bool $val) - * @method self controls(?bool $val) - * @method self coords(?string $val) - * @method self crossorigin(?string $val) - * @method self datetime(?string $val) - * @method self decoding(?string $val) - * @method self default(?bool $val) - * @method self defer(?bool $val) - * @method self dir(?string $val) - * @method self dirname(?string $val) - * @method self disabled(?bool $val) - * @method self download(?bool $val) - * @method self draggable(?string $val) - * @method self dropzone(?string $val) - * @method self enctype(?string $val) - * @method self for(?string $val) - * @method self form(?string $val) - * @method self formaction(?string $val) - * @method self formenctype(?string $val) - * @method self formmethod(?string $val) - * @method self formnovalidate(?bool $val) - * @method self formtarget(?string $val) - * @method self headers(?string $val, bool $state = null) - * @method self height(?int $val) - * @method self hidden(?bool $val) - * @method self high(?float $val) - * @method self hreflang(?string $val) - * @method self id(?string $val) - * @method self integrity(?string $val) - * @method self inputmode(?string $val) - * @method self ismap(?bool $val) - * @method self itemprop(?string $val) - * @method self kind(?string $val) - * @method self label(?string $val) - * @method self lang(?string $val) - * @method self list(?string $val) - * @method self loop(?bool $val) - * @method self low(?float $val) - * @method self max(?float $val) - * @method self maxlength(?int $val) - * @method self minlength(?int $val) - * @method self media(?string $val) - * @method self method(?string $val) - * @method self min(?float $val) - * @method self multiple(?bool $val) - * @method self muted(?bool $val) - * @method self name(?string $val) - * @method self novalidate(?bool $val) - * @method self open(?bool $val) - * @method self optimum(?float $val) - * @method self pattern(?string $val) - * @method self ping(?string $val, bool $state = null) - * @method self placeholder(?string $val) - * @method self poster(?string $val) - * @method self preload(?string $val) - * @method self radiogroup(?string $val) - * @method self readonly(?bool $val) - * @method self rel(?string $val) - * @method self required(?bool $val) - * @method self reversed(?bool $val) - * @method self rows(?int $val) - * @method self rowspan(?int $val) - * @method self sandbox(?string $val, bool $state = null) - * @method self scope(?string $val) - * @method self selected(?bool $val) - * @method self shape(?string $val) - * @method self size(?int $val) - * @method self sizes(?string $val) - * @method self slot(?string $val) - * @method self span(?int $val) - * @method self spellcheck(?string $val) - * @method self src(?string $val) - * @method self srcdoc(?string $val) - * @method self srclang(?string $val) - * @method self srcset(?string $val) - * @method self start(?int $val) - * @method self step(?float $val) - * @method self style(?string $property, string $val = null) - * @method self tabindex(?int $val) - * @method self target(?string $val) - * @method self title(?string $val) - * @method self translate(?string $val) - * @method self type(?string $val) - * @method self usemap(?string $val) - * @method self value(?string $val) - * @method self width(?int $val) - * @method self wrap(?string $val) - */ -class Html implements \ArrayAccess, \Countable, \IteratorAggregate, HtmlStringable -{ - use Nette\SmartObject; - - /** @var array<string, mixed> element's attributes */ - public $attrs = []; - - /** void elements */ - public static $emptyElements = [ - 'img' => 1, 'hr' => 1, 'br' => 1, 'input' => 1, 'meta' => 1, 'area' => 1, 'embed' => 1, 'keygen' => 1, - 'source' => 1, 'base' => 1, 'col' => 1, 'link' => 1, 'param' => 1, 'basefont' => 1, 'frame' => 1, - 'isindex' => 1, 'wbr' => 1, 'command' => 1, 'track' => 1, - ]; - - /** @var array<int, HtmlStringable|string> nodes */ - protected $children = []; - - /** element's name */ - private string $name = ''; - - private bool $isEmpty = false; - - - /** - * Constructs new HTML element. - * @param array|string $attrs element's attributes or plain text content - */ - public static function el(?string $name = null, array|string|null $attrs = null): static - { - $el = new static; - $parts = explode(' ', (string) $name, 2); - $el->setName($parts[0]); - - if (is_array($attrs)) { - $el->attrs = $attrs; - - } elseif ($attrs !== null) { - $el->setText($attrs); - } - - if (isset($parts[1])) { - foreach (Strings::matchAll($parts[1] . ' ', '#([a-z0-9:-]+)(?:=(["\'])?(.*?)(?(2)\2|\s))?#i') as $m) { - $el->attrs[$m[1]] = $m[3] ?? true; - } - } - - return $el; - } - - - /** - * Returns an object representing HTML text. - */ - public static function fromHtml(string $html): static - { - return (new static)->setHtml($html); - } - - - /** - * Returns an object representing plain text. - */ - public static function fromText(string $text): static - { - return (new static)->setText($text); - } - - - /** - * Converts to HTML. - */ - final public function toHtml(): string - { - return $this->render(); - } - - - /** - * Converts to plain text. - */ - final public function toText(): string - { - return $this->getText(); - } - - - /** - * Converts given HTML code to plain text. - */ - public static function htmlToText(string $html): string - { - return html_entity_decode(strip_tags($html), ENT_QUOTES | ENT_HTML5, 'UTF-8'); - } - - - /** - * Changes element's name. - */ - final public function setName(string $name, ?bool $isEmpty = null): static - { - $this->name = $name; - $this->isEmpty = $isEmpty ?? isset(static::$emptyElements[$name]); - return $this; - } - - - /** - * Returns element's name. - */ - final public function getName(): string - { - return $this->name; - } - - - /** - * Is element empty? - */ - final public function isEmpty(): bool - { - return $this->isEmpty; - } - - - /** - * Sets multiple attributes. - */ - public function addAttributes(array $attrs): static - { - $this->attrs = array_merge($this->attrs, $attrs); - return $this; - } - - - /** - * Appends value to element's attribute. - */ - public function appendAttribute(string $name, mixed $value, mixed $option = true): static - { - if (is_array($value)) { - $prev = isset($this->attrs[$name]) ? (array) $this->attrs[$name] : []; - $this->attrs[$name] = $value + $prev; - - } elseif ((string) $value === '') { - $tmp = &$this->attrs[$name]; // appending empty value? -> ignore, but ensure it exists - - } elseif (!isset($this->attrs[$name]) || is_array($this->attrs[$name])) { // needs array - $this->attrs[$name][$value] = $option; - - } else { - $this->attrs[$name] = [$this->attrs[$name] => true, $value => $option]; - } - - return $this; - } - - - /** - * Sets element's attribute. - */ - public function setAttribute(string $name, mixed $value): static - { - $this->attrs[$name] = $value; - return $this; - } - - - /** - * Returns element's attribute. - */ - public function getAttribute(string $name): mixed - { - return $this->attrs[$name] ?? null; - } - - - /** - * Unsets element's attribute. - */ - public function removeAttribute(string $name): static - { - unset($this->attrs[$name]); - return $this; - } - - - /** - * Unsets element's attributes. - */ - public function removeAttributes(array $attributes): static - { - foreach ($attributes as $name) { - unset($this->attrs[$name]); - } - - return $this; - } - - - /** - * Overloaded setter for element's attribute. - */ - final public function __set(string $name, mixed $value): void - { - $this->attrs[$name] = $value; - } - - - /** - * Overloaded getter for element's attribute. - */ - final public function &__get(string $name): mixed - { - return $this->attrs[$name]; - } - - - /** - * Overloaded tester for element's attribute. - */ - final public function __isset(string $name): bool - { - return isset($this->attrs[$name]); - } - - - /** - * Overloaded unsetter for element's attribute. - */ - final public function __unset(string $name): void - { - unset($this->attrs[$name]); - } - - - /** - * Overloaded setter for element's attribute. - */ - final public function __call(string $m, array $args): mixed - { - $p = substr($m, 0, 3); - if ($p === 'get' || $p === 'set' || $p === 'add') { - $m = substr($m, 3); - $m[0] = $m[0] | "\x20"; - if ($p === 'get') { - return $this->attrs[$m] ?? null; - - } elseif ($p === 'add') { - $args[] = true; - } - } - - if (count($args) === 0) { // invalid - - } elseif (count($args) === 1) { // set - $this->attrs[$m] = $args[0]; - - } else { // add - $this->appendAttribute($m, $args[0], $args[1]); - } - - return $this; - } - - - /** - * Special setter for element's attribute. - */ - final public function href(string $path, array $query = []): static - { - if ($query) { - $query = http_build_query($query, '', '&'); - if ($query !== '') { - $path .= '?' . $query; - } - } - - $this->attrs['href'] = $path; - return $this; - } - - - /** - * Setter for data-* attributes. Booleans are converted to 'true' resp. 'false'. - */ - public function data(string $name, mixed $value = null): static - { - if (func_num_args() === 1) { - $this->attrs['data'] = $name; - } else { - $this->attrs["data-$name"] = is_bool($value) - ? json_encode($value) - : $value; - } - - return $this; - } - - - /** - * Sets element's HTML content. - */ - final public function setHtml(mixed $html): static - { - $this->children = [(string) $html]; - return $this; - } - - - /** - * Returns element's HTML content. - */ - final public function getHtml(): string - { - return implode('', $this->children); - } - - - /** - * Sets element's textual content. - */ - final public function setText(mixed $text): static - { - if (!$text instanceof HtmlStringable) { - $text = htmlspecialchars((string) $text, ENT_NOQUOTES, 'UTF-8'); - } - - $this->children = [(string) $text]; - return $this; - } - - - /** - * Returns element's textual content. - */ - final public function getText(): string - { - return self::htmlToText($this->getHtml()); - } - - - /** - * Adds new element's child. - */ - final public function addHtml(mixed $child): static - { - return $this->insert(null, $child); - } - - - /** - * Appends plain-text string to element content. - */ - public function addText(mixed $text): static - { - if (!$text instanceof HtmlStringable) { - $text = htmlspecialchars((string) $text, ENT_NOQUOTES, 'UTF-8'); - } - - return $this->insert(null, $text); - } - - - /** - * Creates and adds a new Html child. - */ - final public function create(string $name, array|string|null $attrs = null): static - { - $this->insert(null, $child = static::el($name, $attrs)); - return $child; - } - - - /** - * Inserts child node. - */ - public function insert(?int $index, HtmlStringable|string $child, bool $replace = false): static - { - $child = $child instanceof self ? $child : (string) $child; - if ($index === null) { // append - $this->children[] = $child; - - } else { // insert or replace - array_splice($this->children, $index, $replace ? 1 : 0, [$child]); - } - - return $this; - } - - - /** - * Inserts (replaces) child node (\ArrayAccess implementation). - * @param int|null $index position or null for appending - * @param Html|string $child Html node or raw HTML string - */ - final public function offsetSet($index, $child): void - { - $this->insert($index, $child, replace: true); - } - - - /** - * Returns child node (\ArrayAccess implementation). - * @param int $index - */ - final public function offsetGet($index): HtmlStringable|string - { - return $this->children[$index]; - } - - - /** - * Exists child node? (\ArrayAccess implementation). - * @param int $index - */ - final public function offsetExists($index): bool - { - return isset($this->children[$index]); - } - - - /** - * Removes child node (\ArrayAccess implementation). - * @param int $index - */ - public function offsetUnset($index): void - { - if (isset($this->children[$index])) { - array_splice($this->children, $index, 1); - } - } - - - /** - * Returns children count. - */ - final public function count(): int - { - return count($this->children); - } - - - /** - * Removes all children. - */ - public function removeChildren(): void - { - $this->children = []; - } - - - /** - * Iterates over elements. - * @return \ArrayIterator<int, HtmlStringable|string> - */ - final public function getIterator(): \ArrayIterator - { - return new \ArrayIterator($this->children); - } - - - /** - * Returns all children. - */ - final public function getChildren(): array - { - return $this->children; - } - - - /** - * Renders element's start tag, content and end tag. - */ - final public function render(?int $indent = null): string - { - $s = $this->startTag(); - - if (!$this->isEmpty) { - // add content - if ($indent !== null) { - $indent++; - } - - foreach ($this->children as $child) { - if ($child instanceof self) { - $s .= $child->render($indent); - } else { - $s .= $child; - } - } - - // add end tag - $s .= $this->endTag(); - } - - if ($indent !== null) { - return "\n" . str_repeat("\t", $indent - 1) . $s . "\n" . str_repeat("\t", max(0, $indent - 2)); - } - - return $s; - } - - - final public function __toString(): string - { - return $this->render(); - } - - - /** - * Returns element's start tag. - */ - final public function startTag(): string - { - return $this->name - ? '<' . $this->name . $this->attributes() . '>' - : ''; - } - - - /** - * Returns element's end tag. - */ - final public function endTag(): string - { - return $this->name && !$this->isEmpty ? '</' . $this->name . '>' : ''; - } - - - /** - * Returns element's attributes. - * @internal - */ - final public function attributes(): string - { - if (!is_array($this->attrs)) { - return ''; - } - - $s = ''; - $attrs = $this->attrs; - foreach ($attrs as $key => $value) { - if ($value === null || $value === false) { - continue; - - } elseif ($value === true) { - $s .= ' ' . $key; - - continue; - - } elseif (is_array($value)) { - if (strncmp($key, 'data-', 5) === 0) { - $value = Json::encode($value); - - } else { - $tmp = null; - foreach ($value as $k => $v) { - if ($v != null) { // intentionally ==, skip nulls & empty string - // composite 'style' vs. 'others' - $tmp[] = $v === true - ? $k - : (is_string($k) ? $k . ':' . $v : $v); - } - } - - if ($tmp === null) { - continue; - } - - $value = implode($key === 'style' || !strncmp($key, 'on', 2) ? ';' : ' ', $tmp); - } - } elseif (is_float($value)) { - $value = rtrim(rtrim(number_format($value, 10, '.', ''), '0'), '.'); - - } else { - $value = (string) $value; - } - - $q = str_contains($value, '"') ? "'" : '"'; - $s .= ' ' . $key . '=' . $q - . str_replace( - ['&', $q, '<'], - ['&', $q === '"' ? '"' : ''', '<'], - $value, - ) - . (str_contains($value, '`') && strpbrk($value, ' <>"\'') === false ? ' ' : '') - . $q; - } - - $s = str_replace('@', '@', $s); - return $s; - } - - - /** - * Clones all children too. - */ - public function __clone() - { - foreach ($this->children as $key => $value) { - if (is_object($value)) { - $this->children[$key] = clone $value; - } - } - } -} diff --git a/vendor/nette/utils/src/Utils/Image.php b/vendor/nette/utils/src/Utils/Image.php deleted file mode 100644 index d2947c7..0000000 --- a/vendor/nette/utils/src/Utils/Image.php +++ /dev/null @@ -1,831 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Utils; - -use Nette; - - -/** - * Basic manipulation with images. Supported types are JPEG, PNG, GIF, WEBP, AVIF and BMP. - * - * <code> - * $image = Image::fromFile('nette.jpg'); - * $image->resize(150, 100); - * $image->sharpen(); - * $image->send(); - * </code> - * - * @method Image affine(array $affine, ?array $clip = null) - * @method void alphaBlending(bool $enable) - * @method void antialias(bool $enable) - * @method void arc(int $centerX, int $centerY, int $width, int $height, int $startAngle, int $endAngle, ImageColor $color) - * @method int colorAllocate(int $red, int $green, int $blue) - * @method int colorAllocateAlpha(int $red, int $green, int $blue, int $alpha) - * @method int colorAt(int $x, int $y) - * @method int colorClosest(int $red, int $green, int $blue) - * @method int colorClosestAlpha(int $red, int $green, int $blue, int $alpha) - * @method int colorClosestHWB(int $red, int $green, int $blue) - * @method void colorDeallocate(int $color) - * @method int colorExact(int $red, int $green, int $blue) - * @method int colorExactAlpha(int $red, int $green, int $blue, int $alpha) - * @method void colorMatch(Image $image2) - * @method int colorResolve(int $red, int $green, int $blue) - * @method int colorResolveAlpha(int $red, int $green, int $blue, int $alpha) - * @method void colorSet(int $index, int $red, int $green, int $blue, int $alpha = 0) - * @method array colorsForIndex(int $color) - * @method int colorsTotal() - * @method int colorTransparent(?int $color = null) - * @method void convolution(array $matrix, float $div, float $offset) - * @method void copy(Image $src, int $dstX, int $dstY, int $srcX, int $srcY, int $srcW, int $srcH) - * @method void copyMerge(Image $src, int $dstX, int $dstY, int $srcX, int $srcY, int $srcW, int $srcH, int $pct) - * @method void copyMergeGray(Image $src, int $dstX, int $dstY, int $srcX, int $srcY, int $srcW, int $srcH, int $pct) - * @method void copyResampled(Image $src, int $dstX, int $dstY, int $srcX, int $srcY, int $dstW, int $dstH, int $srcW, int $srcH) - * @method void copyResized(Image $src, int $dstX, int $dstY, int $srcX, int $srcY, int $dstW, int $dstH, int $srcW, int $srcH) - * @method Image cropAuto(int $mode = IMG_CROP_DEFAULT, float $threshold = .5, ?ImageColor $color = null) - * @method void ellipse(int $centerX, int $centerY, int $width, int $height, ImageColor $color) - * @method void fill(int $x, int $y, ImageColor $color) - * @method void filledArc(int $centerX, int $centerY, int $width, int $height, int $startAngle, int $endAngle, ImageColor $color, int $style) - * @method void filledEllipse(int $centerX, int $centerY, int $width, int $height, ImageColor $color) - * @method void filledPolygon(array $points, ImageColor $color) - * @method void filledRectangle(int $x1, int $y1, int $x2, int $y2, ImageColor $color) - * @method void fillToBorder(int $x, int $y, ImageColor $borderColor, ImageColor $color) - * @method void filter(int $filter, ...$args) - * @method void flip(int $mode) - * @method array ftText(float $size, float $angle, int $x, int $y, ImageColor $color, string $fontFile, string $text, array $options = []) - * @method void gammaCorrect(float $inputgamma, float $outputgamma) - * @method array getClip() - * @method int getInterpolation() - * @method int interlace(?bool $enable = null) - * @method bool isTrueColor() - * @method void layerEffect(int $effect) - * @method void line(int $x1, int $y1, int $x2, int $y2, ImageColor $color) - * @method void openPolygon(array $points, ImageColor $color) - * @method void paletteCopy(Image $source) - * @method void paletteToTrueColor() - * @method void polygon(array $points, ImageColor $color) - * @method void rectangle(int $x1, int $y1, int $x2, int $y2, ImageColor $color) - * @method mixed resolution(?int $resolutionX = null, ?int $resolutionY = null) - * @method Image rotate(float $angle, ImageColor $backgroundColor) - * @method void saveAlpha(bool $enable) - * @method Image scale(int $newWidth, int $newHeight = -1, int $mode = IMG_BILINEAR_FIXED) - * @method void setBrush(Image $brush) - * @method void setClip(int $x1, int $y1, int $x2, int $y2) - * @method void setInterpolation(int $method = IMG_BILINEAR_FIXED) - * @method void setPixel(int $x, int $y, ImageColor $color) - * @method void setStyle(array $style) - * @method void setThickness(int $thickness) - * @method void setTile(Image $tile) - * @method void trueColorToPalette(bool $dither, int $ncolors) - * @method array ttfText(float $size, float $angle, int $x, int $y, ImageColor $color, string $fontfile, string $text, array $options = []) - * @property-read positive-int $width - * @property-read positive-int $height - * @property-read \GdImage $imageResource - */ -class Image -{ - use Nette\SmartObject; - - /** Prevent from getting resized to a bigger size than the original */ - public const ShrinkOnly = 0b0001; - - /** Resizes to a specified width and height without keeping aspect ratio */ - public const Stretch = 0b0010; - - /** Resizes to fit into a specified width and height and preserves aspect ratio */ - public const OrSmaller = 0b0000; - - /** Resizes while bounding the smaller dimension to the specified width or height and preserves aspect ratio */ - public const OrBigger = 0b0100; - - /** Resizes to the smallest possible size to completely cover specified width and height and reserves aspect ratio */ - public const Cover = 0b1000; - - /** @deprecated use Image::ShrinkOnly */ - public const SHRINK_ONLY = self::ShrinkOnly; - - /** @deprecated use Image::Stretch */ - public const STRETCH = self::Stretch; - - /** @deprecated use Image::OrSmaller */ - public const FIT = self::OrSmaller; - - /** @deprecated use Image::OrBigger */ - public const FILL = self::OrBigger; - - /** @deprecated use Image::Cover */ - public const EXACT = self::Cover; - - /** @deprecated use Image::EmptyGIF */ - public const EMPTY_GIF = self::EmptyGIF; - - /** image types */ - public const - JPEG = ImageType::JPEG, - PNG = ImageType::PNG, - GIF = ImageType::GIF, - WEBP = ImageType::WEBP, - AVIF = ImageType::AVIF, - BMP = ImageType::BMP; - - public const EmptyGIF = "GIF89a\x01\x00\x01\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00!\xf9\x04\x01\x00\x00\x00\x00,\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02D\x01\x00;"; - - private const Formats = [ImageType::JPEG => 'jpeg', ImageType::PNG => 'png', ImageType::GIF => 'gif', ImageType::WEBP => 'webp', ImageType::AVIF => 'avif', ImageType::BMP => 'bmp']; - - private \GdImage $image; - - - /** - * Returns RGB color (0..255) and transparency (0..127). - * @deprecated use ImageColor::rgb() - */ - public static function rgb(int $red, int $green, int $blue, int $transparency = 0): array - { - return [ - 'red' => max(0, min(255, $red)), - 'green' => max(0, min(255, $green)), - 'blue' => max(0, min(255, $blue)), - 'alpha' => max(0, min(127, $transparency)), - ]; - } - - - /** - * Reads an image from a file and returns its type in $type. - * @throws Nette\NotSupportedException if gd extension is not loaded - * @throws UnknownImageFileException if file not found or file type is not known - */ - public static function fromFile(string $file, ?int &$type = null): static - { - self::ensureExtension(); - $type = self::detectTypeFromFile($file); - if (!$type) { - throw new UnknownImageFileException(is_file($file) ? "Unknown type of file '$file'." : "File '$file' not found."); - } - - return self::invokeSafe('imagecreatefrom' . self::Formats[$type], $file, "Unable to open file '$file'.", __METHOD__); - } - - - /** - * Reads an image from a string and returns its type in $type. - * @throws Nette\NotSupportedException if gd extension is not loaded - * @throws ImageException - */ - public static function fromString(string $s, ?int &$type = null): static - { - self::ensureExtension(); - $type = self::detectTypeFromString($s); - if (!$type) { - throw new UnknownImageFileException('Unknown type of image.'); - } - - return self::invokeSafe('imagecreatefromstring', $s, 'Unable to open image from string.', __METHOD__); - } - - - private static function invokeSafe(string $func, string $arg, string $message, string $callee): static - { - $errors = []; - $res = Callback::invokeSafe($func, [$arg], function (string $message) use (&$errors): void { - $errors[] = $message; - }); - - if (!$res) { - throw new ImageException($message . ' Errors: ' . implode(', ', $errors)); - } elseif ($errors) { - trigger_error($callee . '(): ' . implode(', ', $errors), E_USER_WARNING); - } - - return new static($res); - } - - - /** - * Creates a new true color image of the given dimensions. The default color is black. - * @param positive-int $width - * @param positive-int $height - * @throws Nette\NotSupportedException if gd extension is not loaded - */ - public static function fromBlank(int $width, int $height, ImageColor|array|null $color = null): static - { - self::ensureExtension(); - if ($width < 1 || $height < 1) { - throw new Nette\InvalidArgumentException('Image width and height must be greater than zero.'); - } - - $image = new static(imagecreatetruecolor($width, $height)); - if ($color) { - $image->alphablending(false); - $image->filledrectangle(0, 0, $width - 1, $height - 1, $color); - $image->alphablending(true); - } - - return $image; - } - - - /** - * Returns the type of image from file. - * @return ImageType::*|null - */ - public static function detectTypeFromFile(string $file, &$width = null, &$height = null): ?int - { - [$width, $height, $type] = @getimagesize($file); // @ - files smaller than 12 bytes causes read error - return isset(self::Formats[$type]) ? $type : null; - } - - - /** - * Returns the type of image from string. - * @return ImageType::*|null - */ - public static function detectTypeFromString(string $s, &$width = null, &$height = null): ?int - { - [$width, $height, $type] = @getimagesizefromstring($s); // @ - strings smaller than 12 bytes causes read error - return isset(self::Formats[$type]) ? $type : null; - } - - - /** - * Returns the file extension for the given image type. - * @param ImageType::* $type - * @return value-of<self::Formats> - */ - public static function typeToExtension(int $type): string - { - if (!isset(self::Formats[$type])) { - throw new Nette\InvalidArgumentException("Unsupported image type '$type'."); - } - - return self::Formats[$type]; - } - - - /** - * Returns the image type for given file extension. - * @return ImageType::* - */ - public static function extensionToType(string $extension): int - { - $extensions = array_flip(self::Formats) + ['jpg' => ImageType::JPEG]; - $extension = strtolower($extension); - if (!isset($extensions[$extension])) { - throw new Nette\InvalidArgumentException("Unsupported file extension '$extension'."); - } - - return $extensions[$extension]; - } - - - /** - * Returns the mime type for the given image type. - * @param ImageType::* $type - */ - public static function typeToMimeType(int $type): string - { - return 'image/' . self::typeToExtension($type); - } - - - /** - * @param ImageType::* $type - */ - public static function isTypeSupported(int $type): bool - { - self::ensureExtension(); - return (bool) (imagetypes() & match ($type) { - ImageType::JPEG => IMG_JPG, - ImageType::PNG => IMG_PNG, - ImageType::GIF => IMG_GIF, - ImageType::WEBP => IMG_WEBP, - ImageType::AVIF => 256, // IMG_AVIF, - ImageType::BMP => IMG_BMP, - default => 0, - }); - } - - - /** @return ImageType[] */ - public static function getSupportedTypes(): array - { - self::ensureExtension(); - $flag = imagetypes(); - return array_filter([ - $flag & IMG_GIF ? ImageType::GIF : null, - $flag & IMG_JPG ? ImageType::JPEG : null, - $flag & IMG_PNG ? ImageType::PNG : null, - $flag & IMG_WEBP ? ImageType::WEBP : null, - $flag & 256 ? ImageType::AVIF : null, // IMG_AVIF - $flag & IMG_BMP ? ImageType::BMP : null, - ]); - } - - - /** - * Wraps GD image. - */ - public function __construct(\GdImage $image) - { - $this->setImageResource($image); - imagesavealpha($image, true); - } - - - /** - * Returns image width. - * @return positive-int - */ - public function getWidth(): int - { - return imagesx($this->image); - } - - - /** - * Returns image height. - * @return positive-int - */ - public function getHeight(): int - { - return imagesy($this->image); - } - - - /** - * Sets image resource. - */ - protected function setImageResource(\GdImage $image): static - { - $this->image = $image; - return $this; - } - - - /** - * Returns image GD resource. - */ - public function getImageResource(): \GdImage - { - return $this->image; - } - - - /** - * Scales an image. Width and height accept pixels or percent. - * @param int-mask-of<self::OrSmaller|self::OrBigger|self::Stretch|self::Cover|self::ShrinkOnly> $mode - */ - public function resize(int|string|null $width, int|string|null $height, int $mode = self::OrSmaller): static - { - if ($mode & self::Cover) { - return $this->resize($width, $height, self::OrBigger)->crop('50%', '50%', $width, $height); - } - - [$newWidth, $newHeight] = static::calculateSize($this->getWidth(), $this->getHeight(), $width, $height, $mode); - - if ($newWidth !== $this->getWidth() || $newHeight !== $this->getHeight()) { // resize - $newImage = static::fromBlank($newWidth, $newHeight, ImageColor::rgb(0, 0, 0, 0))->getImageResource(); - imagecopyresampled( - $newImage, - $this->image, - 0, - 0, - 0, - 0, - $newWidth, - $newHeight, - $this->getWidth(), - $this->getHeight(), - ); - $this->image = $newImage; - } - - if ($width < 0 || $height < 0) { - imageflip($this->image, $width < 0 ? ($height < 0 ? IMG_FLIP_BOTH : IMG_FLIP_HORIZONTAL) : IMG_FLIP_VERTICAL); - } - - return $this; - } - - - /** - * Calculates dimensions of resized image. Width and height accept pixels or percent. - * @param int-mask-of<self::OrSmaller|self::OrBigger|self::Stretch|self::Cover|self::ShrinkOnly> $mode - */ - public static function calculateSize( - int $srcWidth, - int $srcHeight, - $newWidth, - $newHeight, - int $mode = self::OrSmaller, - ): array - { - if ($newWidth === null) { - } elseif (self::isPercent($newWidth)) { - $newWidth = (int) round($srcWidth / 100 * abs($newWidth)); - $percents = true; - } else { - $newWidth = abs($newWidth); - } - - if ($newHeight === null) { - } elseif (self::isPercent($newHeight)) { - $newHeight = (int) round($srcHeight / 100 * abs($newHeight)); - $mode |= empty($percents) ? 0 : self::Stretch; - } else { - $newHeight = abs($newHeight); - } - - if ($mode & self::Stretch) { // non-proportional - if (!$newWidth || !$newHeight) { - throw new Nette\InvalidArgumentException('For stretching must be both width and height specified.'); - } - - if ($mode & self::ShrinkOnly) { - $newWidth = min($srcWidth, $newWidth); - $newHeight = min($srcHeight, $newHeight); - } - } else { // proportional - if (!$newWidth && !$newHeight) { - throw new Nette\InvalidArgumentException('At least width or height must be specified.'); - } - - $scale = []; - if ($newWidth > 0) { // fit width - $scale[] = $newWidth / $srcWidth; - } - - if ($newHeight > 0) { // fit height - $scale[] = $newHeight / $srcHeight; - } - - if ($mode & self::OrBigger) { - $scale = [max($scale)]; - } - - if ($mode & self::ShrinkOnly) { - $scale[] = 1; - } - - $scale = min($scale); - $newWidth = (int) round($srcWidth * $scale); - $newHeight = (int) round($srcHeight * $scale); - } - - return [max($newWidth, 1), max($newHeight, 1)]; - } - - - /** - * Crops image. Arguments accepts pixels or percent. - */ - public function crop(int|string $left, int|string $top, int|string $width, int|string $height): static - { - [$r['x'], $r['y'], $r['width'], $r['height']] - = static::calculateCutout($this->getWidth(), $this->getHeight(), $left, $top, $width, $height); - if (gd_info()['GD Version'] === 'bundled (2.1.0 compatible)') { - $this->image = imagecrop($this->image, $r); - imagesavealpha($this->image, true); - } else { - $newImage = static::fromBlank($r['width'], $r['height'], ImageColor::rgb(0, 0, 0, 0))->getImageResource(); - imagecopy($newImage, $this->image, 0, 0, $r['x'], $r['y'], $r['width'], $r['height']); - $this->image = $newImage; - } - - return $this; - } - - - /** - * Calculates dimensions of cutout in image. Arguments accepts pixels or percent. - */ - public static function calculateCutout( - int $srcWidth, - int $srcHeight, - int|string $left, - int|string $top, - int|string $newWidth, - int|string $newHeight, - ): array - { - if (self::isPercent($newWidth)) { - $newWidth = (int) round($srcWidth / 100 * $newWidth); - } - - if (self::isPercent($newHeight)) { - $newHeight = (int) round($srcHeight / 100 * $newHeight); - } - - if (self::isPercent($left)) { - $left = (int) round(($srcWidth - $newWidth) / 100 * $left); - } - - if (self::isPercent($top)) { - $top = (int) round(($srcHeight - $newHeight) / 100 * $top); - } - - if ($left < 0) { - $newWidth += $left; - $left = 0; - } - - if ($top < 0) { - $newHeight += $top; - $top = 0; - } - - $newWidth = min($newWidth, $srcWidth - $left); - $newHeight = min($newHeight, $srcHeight - $top); - return [$left, $top, $newWidth, $newHeight]; - } - - - /** - * Sharpens image a little bit. - */ - public function sharpen(): static - { - imageconvolution($this->image, [ // my magic numbers ;) - [-1, -1, -1], - [-1, 24, -1], - [-1, -1, -1], - ], 16, 0); - return $this; - } - - - /** - * Puts another image into this image. Left and top accepts pixels or percent. - * @param int<0, 100> $opacity 0..100 - */ - public function place(self $image, int|string $left = 0, int|string $top = 0, int $opacity = 100): static - { - $opacity = max(0, min(100, $opacity)); - if ($opacity === 0) { - return $this; - } - - $width = $image->getWidth(); - $height = $image->getHeight(); - - if (self::isPercent($left)) { - $left = (int) round(($this->getWidth() - $width) / 100 * $left); - } - - if (self::isPercent($top)) { - $top = (int) round(($this->getHeight() - $height) / 100 * $top); - } - - $output = $input = $image->image; - if ($opacity < 100) { - $tbl = []; - for ($i = 0; $i < 128; $i++) { - $tbl[$i] = round(127 - (127 - $i) * $opacity / 100); - } - - $output = imagecreatetruecolor($width, $height); - imagealphablending($output, false); - if (!$image->isTrueColor()) { - $input = $output; - imagefilledrectangle($output, 0, 0, $width, $height, imagecolorallocatealpha($output, 0, 0, 0, 127)); - imagecopy($output, $image->image, 0, 0, 0, 0, $width, $height); - } - - for ($x = 0; $x < $width; $x++) { - for ($y = 0; $y < $height; $y++) { - $c = \imagecolorat($input, $x, $y); - $c = ($c & 0xFFFFFF) + ($tbl[$c >> 24] << 24); - \imagesetpixel($output, $x, $y, $c); - } - } - - imagealphablending($output, true); - } - - imagecopy( - $this->image, - $output, - $left, - $top, - 0, - 0, - $width, - $height, - ); - return $this; - } - - - /** - * Calculates the bounding box for a TrueType text. Returns keys left, top, width and height. - */ - public static function calculateTextBox( - string $text, - string $fontFile, - float $size, - float $angle = 0, - array $options = [], - ): array - { - self::ensureExtension(); - $box = imagettfbbox($size, $angle, $fontFile, $text, $options); - return [ - 'left' => $minX = min([$box[0], $box[2], $box[4], $box[6]]), - 'top' => $minY = min([$box[1], $box[3], $box[5], $box[7]]), - 'width' => max([$box[0], $box[2], $box[4], $box[6]]) - $minX + 1, - 'height' => max([$box[1], $box[3], $box[5], $box[7]]) - $minY + 1, - ]; - } - - - /** - * Draw a rectangle. - */ - public function rectangleWH(int $x, int $y, int $width, int $height, ImageColor $color): void - { - if ($width !== 0 && $height !== 0) { - $this->rectangle($x, $y, $x + $width + ($width > 0 ? -1 : 1), $y + $height + ($height > 0 ? -1 : 1), $color); - } - } - - - /** - * Draw a filled rectangle. - */ - public function filledRectangleWH(int $x, int $y, int $width, int $height, ImageColor $color): void - { - if ($width !== 0 && $height !== 0) { - $this->filledRectangle($x, $y, $x + $width + ($width > 0 ? -1 : 1), $y + $height + ($height > 0 ? -1 : 1), $color); - } - } - - - /** - * Saves image to the file. Quality is in the range 0..100 for JPEG (default 85), WEBP (default 80) and AVIF (default 30) and 0..9 for PNG (default 9). - * @param ImageType::*|null $type - * @throws ImageException - */ - public function save(string $file, ?int $quality = null, ?int $type = null): void - { - $type ??= self::extensionToType(pathinfo($file, PATHINFO_EXTENSION)); - $this->output($type, $quality, $file); - } - - - /** - * Outputs image to string. Quality is in the range 0..100 for JPEG (default 85), WEBP (default 80) and AVIF (default 30) and 0..9 for PNG (default 9). - * @param ImageType::* $type - */ - public function toString(int $type = ImageType::JPEG, ?int $quality = null): string - { - return Helpers::capture(function () use ($type, $quality): void { - $this->output($type, $quality); - }); - } - - - /** - * Outputs image to string. - */ - public function __toString(): string - { - return $this->toString(); - } - - - /** - * Outputs image to browser. Quality is in the range 0..100 for JPEG (default 85), WEBP (default 80) and AVIF (default 30) and 0..9 for PNG (default 9). - * @param ImageType::* $type - * @throws ImageException - */ - public function send(int $type = ImageType::JPEG, ?int $quality = null): void - { - header('Content-Type: ' . self::typeToMimeType($type)); - $this->output($type, $quality); - } - - - /** - * Outputs image to browser or file. - * @param ImageType::* $type - * @throws ImageException - */ - private function output(int $type, ?int $quality, ?string $file = null): void - { - switch ($type) { - case ImageType::JPEG: - $quality = $quality === null ? 85 : max(0, min(100, $quality)); - $success = @imagejpeg($this->image, $file, $quality); // @ is escalated to exception - break; - - case ImageType::PNG: - $quality = $quality === null ? 9 : max(0, min(9, $quality)); - $success = @imagepng($this->image, $file, $quality); // @ is escalated to exception - break; - - case ImageType::GIF: - $success = @imagegif($this->image, $file); // @ is escalated to exception - break; - - case ImageType::WEBP: - $quality = $quality === null ? 80 : max(0, min(100, $quality)); - $success = @imagewebp($this->image, $file, $quality); // @ is escalated to exception - break; - - case ImageType::AVIF: - $quality = $quality === null ? 30 : max(0, min(100, $quality)); - $success = @imageavif($this->image, $file, $quality); // @ is escalated to exception - break; - - case ImageType::BMP: - $success = @imagebmp($this->image, $file); // @ is escalated to exception - break; - - default: - throw new Nette\InvalidArgumentException("Unsupported image type '$type'."); - } - - if (!$success) { - throw new ImageException(Helpers::getLastError() ?: 'Unknown error'); - } - } - - - /** - * Call to undefined method. - * @throws Nette\MemberAccessException - */ - public function __call(string $name, array $args): mixed - { - $function = 'image' . $name; - if (!function_exists($function)) { - ObjectHelpers::strictCall(static::class, $name); - } - - foreach ($args as $key => $value) { - if ($value instanceof self) { - $args[$key] = $value->getImageResource(); - - } elseif ($value instanceof ImageColor || (is_array($value) && isset($value['red']))) { - $args[$key] = $this->resolveColor($value); - } - } - - $res = $function($this->image, ...$args); - return $res instanceof \GdImage - ? $this->setImageResource($res) - : $res; - } - - - public function __clone() - { - ob_start(function () {}); - imagepng($this->image, null, 0); - $this->setImageResource(imagecreatefromstring(ob_get_clean())); - } - - - private static function isPercent(int|string &$num): bool - { - if (is_string($num) && str_ends_with($num, '%')) { - $num = (float) substr($num, 0, -1); - return true; - } elseif (is_int($num) || $num === (string) (int) $num) { - $num = (int) $num; - return false; - } - - throw new Nette\InvalidArgumentException("Expected dimension in int|string, '$num' given."); - } - - - /** - * Prevents serialization. - */ - public function __sleep(): array - { - throw new Nette\NotSupportedException('You cannot serialize or unserialize ' . self::class . ' instances.'); - } - - - public function resolveColor(ImageColor|array $color): int - { - $color = $color instanceof ImageColor ? $color->toRGBA() : array_values($color); - return imagecolorallocatealpha($this->image, ...$color) ?: imagecolorresolvealpha($this->image, ...$color); - } - - - private static function ensureExtension(): void - { - if (!extension_loaded('gd')) { - throw new Nette\NotSupportedException('PHP extension GD is not loaded.'); - } - } -} diff --git a/vendor/nette/utils/src/Utils/ImageColor.php b/vendor/nette/utils/src/Utils/ImageColor.php deleted file mode 100644 index 013adbd..0000000 --- a/vendor/nette/utils/src/Utils/ImageColor.php +++ /dev/null @@ -1,75 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Utils; - -use Nette; - - -/** - * Represent RGB color (0..255) with opacity (0..1). - */ -class ImageColor -{ - public static function rgb(int $red, int $green, int $blue, float $opacity = 1): self - { - return new self($red, $green, $blue, $opacity); - } - - - /** - * Accepts formats #RRGGBB, #RRGGBBAA, #RGB, #RGBA - */ - public static function hex(string $hex): self - { - $hex = ltrim($hex, '#'); - $len = strlen($hex); - if ($len === 3 || $len === 4) { - return new self( - (int) hexdec($hex[0]) * 17, - (int) hexdec($hex[1]) * 17, - (int) hexdec($hex[2]) * 17, - (int) hexdec($hex[3] ?? 'F') * 17 / 255, - ); - } elseif ($len === 6 || $len === 8) { - return new self( - (int) hexdec($hex[0] . $hex[1]), - (int) hexdec($hex[2] . $hex[3]), - (int) hexdec($hex[4] . $hex[5]), - (int) hexdec(($hex[6] ?? 'F') . ($hex[7] ?? 'F')) / 255, - ); - } else { - throw new Nette\InvalidArgumentException('Invalid hex color format.'); - } - } - - - private function __construct( - public int $red, - public int $green, - public int $blue, - public float $opacity = 1, - ) { - $this->red = max(0, min(255, $red)); - $this->green = max(0, min(255, $green)); - $this->blue = max(0, min(255, $blue)); - $this->opacity = max(0, min(1, $opacity)); - } - - - public function toRGBA(): array - { - return [ - max(0, min(255, $this->red)), - max(0, min(255, $this->green)), - max(0, min(255, $this->blue)), - max(0, min(127, (int) round(127 - $this->opacity * 127))), - ]; - } -} diff --git a/vendor/nette/utils/src/Utils/ImageType.php b/vendor/nette/utils/src/Utils/ImageType.php deleted file mode 100644 index 3092c8f..0000000 --- a/vendor/nette/utils/src/Utils/ImageType.php +++ /dev/null @@ -1,25 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Utils; - - -/** - * Type of image file. - */ -/*enum*/ final class ImageType -{ - public const - JPEG = IMAGETYPE_JPEG, - PNG = IMAGETYPE_PNG, - GIF = IMAGETYPE_GIF, - WEBP = IMAGETYPE_WEBP, - AVIF = 19, // IMAGETYPE_AVIF, - BMP = IMAGETYPE_BMP; -} diff --git a/vendor/nette/utils/src/Utils/Iterables.php b/vendor/nette/utils/src/Utils/Iterables.php deleted file mode 100644 index cc75152..0000000 --- a/vendor/nette/utils/src/Utils/Iterables.php +++ /dev/null @@ -1,238 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Utils; - -use Nette; - - -/** - * Utilities for iterables. - */ -final class Iterables -{ - use Nette\StaticClass; - - /** - * Tests for the presence of value. - */ - public static function contains(iterable $iterable, mixed $value): bool - { - foreach ($iterable as $v) { - if ($v === $value) { - return true; - } - } - return false; - } - - - /** - * Tests for the presence of key. - */ - public static function containsKey(iterable $iterable, mixed $key): bool - { - foreach ($iterable as $k => $v) { - if ($k === $key) { - return true; - } - } - return false; - } - - - /** - * Returns the first item (matching the specified predicate if given). If there is no such item, it returns result of invoking $else or null. - * @template K - * @template V - * @param iterable<K, V> $iterable - * @param ?callable(V, K, iterable<K, V>): bool $predicate - * @return ?V - */ - public static function first(iterable $iterable, ?callable $predicate = null, ?callable $else = null): mixed - { - foreach ($iterable as $k => $v) { - if (!$predicate || $predicate($v, $k, $iterable)) { - return $v; - } - } - return $else ? $else() : null; - } - - - /** - * Returns the key of first item (matching the specified predicate if given). If there is no such item, it returns result of invoking $else or null. - * @template K - * @template V - * @param iterable<K, V> $iterable - * @param ?callable(V, K, iterable<K, V>): bool $predicate - * @return ?K - */ - public static function firstKey(iterable $iterable, ?callable $predicate = null, ?callable $else = null): mixed - { - foreach ($iterable as $k => $v) { - if (!$predicate || $predicate($v, $k, $iterable)) { - return $k; - } - } - return $else ? $else() : null; - } - - - /** - * Tests whether at least one element in the iterator passes the test implemented by the provided function. - * @template K - * @template V - * @param iterable<K, V> $iterable - * @param callable(V, K, iterable<K, V>): bool $predicate - */ - public static function some(iterable $iterable, callable $predicate): bool - { - foreach ($iterable as $k => $v) { - if ($predicate($v, $k, $iterable)) { - return true; - } - } - return false; - } - - - /** - * Tests whether all elements in the iterator pass the test implemented by the provided function. - * @template K - * @template V - * @param iterable<K, V> $iterable - * @param callable(V, K, iterable<K, V>): bool $predicate - */ - public static function every(iterable $iterable, callable $predicate): bool - { - foreach ($iterable as $k => $v) { - if (!$predicate($v, $k, $iterable)) { - return false; - } - } - return true; - } - - - /** - * Iterator that filters elements according to a given $predicate. Maintains original keys. - * @template K - * @template V - * @param iterable<K, V> $iterable - * @param callable(V, K, iterable<K, V>): bool $predicate - * @return \Generator<K, V> - */ - public static function filter(iterable $iterable, callable $predicate): \Generator - { - foreach ($iterable as $k => $v) { - if ($predicate($v, $k, $iterable)) { - yield $k => $v; - } - } - } - - - /** - * Iterator that transforms values by calling $transformer. Maintains original keys. - * @template K - * @template V - * @template R - * @param iterable<K, V> $iterable - * @param callable(V, K, iterable<K, V>): R $transformer - * @return \Generator<K, R> - */ - public static function map(iterable $iterable, callable $transformer): \Generator - { - foreach ($iterable as $k => $v) { - yield $k => $transformer($v, $k, $iterable); - } - } - - - /** - * Iterator that transforms keys and values by calling $transformer. If it returns null, the element is skipped. - * @template K - * @template V - * @template ResV - * @template ResK - * @param iterable<K, V> $iterable - * @param callable(V, K, iterable<K, V>): ?array{ResV, ResK} $transformer - * @return \Generator<ResV, ResK> - */ - public static function mapWithKeys(iterable $iterable, callable $transformer): \Generator - { - foreach ($iterable as $k => $v) { - $pair = $transformer($v, $k, $iterable); - if ($pair) { - yield $pair[0] => $pair[1]; - } - } - } - - - /** - * Wraps around iterator and caches its keys and values during iteration. - * This allows the data to be re-iterated multiple times. - * @template K - * @template V - * @param iterable<K, V> $iterable - * @return \IteratorAggregate<K, V> - */ - public static function memoize(iterable $iterable): iterable - { - return new class (self::toIterator($iterable)) implements \IteratorAggregate { - public function __construct( - private \Iterator $iterator, - private array $cache = [], - ) { - } - - - public function getIterator(): \Generator - { - if (!$this->cache) { - $this->iterator->rewind(); - } - $i = 0; - while (true) { - if (isset($this->cache[$i])) { - [$k, $v] = $this->cache[$i]; - } elseif ($this->iterator->valid()) { - $k = $this->iterator->key(); - $v = $this->iterator->current(); - $this->iterator->next(); - $this->cache[$i] = [$k, $v]; - } else { - break; - } - yield $k => $v; - $i++; - } - } - }; - } - - - /** - * Creates an iterator from anything that is iterable. - * @template K - * @template V - * @param iterable<K, V> $iterable - * @return \Iterator<K, V> - */ - public static function toIterator(iterable $iterable): \Iterator - { - return match (true) { - $iterable instanceof \Iterator => $iterable, - $iterable instanceof \IteratorAggregate => self::toIterator($iterable->getIterator()), - is_array($iterable) => new \ArrayIterator($iterable), - }; - } -} diff --git a/vendor/nette/utils/src/Utils/Json.php b/vendor/nette/utils/src/Utils/Json.php deleted file mode 100644 index b87917b..0000000 --- a/vendor/nette/utils/src/Utils/Json.php +++ /dev/null @@ -1,84 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Utils; - -use Nette; - - -/** - * JSON encoder and decoder. - */ -final class Json -{ - use Nette\StaticClass; - - /** @deprecated use Json::decode(..., forceArrays: true) */ - public const FORCE_ARRAY = JSON_OBJECT_AS_ARRAY; - - /** @deprecated use Json::encode(..., pretty: true) */ - public const PRETTY = JSON_PRETTY_PRINT; - - /** @deprecated use Json::encode(..., asciiSafe: true) */ - public const ESCAPE_UNICODE = 1 << 19; - - - /** - * Converts value to JSON format. Use $pretty for easier reading and clarity, $asciiSafe for ASCII output - * and $htmlSafe for HTML escaping, $forceObjects enforces the encoding of non-associateve arrays as objects. - * @throws JsonException - */ - public static function encode( - mixed $value, - bool|int $pretty = false, - bool $asciiSafe = false, - bool $htmlSafe = false, - bool $forceObjects = false, - ): string - { - if (is_int($pretty)) { // back compatibility - $flags = ($pretty & self::ESCAPE_UNICODE ? 0 : JSON_UNESCAPED_UNICODE) | ($pretty & ~self::ESCAPE_UNICODE); - } else { - $flags = ($asciiSafe ? 0 : JSON_UNESCAPED_UNICODE) - | ($pretty ? JSON_PRETTY_PRINT : 0) - | ($forceObjects ? JSON_FORCE_OBJECT : 0) - | ($htmlSafe ? JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_TAG : 0); - } - - $flags |= JSON_UNESCAPED_SLASHES - | (defined('JSON_PRESERVE_ZERO_FRACTION') ? JSON_PRESERVE_ZERO_FRACTION : 0); // since PHP 5.6.6 & PECL JSON-C 1.3.7 - - $json = json_encode($value, $flags); - if ($error = json_last_error()) { - throw new JsonException(json_last_error_msg(), $error); - } - - return $json; - } - - - /** - * Parses JSON to PHP value. The $forceArrays enforces the decoding of objects as arrays. - * @throws JsonException - */ - public static function decode(string $json, bool|int $forceArrays = false): mixed - { - $flags = is_int($forceArrays) // back compatibility - ? $forceArrays - : ($forceArrays ? JSON_OBJECT_AS_ARRAY : 0); - $flags |= JSON_BIGINT_AS_STRING; - - $value = json_decode($json, flags: $flags); - if ($error = json_last_error()) { - throw new JsonException(json_last_error_msg(), $error); - } - - return $value; - } -} diff --git a/vendor/nette/utils/src/Utils/ObjectHelpers.php b/vendor/nette/utils/src/Utils/ObjectHelpers.php deleted file mode 100644 index f4bd55f..0000000 --- a/vendor/nette/utils/src/Utils/ObjectHelpers.php +++ /dev/null @@ -1,229 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Utils; - -use Nette; -use Nette\MemberAccessException; - - -/** - * Nette\SmartObject helpers. - * @internal - */ -final class ObjectHelpers -{ - use Nette\StaticClass; - - /** - * @return never - * @throws MemberAccessException - */ - public static function strictGet(string $class, string $name): void - { - $rc = new \ReflectionClass($class); - $hint = self::getSuggestion(array_merge( - array_filter($rc->getProperties(\ReflectionProperty::IS_PUBLIC), fn($p) => !$p->isStatic()), - self::parseFullDoc($rc, '~^[ \t*]*@property(?:-read)?[ \t]+(?:\S+[ \t]+)??\$(\w+)~m'), - ), $name); - throw new MemberAccessException("Cannot read an undeclared property $class::\$$name" . ($hint ? ", did you mean \$$hint?" : '.')); - } - - - /** - * @return never - * @throws MemberAccessException - */ - public static function strictSet(string $class, string $name): void - { - $rc = new \ReflectionClass($class); - $hint = self::getSuggestion(array_merge( - array_filter($rc->getProperties(\ReflectionProperty::IS_PUBLIC), fn($p) => !$p->isStatic()), - self::parseFullDoc($rc, '~^[ \t*]*@property(?:-write)?[ \t]+(?:\S+[ \t]+)??\$(\w+)~m'), - ), $name); - throw new MemberAccessException("Cannot write to an undeclared property $class::\$$name" . ($hint ? ", did you mean \$$hint?" : '.')); - } - - - /** - * @return never - * @throws MemberAccessException - */ - public static function strictCall(string $class, string $method, array $additionalMethods = []): void - { - $trace = debug_backtrace(0, 3); // suppose this method is called from __call() - $context = ($trace[1]['function'] ?? null) === '__call' - ? ($trace[2]['class'] ?? null) - : null; - - if ($context && is_a($class, $context, true) && method_exists($context, $method)) { // called parent::$method() - $class = get_parent_class($context); - } - - if (method_exists($class, $method)) { // insufficient visibility - $rm = new \ReflectionMethod($class, $method); - $visibility = $rm->isPrivate() - ? 'private ' - : ($rm->isProtected() ? 'protected ' : ''); - throw new MemberAccessException("Call to {$visibility}method $class::$method() from " . ($context ? "scope $context." : 'global scope.')); - - } else { - $hint = self::getSuggestion(array_merge( - get_class_methods($class), - self::parseFullDoc(new \ReflectionClass($class), '~^[ \t*]*@method[ \t]+(?:static[ \t]+)?(?:\S+[ \t]+)??(\w+)\(~m'), - $additionalMethods, - ), $method); - throw new MemberAccessException("Call to undefined method $class::$method()" . ($hint ? ", did you mean $hint()?" : '.')); - } - } - - - /** - * @return never - * @throws MemberAccessException - */ - public static function strictStaticCall(string $class, string $method): void - { - $trace = debug_backtrace(0, 3); // suppose this method is called from __callStatic() - $context = ($trace[1]['function'] ?? null) === '__callStatic' - ? ($trace[2]['class'] ?? null) - : null; - - if ($context && is_a($class, $context, true) && method_exists($context, $method)) { // called parent::$method() - $class = get_parent_class($context); - } - - if (method_exists($class, $method)) { // insufficient visibility - $rm = new \ReflectionMethod($class, $method); - $visibility = $rm->isPrivate() - ? 'private ' - : ($rm->isProtected() ? 'protected ' : ''); - throw new MemberAccessException("Call to {$visibility}method $class::$method() from " . ($context ? "scope $context." : 'global scope.')); - - } else { - $hint = self::getSuggestion( - array_filter((new \ReflectionClass($class))->getMethods(\ReflectionMethod::IS_PUBLIC), fn($m) => $m->isStatic()), - $method, - ); - throw new MemberAccessException("Call to undefined static method $class::$method()" . ($hint ? ", did you mean $hint()?" : '.')); - } - } - - - /** - * Returns array of magic properties defined by annotation @property. - * @return array of [name => bit mask] - * @internal - */ - public static function getMagicProperties(string $class): array - { - static $cache; - $props = &$cache[$class]; - if ($props !== null) { - return $props; - } - - $rc = new \ReflectionClass($class); - preg_match_all( - '~^ [ \t*]* @property(|-read|-write|-deprecated) [ \t]+ [^\s$]+ [ \t]+ \$ (\w+) ()~mx', - (string) $rc->getDocComment(), - $matches, - PREG_SET_ORDER, - ); - - $props = []; - foreach ($matches as [, $type, $name]) { - $uname = ucfirst($name); - $write = $type !== '-read' - && $rc->hasMethod($nm = 'set' . $uname) - && ($rm = $rc->getMethod($nm))->name === $nm && !$rm->isPrivate() && !$rm->isStatic(); - $read = $type !== '-write' - && ($rc->hasMethod($nm = 'get' . $uname) || $rc->hasMethod($nm = 'is' . $uname)) - && ($rm = $rc->getMethod($nm))->name === $nm && !$rm->isPrivate() && !$rm->isStatic(); - - if ($read || $write) { - $props[$name] = $read << 0 | ($nm[0] === 'g') << 1 | $rm->returnsReference() << 2 | $write << 3 | ($type === '-deprecated') << 4; - } - } - - foreach ($rc->getTraits() as $trait) { - $props += self::getMagicProperties($trait->name); - } - - if ($parent = get_parent_class($class)) { - $props += self::getMagicProperties($parent); - } - - return $props; - } - - - /** - * Finds the best suggestion (for 8-bit encoding). - * @param (\ReflectionFunctionAbstract|\ReflectionParameter|\ReflectionClass|\ReflectionProperty|string)[] $possibilities - * @internal - */ - public static function getSuggestion(array $possibilities, string $value): ?string - { - $norm = preg_replace($re = '#^(get|set|has|is|add)(?=[A-Z])#', '+', $value); - $best = null; - $min = (strlen($value) / 4 + 1) * 10 + .1; - foreach (array_unique($possibilities, SORT_REGULAR) as $item) { - $item = $item instanceof \Reflector ? $item->name : $item; - if ($item !== $value && ( - ($len = levenshtein($item, $value, 10, 11, 10)) < $min - || ($len = levenshtein(preg_replace($re, '*', $item), $norm, 10, 11, 10)) < $min - )) { - $min = $len; - $best = $item; - } - } - - return $best; - } - - - private static function parseFullDoc(\ReflectionClass $rc, string $pattern): array - { - do { - $doc[] = $rc->getDocComment(); - $traits = $rc->getTraits(); - while ($trait = array_pop($traits)) { - $doc[] = $trait->getDocComment(); - $traits += $trait->getTraits(); - } - } while ($rc = $rc->getParentClass()); - - return preg_match_all($pattern, implode('', $doc), $m) ? $m[1] : []; - } - - - /** - * Checks if the public non-static property exists. - * Returns 'event' if the property exists and has event like name - * @internal - */ - public static function hasProperty(string $class, string $name): bool|string - { - static $cache; - $prop = &$cache[$class][$name]; - if ($prop === null) { - $prop = false; - try { - $rp = new \ReflectionProperty($class, $name); - if ($rp->isPublic() && !$rp->isStatic()) { - $prop = $name >= 'onA' && $name < 'on_' ? 'event' : true; - } - } catch (\ReflectionException $e) { - } - } - - return $prop; - } -} diff --git a/vendor/nette/utils/src/Utils/Paginator.php b/vendor/nette/utils/src/Utils/Paginator.php deleted file mode 100644 index aa4812c..0000000 --- a/vendor/nette/utils/src/Utils/Paginator.php +++ /dev/null @@ -1,245 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Utils; - -use Nette; - - -/** - * Paginating math. - * - * @property int $page - * @property-read int $firstPage - * @property-read int|null $lastPage - * @property-read int<0,max> $firstItemOnPage - * @property-read int<0,max> $lastItemOnPage - * @property int $base - * @property-read bool $first - * @property-read bool $last - * @property-read int<0,max>|null $pageCount - * @property positive-int $itemsPerPage - * @property int<0,max>|null $itemCount - * @property-read int<0,max> $offset - * @property-read int<0,max>|null $countdownOffset - * @property-read int<0,max> $length - */ -class Paginator -{ - use Nette\SmartObject; - - private int $base = 1; - - /** @var positive-int */ - private int $itemsPerPage = 1; - - private int $page = 1; - - /** @var int<0, max>|null */ - private ?int $itemCount = null; - - - /** - * Sets current page number. - */ - public function setPage(int $page): static - { - $this->page = $page; - return $this; - } - - - /** - * Returns current page number. - */ - public function getPage(): int - { - return $this->base + $this->getPageIndex(); - } - - - /** - * Returns first page number. - */ - public function getFirstPage(): int - { - return $this->base; - } - - - /** - * Returns last page number. - */ - public function getLastPage(): ?int - { - return $this->itemCount === null - ? null - : $this->base + max(0, $this->getPageCount() - 1); - } - - - /** - * Returns the sequence number of the first element on the page - * @return int<0, max> - */ - public function getFirstItemOnPage(): int - { - return $this->itemCount !== 0 - ? $this->offset + 1 - : 0; - } - - - /** - * Returns the sequence number of the last element on the page - * @return int<0, max> - */ - public function getLastItemOnPage(): int - { - return $this->offset + $this->length; - } - - - /** - * Sets first page (base) number. - */ - public function setBase(int $base): static - { - $this->base = $base; - return $this; - } - - - /** - * Returns first page (base) number. - */ - public function getBase(): int - { - return $this->base; - } - - - /** - * Returns zero-based page number. - * @return int<0, max> - */ - protected function getPageIndex(): int - { - $index = max(0, $this->page - $this->base); - return $this->itemCount === null - ? $index - : min($index, max(0, $this->getPageCount() - 1)); - } - - - /** - * Is the current page the first one? - */ - public function isFirst(): bool - { - return $this->getPageIndex() === 0; - } - - - /** - * Is the current page the last one? - */ - public function isLast(): bool - { - return $this->itemCount === null - ? false - : $this->getPageIndex() >= $this->getPageCount() - 1; - } - - - /** - * Returns the total number of pages. - * @return int<0, max>|null - */ - public function getPageCount(): ?int - { - return $this->itemCount === null - ? null - : (int) ceil($this->itemCount / $this->itemsPerPage); - } - - - /** - * Sets the number of items to display on a single page. - */ - public function setItemsPerPage(int $itemsPerPage): static - { - $this->itemsPerPage = max(1, $itemsPerPage); - return $this; - } - - - /** - * Returns the number of items to display on a single page. - * @return positive-int - */ - public function getItemsPerPage(): int - { - return $this->itemsPerPage; - } - - - /** - * Sets the total number of items. - */ - public function setItemCount(?int $itemCount = null): static - { - $this->itemCount = $itemCount === null ? null : max(0, $itemCount); - return $this; - } - - - /** - * Returns the total number of items. - * @return int<0, max>|null - */ - public function getItemCount(): ?int - { - return $this->itemCount; - } - - - /** - * Returns the absolute index of the first item on current page. - * @return int<0, max> - */ - public function getOffset(): int - { - return $this->getPageIndex() * $this->itemsPerPage; - } - - - /** - * Returns the absolute index of the first item on current page in countdown paging. - * @return int<0, max>|null - */ - public function getCountdownOffset(): ?int - { - return $this->itemCount === null - ? null - : max(0, $this->itemCount - ($this->getPageIndex() + 1) * $this->itemsPerPage); - } - - - /** - * Returns the number of items on current page. - * @return int<0, max> - */ - public function getLength(): int - { - return $this->itemCount === null - ? $this->itemsPerPage - : min($this->itemsPerPage, $this->itemCount - $this->getPageIndex() * $this->itemsPerPage); - } -} diff --git a/vendor/nette/utils/src/Utils/Random.php b/vendor/nette/utils/src/Utils/Random.php deleted file mode 100644 index b14fbd5..0000000 --- a/vendor/nette/utils/src/Utils/Random.php +++ /dev/null @@ -1,52 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Utils; - -use Nette; -use Random\Randomizer; - - -/** - * Secure random string generator. - */ -final class Random -{ - use Nette\StaticClass; - - /** - * Generates a random string of given length from characters specified in second argument. - * Supports intervals, such as `0-9` or `A-Z`. - */ - public static function generate(int $length = 10, string $charlist = '0-9a-z'): string - { - $charlist = preg_replace_callback( - '#.-.#', - fn(array $m): string => implode('', range($m[0][0], $m[0][2])), - $charlist, - ); - $charlist = count_chars($charlist, mode: 3); - $chLen = strlen($charlist); - - if ($length < 1) { - throw new Nette\InvalidArgumentException('Length must be greater than zero.'); - } elseif ($chLen < 2) { - throw new Nette\InvalidArgumentException('Character list must contain at least two chars.'); - } elseif (PHP_VERSION_ID >= 80300) { - return (new Randomizer)->getBytesFromString($charlist, $length); - } - - $res = ''; - for ($i = 0; $i < $length; $i++) { - $res .= $charlist[random_int(0, $chLen - 1)]; - } - - return $res; - } -} diff --git a/vendor/nette/utils/src/Utils/Reflection.php b/vendor/nette/utils/src/Utils/Reflection.php deleted file mode 100644 index 87889be..0000000 --- a/vendor/nette/utils/src/Utils/Reflection.php +++ /dev/null @@ -1,322 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Utils; - -use Nette; - - -/** - * PHP reflection helpers. - */ -final class Reflection -{ - use Nette\StaticClass; - - /** @deprecated use Nette\Utils\Validator::isBuiltinType() */ - public static function isBuiltinType(string $type): bool - { - return Validators::isBuiltinType($type); - } - - - /** @deprecated use Nette\Utils\Validator::isClassKeyword() */ - public static function isClassKeyword(string $name): bool - { - return Validators::isClassKeyword($name); - } - - - /** @deprecated use native ReflectionParameter::getDefaultValue() */ - public static function getParameterDefaultValue(\ReflectionParameter $param): mixed - { - if ($param->isDefaultValueConstant()) { - $const = $orig = $param->getDefaultValueConstantName(); - $pair = explode('::', $const); - if (isset($pair[1])) { - $pair[0] = Type::resolve($pair[0], $param); - try { - $rcc = new \ReflectionClassConstant($pair[0], $pair[1]); - } catch (\ReflectionException $e) { - $name = self::toString($param); - throw new \ReflectionException("Unable to resolve constant $orig used as default value of $name.", 0, $e); - } - - return $rcc->getValue(); - - } elseif (!defined($const)) { - $const = substr((string) strrchr($const, '\\'), 1); - if (!defined($const)) { - $name = self::toString($param); - throw new \ReflectionException("Unable to resolve constant $orig used as default value of $name."); - } - } - - return constant($const); - } - - return $param->getDefaultValue(); - } - - - /** - * Returns a reflection of a class or trait that contains a declaration of given property. Property can also be declared in the trait. - */ - public static function getPropertyDeclaringClass(\ReflectionProperty $prop): \ReflectionClass - { - foreach ($prop->getDeclaringClass()->getTraits() as $trait) { - if ($trait->hasProperty($prop->name) - // doc-comment guessing as workaround for insufficient PHP reflection - && $trait->getProperty($prop->name)->getDocComment() === $prop->getDocComment() - ) { - return self::getPropertyDeclaringClass($trait->getProperty($prop->name)); - } - } - - return $prop->getDeclaringClass(); - } - - - /** - * Returns a reflection of a method that contains a declaration of $method. - * Usually, each method is its own declaration, but the body of the method can also be in the trait and under a different name. - */ - public static function getMethodDeclaringMethod(\ReflectionMethod $method): \ReflectionMethod - { - // file & line guessing as workaround for insufficient PHP reflection - $decl = $method->getDeclaringClass(); - if ($decl->getFileName() === $method->getFileName() - && $decl->getStartLine() <= $method->getStartLine() - && $decl->getEndLine() >= $method->getEndLine() - ) { - return $method; - } - - $hash = [$method->getFileName(), $method->getStartLine(), $method->getEndLine()]; - if (($alias = $decl->getTraitAliases()[$method->name] ?? null) - && ($m = new \ReflectionMethod(...explode('::', $alias, 2))) - && $hash === [$m->getFileName(), $m->getStartLine(), $m->getEndLine()] - ) { - return self::getMethodDeclaringMethod($m); - } - - foreach ($decl->getTraits() as $trait) { - if ($trait->hasMethod($method->name) - && ($m = $trait->getMethod($method->name)) - && $hash === [$m->getFileName(), $m->getStartLine(), $m->getEndLine()] - ) { - return self::getMethodDeclaringMethod($m); - } - } - - return $method; - } - - - /** - * Finds out if reflection has access to PHPdoc comments. Comments may not be available due to the opcode cache. - */ - public static function areCommentsAvailable(): bool - { - static $res; - return $res ?? $res = (bool) (new \ReflectionMethod(self::class, __FUNCTION__))->getDocComment(); - } - - - public static function toString(\Reflector $ref): string - { - if ($ref instanceof \ReflectionClass) { - return $ref->name; - } elseif ($ref instanceof \ReflectionMethod) { - return $ref->getDeclaringClass()->name . '::' . $ref->name . '()'; - } elseif ($ref instanceof \ReflectionFunction) { - return PHP_VERSION_ID >= 80200 && $ref->isAnonymous() - ? '{closure}()' - : $ref->name . '()'; - } elseif ($ref instanceof \ReflectionProperty) { - return self::getPropertyDeclaringClass($ref)->name . '::$' . $ref->name; - } elseif ($ref instanceof \ReflectionParameter) { - return '$' . $ref->name . ' in ' . self::toString($ref->getDeclaringFunction()); - } else { - throw new Nette\InvalidArgumentException; - } - } - - - /** - * Expands the name of the class to full name in the given context of given class. - * Thus, it returns how the PHP parser would understand $name if it were written in the body of the class $context. - * @throws Nette\InvalidArgumentException - */ - public static function expandClassName(string $name, \ReflectionClass $context): string - { - $lower = strtolower($name); - if (empty($name)) { - throw new Nette\InvalidArgumentException('Class name must not be empty.'); - - } elseif (Validators::isBuiltinType($lower)) { - return $lower; - - } elseif ($lower === 'self' || $lower === 'static') { - return $context->name; - - } elseif ($lower === 'parent') { - return $context->getParentClass() - ? $context->getParentClass()->name - : 'parent'; - - } elseif ($name[0] === '\\') { // fully qualified name - return ltrim($name, '\\'); - } - - $uses = self::getUseStatements($context); - $parts = explode('\\', $name, 2); - if (isset($uses[$parts[0]])) { - $parts[0] = $uses[$parts[0]]; - return implode('\\', $parts); - - } elseif ($context->inNamespace()) { - return $context->getNamespaceName() . '\\' . $name; - - } else { - return $name; - } - } - - - /** @return array<string, class-string> of [alias => class] */ - public static function getUseStatements(\ReflectionClass $class): array - { - if ($class->isAnonymous()) { - throw new Nette\NotImplementedException('Anonymous classes are not supported.'); - } - - static $cache = []; - if (!isset($cache[$name = $class->name])) { - if ($class->isInternal()) { - $cache[$name] = []; - } else { - $code = file_get_contents($class->getFileName()); - $cache = self::parseUseStatements($code, $name) + $cache; - } - } - - return $cache[$name]; - } - - - /** - * Parses PHP code to [class => [alias => class, ...]] - */ - private static function parseUseStatements(string $code, ?string $forClass = null): array - { - try { - $tokens = \PhpToken::tokenize($code, TOKEN_PARSE); - } catch (\ParseError $e) { - trigger_error($e->getMessage(), E_USER_NOTICE); - $tokens = []; - } - - $namespace = $class = null; - $classLevel = $level = 0; - $res = $uses = []; - - $nameTokens = [T_STRING, T_NS_SEPARATOR, T_NAME_QUALIFIED, T_NAME_FULLY_QUALIFIED]; - - while ($token = current($tokens)) { - next($tokens); - switch ($token->id) { - case T_NAMESPACE: - $namespace = ltrim(self::fetch($tokens, $nameTokens) . '\\', '\\'); - $uses = []; - break; - - case T_CLASS: - case T_INTERFACE: - case T_TRAIT: - case PHP_VERSION_ID < 80100 - ? T_CLASS - : T_ENUM: - if ($name = self::fetch($tokens, T_STRING)) { - $class = $namespace . $name; - $classLevel = $level + 1; - $res[$class] = $uses; - if ($class === $forClass) { - return $res; - } - } - - break; - - case T_USE: - while (!$class && ($name = self::fetch($tokens, $nameTokens))) { - $name = ltrim($name, '\\'); - if (self::fetch($tokens, '{')) { - while ($suffix = self::fetch($tokens, $nameTokens)) { - if (self::fetch($tokens, T_AS)) { - $uses[self::fetch($tokens, T_STRING)] = $name . $suffix; - } else { - $tmp = explode('\\', $suffix); - $uses[end($tmp)] = $name . $suffix; - } - - if (!self::fetch($tokens, ',')) { - break; - } - } - } elseif (self::fetch($tokens, T_AS)) { - $uses[self::fetch($tokens, T_STRING)] = $name; - - } else { - $tmp = explode('\\', $name); - $uses[end($tmp)] = $name; - } - - if (!self::fetch($tokens, ',')) { - break; - } - } - - break; - - case T_CURLY_OPEN: - case T_DOLLAR_OPEN_CURLY_BRACES: - case ord('{'): - $level++; - break; - - case ord('}'): - if ($level === $classLevel) { - $class = $classLevel = 0; - } - - $level--; - } - } - - return $res; - } - - - private static function fetch(array &$tokens, string|int|array $take): ?string - { - $res = null; - while ($token = current($tokens)) { - if ($token->is($take)) { - $res .= $token->text; - } elseif (!$token->is([T_DOC_COMMENT, T_WHITESPACE, T_COMMENT])) { - break; - } - - next($tokens); - } - - return $res; - } -} diff --git a/vendor/nette/utils/src/Utils/ReflectionMethod.php b/vendor/nette/utils/src/Utils/ReflectionMethod.php deleted file mode 100644 index b003fcb..0000000 --- a/vendor/nette/utils/src/Utils/ReflectionMethod.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Utils; - - -/** - * ReflectionMethod preserving the original class name. - * @internal - */ -final class ReflectionMethod extends \ReflectionMethod -{ - private \ReflectionClass $originalClass; - - - public function __construct(object|string $objectOrMethod, ?string $method = null) - { - if (is_string($objectOrMethod) && str_contains($objectOrMethod, '::')) { - [$objectOrMethod, $method] = explode('::', $objectOrMethod, 2); - } - parent::__construct($objectOrMethod, $method); - $this->originalClass = new \ReflectionClass($objectOrMethod); - } - - - public function getOriginalClass(): \ReflectionClass - { - return $this->originalClass; - } -} diff --git a/vendor/nette/utils/src/Utils/Strings.php b/vendor/nette/utils/src/Utils/Strings.php deleted file mode 100644 index c073565..0000000 --- a/vendor/nette/utils/src/Utils/Strings.php +++ /dev/null @@ -1,728 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Utils; - -use JetBrains\PhpStorm\Language; -use Nette; -use function is_array, is_object, strlen; - - -/** - * String tools library. - */ -class Strings -{ - use Nette\StaticClass; - - public const TrimCharacters = " \t\n\r\0\x0B\u{A0}\u{2000}\u{2001}\u{2002}\u{2003}\u{2004}\u{2005}\u{2006}\u{2007}\u{2008}\u{2009}\u{200A}\u{200B}"; - - /** @deprecated use Strings::TrimCharacters */ - public const TRIM_CHARACTERS = self::TrimCharacters; - - - /** - * @deprecated use Nette\Utils\Validator::isUnicode() - */ - public static function checkEncoding(string $s): bool - { - return $s === self::fixEncoding($s); - } - - - /** - * Removes all invalid UTF-8 characters from a string. - */ - public static function fixEncoding(string $s): string - { - // removes xD800-xDFFF, x110000 and higher - return htmlspecialchars_decode(htmlspecialchars($s, ENT_NOQUOTES | ENT_IGNORE, 'UTF-8'), ENT_NOQUOTES); - } - - - /** - * Returns a specific character in UTF-8 from code point (number in range 0x0000..D7FF or 0xE000..10FFFF). - * @throws Nette\InvalidArgumentException if code point is not in valid range - */ - public static function chr(int $code): string - { - if ($code < 0 || ($code >= 0xD800 && $code <= 0xDFFF) || $code > 0x10FFFF) { - throw new Nette\InvalidArgumentException('Code point must be in range 0x0 to 0xD7FF or 0xE000 to 0x10FFFF.'); - } elseif (!extension_loaded('iconv')) { - throw new Nette\NotSupportedException(__METHOD__ . '() requires ICONV extension that is not loaded.'); - } - - return iconv('UTF-32BE', 'UTF-8//IGNORE', pack('N', $code)); - } - - - /** - * Returns a code point of specific character in UTF-8 (number in range 0x0000..D7FF or 0xE000..10FFFF). - */ - public static function ord(string $c): int - { - if (!extension_loaded('iconv')) { - throw new Nette\NotSupportedException(__METHOD__ . '() requires ICONV extension that is not loaded.'); - } - - $tmp = iconv('UTF-8', 'UTF-32BE//IGNORE', $c); - if (!$tmp) { - throw new Nette\InvalidArgumentException('Invalid UTF-8 character "' . ($c === '' ? '' : '\x' . strtoupper(bin2hex($c))) . '".'); - } - - return unpack('N', $tmp)[1]; - } - - - /** - * @deprecated use str_starts_with() - */ - public static function startsWith(string $haystack, string $needle): bool - { - return str_starts_with($haystack, $needle); - } - - - /** - * @deprecated use str_ends_with() - */ - public static function endsWith(string $haystack, string $needle): bool - { - return str_ends_with($haystack, $needle); - } - - - /** - * @deprecated use str_contains() - */ - public static function contains(string $haystack, string $needle): bool - { - return str_contains($haystack, $needle); - } - - - /** - * Returns a part of UTF-8 string specified by starting position and length. If start is negative, - * the returned string will start at the start'th character from the end of string. - */ - public static function substring(string $s, int $start, ?int $length = null): string - { - if (function_exists('mb_substr')) { - return mb_substr($s, $start, $length, 'UTF-8'); // MB is much faster - } elseif (!extension_loaded('iconv')) { - throw new Nette\NotSupportedException(__METHOD__ . '() requires extension ICONV or MBSTRING, neither is loaded.'); - } elseif ($length === null) { - $length = self::length($s); - } elseif ($start < 0 && $length < 0) { - $start += self::length($s); // unifies iconv_substr behavior with mb_substr - } - - return iconv_substr($s, $start, $length, 'UTF-8'); - } - - - /** - * Removes control characters, normalizes line breaks to `\n`, removes leading and trailing blank lines, - * trims end spaces on lines, normalizes UTF-8 to the normal form of NFC. - */ - public static function normalize(string $s): string - { - // convert to compressed normal form (NFC) - if (class_exists('Normalizer', false) && ($n = \Normalizer::normalize($s, \Normalizer::FORM_C)) !== false) { - $s = $n; - } - - $s = self::unixNewLines($s); - - // remove control characters; leave \t + \n - $s = self::pcre('preg_replace', ['#[\x00-\x08\x0B-\x1F\x7F-\x9F]+#u', '', $s]); - - // right trim - $s = self::pcre('preg_replace', ['#[\t ]+$#m', '', $s]); - - // leading and trailing blank lines - $s = trim($s, "\n"); - - return $s; - } - - - /** @deprecated use Strings::unixNewLines() */ - public static function normalizeNewLines(string $s): string - { - return self::unixNewLines($s); - } - - - /** - * Converts line endings to \n used on Unix-like systems. - * Line endings are: \n, \r, \r\n, U+2028 line separator, U+2029 paragraph separator. - */ - public static function unixNewLines(string $s): string - { - return preg_replace("~\r\n?|\u{2028}|\u{2029}~", "\n", $s); - } - - - /** - * Converts line endings to platform-specific, i.e. \r\n on Windows and \n elsewhere. - * Line endings are: \n, \r, \r\n, U+2028 line separator, U+2029 paragraph separator. - */ - public static function platformNewLines(string $s): string - { - return preg_replace("~\r\n?|\n|\u{2028}|\u{2029}~", PHP_EOL, $s); - } - - - /** - * Converts UTF-8 string to ASCII, ie removes diacritics etc. - */ - public static function toAscii(string $s): string - { - $iconv = defined('ICONV_IMPL') ? trim(ICONV_IMPL, '"\'') : null; - static $transliterator = null; - if ($transliterator === null) { - if (class_exists('Transliterator', false)) { - $transliterator = \Transliterator::create('Any-Latin; Latin-ASCII'); - } else { - trigger_error(__METHOD__ . "(): it is recommended to enable PHP extensions 'intl'.", E_USER_NOTICE); - $transliterator = false; - } - } - - // remove control characters and check UTF-8 validity - $s = self::pcre('preg_replace', ['#[^\x09\x0A\x0D\x20-\x7E\xA0-\x{2FF}\x{370}-\x{10FFFF}]#u', '', $s]); - - // transliteration (by Transliterator and iconv) is not optimal, replace some characters directly - $s = strtr($s, ["\u{201E}" => '"', "\u{201C}" => '"', "\u{201D}" => '"', "\u{201A}" => "'", "\u{2018}" => "'", "\u{2019}" => "'", "\u{B0}" => '^', "\u{42F}" => 'Ya', "\u{44F}" => 'ya', "\u{42E}" => 'Yu', "\u{44E}" => 'yu', "\u{c4}" => 'Ae', "\u{d6}" => 'Oe', "\u{dc}" => 'Ue', "\u{1e9e}" => 'Ss', "\u{e4}" => 'ae', "\u{f6}" => 'oe', "\u{fc}" => 'ue', "\u{df}" => 'ss']); // „ “ ” ‚ ‘ ’ ° Я я Ю ю Ä Ö Ü ẞ ä ö ü ß - if ($iconv !== 'libiconv') { - $s = strtr($s, ["\u{AE}" => '(R)', "\u{A9}" => '(c)', "\u{2026}" => '...', "\u{AB}" => '<<', "\u{BB}" => '>>', "\u{A3}" => 'lb', "\u{A5}" => 'yen', "\u{B2}" => '^2', "\u{B3}" => '^3', "\u{B5}" => 'u', "\u{B9}" => '^1', "\u{BA}" => 'o', "\u{BF}" => '?', "\u{2CA}" => "'", "\u{2CD}" => '_', "\u{2DD}" => '"', "\u{1FEF}" => '', "\u{20AC}" => 'EUR', "\u{2122}" => 'TM', "\u{212E}" => 'e', "\u{2190}" => '<-', "\u{2191}" => '^', "\u{2192}" => '->', "\u{2193}" => 'V', "\u{2194}" => '<->']); // ® © … « » £ ¥ ² ³ µ ¹ º ¿ ˊ ˍ ˝ ` € ™ ℮ ← ↑ → ↓ ↔ - } - - if ($transliterator) { - $s = $transliterator->transliterate($s); - // use iconv because The transliterator leaves some characters out of ASCII, eg → ʾ - if ($iconv === 'glibc') { - $s = strtr($s, '?', "\x01"); // temporarily hide ? to distinguish them from the garbage that iconv creates - $s = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $s); - $s = str_replace(['?', "\x01"], ['', '?'], $s); // remove garbage and restore ? characters - } elseif ($iconv === 'libiconv') { - $s = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $s); - } else { // null or 'unknown' (#216) - $s = self::pcre('preg_replace', ['#[^\x00-\x7F]++#', '', $s]); // remove non-ascii chars - } - } elseif ($iconv === 'glibc' || $iconv === 'libiconv') { - // temporarily hide these characters to distinguish them from the garbage that iconv creates - $s = strtr($s, '`\'"^~?', "\x01\x02\x03\x04\x05\x06"); - if ($iconv === 'glibc') { - // glibc implementation is very limited. transliterate into Windows-1250 and then into ASCII, so most Eastern European characters are preserved - $s = iconv('UTF-8', 'WINDOWS-1250//TRANSLIT//IGNORE', $s); - $s = strtr( - $s, - "\xa5\xa3\xbc\x8c\xa7\x8a\xaa\x8d\x8f\x8e\xaf\xb9\xb3\xbe\x9c\x9a\xba\x9d\x9f\x9e\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf8\xf9\xfa\xfb\xfc\xfd\xfe\x96\xa0\x8b\x97\x9b\xa6\xad\xb7", - 'ALLSSSSTZZZallssstzzzRAAAALCCCEEEEIIDDNNOOOOxRUUUUYTsraaaalccceeeeiiddnnooooruuuuyt- <->|-.', - ); - $s = self::pcre('preg_replace', ['#[^\x00-\x7F]++#', '', $s]); - } else { - $s = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $s); - } - - // remove garbage that iconv creates during transliteration (eg Ý -> Y') - $s = str_replace(['`', "'", '"', '^', '~', '?'], '', $s); - // restore temporarily hidden characters - $s = strtr($s, "\x01\x02\x03\x04\x05\x06", '`\'"^~?'); - } else { - $s = self::pcre('preg_replace', ['#[^\x00-\x7F]++#', '', $s]); // remove non-ascii chars - } - - return $s; - } - - - /** - * Modifies the UTF-8 string to the form used in the URL, ie removes diacritics and replaces all characters - * except letters of the English alphabet and numbers with a hyphens. - */ - public static function webalize(string $s, ?string $charlist = null, bool $lower = true): string - { - $s = self::toAscii($s); - if ($lower) { - $s = strtolower($s); - } - - $s = self::pcre('preg_replace', ['#[^a-z0-9' . ($charlist !== null ? preg_quote($charlist, '#') : '') . ']+#i', '-', $s]); - $s = trim($s, '-'); - return $s; - } - - - /** - * Truncates a UTF-8 string to given maximal length, while trying not to split whole words. Only if the string is truncated, - * an ellipsis (or something else set with third argument) is appended to the string. - */ - public static function truncate(string $s, int $maxLen, string $append = "\u{2026}"): string - { - if (self::length($s) > $maxLen) { - $maxLen -= self::length($append); - if ($maxLen < 1) { - return $append; - - } elseif ($matches = self::match($s, '#^.{1,' . $maxLen . '}(?=[\s\x00-/:-@\[-`{-~])#us')) { - return $matches[0] . $append; - - } else { - return self::substring($s, 0, $maxLen) . $append; - } - } - - return $s; - } - - - /** - * Indents a multiline text from the left. Second argument sets how many indentation chars should be used, - * while the indent itself is the third argument (*tab* by default). - */ - public static function indent(string $s, int $level = 1, string $chars = "\t"): string - { - if ($level > 0) { - $s = self::replace($s, '#(?:^|[\r\n]+)(?=[^\r\n])#', '$0' . str_repeat($chars, $level)); - } - - return $s; - } - - - /** - * Converts all characters of UTF-8 string to lower case. - */ - public static function lower(string $s): string - { - return mb_strtolower($s, 'UTF-8'); - } - - - /** - * Converts the first character of a UTF-8 string to lower case and leaves the other characters unchanged. - */ - public static function firstLower(string $s): string - { - return self::lower(self::substring($s, 0, 1)) . self::substring($s, 1); - } - - - /** - * Converts all characters of a UTF-8 string to upper case. - */ - public static function upper(string $s): string - { - return mb_strtoupper($s, 'UTF-8'); - } - - - /** - * Converts the first character of a UTF-8 string to upper case and leaves the other characters unchanged. - */ - public static function firstUpper(string $s): string - { - return self::upper(self::substring($s, 0, 1)) . self::substring($s, 1); - } - - - /** - * Converts the first character of every word of a UTF-8 string to upper case and the others to lower case. - */ - public static function capitalize(string $s): string - { - return mb_convert_case($s, MB_CASE_TITLE, 'UTF-8'); - } - - - /** - * Compares two UTF-8 strings or their parts, without taking character case into account. If length is null, whole strings are compared, - * if it is negative, the corresponding number of characters from the end of the strings is compared, - * otherwise the appropriate number of characters from the beginning is compared. - */ - public static function compare(string $left, string $right, ?int $length = null): bool - { - if (class_exists('Normalizer', false)) { - $left = \Normalizer::normalize($left, \Normalizer::FORM_D); // form NFD is faster - $right = \Normalizer::normalize($right, \Normalizer::FORM_D); // form NFD is faster - } - - if ($length < 0) { - $left = self::substring($left, $length, -$length); - $right = self::substring($right, $length, -$length); - } elseif ($length !== null) { - $left = self::substring($left, 0, $length); - $right = self::substring($right, 0, $length); - } - - return self::lower($left) === self::lower($right); - } - - - /** - * Finds the common prefix of strings or returns empty string if the prefix was not found. - * @param string[] $strings - */ - public static function findPrefix(array $strings): string - { - $first = array_shift($strings); - for ($i = 0; $i < strlen($first); $i++) { - foreach ($strings as $s) { - if (!isset($s[$i]) || $first[$i] !== $s[$i]) { - while ($i && $first[$i - 1] >= "\x80" && $first[$i] >= "\x80" && $first[$i] < "\xC0") { - $i--; - } - - return substr($first, 0, $i); - } - } - } - - return $first; - } - - - /** - * Returns number of characters (not bytes) in UTF-8 string. - * That is the number of Unicode code points which may differ from the number of graphemes. - */ - public static function length(string $s): int - { - return match (true) { - extension_loaded('mbstring') => mb_strlen($s, 'UTF-8'), - extension_loaded('iconv') => iconv_strlen($s, 'UTF-8'), - default => strlen(@utf8_decode($s)), // deprecated - }; - } - - - /** - * Removes all left and right side spaces (or the characters passed as second argument) from a UTF-8 encoded string. - */ - public static function trim(string $s, string $charlist = self::TrimCharacters): string - { - $charlist = preg_quote($charlist, '#'); - return self::replace($s, '#^[' . $charlist . ']+|[' . $charlist . ']+$#Du', ''); - } - - - /** - * Pads a UTF-8 string to given length by prepending the $pad string to the beginning. - * @param non-empty-string $pad - */ - public static function padLeft(string $s, int $length, string $pad = ' '): string - { - $length = max(0, $length - self::length($s)); - $padLen = self::length($pad); - return str_repeat($pad, (int) ($length / $padLen)) . self::substring($pad, 0, $length % $padLen) . $s; - } - - - /** - * Pads UTF-8 string to given length by appending the $pad string to the end. - * @param non-empty-string $pad - */ - public static function padRight(string $s, int $length, string $pad = ' '): string - { - $length = max(0, $length - self::length($s)); - $padLen = self::length($pad); - return $s . str_repeat($pad, (int) ($length / $padLen)) . self::substring($pad, 0, $length % $padLen); - } - - - /** - * Reverses UTF-8 string. - */ - public static function reverse(string $s): string - { - if (!extension_loaded('iconv')) { - throw new Nette\NotSupportedException(__METHOD__ . '() requires ICONV extension that is not loaded.'); - } - - return iconv('UTF-32LE', 'UTF-8', strrev(iconv('UTF-8', 'UTF-32BE', $s))); - } - - - /** - * Returns part of $haystack before $nth occurence of $needle or returns null if the needle was not found. - * Negative value means searching from the end. - */ - public static function before(string $haystack, string $needle, int $nth = 1): ?string - { - $pos = self::pos($haystack, $needle, $nth); - return $pos === null - ? null - : substr($haystack, 0, $pos); - } - - - /** - * Returns part of $haystack after $nth occurence of $needle or returns null if the needle was not found. - * Negative value means searching from the end. - */ - public static function after(string $haystack, string $needle, int $nth = 1): ?string - { - $pos = self::pos($haystack, $needle, $nth); - return $pos === null - ? null - : substr($haystack, $pos + strlen($needle)); - } - - - /** - * Returns position in characters of $nth occurence of $needle in $haystack or null if the $needle was not found. - * Negative value of `$nth` means searching from the end. - */ - public static function indexOf(string $haystack, string $needle, int $nth = 1): ?int - { - $pos = self::pos($haystack, $needle, $nth); - return $pos === null - ? null - : self::length(substr($haystack, 0, $pos)); - } - - - /** - * Returns position in characters of $nth occurence of $needle in $haystack or null if the needle was not found. - */ - private static function pos(string $haystack, string $needle, int $nth = 1): ?int - { - if (!$nth) { - return null; - } elseif ($nth > 0) { - if ($needle === '') { - return 0; - } - - $pos = 0; - while (($pos = strpos($haystack, $needle, $pos)) !== false && --$nth) { - $pos++; - } - } else { - $len = strlen($haystack); - if ($needle === '') { - return $len; - } elseif ($len === 0) { - return null; - } - - $pos = $len - 1; - while (($pos = strrpos($haystack, $needle, $pos - $len)) !== false && ++$nth) { - $pos--; - } - } - - return Helpers::falseToNull($pos); - } - - - /** - * Divides the string into arrays according to the regular expression. Expressions in parentheses will be captured and returned as well. - */ - public static function split( - string $subject, - #[Language('RegExp')] - string $pattern, - bool|int $captureOffset = false, - bool $skipEmpty = false, - int $limit = -1, - bool $utf8 = false, - ): array - { - $flags = is_int($captureOffset) // back compatibility - ? $captureOffset - : ($captureOffset ? PREG_SPLIT_OFFSET_CAPTURE : 0) | ($skipEmpty ? PREG_SPLIT_NO_EMPTY : 0); - - $pattern .= $utf8 ? 'u' : ''; - $m = self::pcre('preg_split', [$pattern, $subject, $limit, $flags | PREG_SPLIT_DELIM_CAPTURE]); - return $utf8 && $captureOffset - ? self::bytesToChars($subject, [$m])[0] - : $m; - - } - - - /** - * Searches the string for the part matching the regular expression and returns - * an array with the found expression and individual subexpressions, or `null`. - */ - public static function match( - string $subject, - #[Language('RegExp')] - string $pattern, - bool|int $captureOffset = false, - int $offset = 0, - bool $unmatchedAsNull = false, - bool $utf8 = false, - ): ?array - { - $flags = is_int($captureOffset) // back compatibility - ? $captureOffset - : ($captureOffset ? PREG_OFFSET_CAPTURE : 0) | ($unmatchedAsNull ? PREG_UNMATCHED_AS_NULL : 0); - - if ($utf8) { - $offset = strlen(self::substring($subject, 0, $offset)); - $pattern .= 'u'; - } - - if ($offset > strlen($subject)) { - return null; - } elseif (!self::pcre('preg_match', [$pattern, $subject, &$m, $flags, $offset])) { - return null; - } elseif ($utf8 && $captureOffset) { - return self::bytesToChars($subject, [$m])[0]; - } else { - return $m; - } - } - - - /** - * Searches the string for all occurrences matching the regular expression and - * returns an array of arrays containing the found expression and each subexpression. - * @return ($lazy is true ? \Generator<int, array> : array[]) - */ - public static function matchAll( - string $subject, - #[Language('RegExp')] - string $pattern, - bool|int $captureOffset = false, - int $offset = 0, - bool $unmatchedAsNull = false, - bool $patternOrder = false, - bool $utf8 = false, - bool $lazy = false, - ): array|\Generator - { - if ($utf8) { - $offset = strlen(self::substring($subject, 0, $offset)); - $pattern .= 'u'; - } - - if ($lazy) { - $flags = PREG_OFFSET_CAPTURE | ($unmatchedAsNull ? PREG_UNMATCHED_AS_NULL : 0); - return (function () use ($utf8, $captureOffset, $flags, $subject, $pattern, $offset) { - $counter = 0; - while ( - $offset <= strlen($subject) - ($counter ? 1 : 0) - && self::pcre('preg_match', [$pattern, $subject, &$m, $flags, $offset]) - ) { - $offset = $m[0][1] + max(1, strlen($m[0][0])); - if (!$captureOffset) { - $m = array_map(fn($item) => $item[0], $m); - } elseif ($utf8) { - $m = self::bytesToChars($subject, [$m])[0]; - } - yield $counter++ => $m; - } - })(); - } - - if ($offset > strlen($subject)) { - return []; - } - - $flags = is_int($captureOffset) // back compatibility - ? $captureOffset - : ($captureOffset ? PREG_OFFSET_CAPTURE : 0) | ($unmatchedAsNull ? PREG_UNMATCHED_AS_NULL : 0) | ($patternOrder ? PREG_PATTERN_ORDER : 0); - - self::pcre('preg_match_all', [ - $pattern, $subject, &$m, - ($flags & PREG_PATTERN_ORDER) ? $flags : ($flags | PREG_SET_ORDER), - $offset, - ]); - return $utf8 && $captureOffset - ? self::bytesToChars($subject, $m) - : $m; - } - - - /** - * Replaces all occurrences matching regular expression $pattern which can be string or array in the form `pattern => replacement`. - */ - public static function replace( - string $subject, - #[Language('RegExp')] - string|array $pattern, - string|callable $replacement = '', - int $limit = -1, - bool $captureOffset = false, - bool $unmatchedAsNull = false, - bool $utf8 = false, - ): string - { - if (is_object($replacement) || is_array($replacement)) { - if (!is_callable($replacement, false, $textual)) { - throw new Nette\InvalidStateException("Callback '$textual' is not callable."); - } - - $flags = ($captureOffset ? PREG_OFFSET_CAPTURE : 0) | ($unmatchedAsNull ? PREG_UNMATCHED_AS_NULL : 0); - if ($utf8) { - $pattern .= 'u'; - if ($captureOffset) { - $replacement = fn($m) => $replacement(self::bytesToChars($subject, [$m])[0]); - } - } - - return self::pcre('preg_replace_callback', [$pattern, $replacement, $subject, $limit, 0, $flags]); - - } elseif (is_array($pattern) && is_string(key($pattern))) { - $replacement = array_values($pattern); - $pattern = array_keys($pattern); - } - - if ($utf8) { - $pattern = array_map(fn($item) => $item . 'u', (array) $pattern); - } - - return self::pcre('preg_replace', [$pattern, $replacement, $subject, $limit]); - } - - - private static function bytesToChars(string $s, array $groups): array - { - $lastBytes = $lastChars = 0; - foreach ($groups as &$matches) { - foreach ($matches as &$match) { - if ($match[1] > $lastBytes) { - $lastChars += self::length(substr($s, $lastBytes, $match[1] - $lastBytes)); - } elseif ($match[1] < $lastBytes) { - $lastChars -= self::length(substr($s, $match[1], $lastBytes - $match[1])); - } - - $lastBytes = $match[1]; - $match[1] = $lastChars; - } - } - - return $groups; - } - - - /** @internal */ - public static function pcre(string $func, array $args) - { - $res = Callback::invokeSafe($func, $args, function (string $message) use ($args): void { - // compile-time error, not detectable by preg_last_error - throw new RegexpException($message . ' in pattern: ' . implode(' or ', (array) $args[0])); - }); - - if (($code = preg_last_error()) // run-time error, but preg_last_error & return code are liars - && ($res === null || !in_array($func, ['preg_filter', 'preg_replace_callback', 'preg_replace'], true)) - ) { - throw new RegexpException(preg_last_error_msg() - . ' (pattern: ' . implode(' or ', (array) $args[0]) . ')', $code); - } - - return $res; - } -} diff --git a/vendor/nette/utils/src/Utils/Type.php b/vendor/nette/utils/src/Utils/Type.php deleted file mode 100644 index 7a17881..0000000 --- a/vendor/nette/utils/src/Utils/Type.php +++ /dev/null @@ -1,267 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Utils; - -use Nette; - - -/** - * PHP type reflection. - */ -final class Type -{ - /** @var array<int, string|self> */ - private array $types; - private bool $simple; - private string $kind; // | & - - - /** - * Creates a Type object based on reflection. Resolves self, static and parent to the actual class name. - * If the subject has no type, it returns null. - */ - public static function fromReflection( - \ReflectionFunctionAbstract|\ReflectionParameter|\ReflectionProperty $reflection, - ): ?self - { - $type = $reflection instanceof \ReflectionFunctionAbstract - ? $reflection->getReturnType() ?? (PHP_VERSION_ID >= 80100 && $reflection instanceof \ReflectionMethod ? $reflection->getTentativeReturnType() : null) - : $reflection->getType(); - - return $type ? self::fromReflectionType($type, $reflection, asObject: true) : null; - } - - - private static function fromReflectionType(\ReflectionType $type, $of, bool $asObject): self|string - { - if ($type instanceof \ReflectionNamedType) { - $name = self::resolve($type->getName(), $of); - return $asObject - ? new self($type->allowsNull() && $name !== 'mixed' ? [$name, 'null'] : [$name]) - : $name; - - } elseif ($type instanceof \ReflectionUnionType || $type instanceof \ReflectionIntersectionType) { - return new self( - array_map(fn($t) => self::fromReflectionType($t, $of, asObject: false), $type->getTypes()), - $type instanceof \ReflectionUnionType ? '|' : '&', - ); - - } else { - throw new Nette\InvalidStateException('Unexpected type of ' . Reflection::toString($of)); - } - } - - - /** - * Creates the Type object according to the text notation. - */ - public static function fromString(string $type): self - { - if (!Validators::isTypeDeclaration($type)) { - throw new Nette\InvalidArgumentException("Invalid type '$type'."); - } - - if ($type[0] === '?') { - return new self([substr($type, 1), 'null']); - } - - $unions = []; - foreach (explode('|', $type) as $part) { - $part = explode('&', trim($part, '()')); - $unions[] = count($part) === 1 ? $part[0] : new self($part, '&'); - } - - return count($unions) === 1 && $unions[0] instanceof self - ? $unions[0] - : new self($unions); - } - - - /** - * Resolves 'self', 'static' and 'parent' to the actual class name. - */ - public static function resolve( - string $type, - \ReflectionFunctionAbstract|\ReflectionParameter|\ReflectionProperty $of, - ): string - { - $lower = strtolower($type); - if ($of instanceof \ReflectionFunction) { - return $type; - } elseif ($lower === 'self') { - return $of->getDeclaringClass()->name; - } elseif ($lower === 'static') { - return ($of instanceof ReflectionMethod ? $of->getOriginalClass() : $of->getDeclaringClass())->name; - } elseif ($lower === 'parent' && $of->getDeclaringClass()->getParentClass()) { - return $of->getDeclaringClass()->getParentClass()->name; - } else { - return $type; - } - } - - - private function __construct(array $types, string $kind = '|') - { - $o = array_search('null', $types, strict: true); - if ($o !== false) { // null as last - array_splice($types, $o, 1); - $types[] = 'null'; - } - - $this->types = $types; - $this->simple = is_string($types[0]) && ($types[1] ?? 'null') === 'null'; - $this->kind = count($types) > 1 ? $kind : ''; - } - - - public function __toString(): string - { - $multi = count($this->types) > 1; - if ($this->simple) { - return ($multi ? '?' : '') . $this->types[0]; - } - - $res = []; - foreach ($this->types as $type) { - $res[] = $type instanceof self && $multi ? "($type)" : $type; - } - return implode($this->kind, $res); - } - - - /** - * Returns the array of subtypes that make up the compound type as strings. - * @return array<int, string|string[]> - */ - public function getNames(): array - { - return array_map(fn($t) => $t instanceof self ? $t->getNames() : $t, $this->types); - } - - - /** - * Returns the array of subtypes that make up the compound type as Type objects: - * @return self[] - */ - public function getTypes(): array - { - return array_map(fn($t) => $t instanceof self ? $t : new self([$t]), $this->types); - } - - - /** - * Returns the type name for simple types, otherwise null. - */ - public function getSingleName(): ?string - { - return $this->simple - ? $this->types[0] - : null; - } - - - /** - * Returns true whether it is a union type. - */ - public function isUnion(): bool - { - return $this->kind === '|'; - } - - - /** - * Returns true whether it is an intersection type. - */ - public function isIntersection(): bool - { - return $this->kind === '&'; - } - - - /** - * Returns true whether it is a simple type. Single nullable types are also considered to be simple types. - */ - public function isSimple(): bool - { - return $this->simple; - } - - - /** @deprecated use isSimple() */ - public function isSingle(): bool - { - return $this->simple; - } - - - /** - * Returns true whether the type is both a simple and a PHP built-in type. - */ - public function isBuiltin(): bool - { - return $this->simple && Validators::isBuiltinType($this->types[0]); - } - - - /** - * Returns true whether the type is both a simple and a class name. - */ - public function isClass(): bool - { - return $this->simple && !Validators::isBuiltinType($this->types[0]); - } - - - /** - * Determines if type is special class name self/parent/static. - */ - public function isClassKeyword(): bool - { - return $this->simple && Validators::isClassKeyword($this->types[0]); - } - - - /** - * Verifies type compatibility. For example, it checks if a value of a certain type could be passed as a parameter. - */ - public function allows(string $subtype): bool - { - if ($this->types === ['mixed']) { - return true; - } - - $subtype = self::fromString($subtype); - return $subtype->isUnion() - ? Arrays::every($subtype->types, fn($t) => $this->allows2($t instanceof self ? $t->types : [$t])) - : $this->allows2($subtype->types); - } - - - private function allows2(array $subtypes): bool - { - return $this->isUnion() - ? Arrays::some($this->types, fn($t) => $this->allows3($t instanceof self ? $t->types : [$t], $subtypes)) - : $this->allows3($this->types, $subtypes); - } - - - private function allows3(array $types, array $subtypes): bool - { - return Arrays::every( - $types, - fn($type) => Arrays::some( - $subtypes, - fn($subtype) => Validators::isBuiltinType($type) - ? strcasecmp($type, $subtype) === 0 - : is_a($subtype, $type, allow_string: true) - ) - ); - } -} diff --git a/vendor/nette/utils/src/Utils/Validators.php b/vendor/nette/utils/src/Utils/Validators.php deleted file mode 100644 index 61ccf09..0000000 --- a/vendor/nette/utils/src/Utils/Validators.php +++ /dev/null @@ -1,416 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Utils; - -use Nette; - - -/** - * Validation utilities. - */ -class Validators -{ - use Nette\StaticClass; - - private const BuiltinTypes = [ - 'string' => 1, 'int' => 1, 'float' => 1, 'bool' => 1, 'array' => 1, 'object' => 1, - 'callable' => 1, 'iterable' => 1, 'void' => 1, 'null' => 1, 'mixed' => 1, 'false' => 1, - 'never' => 1, 'true' => 1, - ]; - - /** @var array<string,?callable> */ - protected static $validators = [ - // PHP types - 'array' => 'is_array', - 'bool' => 'is_bool', - 'boolean' => 'is_bool', - 'float' => 'is_float', - 'int' => 'is_int', - 'integer' => 'is_int', - 'null' => 'is_null', - 'object' => 'is_object', - 'resource' => 'is_resource', - 'scalar' => 'is_scalar', - 'string' => 'is_string', - - // pseudo-types - 'callable' => [self::class, 'isCallable'], - 'iterable' => 'is_iterable', - 'list' => [Arrays::class, 'isList'], - 'mixed' => [self::class, 'isMixed'], - 'none' => [self::class, 'isNone'], - 'number' => [self::class, 'isNumber'], - 'numeric' => [self::class, 'isNumeric'], - 'numericint' => [self::class, 'isNumericInt'], - - // string patterns - 'alnum' => 'ctype_alnum', - 'alpha' => 'ctype_alpha', - 'digit' => 'ctype_digit', - 'lower' => 'ctype_lower', - 'pattern' => null, - 'space' => 'ctype_space', - 'unicode' => [self::class, 'isUnicode'], - 'upper' => 'ctype_upper', - 'xdigit' => 'ctype_xdigit', - - // syntax validation - 'email' => [self::class, 'isEmail'], - 'identifier' => [self::class, 'isPhpIdentifier'], - 'uri' => [self::class, 'isUri'], - 'url' => [self::class, 'isUrl'], - - // environment validation - 'class' => 'class_exists', - 'interface' => 'interface_exists', - 'directory' => 'is_dir', - 'file' => 'is_file', - 'type' => [self::class, 'isType'], - ]; - - /** @var array<string,callable> */ - protected static $counters = [ - 'string' => 'strlen', - 'unicode' => [Strings::class, 'length'], - 'array' => 'count', - 'list' => 'count', - 'alnum' => 'strlen', - 'alpha' => 'strlen', - 'digit' => 'strlen', - 'lower' => 'strlen', - 'space' => 'strlen', - 'upper' => 'strlen', - 'xdigit' => 'strlen', - ]; - - - /** - * Verifies that the value is of expected types separated by pipe. - * @throws AssertionException - */ - public static function assert(mixed $value, string $expected, string $label = 'variable'): void - { - if (!static::is($value, $expected)) { - $expected = str_replace(['|', ':'], [' or ', ' in range '], $expected); - $translate = ['boolean' => 'bool', 'integer' => 'int', 'double' => 'float', 'NULL' => 'null']; - $type = $translate[gettype($value)] ?? gettype($value); - if (is_int($value) || is_float($value) || (is_string($value) && strlen($value) < 40)) { - $type .= ' ' . var_export($value, return: true); - } elseif (is_object($value)) { - $type .= ' ' . $value::class; - } - - throw new AssertionException("The $label expects to be $expected, $type given."); - } - } - - - /** - * Verifies that element $key in array is of expected types separated by pipe. - * @param mixed[] $array - * @throws AssertionException - */ - public static function assertField( - array $array, - $key, - ?string $expected = null, - string $label = "item '%' in array", - ): void - { - if (!array_key_exists($key, $array)) { - throw new AssertionException('Missing ' . str_replace('%', $key, $label) . '.'); - - } elseif ($expected) { - static::assert($array[$key], $expected, str_replace('%', $key, $label)); - } - } - - - /** - * Verifies that the value is of expected types separated by pipe. - */ - public static function is(mixed $value, string $expected): bool - { - foreach (explode('|', $expected) as $item) { - if (str_ends_with($item, '[]')) { - if (is_iterable($value) && self::everyIs($value, substr($item, 0, -2))) { - return true; - } - - continue; - } elseif (str_starts_with($item, '?')) { - $item = substr($item, 1); - if ($value === null) { - return true; - } - } - - [$type] = $item = explode(':', $item, 2); - if (isset(static::$validators[$type])) { - try { - if (!static::$validators[$type]($value)) { - continue; - } - } catch (\TypeError $e) { - continue; - } - } elseif ($type === 'pattern') { - if (Strings::match($value, '|^' . ($item[1] ?? '') . '$|D')) { - return true; - } - - continue; - } elseif (!$value instanceof $type) { - continue; - } - - if (isset($item[1])) { - $length = $value; - if (isset(static::$counters[$type])) { - $length = static::$counters[$type]($value); - } - - $range = explode('..', $item[1]); - if (!isset($range[1])) { - $range[1] = $range[0]; - } - - if (($range[0] !== '' && $length < $range[0]) || ($range[1] !== '' && $length > $range[1])) { - continue; - } - } - - return true; - } - - return false; - } - - - /** - * Finds whether all values are of expected types separated by pipe. - * @param mixed[] $values - */ - public static function everyIs(iterable $values, string $expected): bool - { - foreach ($values as $value) { - if (!static::is($value, $expected)) { - return false; - } - } - - return true; - } - - - /** - * Checks if the value is an integer or a float. - * @return ($value is int|float ? true : false) - */ - public static function isNumber(mixed $value): bool - { - return is_int($value) || is_float($value); - } - - - /** - * Checks if the value is an integer or a integer written in a string. - * @return ($value is non-empty-string ? bool : ($value is int ? true : false)) - */ - public static function isNumericInt(mixed $value): bool - { - return is_int($value) || (is_string($value) && preg_match('#^[+-]?[0-9]+$#D', $value)); - } - - - /** - * Checks if the value is a number or a number written in a string. - * @return ($value is non-empty-string ? bool : ($value is int|float ? true : false)) - */ - public static function isNumeric(mixed $value): bool - { - return is_float($value) || is_int($value) || (is_string($value) && preg_match('#^[+-]?([0-9]++\.?[0-9]*|\.[0-9]+)$#D', $value)); - } - - - /** - * Checks if the value is a syntactically correct callback. - */ - public static function isCallable(mixed $value): bool - { - return $value && is_callable($value, syntax_only: true); - } - - - /** - * Checks if the value is a valid UTF-8 string. - */ - public static function isUnicode(mixed $value): bool - { - return is_string($value) && preg_match('##u', $value); - } - - - /** - * Checks if the value is 0, '', false or null. - * @return ($value is 0|''|false|null ? true : false) - */ - public static function isNone(mixed $value): bool - { - return $value == null; // intentionally == - } - - - /** @internal */ - public static function isMixed(): bool - { - return true; - } - - - /** - * Checks if a variable is a zero-based integer indexed array. - * @deprecated use Nette\Utils\Arrays::isList - * @return ($value is list ? true : false) - */ - public static function isList(mixed $value): bool - { - return Arrays::isList($value); - } - - - /** - * Checks if the value is in the given range [min, max], where the upper or lower limit can be omitted (null). - * Numbers, strings and DateTime objects can be compared. - */ - public static function isInRange(mixed $value, array $range): bool - { - if ($value === null || !(isset($range[0]) || isset($range[1]))) { - return false; - } - - $limit = $range[0] ?? $range[1]; - if (is_string($limit)) { - $value = (string) $value; - } elseif ($limit instanceof \DateTimeInterface) { - if (!$value instanceof \DateTimeInterface) { - return false; - } - } elseif (is_numeric($value)) { - $value *= 1; - } else { - return false; - } - - return (!isset($range[0]) || ($value >= $range[0])) && (!isset($range[1]) || ($value <= $range[1])); - } - - - /** - * Checks if the value is a valid email address. It does not verify that the domain actually exists, only the syntax is verified. - */ - public static function isEmail(string $value): bool - { - $atom = "[-a-z0-9!#$%&'*+/=?^_`{|}~]"; // RFC 5322 unquoted characters in local-part - $alpha = "a-z\x80-\xFF"; // superset of IDN - return (bool) preg_match(<<<XX - (^(?n) - ("([ !#-[\\]-~]*|\\\\[ -~])+"|$atom+(\\.$atom+)*) # quoted or unquoted - @ - ([0-9$alpha]([-0-9$alpha]{0,61}[0-9$alpha])?\\.)+ # domain - RFC 1034 - [$alpha]([-0-9$alpha]{0,17}[$alpha])? # top domain - $)Dix - XX, $value); - } - - - /** - * Checks if the value is a valid URL address. - */ - public static function isUrl(string $value): bool - { - $alpha = "a-z\x80-\xFF"; - return (bool) preg_match(<<<XX - (^(?n) - https?://( - (([-_0-9$alpha]+\\.)* # subdomain - [0-9$alpha]([-0-9$alpha]{0,61}[0-9$alpha])?\\.)? # domain - [$alpha]([-0-9$alpha]{0,17}[$alpha])? # top domain - |\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3} # IPv4 - |\\[[0-9a-f:]{3,39}\\] # IPv6 - )(:\\d{1,5})? # port - (/\\S*)? # path - (\\?\\S*)? # query - (\\#\\S*)? # fragment - $)Dix - XX, $value); - } - - - /** - * Checks if the value is a valid URI address, that is, actually a string beginning with a syntactically valid schema. - */ - public static function isUri(string $value): bool - { - return (bool) preg_match('#^[a-z\d+\.-]+:\S+$#Di', $value); - } - - - /** - * Checks whether the input is a class, interface or trait. - * @deprecated - */ - public static function isType(string $type): bool - { - return class_exists($type) || interface_exists($type) || trait_exists($type); - } - - - /** - * Checks whether the input is a valid PHP identifier. - */ - public static function isPhpIdentifier(string $value): bool - { - return preg_match('#^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$#D', $value) === 1; - } - - - /** - * Determines if type is PHP built-in type. Otherwise, it is the class name. - */ - public static function isBuiltinType(string $type): bool - { - return isset(self::BuiltinTypes[strtolower($type)]); - } - - - /** - * Determines if type is special class name self/parent/static. - */ - public static function isClassKeyword(string $name): bool - { - return (bool) preg_match('#^(self|parent|static)$#Di', $name); - } - - - /** - * Checks whether the given type declaration is syntactically valid. - */ - public static function isTypeDeclaration(string $type): bool - { - return (bool) preg_match(<<<'XX' - ~((?n) - \?? (?<type> \\? (?<name> [a-zA-Z_\x7f-\xff][\w\x7f-\xff]*) (\\ (?&name))* ) | - (?<intersection> (?&type) (& (?&type))+ ) | - (?<upart> (?&type) | \( (?&intersection) \) ) (\| (?&upart))+ - )$~xAD - XX, $type); - } -} diff --git a/vendor/nette/utils/src/Utils/exceptions.php b/vendor/nette/utils/src/Utils/exceptions.php deleted file mode 100644 index af949ce..0000000 --- a/vendor/nette/utils/src/Utils/exceptions.php +++ /dev/null @@ -1,50 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Utils; - - -/** - * The exception that is thrown when an image error occurs. - */ -class ImageException extends \Exception -{ -} - - -/** - * The exception that indicates invalid image file. - */ -class UnknownImageFileException extends ImageException -{ -} - - -/** - * The exception that indicates error of JSON encoding/decoding. - */ -class JsonException extends \JsonException -{ -} - - -/** - * The exception that indicates error of the last Regexp execution. - */ -class RegexpException extends \Exception -{ -} - - -/** - * The exception that indicates assertion error. - */ -class AssertionException extends \Exception -{ -} diff --git a/vendor/nette/utils/src/compatibility.php b/vendor/nette/utils/src/compatibility.php deleted file mode 100644 index 9df5480..0000000 --- a/vendor/nette/utils/src/compatibility.php +++ /dev/null @@ -1,32 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette\Utils; - -use Nette; - -if (false) { - /** @deprecated use Nette\HtmlStringable */ - interface IHtmlString extends Nette\HtmlStringable - { - } -} elseif (!interface_exists(IHtmlString::class)) { - class_alias(Nette\HtmlStringable::class, IHtmlString::class); -} - -namespace Nette\Localization; - -if (false) { - /** @deprecated use Nette\Localization\Translator */ - interface ITranslator extends Translator - { - } -} elseif (!interface_exists(ITranslator::class)) { - class_alias(Translator::class, ITranslator::class); -} diff --git a/vendor/nette/utils/src/exceptions.php b/vendor/nette/utils/src/exceptions.php deleted file mode 100644 index bbda7dd..0000000 --- a/vendor/nette/utils/src/exceptions.php +++ /dev/null @@ -1,109 +0,0 @@ -<?php - -/** - * This file is part of the Nette Framework (https://nette.org) - * Copyright (c) 2004 David Grudl (https://davidgrudl.com) - */ - -declare(strict_types=1); - -namespace Nette; - - -/** - * The exception that is thrown when the value of an argument is - * outside the allowable range of values as defined by the invoked method. - */ -class ArgumentOutOfRangeException extends \InvalidArgumentException -{ -} - - -/** - * The exception that is thrown when a method call is invalid for the object's - * current state, method has been invoked at an illegal or inappropriate time. - */ -class InvalidStateException extends \RuntimeException -{ -} - - -/** - * The exception that is thrown when a requested method or operation is not implemented. - */ -class NotImplementedException extends \LogicException -{ -} - - -/** - * The exception that is thrown when an invoked method is not supported. For scenarios where - * it is sometimes possible to perform the requested operation, see InvalidStateException. - */ -class NotSupportedException extends \LogicException -{ -} - - -/** - * The exception that is thrown when a requested method or operation is deprecated. - */ -class DeprecatedException extends NotSupportedException -{ -} - - -/** - * The exception that is thrown when accessing a class member (property or method) fails. - */ -class MemberAccessException extends \Error -{ -} - - -/** - * The exception that is thrown when an I/O error occurs. - */ -class IOException extends \RuntimeException -{ -} - - -/** - * The exception that is thrown when accessing a file that does not exist on disk. - */ -class FileNotFoundException extends IOException -{ -} - - -/** - * The exception that is thrown when part of a file or directory cannot be found. - */ -class DirectoryNotFoundException extends IOException -{ -} - - -/** - * The exception that is thrown when an argument does not match with the expected value. - */ -class InvalidArgumentException extends \InvalidArgumentException -{ -} - - -/** - * The exception that is thrown when an illegal index was requested. - */ -class OutOfRangeException extends \OutOfRangeException -{ -} - - -/** - * The exception that is thrown when a value (typically returned by function) does not match with the expected value. - */ -class UnexpectedValueException extends \UnexpectedValueException -{ -} diff --git a/vendor/psr/event-dispatcher/.editorconfig b/vendor/psr/event-dispatcher/.editorconfig deleted file mode 100644 index 164f092..0000000 --- a/vendor/psr/event-dispatcher/.editorconfig +++ /dev/null @@ -1,15 +0,0 @@ -; This file is for unifying the coding style for different editors and IDEs. -; More information at http://editorconfig.org - -root = true - -[*] -charset = utf-8 -indent_size = 4 -indent_style = space -end_of_line = lf -insert_final_newline = true -trim_trailing_whitespace = true - -[Makefile] -indent_style = tab diff --git a/vendor/psr/event-dispatcher/.gitignore b/vendor/psr/event-dispatcher/.gitignore deleted file mode 100644 index 3a9875b..0000000 --- a/vendor/psr/event-dispatcher/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/vendor/ -composer.lock diff --git a/vendor/psr/event-dispatcher/LICENSE b/vendor/psr/event-dispatcher/LICENSE deleted file mode 100644 index 3f1559b..0000000 --- a/vendor/psr/event-dispatcher/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2018 PHP-FIG - -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/psr/event-dispatcher/README.md b/vendor/psr/event-dispatcher/README.md deleted file mode 100644 index 294214a..0000000 --- a/vendor/psr/event-dispatcher/README.md +++ /dev/null @@ -1,6 +0,0 @@ -PSR Event Dispatcher -==================== - -This repository holds the interfaces related to [PSR-14](http://www.php-fig.org/psr/psr-14/). - -Note that this is not an Event Dispatcher implementation of its own. It is merely interfaces that describe the components of an Event Dispatcher. See the specification for more details. diff --git a/vendor/psr/event-dispatcher/composer.json b/vendor/psr/event-dispatcher/composer.json deleted file mode 100644 index 667a714..0000000 --- a/vendor/psr/event-dispatcher/composer.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "psr/event-dispatcher", - "description": "Standard interfaces for event handling.", - "type": "library", - "keywords": ["psr", "psr-14", "events"], - "license": "MIT", - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "require": { - "php": ">=7.2.0" - }, - "autoload": { - "psr-4": { - "Psr\\EventDispatcher\\": "src/" - } - }, - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - } -} diff --git a/vendor/psr/event-dispatcher/src/EventDispatcherInterface.php b/vendor/psr/event-dispatcher/src/EventDispatcherInterface.php deleted file mode 100644 index 4306fa9..0000000 --- a/vendor/psr/event-dispatcher/src/EventDispatcherInterface.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php -declare(strict_types=1); - -namespace Psr\EventDispatcher; - -/** - * Defines a dispatcher for events. - */ -interface EventDispatcherInterface -{ - /** - * Provide all relevant listeners with an event to process. - * - * @param object $event - * The object to process. - * - * @return object - * The Event that was passed, now modified by listeners. - */ - public function dispatch(object $event); -} diff --git a/vendor/psr/event-dispatcher/src/ListenerProviderInterface.php b/vendor/psr/event-dispatcher/src/ListenerProviderInterface.php deleted file mode 100644 index bdacb6e..0000000 --- a/vendor/psr/event-dispatcher/src/ListenerProviderInterface.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php -declare(strict_types=1); - -namespace Psr\EventDispatcher; - -/** - * Mapper from an event to the listeners that are applicable to that event. - */ -interface ListenerProviderInterface -{ - /** - * @param object $event - * An event for which to return the relevant listeners. - * @return iterable[callable] - * An iterable (array, iterator, or generator) of callables. Each - * callable MUST be type-compatible with $event. - */ - public function getListenersForEvent(object $event) : iterable; -} diff --git a/vendor/psr/event-dispatcher/src/StoppableEventInterface.php b/vendor/psr/event-dispatcher/src/StoppableEventInterface.php deleted file mode 100644 index 5955081..0000000 --- a/vendor/psr/event-dispatcher/src/StoppableEventInterface.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php -declare(strict_types=1); - -namespace Psr\EventDispatcher; - -/** - * An Event whose processing may be interrupted when the event has been handled. - * - * A Dispatcher implementation MUST check to determine if an Event - * is marked as stopped after each listener is called. If it is then it should - * return immediately without calling any further Listeners. - */ -interface StoppableEventInterface -{ - /** - * Is propagation stopped? - * - * This will typically only be used by the Dispatcher to determine if the - * previous listener halted propagation. - * - * @return bool - * True if the Event is complete and no further listeners should be called. - * False to continue calling listeners. - */ - public function isPropagationStopped() : bool; -} diff --git a/vendor/symfony/deprecation-contracts/CHANGELOG.md b/vendor/symfony/deprecation-contracts/CHANGELOG.md deleted file mode 100644 index 7932e26..0000000 --- a/vendor/symfony/deprecation-contracts/CHANGELOG.md +++ /dev/null @@ -1,5 +0,0 @@ -CHANGELOG -========= - -The changelog is maintained for all Symfony contracts at the following URL: -https://github.com/symfony/contracts/blob/main/CHANGELOG.md diff --git a/vendor/symfony/deprecation-contracts/LICENSE b/vendor/symfony/deprecation-contracts/LICENSE deleted file mode 100644 index 0ed3a24..0000000 --- a/vendor/symfony/deprecation-contracts/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2020-present Fabien Potencier - -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/symfony/deprecation-contracts/README.md b/vendor/symfony/deprecation-contracts/README.md deleted file mode 100644 index 9814864..0000000 --- a/vendor/symfony/deprecation-contracts/README.md +++ /dev/null @@ -1,26 +0,0 @@ -Symfony Deprecation Contracts -============================= - -A generic function and convention to trigger deprecation notices. - -This package provides a single global function named `trigger_deprecation()` that triggers silenced deprecation notices. - -By using a custom PHP error handler such as the one provided by the Symfony ErrorHandler component, -the triggered deprecations can be caught and logged for later discovery, both on dev and prod environments. - -The function requires at least 3 arguments: - - the name of the Composer package that is triggering the deprecation - - the version of the package that introduced the deprecation - - the message of the deprecation - - more arguments can be provided: they will be inserted in the message using `printf()` formatting - -Example: -```php -trigger_deprecation('symfony/blockchain', '8.9', 'Using "%s" is deprecated, use "%s" instead.', 'bitcoin', 'fabcoin'); -``` - -This will generate the following message: -`Since symfony/blockchain 8.9: Using "bitcoin" is deprecated, use "fabcoin" instead.` - -While not recommended, the deprecation notices can be completely ignored by declaring an empty -`function trigger_deprecation() {}` in your application. diff --git a/vendor/symfony/deprecation-contracts/composer.json b/vendor/symfony/deprecation-contracts/composer.json deleted file mode 100644 index ceb6c07..0000000 --- a/vendor/symfony/deprecation-contracts/composer.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "symfony/deprecation-contracts", - "type": "library", - "description": "A generic function and convention to trigger deprecation notices", - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=8.1" - }, - "autoload": { - "files": [ - "function.php" - ] - }, - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-main": "3.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - } -} diff --git a/vendor/symfony/deprecation-contracts/function.php b/vendor/symfony/deprecation-contracts/function.php deleted file mode 100644 index 2d56512..0000000 --- a/vendor/symfony/deprecation-contracts/function.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -if (!function_exists('trigger_deprecation')) { - /** - * Triggers a silenced deprecation notice. - * - * @param string $package The name of the Composer package that is triggering the deprecation - * @param string $version The version of the package that introduced the deprecation - * @param string $message The message of the deprecation - * @param mixed ...$args Values to insert in the message using printf() formatting - * - * @author Nicolas Grekas <p@tchwork.com> - */ - function trigger_deprecation(string $package, string $version, string $message, mixed ...$args): void - { - @trigger_error(($package || $version ? "Since $package $version: " : '').($args ? vsprintf($message, $args) : $message), \E_USER_DEPRECATED); - } -} diff --git a/vendor/symfony/polyfill-ctype/Ctype.php b/vendor/symfony/polyfill-ctype/Ctype.php deleted file mode 100644 index ba75a2c..0000000 --- a/vendor/symfony/polyfill-ctype/Ctype.php +++ /dev/null @@ -1,232 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Polyfill\Ctype; - -/** - * Ctype implementation through regex. - * - * @internal - * - * @author Gert de Pagter <BackEndTea@gmail.com> - */ -final class Ctype -{ - /** - * Returns TRUE if every character in text is either a letter or a digit, FALSE otherwise. - * - * @see https://php.net/ctype-alnum - * - * @param mixed $text - * - * @return bool - */ - public static function ctype_alnum($text) - { - $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); - - return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z0-9]/', $text); - } - - /** - * Returns TRUE if every character in text is a letter, FALSE otherwise. - * - * @see https://php.net/ctype-alpha - * - * @param mixed $text - * - * @return bool - */ - public static function ctype_alpha($text) - { - $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); - - return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z]/', $text); - } - - /** - * Returns TRUE if every character in text is a control character from the current locale, FALSE otherwise. - * - * @see https://php.net/ctype-cntrl - * - * @param mixed $text - * - * @return bool - */ - public static function ctype_cntrl($text) - { - $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); - - return \is_string($text) && '' !== $text && !preg_match('/[^\x00-\x1f\x7f]/', $text); - } - - /** - * Returns TRUE if every character in the string text is a decimal digit, FALSE otherwise. - * - * @see https://php.net/ctype-digit - * - * @param mixed $text - * - * @return bool - */ - public static function ctype_digit($text) - { - $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); - - return \is_string($text) && '' !== $text && !preg_match('/[^0-9]/', $text); - } - - /** - * Returns TRUE if every character in text is printable and actually creates visible output (no white space), FALSE otherwise. - * - * @see https://php.net/ctype-graph - * - * @param mixed $text - * - * @return bool - */ - public static function ctype_graph($text) - { - $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); - - return \is_string($text) && '' !== $text && !preg_match('/[^!-~]/', $text); - } - - /** - * Returns TRUE if every character in text is a lowercase letter. - * - * @see https://php.net/ctype-lower - * - * @param mixed $text - * - * @return bool - */ - public static function ctype_lower($text) - { - $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); - - return \is_string($text) && '' !== $text && !preg_match('/[^a-z]/', $text); - } - - /** - * Returns TRUE if every character in text will actually create output (including blanks). Returns FALSE if text contains control characters or characters that do not have any output or control function at all. - * - * @see https://php.net/ctype-print - * - * @param mixed $text - * - * @return bool - */ - public static function ctype_print($text) - { - $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); - - return \is_string($text) && '' !== $text && !preg_match('/[^ -~]/', $text); - } - - /** - * Returns TRUE if every character in text is printable, but neither letter, digit or blank, FALSE otherwise. - * - * @see https://php.net/ctype-punct - * - * @param mixed $text - * - * @return bool - */ - public static function ctype_punct($text) - { - $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); - - return \is_string($text) && '' !== $text && !preg_match('/[^!-\/\:-@\[-`\{-~]/', $text); - } - - /** - * Returns TRUE if every character in text creates some sort of white space, FALSE otherwise. Besides the blank character this also includes tab, vertical tab, line feed, carriage return and form feed characters. - * - * @see https://php.net/ctype-space - * - * @param mixed $text - * - * @return bool - */ - public static function ctype_space($text) - { - $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); - - return \is_string($text) && '' !== $text && !preg_match('/[^\s]/', $text); - } - - /** - * Returns TRUE if every character in text is an uppercase letter. - * - * @see https://php.net/ctype-upper - * - * @param mixed $text - * - * @return bool - */ - public static function ctype_upper($text) - { - $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); - - return \is_string($text) && '' !== $text && !preg_match('/[^A-Z]/', $text); - } - - /** - * Returns TRUE if every character in text is a hexadecimal 'digit', that is a decimal digit or a character from [A-Fa-f] , FALSE otherwise. - * - * @see https://php.net/ctype-xdigit - * - * @param mixed $text - * - * @return bool - */ - public static function ctype_xdigit($text) - { - $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); - - return \is_string($text) && '' !== $text && !preg_match('/[^A-Fa-f0-9]/', $text); - } - - /** - * Converts integers to their char versions according to normal ctype behaviour, if needed. - * - * If an integer between -128 and 255 inclusive is provided, - * it is interpreted as the ASCII value of a single character - * (negative values have 256 added in order to allow characters in the Extended ASCII range). - * Any other integer is interpreted as a string containing the decimal digits of the integer. - * - * @param mixed $int - * @param string $function - * - * @return mixed - */ - private static function convert_int_to_char_for_ctype($int, $function) - { - if (!\is_int($int)) { - return $int; - } - - if ($int < -128 || $int > 255) { - return (string) $int; - } - - if (\PHP_VERSION_ID >= 80100) { - @trigger_error($function.'(): Argument of type int will be interpreted as string in the future', \E_USER_DEPRECATED); - } - - if ($int < 0) { - $int += 256; - } - - return \chr($int); - } -} diff --git a/vendor/symfony/polyfill-ctype/LICENSE b/vendor/symfony/polyfill-ctype/LICENSE deleted file mode 100644 index 7536cae..0000000 --- a/vendor/symfony/polyfill-ctype/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2018-present Fabien Potencier - -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/symfony/polyfill-ctype/README.md b/vendor/symfony/polyfill-ctype/README.md deleted file mode 100644 index b144d03..0000000 --- a/vendor/symfony/polyfill-ctype/README.md +++ /dev/null @@ -1,12 +0,0 @@ -Symfony Polyfill / Ctype -======================== - -This component provides `ctype_*` functions to users who run php versions without the ctype extension. - -More information can be found in the -[main Polyfill README](https://github.com/symfony/polyfill/blob/main/README.md). - -License -======= - -This library is released under the [MIT license](LICENSE). diff --git a/vendor/symfony/polyfill-ctype/bootstrap.php b/vendor/symfony/polyfill-ctype/bootstrap.php deleted file mode 100644 index d54524b..0000000 --- a/vendor/symfony/polyfill-ctype/bootstrap.php +++ /dev/null @@ -1,50 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -use Symfony\Polyfill\Ctype as p; - -if (\PHP_VERSION_ID >= 80000) { - return require __DIR__.'/bootstrap80.php'; -} - -if (!function_exists('ctype_alnum')) { - function ctype_alnum($text) { return p\Ctype::ctype_alnum($text); } -} -if (!function_exists('ctype_alpha')) { - function ctype_alpha($text) { return p\Ctype::ctype_alpha($text); } -} -if (!function_exists('ctype_cntrl')) { - function ctype_cntrl($text) { return p\Ctype::ctype_cntrl($text); } -} -if (!function_exists('ctype_digit')) { - function ctype_digit($text) { return p\Ctype::ctype_digit($text); } -} -if (!function_exists('ctype_graph')) { - function ctype_graph($text) { return p\Ctype::ctype_graph($text); } -} -if (!function_exists('ctype_lower')) { - function ctype_lower($text) { return p\Ctype::ctype_lower($text); } -} -if (!function_exists('ctype_print')) { - function ctype_print($text) { return p\Ctype::ctype_print($text); } -} -if (!function_exists('ctype_punct')) { - function ctype_punct($text) { return p\Ctype::ctype_punct($text); } -} -if (!function_exists('ctype_space')) { - function ctype_space($text) { return p\Ctype::ctype_space($text); } -} -if (!function_exists('ctype_upper')) { - function ctype_upper($text) { return p\Ctype::ctype_upper($text); } -} -if (!function_exists('ctype_xdigit')) { - function ctype_xdigit($text) { return p\Ctype::ctype_xdigit($text); } -} diff --git a/vendor/symfony/polyfill-ctype/bootstrap80.php b/vendor/symfony/polyfill-ctype/bootstrap80.php deleted file mode 100644 index ab2f861..0000000 --- a/vendor/symfony/polyfill-ctype/bootstrap80.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -use Symfony\Polyfill\Ctype as p; - -if (!function_exists('ctype_alnum')) { - function ctype_alnum(mixed $text): bool { return p\Ctype::ctype_alnum($text); } -} -if (!function_exists('ctype_alpha')) { - function ctype_alpha(mixed $text): bool { return p\Ctype::ctype_alpha($text); } -} -if (!function_exists('ctype_cntrl')) { - function ctype_cntrl(mixed $text): bool { return p\Ctype::ctype_cntrl($text); } -} -if (!function_exists('ctype_digit')) { - function ctype_digit(mixed $text): bool { return p\Ctype::ctype_digit($text); } -} -if (!function_exists('ctype_graph')) { - function ctype_graph(mixed $text): bool { return p\Ctype::ctype_graph($text); } -} -if (!function_exists('ctype_lower')) { - function ctype_lower(mixed $text): bool { return p\Ctype::ctype_lower($text); } -} -if (!function_exists('ctype_print')) { - function ctype_print(mixed $text): bool { return p\Ctype::ctype_print($text); } -} -if (!function_exists('ctype_punct')) { - function ctype_punct(mixed $text): bool { return p\Ctype::ctype_punct($text); } -} -if (!function_exists('ctype_space')) { - function ctype_space(mixed $text): bool { return p\Ctype::ctype_space($text); } -} -if (!function_exists('ctype_upper')) { - function ctype_upper(mixed $text): bool { return p\Ctype::ctype_upper($text); } -} -if (!function_exists('ctype_xdigit')) { - function ctype_xdigit(mixed $text): bool { return p\Ctype::ctype_xdigit($text); } -} diff --git a/vendor/symfony/polyfill-ctype/composer.json b/vendor/symfony/polyfill-ctype/composer.json deleted file mode 100644 index 131ca7a..0000000 --- a/vendor/symfony/polyfill-ctype/composer.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "symfony/polyfill-ctype", - "type": "library", - "description": "Symfony polyfill for ctype functions", - "keywords": ["polyfill", "compatibility", "portable", "ctype"], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=7.2" - }, - "provide": { - "ext-ctype": "*" - }, - "autoload": { - "psr-4": { "Symfony\\Polyfill\\Ctype\\": "" }, - "files": [ "bootstrap.php" ] - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "minimum-stability": "dev", - "extra": { - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - } -} diff --git a/vendor/symfony/polyfill-php80/LICENSE b/vendor/symfony/polyfill-php80/LICENSE deleted file mode 100644 index 0ed3a24..0000000 --- a/vendor/symfony/polyfill-php80/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2020-present Fabien Potencier - -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/symfony/polyfill-php80/Php80.php b/vendor/symfony/polyfill-php80/Php80.php deleted file mode 100644 index 362dd1a..0000000 --- a/vendor/symfony/polyfill-php80/Php80.php +++ /dev/null @@ -1,115 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Polyfill\Php80; - -/** - * @author Ion Bazan <ion.bazan@gmail.com> - * @author Nico Oelgart <nicoswd@gmail.com> - * @author Nicolas Grekas <p@tchwork.com> - * - * @internal - */ -final class Php80 -{ - public static function fdiv(float $dividend, float $divisor): float - { - return @($dividend / $divisor); - } - - public static function get_debug_type($value): string - { - switch (true) { - case null === $value: return 'null'; - case \is_bool($value): return 'bool'; - case \is_string($value): return 'string'; - case \is_array($value): return 'array'; - case \is_int($value): return 'int'; - case \is_float($value): return 'float'; - case \is_object($value): break; - case $value instanceof \__PHP_Incomplete_Class: return '__PHP_Incomplete_Class'; - default: - if (null === $type = @get_resource_type($value)) { - return 'unknown'; - } - - if ('Unknown' === $type) { - $type = 'closed'; - } - - return "resource ($type)"; - } - - $class = \get_class($value); - - if (false === strpos($class, '@')) { - return $class; - } - - return (get_parent_class($class) ?: key(class_implements($class)) ?: 'class').'@anonymous'; - } - - public static function get_resource_id($res): int - { - if (!\is_resource($res) && null === @get_resource_type($res)) { - throw new \TypeError(sprintf('Argument 1 passed to get_resource_id() must be of the type resource, %s given', get_debug_type($res))); - } - - return (int) $res; - } - - public static function preg_last_error_msg(): string - { - switch (preg_last_error()) { - case \PREG_INTERNAL_ERROR: - return 'Internal error'; - case \PREG_BAD_UTF8_ERROR: - return 'Malformed UTF-8 characters, possibly incorrectly encoded'; - case \PREG_BAD_UTF8_OFFSET_ERROR: - return 'The offset did not correspond to the beginning of a valid UTF-8 code point'; - case \PREG_BACKTRACK_LIMIT_ERROR: - return 'Backtrack limit exhausted'; - case \PREG_RECURSION_LIMIT_ERROR: - return 'Recursion limit exhausted'; - case \PREG_JIT_STACKLIMIT_ERROR: - return 'JIT stack limit exhausted'; - case \PREG_NO_ERROR: - return 'No error'; - default: - return 'Unknown error'; - } - } - - public static function str_contains(string $haystack, string $needle): bool - { - return '' === $needle || false !== strpos($haystack, $needle); - } - - public static function str_starts_with(string $haystack, string $needle): bool - { - return 0 === strncmp($haystack, $needle, \strlen($needle)); - } - - public static function str_ends_with(string $haystack, string $needle): bool - { - if ('' === $needle || $needle === $haystack) { - return true; - } - - if ('' === $haystack) { - return false; - } - - $needleLength = \strlen($needle); - - return $needleLength <= \strlen($haystack) && 0 === substr_compare($haystack, $needle, -$needleLength); - } -} diff --git a/vendor/symfony/polyfill-php80/PhpToken.php b/vendor/symfony/polyfill-php80/PhpToken.php deleted file mode 100644 index fe6e691..0000000 --- a/vendor/symfony/polyfill-php80/PhpToken.php +++ /dev/null @@ -1,103 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Polyfill\Php80; - -/** - * @author Fedonyuk Anton <info@ensostudio.ru> - * - * @internal - */ -class PhpToken implements \Stringable -{ - /** - * @var int - */ - public $id; - - /** - * @var string - */ - public $text; - - /** - * @var int - */ - public $line; - - /** - * @var int - */ - public $pos; - - public function __construct(int $id, string $text, int $line = -1, int $position = -1) - { - $this->id = $id; - $this->text = $text; - $this->line = $line; - $this->pos = $position; - } - - public function getTokenName(): ?string - { - if ('UNKNOWN' === $name = token_name($this->id)) { - $name = \strlen($this->text) > 1 || \ord($this->text) < 32 ? null : $this->text; - } - - return $name; - } - - /** - * @param int|string|array $kind - */ - public function is($kind): bool - { - foreach ((array) $kind as $value) { - if (\in_array($value, [$this->id, $this->text], true)) { - return true; - } - } - - return false; - } - - public function isIgnorable(): bool - { - return \in_array($this->id, [\T_WHITESPACE, \T_COMMENT, \T_DOC_COMMENT, \T_OPEN_TAG], true); - } - - public function __toString(): string - { - return (string) $this->text; - } - - /** - * @return static[] - */ - public static function tokenize(string $code, int $flags = 0): array - { - $line = 1; - $position = 0; - $tokens = token_get_all($code, $flags); - foreach ($tokens as $index => $token) { - if (\is_string($token)) { - $id = \ord($token); - $text = $token; - } else { - [$id, $text, $line] = $token; - } - $tokens[$index] = new static($id, $text, $line, $position); - $position += \strlen($text); - } - - return $tokens; - } -} diff --git a/vendor/symfony/polyfill-php80/README.md b/vendor/symfony/polyfill-php80/README.md deleted file mode 100644 index 3816c55..0000000 --- a/vendor/symfony/polyfill-php80/README.md +++ /dev/null @@ -1,25 +0,0 @@ -Symfony Polyfill / Php80 -======================== - -This component provides features added to PHP 8.0 core: - -- [`Stringable`](https://php.net/stringable) interface -- [`fdiv`](https://php.net/fdiv) -- [`ValueError`](https://php.net/valueerror) class -- [`UnhandledMatchError`](https://php.net/unhandledmatcherror) class -- `FILTER_VALIDATE_BOOL` constant -- [`get_debug_type`](https://php.net/get_debug_type) -- [`PhpToken`](https://php.net/phptoken) class -- [`preg_last_error_msg`](https://php.net/preg_last_error_msg) -- [`str_contains`](https://php.net/str_contains) -- [`str_starts_with`](https://php.net/str_starts_with) -- [`str_ends_with`](https://php.net/str_ends_with) -- [`get_resource_id`](https://php.net/get_resource_id) - -More information can be found in the -[main Polyfill README](https://github.com/symfony/polyfill/blob/main/README.md). - -License -======= - -This library is released under the [MIT license](LICENSE). diff --git a/vendor/symfony/polyfill-php80/Resources/stubs/Attribute.php b/vendor/symfony/polyfill-php80/Resources/stubs/Attribute.php deleted file mode 100644 index 2b95542..0000000 --- a/vendor/symfony/polyfill-php80/Resources/stubs/Attribute.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -#[Attribute(Attribute::TARGET_CLASS)] -final class Attribute -{ - public const TARGET_CLASS = 1; - public const TARGET_FUNCTION = 2; - public const TARGET_METHOD = 4; - public const TARGET_PROPERTY = 8; - public const TARGET_CLASS_CONSTANT = 16; - public const TARGET_PARAMETER = 32; - public const TARGET_ALL = 63; - public const IS_REPEATABLE = 64; - - /** @var int */ - public $flags; - - public function __construct(int $flags = self::TARGET_ALL) - { - $this->flags = $flags; - } -} diff --git a/vendor/symfony/polyfill-php80/Resources/stubs/PhpToken.php b/vendor/symfony/polyfill-php80/Resources/stubs/PhpToken.php deleted file mode 100644 index bd1212f..0000000 --- a/vendor/symfony/polyfill-php80/Resources/stubs/PhpToken.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -if (\PHP_VERSION_ID < 80000 && extension_loaded('tokenizer')) { - class PhpToken extends Symfony\Polyfill\Php80\PhpToken - { - } -} diff --git a/vendor/symfony/polyfill-php80/Resources/stubs/Stringable.php b/vendor/symfony/polyfill-php80/Resources/stubs/Stringable.php deleted file mode 100644 index 7c62d75..0000000 --- a/vendor/symfony/polyfill-php80/Resources/stubs/Stringable.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -if (\PHP_VERSION_ID < 80000) { - interface Stringable - { - /** - * @return string - */ - public function __toString(); - } -} diff --git a/vendor/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php b/vendor/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php deleted file mode 100644 index 01c6c6c..0000000 --- a/vendor/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -if (\PHP_VERSION_ID < 80000) { - class UnhandledMatchError extends Error - { - } -} diff --git a/vendor/symfony/polyfill-php80/Resources/stubs/ValueError.php b/vendor/symfony/polyfill-php80/Resources/stubs/ValueError.php deleted file mode 100644 index 783dbc2..0000000 --- a/vendor/symfony/polyfill-php80/Resources/stubs/ValueError.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -if (\PHP_VERSION_ID < 80000) { - class ValueError extends Error - { - } -} diff --git a/vendor/symfony/polyfill-php80/bootstrap.php b/vendor/symfony/polyfill-php80/bootstrap.php deleted file mode 100644 index e5f7dbc..0000000 --- a/vendor/symfony/polyfill-php80/bootstrap.php +++ /dev/null @@ -1,42 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -use Symfony\Polyfill\Php80 as p; - -if (\PHP_VERSION_ID >= 80000) { - return; -} - -if (!defined('FILTER_VALIDATE_BOOL') && defined('FILTER_VALIDATE_BOOLEAN')) { - define('FILTER_VALIDATE_BOOL', \FILTER_VALIDATE_BOOLEAN); -} - -if (!function_exists('fdiv')) { - function fdiv(float $num1, float $num2): float { return p\Php80::fdiv($num1, $num2); } -} -if (!function_exists('preg_last_error_msg')) { - function preg_last_error_msg(): string { return p\Php80::preg_last_error_msg(); } -} -if (!function_exists('str_contains')) { - function str_contains(?string $haystack, ?string $needle): bool { return p\Php80::str_contains($haystack ?? '', $needle ?? ''); } -} -if (!function_exists('str_starts_with')) { - function str_starts_with(?string $haystack, ?string $needle): bool { return p\Php80::str_starts_with($haystack ?? '', $needle ?? ''); } -} -if (!function_exists('str_ends_with')) { - function str_ends_with(?string $haystack, ?string $needle): bool { return p\Php80::str_ends_with($haystack ?? '', $needle ?? ''); } -} -if (!function_exists('get_debug_type')) { - function get_debug_type($value): string { return p\Php80::get_debug_type($value); } -} -if (!function_exists('get_resource_id')) { - function get_resource_id($resource): int { return p\Php80::get_resource_id($resource); } -} diff --git a/vendor/symfony/polyfill-php80/composer.json b/vendor/symfony/polyfill-php80/composer.json deleted file mode 100644 index a503b03..0000000 --- a/vendor/symfony/polyfill-php80/composer.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "symfony/polyfill-php80", - "type": "library", - "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", - "keywords": ["polyfill", "shim", "compatibility", "portable"], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Ion Bazan", - "email": "ion.bazan@gmail.com" - }, - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=7.2" - }, - "autoload": { - "psr-4": { "Symfony\\Polyfill\\Php80\\": "" }, - "files": [ "bootstrap.php" ], - "classmap": [ "Resources/stubs" ] - }, - "minimum-stability": "dev", - "extra": { - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - } -} diff --git a/vendor/symfony/yaml/CHANGELOG.md b/vendor/symfony/yaml/CHANGELOG.md deleted file mode 100644 index 05b23cd..0000000 --- a/vendor/symfony/yaml/CHANGELOG.md +++ /dev/null @@ -1,268 +0,0 @@ -CHANGELOG -========= - -7.2 ---- - - * Deprecate parsing duplicate mapping keys whose value is `null` - -7.1 ---- - - * Add support for getting all the enum cases with `!php/enum Foo` - -7.0 ---- - - * Remove the `!php/const:` tag, use `!php/const` instead (without the colon) - -6.3 ---- - - * Add support to dump int keys as strings by using the `Yaml::DUMP_NUMERIC_KEY_AS_STRING` flag - -6.2 ---- - - * Add support for `!php/enum` and `!php/enum *->value` - * Deprecate the `!php/const:` tag in key which will be replaced by the `!php/const` tag (without the colon) since 3.4 - -6.1 ---- - - * In cases where it will likely improve readability, strings containing single quotes will be double-quoted - -5.4 ---- - - * Add new `lint:yaml dirname --exclude=/dirname/foo.yaml --exclude=/dirname/bar.yaml` - option to exclude one or more specific files from multiple file list - * Allow negatable for the parse tags option with `--no-parse-tags` - -5.3 ---- - - * Added `github` format support & autodetection to render errors as annotations - when running the YAML linter command in a Github Action environment. - -5.1.0 ------ - - * Added support for parsing numbers prefixed with `0o` as octal numbers. - * Deprecated support for parsing numbers starting with `0` as octal numbers. They will be parsed as strings as of Symfony 6.0. Prefix numbers with `0o` - so that they are parsed as octal numbers. - - Before: - - ```yaml - Yaml::parse('072'); - ``` - - After: - - ```yaml - Yaml::parse('0o72'); - ``` - - * Added `yaml-lint` binary. - * Deprecated using the `!php/object` and `!php/const` tags without a value. - -5.0.0 ------ - - * Removed support for mappings inside multi-line strings. - * removed support for implicit STDIN usage in the `lint:yaml` command, use `lint:yaml -` (append a dash) instead to make it explicit. - -4.4.0 ------ - - * Added support for parsing the inline notation spanning multiple lines. - * Added support to dump `null` as `~` by using the `Yaml::DUMP_NULL_AS_TILDE` flag. - * deprecated accepting STDIN implicitly when using the `lint:yaml` command, use `lint:yaml -` (append a dash) instead to make it explicit. - -4.3.0 ------ - - * Using a mapping inside a multi-line string is deprecated and will throw a `ParseException` in 5.0. - -4.2.0 ------ - - * added support for multiple files or directories in `LintCommand` - -4.0.0 ------ - - * The behavior of the non-specific tag `!` is changed and now forces - non-evaluating your values. - * complex mappings will throw a `ParseException` - * support for the comma as a group separator for floats has been dropped, use - the underscore instead - * support for the `!!php/object` tag has been dropped, use the `!php/object` - tag instead - * duplicate mapping keys throw a `ParseException` - * non-string mapping keys throw a `ParseException`, use the `Yaml::PARSE_KEYS_AS_STRINGS` - flag to cast them to strings - * `%` at the beginning of an unquoted string throw a `ParseException` - * mappings with a colon (`:`) that is not followed by a whitespace throw a - `ParseException` - * the `Dumper::setIndentation()` method has been removed - * being able to pass boolean options to the `Yaml::parse()`, `Yaml::dump()`, - `Parser::parse()`, and `Dumper::dump()` methods to configure the behavior of - the parser and dumper is no longer supported, pass bitmask flags instead - * the constructor arguments of the `Parser` class have been removed - * the `Inline` class is internal and no longer part of the BC promise - * removed support for the `!str` tag, use the `!!str` tag instead - * added support for tagged scalars. - - ```yml - Yaml::parse('!foo bar', Yaml::PARSE_CUSTOM_TAGS); - // returns TaggedValue('foo', 'bar'); - ``` - -3.4.0 ------ - - * added support for parsing YAML files using the `Yaml::parseFile()` or `Parser::parseFile()` method - - * the `Dumper`, `Parser`, and `Yaml` classes are marked as final - - * Deprecated the `!php/object:` tag which will be replaced by the - `!php/object` tag (without the colon) in 4.0. - - * Deprecated the `!php/const:` tag which will be replaced by the - `!php/const` tag (without the colon) in 4.0. - - * Support for the `!str` tag is deprecated, use the `!!str` tag instead. - - * Deprecated using the non-specific tag `!` as its behavior will change in 4.0. - It will force non-evaluating your values in 4.0. Use plain integers or `!!float` instead. - -3.3.0 ------ - - * Starting an unquoted string with a question mark followed by a space is - deprecated and will throw a `ParseException` in Symfony 4.0. - - * Deprecated support for implicitly parsing non-string mapping keys as strings. - Mapping keys that are no strings will lead to a `ParseException` in Symfony - 4.0. Use quotes to opt-in for keys to be parsed as strings. - - Before: - - ```php - $yaml = <<<YAML - null: null key - true: boolean true - 2.0: float key - YAML; - - Yaml::parse($yaml); - ``` - - After: - - ```php - - $yaml = <<<YAML - "null": null key - "true": boolean true - "2.0": float key - YAML; - - Yaml::parse($yaml); - ``` - - * Omitted mapping values will be parsed as `null`. - - * Omitting the key of a mapping is deprecated and will throw a `ParseException` in Symfony 4.0. - - * Added support for dumping empty PHP arrays as YAML sequences: - - ```php - Yaml::dump([], 0, 0, Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE); - ``` - -3.2.0 ------ - - * Mappings with a colon (`:`) that is not followed by a whitespace are deprecated - when the mapping key is not quoted and will lead to a `ParseException` in - Symfony 4.0 (e.g. `foo:bar` must be `foo: bar`). - - * Added support for parsing PHP constants: - - ```php - Yaml::parse('!php/const:PHP_INT_MAX', Yaml::PARSE_CONSTANT); - ``` - - * Support for silently ignoring duplicate mapping keys in YAML has been - deprecated and will lead to a `ParseException` in Symfony 4.0. - -3.1.0 ------ - - * Added support to dump `stdClass` and `ArrayAccess` objects as YAML mappings - through the `Yaml::DUMP_OBJECT_AS_MAP` flag. - - * Strings that are not UTF-8 encoded will be dumped as base64 encoded binary - data. - - * Added support for dumping multi line strings as literal blocks. - - * Added support for parsing base64 encoded binary data when they are tagged - with the `!!binary` tag. - - * Added support for parsing timestamps as `\DateTime` objects: - - ```php - Yaml::parse('2001-12-15 21:59:43.10 -5', Yaml::PARSE_DATETIME); - ``` - - * `\DateTime` and `\DateTimeImmutable` objects are dumped as YAML timestamps. - - * Deprecated usage of `%` at the beginning of an unquoted string. - - * Added support for customizing the YAML parser behavior through an optional bit field: - - ```php - Yaml::parse('{ "foo": "bar", "fiz": "cat" }', Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE | Yaml::PARSE_OBJECT | Yaml::PARSE_OBJECT_FOR_MAP); - ``` - - * Added support for customizing the dumped YAML string through an optional bit field: - - ```php - Yaml::dump(['foo' => new A(), 'bar' => 1], 0, 0, Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE | Yaml::DUMP_OBJECT); - ``` - -3.0.0 ------ - - * Yaml::parse() now throws an exception when a blackslash is not escaped - in double-quoted strings - -2.8.0 ------ - - * Deprecated usage of a colon in an unquoted mapping value - * Deprecated usage of @, \`, | and > at the beginning of an unquoted string - * When surrounding strings with double-quotes, you must now escape `\` characters. Not - escaping those characters (when surrounded by double-quotes) is deprecated. - - Before: - - ```yml - class: "Foo\Var" - ``` - - After: - - ```yml - class: "Foo\\Var" - ``` - -2.1.0 ------ - - * Yaml::parse() does not evaluate loaded files as PHP files by default - anymore (call Yaml::enablePhpParsing() to get back the old behavior) diff --git a/vendor/symfony/yaml/Command/LintCommand.php b/vendor/symfony/yaml/Command/LintCommand.php deleted file mode 100644 index 0fab77c..0000000 --- a/vendor/symfony/yaml/Command/LintCommand.php +++ /dev/null @@ -1,277 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Yaml\Command; - -use Symfony\Component\Console\Attribute\AsCommand; -use Symfony\Component\Console\CI\GithubActionReporter; -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Completion\CompletionInput; -use Symfony\Component\Console\Completion\CompletionSuggestions; -use Symfony\Component\Console\Exception\InvalidArgumentException; -use Symfony\Component\Console\Exception\RuntimeException; -use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Style\SymfonyStyle; -use Symfony\Component\Yaml\Exception\ParseException; -use Symfony\Component\Yaml\Parser; -use Symfony\Component\Yaml\Yaml; - -/** - * Validates YAML files syntax and outputs encountered errors. - * - * @author Grégoire Pineau <lyrixx@lyrixx.info> - * @author Robin Chalas <robin.chalas@gmail.com> - */ -#[AsCommand(name: 'lint:yaml', description: 'Lint a YAML file and outputs encountered errors')] -class LintCommand extends Command -{ - private Parser $parser; - private ?string $format = null; - private bool $displayCorrectFiles; - private ?\Closure $directoryIteratorProvider; - private ?\Closure $isReadableProvider; - - public function __construct(?string $name = null, ?callable $directoryIteratorProvider = null, ?callable $isReadableProvider = null) - { - parent::__construct($name); - - $this->directoryIteratorProvider = null === $directoryIteratorProvider ? null : $directoryIteratorProvider(...); - $this->isReadableProvider = null === $isReadableProvider ? null : $isReadableProvider(...); - } - - protected function configure(): void - { - $this - ->addArgument('filename', InputArgument::IS_ARRAY, 'A file, a directory or "-" for reading from STDIN') - ->addOption('format', null, InputOption::VALUE_REQUIRED, \sprintf('The output format ("%s")', implode('", "', $this->getAvailableFormatOptions()))) - ->addOption('exclude', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Path(s) to exclude') - ->addOption('parse-tags', null, InputOption::VALUE_NEGATABLE, 'Parse custom tags', null) - ->setHelp(<<<EOF -The <info>%command.name%</info> command lints a YAML file and outputs to STDOUT -the first encountered syntax error. - -You can validates YAML contents passed from STDIN: - - <info>cat filename | php %command.full_name% -</info> - -You can also validate the syntax of a file: - - <info>php %command.full_name% filename</info> - -Or of a whole directory: - - <info>php %command.full_name% dirname</info> - -The <info>--format</info> option specifies the format of the command output: - - <info>php %command.full_name% dirname --format=json</info> - -You can also exclude one or more specific files: - - <info>php %command.full_name% dirname --exclude="dirname/foo.yaml" --exclude="dirname/bar.yaml"</info> - -EOF - ) - ; - } - - protected function execute(InputInterface $input, OutputInterface $output): int - { - $io = new SymfonyStyle($input, $output); - $filenames = (array) $input->getArgument('filename'); - $excludes = $input->getOption('exclude'); - $this->format = $input->getOption('format'); - $flags = $input->getOption('parse-tags'); - - if (null === $this->format) { - // Autodetect format according to CI environment - $this->format = class_exists(GithubActionReporter::class) && GithubActionReporter::isGithubActionEnvironment() ? 'github' : 'txt'; - } - - $flags = $flags ? Yaml::PARSE_CUSTOM_TAGS : 0; - - $this->displayCorrectFiles = $output->isVerbose(); - - if (['-'] === $filenames) { - return $this->display($io, [$this->validate(file_get_contents('php://stdin'), $flags)]); - } - - if (!$filenames) { - throw new RuntimeException('Please provide a filename or pipe file content to STDIN.'); - } - - $filesInfo = []; - foreach ($filenames as $filename) { - if (!$this->isReadable($filename)) { - throw new RuntimeException(\sprintf('File or directory "%s" is not readable.', $filename)); - } - - foreach ($this->getFiles($filename) as $file) { - if (!\in_array($file->getPathname(), $excludes, true)) { - $filesInfo[] = $this->validate(file_get_contents($file), $flags, $file); - } - } - } - - return $this->display($io, $filesInfo); - } - - private function validate(string $content, int $flags, ?string $file = null): array - { - $prevErrorHandler = set_error_handler(function ($level, $message, $file, $line) use (&$prevErrorHandler) { - if (\E_USER_DEPRECATED === $level) { - throw new ParseException($message, $this->getParser()->getRealCurrentLineNb() + 1); - } - - return $prevErrorHandler ? $prevErrorHandler($level, $message, $file, $line) : false; - }); - - try { - $this->getParser()->parse($content, Yaml::PARSE_CONSTANT | $flags); - } catch (ParseException $e) { - return ['file' => $file, 'line' => $e->getParsedLine(), 'valid' => false, 'message' => $e->getMessage()]; - } finally { - restore_error_handler(); - } - - return ['file' => $file, 'valid' => true]; - } - - private function display(SymfonyStyle $io, array $files): int - { - return match ($this->format) { - 'txt' => $this->displayTxt($io, $files), - 'json' => $this->displayJson($io, $files), - 'github' => $this->displayTxt($io, $files, true), - default => throw new InvalidArgumentException(\sprintf('Supported formats are "%s".', implode('", "', $this->getAvailableFormatOptions()))), - }; - } - - private function displayTxt(SymfonyStyle $io, array $filesInfo, bool $errorAsGithubAnnotations = false): int - { - $countFiles = \count($filesInfo); - $erroredFiles = 0; - $suggestTagOption = false; - - if ($errorAsGithubAnnotations) { - $githubReporter = new GithubActionReporter($io); - } - - foreach ($filesInfo as $info) { - if ($info['valid'] && $this->displayCorrectFiles) { - $io->comment('<info>OK</info>'.($info['file'] ? \sprintf(' in %s', $info['file']) : '')); - } elseif (!$info['valid']) { - ++$erroredFiles; - $io->text('<error> ERROR </error>'.($info['file'] ? \sprintf(' in %s', $info['file']) : '')); - $io->text(\sprintf('<error> >> %s</error>', $info['message'])); - - if (str_contains($info['message'], 'PARSE_CUSTOM_TAGS')) { - $suggestTagOption = true; - } - - if ($errorAsGithubAnnotations) { - $githubReporter->error($info['message'], $info['file'] ?? 'php://stdin', $info['line']); - } - } - } - - if (0 === $erroredFiles) { - $io->success(\sprintf('All %d YAML files contain valid syntax.', $countFiles)); - } else { - $io->warning(\sprintf('%d YAML files have valid syntax and %d contain errors.%s', $countFiles - $erroredFiles, $erroredFiles, $suggestTagOption ? ' Use the --parse-tags option if you want parse custom tags.' : '')); - } - - return min($erroredFiles, 1); - } - - private function displayJson(SymfonyStyle $io, array $filesInfo): int - { - $errors = 0; - - array_walk($filesInfo, function (&$v) use (&$errors) { - $v['file'] = (string) $v['file']; - if (!$v['valid']) { - ++$errors; - } - - if (isset($v['message']) && str_contains($v['message'], 'PARSE_CUSTOM_TAGS')) { - $v['message'] .= ' Use the --parse-tags option if you want parse custom tags.'; - } - }); - - $io->writeln(json_encode($filesInfo, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES)); - - return min($errors, 1); - } - - private function getFiles(string $fileOrDirectory): iterable - { - if (is_file($fileOrDirectory)) { - yield new \SplFileInfo($fileOrDirectory); - - return; - } - - foreach ($this->getDirectoryIterator($fileOrDirectory) as $file) { - if (!\in_array($file->getExtension(), ['yml', 'yaml'])) { - continue; - } - - yield $file; - } - } - - private function getParser(): Parser - { - return $this->parser ??= new Parser(); - } - - private function getDirectoryIterator(string $directory): iterable - { - $default = fn ($directory) => new \RecursiveIteratorIterator( - new \RecursiveDirectoryIterator($directory, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS), - \RecursiveIteratorIterator::LEAVES_ONLY - ); - - if (null !== $this->directoryIteratorProvider) { - return ($this->directoryIteratorProvider)($directory, $default); - } - - return $default($directory); - } - - private function isReadable(string $fileOrDirectory): bool - { - $default = is_readable(...); - - if (null !== $this->isReadableProvider) { - return ($this->isReadableProvider)($fileOrDirectory, $default); - } - - return $default($fileOrDirectory); - } - - public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void - { - if ($input->mustSuggestOptionValuesFor('format')) { - $suggestions->suggestValues($this->getAvailableFormatOptions()); - } - } - - /** @return string[] */ - private function getAvailableFormatOptions(): array - { - return ['txt', 'json', 'github']; - } -} diff --git a/vendor/symfony/yaml/Dumper.php b/vendor/symfony/yaml/Dumper.php deleted file mode 100644 index f8ea205..0000000 --- a/vendor/symfony/yaml/Dumper.php +++ /dev/null @@ -1,174 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Yaml; - -use Symfony\Component\Yaml\Tag\TaggedValue; - -/** - * Dumper dumps PHP variables to YAML strings. - * - * @author Fabien Potencier <fabien@symfony.com> - * - * @final - */ -class Dumper -{ - /** - * @param int $indentation The amount of spaces to use for indentation of nested nodes - */ - public function __construct(private int $indentation = 4) - { - if ($indentation < 1) { - throw new \InvalidArgumentException('The indentation must be greater than zero.'); - } - } - - /** - * Dumps a PHP value to YAML. - * - * @param mixed $input The PHP value - * @param int $inline The level where you switch to inline YAML - * @param int $indent The level of indentation (used internally) - * @param int-mask-of<Yaml::DUMP_*> $flags A bit field of Yaml::DUMP_* constants to customize the dumped YAML string - */ - public function dump(mixed $input, int $inline = 0, int $indent = 0, int $flags = 0): string - { - $output = ''; - $prefix = $indent ? str_repeat(' ', $indent) : ''; - $dumpObjectAsInlineMap = true; - - if (Yaml::DUMP_OBJECT_AS_MAP & $flags && ($input instanceof \ArrayObject || $input instanceof \stdClass)) { - $dumpObjectAsInlineMap = !(array) $input; - } - - if ($inline <= 0 || (!\is_array($input) && !$input instanceof TaggedValue && $dumpObjectAsInlineMap) || !$input) { - $output .= $prefix.Inline::dump($input, $flags); - } elseif ($input instanceof TaggedValue) { - $output .= $this->dumpTaggedValue($input, $inline, $indent, $flags, $prefix); - } else { - $dumpAsMap = Inline::isHash($input); - - foreach ($input as $key => $value) { - if ('' !== $output && "\n" !== $output[-1]) { - $output .= "\n"; - } - - if (\is_int($key) && Yaml::DUMP_NUMERIC_KEY_AS_STRING & $flags) { - $key = (string) $key; - } - - if (Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value) && str_contains($value, "\n") && !str_contains($value, "\r")) { - $blockIndentationIndicator = $this->getBlockIndentationIndicator($value); - - if (isset($value[-2]) && "\n" === $value[-2] && "\n" === $value[-1]) { - $blockChompingIndicator = '+'; - } elseif ("\n" === $value[-1]) { - $blockChompingIndicator = ''; - } else { - $blockChompingIndicator = '-'; - } - - $output .= \sprintf('%s%s%s |%s%s', $prefix, $dumpAsMap ? Inline::dump($key, $flags).':' : '-', '', $blockIndentationIndicator, $blockChompingIndicator); - - foreach (explode("\n", $value) as $row) { - if ('' === $row) { - $output .= "\n"; - } else { - $output .= \sprintf("\n%s%s%s", $prefix, str_repeat(' ', $this->indentation), $row); - } - } - - continue; - } - - if ($value instanceof TaggedValue) { - $output .= \sprintf('%s%s !%s', $prefix, $dumpAsMap ? Inline::dump($key, $flags).':' : '-', $value->getTag()); - - if (Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value->getValue()) && str_contains($value->getValue(), "\n") && !str_contains($value->getValue(), "\r\n")) { - $blockIndentationIndicator = $this->getBlockIndentationIndicator($value->getValue()); - $output .= \sprintf(' |%s', $blockIndentationIndicator); - - foreach (explode("\n", $value->getValue()) as $row) { - $output .= \sprintf("\n%s%s%s", $prefix, str_repeat(' ', $this->indentation), $row); - } - - continue; - } - - if ($inline - 1 <= 0 || null === $value->getValue() || \is_scalar($value->getValue())) { - $output .= ' '.$this->dump($value->getValue(), $inline - 1, 0, $flags)."\n"; - } else { - $output .= "\n"; - $output .= $this->dump($value->getValue(), $inline - 1, $dumpAsMap ? $indent + $this->indentation : $indent + 2, $flags); - } - - continue; - } - - $dumpObjectAsInlineMap = true; - - if (Yaml::DUMP_OBJECT_AS_MAP & $flags && ($value instanceof \ArrayObject || $value instanceof \stdClass)) { - $dumpObjectAsInlineMap = !(array) $value; - } - - $willBeInlined = $inline - 1 <= 0 || !\is_array($value) && $dumpObjectAsInlineMap || !$value; - - $output .= \sprintf('%s%s%s%s', - $prefix, - $dumpAsMap ? Inline::dump($key, $flags).':' : '-', - $willBeInlined ? ' ' : "\n", - $this->dump($value, $inline - 1, $willBeInlined ? 0 : $indent + $this->indentation, $flags) - ).($willBeInlined ? "\n" : ''); - } - } - - return $output; - } - - private function dumpTaggedValue(TaggedValue $value, int $inline, int $indent, int $flags, string $prefix): string - { - $output = \sprintf('%s!%s', $prefix ? $prefix.' ' : '', $value->getTag()); - - if (Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value->getValue()) && str_contains($value->getValue(), "\n") && !str_contains($value->getValue(), "\r\n")) { - $blockIndentationIndicator = $this->getBlockIndentationIndicator($value->getValue()); - $output .= \sprintf(' |%s', $blockIndentationIndicator); - - foreach (explode("\n", $value->getValue()) as $row) { - $output .= \sprintf("\n%s%s%s", $prefix, str_repeat(' ', $this->indentation), $row); - } - - return $output; - } - - if ($inline - 1 <= 0 || null === $value->getValue() || \is_scalar($value->getValue())) { - return $output.' '.$this->dump($value->getValue(), $inline - 1, 0, $flags)."\n"; - } - - return $output."\n".$this->dump($value->getValue(), $inline - 1, $indent, $flags); - } - - private function getBlockIndentationIndicator(string $value): string - { - $lines = explode("\n", $value); - - // If the first line (that is neither empty nor contains only spaces) - // starts with a space character, the spec requires a block indentation indicator - // http://www.yaml.org/spec/1.2/spec.html#id2793979 - foreach ($lines as $line) { - if ('' !== trim($line, ' ')) { - return str_starts_with($line, ' ') ? (string) $this->indentation : ''; - } - } - - return ''; - } -} diff --git a/vendor/symfony/yaml/Escaper.php b/vendor/symfony/yaml/Escaper.php deleted file mode 100644 index e42034a..0000000 --- a/vendor/symfony/yaml/Escaper.php +++ /dev/null @@ -1,95 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Yaml; - -/** - * Escaper encapsulates escaping rules for single and double-quoted - * YAML strings. - * - * @author Matthew Lewinski <matthew@lewinski.org> - * - * @internal - */ -class Escaper -{ - // Characters that would cause a dumped string to require double quoting. - public const REGEX_CHARACTER_TO_ESCAPE = "[\\x00-\\x1f]|\x7f|\xc2\x85|\xc2\xa0|\xe2\x80\xa8|\xe2\x80\xa9"; - - // Mapping arrays for escaping a double quoted string. The backslash is - // first to ensure proper escaping because str_replace operates iteratively - // on the input arrays. This ordering of the characters avoids the use of strtr, - // which performs more slowly. - private const ESCAPEES = ['\\', '\\\\', '\\"', '"', - "\x00", "\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", - "\x08", "\x09", "\x0a", "\x0b", "\x0c", "\x0d", "\x0e", "\x0f", - "\x10", "\x11", "\x12", "\x13", "\x14", "\x15", "\x16", "\x17", - "\x18", "\x19", "\x1a", "\x1b", "\x1c", "\x1d", "\x1e", "\x1f", - "\x7f", - "\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9", - ]; - private const ESCAPED = ['\\\\', '\\"', '\\\\', '\\"', - '\\0', '\\x01', '\\x02', '\\x03', '\\x04', '\\x05', '\\x06', '\\a', - '\\b', '\\t', '\\n', '\\v', '\\f', '\\r', '\\x0e', '\\x0f', - '\\x10', '\\x11', '\\x12', '\\x13', '\\x14', '\\x15', '\\x16', '\\x17', - '\\x18', '\\x19', '\\x1a', '\\e', '\\x1c', '\\x1d', '\\x1e', '\\x1f', - '\\x7f', - '\\N', '\\_', '\\L', '\\P', - ]; - - /** - * Determines if a PHP value would require double quoting in YAML. - * - * @param string $value A PHP value - */ - public static function requiresDoubleQuoting(string $value): bool - { - return 0 < preg_match('/'.self::REGEX_CHARACTER_TO_ESCAPE.'/u', $value); - } - - /** - * Escapes and surrounds a PHP value with double quotes. - * - * @param string $value A PHP value - */ - public static function escapeWithDoubleQuotes(string $value): string - { - return \sprintf('"%s"', str_replace(self::ESCAPEES, self::ESCAPED, $value)); - } - - /** - * Determines if a PHP value would require single quoting in YAML. - * - * @param string $value A PHP value - */ - public static function requiresSingleQuoting(string $value): bool - { - // Determines if a PHP value is entirely composed of a value that would - // require single quoting in YAML. - if (\in_array(strtolower($value), ['null', '~', 'true', 'false', 'y', 'n', 'yes', 'no', 'on', 'off'])) { - return true; - } - - // Determines if the PHP value contains any single characters that would - // cause it to require single quoting in YAML. - return 0 < preg_match('/[\s\'"\:\{\}\[\],&\*\#\?] | \A[\-?|<>=!%@`\p{Zs}]/xu', $value); - } - - /** - * Escapes and surrounds a PHP value with single quotes. - * - * @param string $value A PHP value - */ - public static function escapeWithSingleQuotes(string $value): string - { - return \sprintf("'%s'", str_replace('\'', '\'\'', $value)); - } -} diff --git a/vendor/symfony/yaml/Exception/DumpException.php b/vendor/symfony/yaml/Exception/DumpException.php deleted file mode 100644 index cce972f..0000000 --- a/vendor/symfony/yaml/Exception/DumpException.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Yaml\Exception; - -/** - * Exception class thrown when an error occurs during dumping. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class DumpException extends RuntimeException -{ -} diff --git a/vendor/symfony/yaml/Exception/ExceptionInterface.php b/vendor/symfony/yaml/Exception/ExceptionInterface.php deleted file mode 100644 index 9091316..0000000 --- a/vendor/symfony/yaml/Exception/ExceptionInterface.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Yaml\Exception; - -/** - * Exception interface for all exceptions thrown by the component. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -interface ExceptionInterface extends \Throwable -{ -} diff --git a/vendor/symfony/yaml/Exception/ParseException.php b/vendor/symfony/yaml/Exception/ParseException.php deleted file mode 100644 index 3b96169..0000000 --- a/vendor/symfony/yaml/Exception/ParseException.php +++ /dev/null @@ -1,121 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Yaml\Exception; - -/** - * Exception class thrown when an error occurs during parsing. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class ParseException extends RuntimeException -{ - /** - * @param string $rawMessage The error message - * @param int $parsedLine The line where the error occurred - * @param string|null $snippet The snippet of code near the problem - * @param string|null $parsedFile The file name where the error occurred - */ - public function __construct( - private string $rawMessage, - private int $parsedLine = -1, - private ?string $snippet = null, - private ?string $parsedFile = null, - ?\Throwable $previous = null, - ) { - $this->updateRepr(); - - parent::__construct($this->message, 0, $previous); - } - - /** - * Gets the snippet of code near the error. - */ - public function getSnippet(): string - { - return $this->snippet; - } - - /** - * Sets the snippet of code near the error. - */ - public function setSnippet(string $snippet): void - { - $this->snippet = $snippet; - - $this->updateRepr(); - } - - /** - * Gets the filename where the error occurred. - * - * This method returns null if a string is parsed. - */ - public function getParsedFile(): string - { - return $this->parsedFile; - } - - /** - * Sets the filename where the error occurred. - */ - public function setParsedFile(string $parsedFile): void - { - $this->parsedFile = $parsedFile; - - $this->updateRepr(); - } - - /** - * Gets the line where the error occurred. - */ - public function getParsedLine(): int - { - return $this->parsedLine; - } - - /** - * Sets the line where the error occurred. - */ - public function setParsedLine(int $parsedLine): void - { - $this->parsedLine = $parsedLine; - - $this->updateRepr(); - } - - private function updateRepr(): void - { - $this->message = $this->rawMessage; - - $dot = false; - if (str_ends_with($this->message, '.')) { - $this->message = substr($this->message, 0, -1); - $dot = true; - } - - if (null !== $this->parsedFile) { - $this->message .= \sprintf(' in %s', json_encode($this->parsedFile, \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE)); - } - - if ($this->parsedLine >= 0) { - $this->message .= \sprintf(' at line %d', $this->parsedLine); - } - - if ($this->snippet) { - $this->message .= \sprintf(' (near "%s")', $this->snippet); - } - - if ($dot) { - $this->message .= '.'; - } - } -} diff --git a/vendor/symfony/yaml/Exception/RuntimeException.php b/vendor/symfony/yaml/Exception/RuntimeException.php deleted file mode 100644 index 3f36b73..0000000 --- a/vendor/symfony/yaml/Exception/RuntimeException.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Yaml\Exception; - -/** - * Exception class thrown when an error occurs during parsing. - * - * @author Romain Neutron <imprec@gmail.com> - */ -class RuntimeException extends \RuntimeException implements ExceptionInterface -{ -} diff --git a/vendor/symfony/yaml/Inline.php b/vendor/symfony/yaml/Inline.php deleted file mode 100644 index 34ef66e..0000000 --- a/vendor/symfony/yaml/Inline.php +++ /dev/null @@ -1,848 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Yaml; - -use Symfony\Component\Yaml\Exception\DumpException; -use Symfony\Component\Yaml\Exception\ParseException; -use Symfony\Component\Yaml\Tag\TaggedValue; - -/** - * Inline implements a YAML parser/dumper for the YAML inline syntax. - * - * @author Fabien Potencier <fabien@symfony.com> - * - * @internal - */ -class Inline -{ - public const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*+(?:\\\\.[^"\\\\]*+)*+)"|\'([^\']*+(?:\'\'[^\']*+)*+)\')'; - - public static int $parsedLineNumber = -1; - public static ?string $parsedFilename = null; - - private static bool $exceptionOnInvalidType = false; - private static bool $objectSupport = false; - private static bool $objectForMap = false; - private static bool $constantSupport = false; - - public static function initialize(int $flags, ?int $parsedLineNumber = null, ?string $parsedFilename = null): void - { - self::$exceptionOnInvalidType = (bool) (Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE & $flags); - self::$objectSupport = (bool) (Yaml::PARSE_OBJECT & $flags); - self::$objectForMap = (bool) (Yaml::PARSE_OBJECT_FOR_MAP & $flags); - self::$constantSupport = (bool) (Yaml::PARSE_CONSTANT & $flags); - self::$parsedFilename = $parsedFilename; - - if (null !== $parsedLineNumber) { - self::$parsedLineNumber = $parsedLineNumber; - } - } - - /** - * Converts a YAML string to a PHP value. - * - * @param int $flags A bit field of Yaml::PARSE_* constants to customize the YAML parser behavior - * @param array $references Mapping of variable names to values - * - * @throws ParseException - */ - public static function parse(string $value, int $flags = 0, array &$references = []): mixed - { - self::initialize($flags); - - $value = trim($value); - - if ('' === $value) { - return ''; - } - - $i = 0; - $tag = self::parseTag($value, $i, $flags); - switch ($value[$i]) { - case '[': - $result = self::parseSequence($value, $flags, $i, $references); - ++$i; - break; - case '{': - $result = self::parseMapping($value, $flags, $i, $references); - ++$i; - break; - default: - $result = self::parseScalar($value, $flags, null, $i, true, $references); - } - - // some comments are allowed at the end - if (preg_replace('/\s*#.*$/A', '', substr($value, $i))) { - throw new ParseException(\sprintf('Unexpected characters near "%s".', substr($value, $i)), self::$parsedLineNumber + 1, $value, self::$parsedFilename); - } - - if (null !== $tag && '' !== $tag) { - return new TaggedValue($tag, $result); - } - - return $result; - } - - /** - * Dumps a given PHP variable to a YAML string. - * - * @param mixed $value The PHP variable to convert - * @param int $flags A bit field of Yaml::DUMP_* constants to customize the dumped YAML string - * - * @throws DumpException When trying to dump PHP resource - */ - public static function dump(mixed $value, int $flags = 0): string - { - switch (true) { - case \is_resource($value): - if (Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE & $flags) { - throw new DumpException(\sprintf('Unable to dump PHP resources in a YAML file ("%s").', get_resource_type($value))); - } - - return self::dumpNull($flags); - case $value instanceof \DateTimeInterface: - return $value->format(match (true) { - !$length = \strlen(rtrim($value->format('u'), '0')) => 'c', - $length < 4 => 'Y-m-d\TH:i:s.vP', - default => 'Y-m-d\TH:i:s.uP', - }); - case $value instanceof \UnitEnum: - return \sprintf('!php/enum %s::%s', $value::class, $value->name); - case \is_object($value): - if ($value instanceof TaggedValue) { - return '!'.$value->getTag().' '.self::dump($value->getValue(), $flags); - } - - if (Yaml::DUMP_OBJECT & $flags) { - return '!php/object '.self::dump(serialize($value)); - } - - if (Yaml::DUMP_OBJECT_AS_MAP & $flags && ($value instanceof \stdClass || $value instanceof \ArrayObject)) { - return self::dumpHashArray($value, $flags); - } - - if (Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE & $flags) { - throw new DumpException('Object support when dumping a YAML file has been disabled.'); - } - - return self::dumpNull($flags); - case \is_array($value): - return self::dumpArray($value, $flags); - case null === $value: - return self::dumpNull($flags); - case true === $value: - return 'true'; - case false === $value: - return 'false'; - case \is_int($value): - return $value; - case is_numeric($value) && false === strpbrk($value, "\f\n\r\t\v"): - $locale = setlocale(\LC_NUMERIC, 0); - if (false !== $locale) { - setlocale(\LC_NUMERIC, 'C'); - } - if (\is_float($value)) { - $repr = (string) $value; - if (is_infinite($value)) { - $repr = str_ireplace('INF', '.Inf', $repr); - } elseif (floor($value) == $value && $repr == $value) { - // Preserve float data type since storing a whole number will result in integer value. - if (!str_contains($repr, 'E')) { - $repr .= '.0'; - } - } - } else { - $repr = \is_string($value) ? "'$value'" : (string) $value; - } - if (false !== $locale) { - setlocale(\LC_NUMERIC, $locale); - } - - return $repr; - case '' == $value: - return "''"; - case self::isBinaryString($value): - return '!!binary '.base64_encode($value); - case Escaper::requiresDoubleQuoting($value): - return Escaper::escapeWithDoubleQuotes($value); - case Escaper::requiresSingleQuoting($value): - $singleQuoted = Escaper::escapeWithSingleQuotes($value); - if (!str_contains($value, "'")) { - return $singleQuoted; - } - // Attempt double-quoting the string instead to see if it's more efficient. - $doubleQuoted = Escaper::escapeWithDoubleQuotes($value); - - return \strlen($doubleQuoted) < \strlen($singleQuoted) ? $doubleQuoted : $singleQuoted; - case Parser::preg_match('{^[0-9]+[_0-9]*$}', $value): - case Parser::preg_match(self::getHexRegex(), $value): - case Parser::preg_match(self::getTimestampRegex(), $value): - return Escaper::escapeWithSingleQuotes($value); - default: - return $value; - } - } - - /** - * Check if given array is hash or just normal indexed array. - */ - public static function isHash(array|\ArrayObject|\stdClass $value): bool - { - if ($value instanceof \stdClass || $value instanceof \ArrayObject) { - return true; - } - - $expectedKey = 0; - - foreach ($value as $key => $val) { - if ($key !== $expectedKey++) { - return true; - } - } - - return false; - } - - /** - * Dumps a PHP array to a YAML string. - * - * @param array $value The PHP array to dump - * @param int $flags A bit field of Yaml::DUMP_* constants to customize the dumped YAML string - */ - private static function dumpArray(array $value, int $flags): string - { - // array - if (($value || Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE & $flags) && !self::isHash($value)) { - $output = []; - foreach ($value as $val) { - $output[] = self::dump($val, $flags); - } - - return \sprintf('[%s]', implode(', ', $output)); - } - - return self::dumpHashArray($value, $flags); - } - - /** - * Dumps hash array to a YAML string. - * - * @param array|\ArrayObject|\stdClass $value The hash array to dump - * @param int $flags A bit field of Yaml::DUMP_* constants to customize the dumped YAML string - */ - private static function dumpHashArray(array|\ArrayObject|\stdClass $value, int $flags): string - { - $output = []; - foreach ($value as $key => $val) { - if (\is_int($key) && Yaml::DUMP_NUMERIC_KEY_AS_STRING & $flags) { - $key = (string) $key; - } - - $output[] = \sprintf('%s: %s', self::dump($key, $flags), self::dump($val, $flags)); - } - - return \sprintf('{ %s }', implode(', ', $output)); - } - - private static function dumpNull(int $flags): string - { - if (Yaml::DUMP_NULL_AS_TILDE & $flags) { - return '~'; - } - - return 'null'; - } - - /** - * Parses a YAML scalar. - * - * @throws ParseException When malformed inline YAML string is parsed - */ - public static function parseScalar(string $scalar, int $flags = 0, ?array $delimiters = null, int &$i = 0, bool $evaluate = true, array &$references = [], ?bool &$isQuoted = null): mixed - { - if (\in_array($scalar[$i], ['"', "'"], true)) { - // quoted scalar - $isQuoted = true; - $output = self::parseQuotedScalar($scalar, $i); - - if (null !== $delimiters) { - $tmp = ltrim(substr($scalar, $i), " \n"); - if ('' === $tmp) { - throw new ParseException(\sprintf('Unexpected end of line, expected one of "%s".', implode('', $delimiters)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); - } - if (!\in_array($tmp[0], $delimiters)) { - throw new ParseException(\sprintf('Unexpected characters (%s).', substr($scalar, $i)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); - } - } - } else { - // "normal" string - $isQuoted = false; - - if (!$delimiters) { - $output = substr($scalar, $i); - $i += \strlen($output); - - // remove comments - if (Parser::preg_match('/[ \t]+#/', $output, $match, \PREG_OFFSET_CAPTURE)) { - $output = substr($output, 0, $match[0][1]); - } - } elseif (Parser::preg_match('/^(.*?)('.implode('|', $delimiters).')/', substr($scalar, $i), $match)) { - $output = $match[1]; - $i += \strlen($output); - $output = trim($output); - } else { - throw new ParseException(\sprintf('Malformed inline YAML string: "%s".', $scalar), self::$parsedLineNumber + 1, null, self::$parsedFilename); - } - - // a non-quoted string cannot start with @ or ` (reserved) nor with a scalar indicator (| or >) - if ($output && ('@' === $output[0] || '`' === $output[0] || '|' === $output[0] || '>' === $output[0] || '%' === $output[0])) { - throw new ParseException(\sprintf('The reserved indicator "%s" cannot start a plain scalar; you need to quote the scalar.', $output[0]), self::$parsedLineNumber + 1, $output, self::$parsedFilename); - } - - if ($evaluate) { - $output = self::evaluateScalar($output, $flags, $references, $isQuoted); - } - } - - return $output; - } - - /** - * Parses a YAML quoted scalar. - * - * @throws ParseException When malformed inline YAML string is parsed - */ - private static function parseQuotedScalar(string $scalar, int &$i = 0): string - { - if (!Parser::preg_match('/'.self::REGEX_QUOTED_STRING.'/Au', substr($scalar, $i), $match)) { - throw new ParseException(\sprintf('Malformed inline YAML string: "%s".', substr($scalar, $i)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); - } - - $output = substr($match[0], 1, -1); - - $unescaper = new Unescaper(); - if ('"' == $scalar[$i]) { - $output = $unescaper->unescapeDoubleQuotedString($output); - } else { - $output = $unescaper->unescapeSingleQuotedString($output); - } - - $i += \strlen($match[0]); - - return $output; - } - - /** - * Parses a YAML sequence. - * - * @throws ParseException When malformed inline YAML string is parsed - */ - private static function parseSequence(string $sequence, int $flags, int &$i = 0, array &$references = []): array - { - $output = []; - $len = \strlen($sequence); - ++$i; - - // [foo, bar, ...] - $lastToken = null; - while ($i < $len) { - if (']' === $sequence[$i]) { - return $output; - } - if (',' === $sequence[$i] || ' ' === $sequence[$i]) { - if (',' === $sequence[$i] && (null === $lastToken || 'separator' === $lastToken)) { - $output[] = null; - } elseif (',' === $sequence[$i]) { - $lastToken = 'separator'; - } - - ++$i; - - continue; - } - - $tag = self::parseTag($sequence, $i, $flags); - switch ($sequence[$i]) { - case '[': - // nested sequence - $value = self::parseSequence($sequence, $flags, $i, $references); - break; - case '{': - // nested mapping - $value = self::parseMapping($sequence, $flags, $i, $references); - break; - default: - $value = self::parseScalar($sequence, $flags, [',', ']'], $i, null === $tag, $references, $isQuoted); - - // the value can be an array if a reference has been resolved to an array var - if (\is_string($value) && !$isQuoted && str_contains($value, ': ')) { - // embedded mapping? - try { - $pos = 0; - $value = self::parseMapping('{'.$value.'}', $flags, $pos, $references); - } catch (\InvalidArgumentException) { - // no, it's not - } - } - - if (!$isQuoted && \is_string($value) && '' !== $value && '&' === $value[0] && Parser::preg_match(Parser::REFERENCE_PATTERN, $value, $matches)) { - $references[$matches['ref']] = $matches['value']; - $value = $matches['value']; - } - - --$i; - } - - if (null !== $tag && '' !== $tag) { - $value = new TaggedValue($tag, $value); - } - - $output[] = $value; - - $lastToken = 'value'; - ++$i; - } - - throw new ParseException(\sprintf('Malformed inline YAML string: "%s".', $sequence), self::$parsedLineNumber + 1, null, self::$parsedFilename); - } - - /** - * Parses a YAML mapping. - * - * @throws ParseException When malformed inline YAML string is parsed - */ - private static function parseMapping(string $mapping, int $flags, int &$i = 0, array &$references = []): array|\stdClass - { - $output = []; - $len = \strlen($mapping); - ++$i; - $allowOverwrite = false; - - // {foo: bar, bar:foo, ...} - while ($i < $len) { - switch ($mapping[$i]) { - case ' ': - case ',': - case "\n": - ++$i; - continue 2; - case '}': - if (self::$objectForMap) { - return (object) $output; - } - - return $output; - } - - // key - $offsetBeforeKeyParsing = $i; - $isKeyQuoted = \in_array($mapping[$i], ['"', "'"], true); - $key = self::parseScalar($mapping, $flags, [':', ' '], $i, false); - - if ($offsetBeforeKeyParsing === $i) { - throw new ParseException('Missing mapping key.', self::$parsedLineNumber + 1, $mapping); - } - - if ('!php/const' === $key || '!php/enum' === $key) { - $key .= ' '.self::parseScalar($mapping, $flags, [':'], $i, false); - $key = self::evaluateScalar($key, $flags); - } - - if (false === $i = strpos($mapping, ':', $i)) { - break; - } - - if (!$isKeyQuoted) { - $evaluatedKey = self::evaluateScalar($key, $flags, $references); - - if ('' !== $key && $evaluatedKey !== $key && !\is_string($evaluatedKey) && !\is_int($evaluatedKey)) { - throw new ParseException('Implicit casting of incompatible mapping keys to strings is not supported. Quote your evaluable mapping keys instead.', self::$parsedLineNumber + 1, $mapping); - } - } - - if (!$isKeyQuoted && (!isset($mapping[$i + 1]) || !\in_array($mapping[$i + 1], [' ', ',', '[', ']', '{', '}', "\n"], true))) { - throw new ParseException('Colons must be followed by a space or an indication character (i.e. " ", ",", "[", "]", "{", "}").', self::$parsedLineNumber + 1, $mapping); - } - - if ('<<' === $key) { - $allowOverwrite = true; - } - - while ($i < $len) { - if (':' === $mapping[$i] || ' ' === $mapping[$i] || "\n" === $mapping[$i]) { - ++$i; - - continue; - } - - $tag = self::parseTag($mapping, $i, $flags); - switch ($mapping[$i]) { - case '[': - // nested sequence - $value = self::parseSequence($mapping, $flags, $i, $references); - // Spec: Keys MUST be unique; first one wins. - // Parser cannot abort this mapping earlier, since lines - // are processed sequentially. - // But overwriting is allowed when a merge node is used in current block. - if ('<<' === $key) { - foreach ($value as $parsedValue) { - $output += $parsedValue; - } - } elseif ($allowOverwrite || !isset($output[$key])) { - if (null !== $tag) { - $output[$key] = new TaggedValue($tag, $value); - } else { - $output[$key] = $value; - } - } elseif (isset($output[$key])) { - throw new ParseException(\sprintf('Duplicate key "%s" detected.', $key), self::$parsedLineNumber + 1, $mapping); - } - break; - case '{': - // nested mapping - $value = self::parseMapping($mapping, $flags, $i, $references); - // Spec: Keys MUST be unique; first one wins. - // Parser cannot abort this mapping earlier, since lines - // are processed sequentially. - // But overwriting is allowed when a merge node is used in current block. - if ('<<' === $key) { - $output += $value; - } elseif ($allowOverwrite || !isset($output[$key])) { - if (null !== $tag) { - $output[$key] = new TaggedValue($tag, $value); - } else { - $output[$key] = $value; - } - } elseif (isset($output[$key])) { - throw new ParseException(\sprintf('Duplicate key "%s" detected.', $key), self::$parsedLineNumber + 1, $mapping); - } - break; - default: - $value = self::parseScalar($mapping, $flags, [',', '}', "\n"], $i, null === $tag, $references, $isValueQuoted); - // Spec: Keys MUST be unique; first one wins. - // Parser cannot abort this mapping earlier, since lines - // are processed sequentially. - // But overwriting is allowed when a merge node is used in current block. - if ('<<' === $key) { - $output += $value; - } elseif ($allowOverwrite || !isset($output[$key])) { - if (!$isValueQuoted && \is_string($value) && '' !== $value && '&' === $value[0] && !self::isBinaryString($value) && Parser::preg_match(Parser::REFERENCE_PATTERN, $value, $matches)) { - $references[$matches['ref']] = $matches['value']; - $value = $matches['value']; - } - - if (null !== $tag) { - $output[$key] = new TaggedValue($tag, $value); - } else { - $output[$key] = $value; - } - } elseif (isset($output[$key])) { - throw new ParseException(\sprintf('Duplicate key "%s" detected.', $key), self::$parsedLineNumber + 1, $mapping); - } - --$i; - } - ++$i; - - continue 2; - } - } - - throw new ParseException(\sprintf('Malformed inline YAML string: "%s".', $mapping), self::$parsedLineNumber + 1, null, self::$parsedFilename); - } - - /** - * Evaluates scalars and replaces magic values. - * - * @throws ParseException when object parsing support was disabled and the parser detected a PHP object or when a reference could not be resolved - */ - private static function evaluateScalar(string $scalar, int $flags, array &$references = [], ?bool &$isQuotedString = null): mixed - { - $isQuotedString = false; - $scalar = trim($scalar); - - if (str_starts_with($scalar, '*')) { - if (false !== $pos = strpos($scalar, '#')) { - $value = substr($scalar, 1, $pos - 2); - } else { - $value = substr($scalar, 1); - } - - // an unquoted * - if ('' === $value) { - throw new ParseException('A reference must contain at least one character.', self::$parsedLineNumber + 1, $value, self::$parsedFilename); - } - - if (!\array_key_exists($value, $references)) { - throw new ParseException(\sprintf('Reference "%s" does not exist.', $value), self::$parsedLineNumber + 1, $value, self::$parsedFilename); - } - - return $references[$value]; - } - - $scalarLower = strtolower($scalar); - - switch (true) { - case 'null' === $scalarLower: - case '' === $scalar: - case '~' === $scalar: - return null; - case 'true' === $scalarLower: - return true; - case 'false' === $scalarLower: - return false; - case '!' === $scalar[0]: - switch (true) { - case str_starts_with($scalar, '!!str '): - $s = substr($scalar, 6); - - if (\in_array($s[0] ?? '', ['"', "'"], true)) { - $isQuotedString = true; - $s = self::parseQuotedScalar($s); - } - - return $s; - case str_starts_with($scalar, '! '): - return substr($scalar, 2); - case str_starts_with($scalar, '!php/object'): - if (self::$objectSupport) { - if (!isset($scalar[12])) { - throw new ParseException('Missing value for tag "!php/object".', self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); - } - - return unserialize(self::parseScalar(substr($scalar, 12))); - } - - if (self::$exceptionOnInvalidType) { - throw new ParseException('Object support when parsing a YAML file has been disabled.', self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); - } - - return null; - case str_starts_with($scalar, '!php/const'): - if (self::$constantSupport) { - if (!isset($scalar[11])) { - throw new ParseException('Missing value for tag "!php/const".', self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); - } - - $i = 0; - if (\defined($const = self::parseScalar(substr($scalar, 11), 0, null, $i, false))) { - return \constant($const); - } - - throw new ParseException(\sprintf('The constant "%s" is not defined.', $const), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); - } - if (self::$exceptionOnInvalidType) { - throw new ParseException(\sprintf('The string "%s" could not be parsed as a constant. Did you forget to pass the "Yaml::PARSE_CONSTANT" flag to the parser?', $scalar), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); - } - - return null; - case str_starts_with($scalar, '!php/enum'): - if (self::$constantSupport) { - if (!isset($scalar[11])) { - throw new ParseException('Missing value for tag "!php/enum".', self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); - } - - $i = 0; - $enumName = self::parseScalar(substr($scalar, 10), 0, null, $i, false); - $useName = str_contains($enumName, '::'); - $enum = $useName ? strstr($enumName, '::', true) : $enumName; - - if (!enum_exists($enum)) { - throw new ParseException(\sprintf('The enum "%s" is not defined.', $enum), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); - } - if (!$useName) { - return $enum::cases(); - } - if ($useValue = str_ends_with($enumName, '->value')) { - $enumName = substr($enumName, 0, -7); - } - - if (!\defined($enumName)) { - throw new ParseException(\sprintf('The string "%s" is not the name of a valid enum.', $enumName), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); - } - - $value = \constant($enumName); - - if (!$useValue) { - return $value; - } - if (!$value instanceof \BackedEnum) { - throw new ParseException(\sprintf('The enum "%s" defines no value next to its name.', $enumName), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); - } - - return $value->value; - } - if (self::$exceptionOnInvalidType) { - throw new ParseException(\sprintf('The string "%s" could not be parsed as an enum. Did you forget to pass the "Yaml::PARSE_CONSTANT" flag to the parser?', $scalar), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); - } - - return null; - case str_starts_with($scalar, '!!float '): - return (float) substr($scalar, 8); - case str_starts_with($scalar, '!!binary '): - return self::evaluateBinaryScalar(substr($scalar, 9)); - } - - throw new ParseException(\sprintf('The string "%s" could not be parsed as it uses an unsupported built-in tag.', $scalar), self::$parsedLineNumber, $scalar, self::$parsedFilename); - case preg_match('/^(?:\+|-)?0o(?P<value>[0-7_]++)$/', $scalar, $matches): - $value = str_replace('_', '', $matches['value']); - - if ('-' === $scalar[0]) { - return -octdec($value); - } - - return octdec($value); - case \in_array($scalar[0], ['+', '-', '.'], true) || is_numeric($scalar[0]): - if (Parser::preg_match('{^[+-]?[0-9][0-9_]*$}', $scalar)) { - $scalar = str_replace('_', '', $scalar); - } - - switch (true) { - case ctype_digit($scalar): - case '-' === $scalar[0] && ctype_digit(substr($scalar, 1)): - $cast = (int) $scalar; - - return ($scalar === (string) $cast) ? $cast : $scalar; - case is_numeric($scalar): - case Parser::preg_match(self::getHexRegex(), $scalar): - $scalar = str_replace('_', '', $scalar); - - return '0x' === $scalar[0].$scalar[1] ? hexdec($scalar) : (float) $scalar; - case '.inf' === $scalarLower: - case '.nan' === $scalarLower: - return -log(0); - case '-.inf' === $scalarLower: - return log(0); - case Parser::preg_match('/^(-|\+)?[0-9][0-9_]*(\.[0-9_]+)?$/', $scalar): - return (float) str_replace('_', '', $scalar); - case Parser::preg_match(self::getTimestampRegex(), $scalar): - try { - // When no timezone is provided in the parsed date, YAML spec says we must assume UTC. - $time = new \DateTimeImmutable($scalar, new \DateTimeZone('UTC')); - } catch (\Exception $e) { - // Some dates accepted by the regex are not valid dates. - throw new ParseException(\sprintf('The date "%s" could not be parsed as it is an invalid date.', $scalar), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename, $e); - } - - if (Yaml::PARSE_DATETIME & $flags) { - return $time; - } - - if ('' !== rtrim($time->format('u'), '0')) { - return (float) $time->format('U.u'); - } - - try { - if (false !== $scalar = $time->getTimestamp()) { - return $scalar; - } - } catch (\ValueError) { - // no-op - } - - return $time->format('U'); - } - } - - return (string) $scalar; - } - - private static function parseTag(string $value, int &$i, int $flags): ?string - { - if ('!' !== $value[$i]) { - return null; - } - - $tagLength = strcspn($value, " \t\n[]{},", $i + 1); - $tag = substr($value, $i + 1, $tagLength); - - $nextOffset = $i + $tagLength + 1; - $nextOffset += strspn($value, ' ', $nextOffset); - - if ('' === $tag && (!isset($value[$nextOffset]) || \in_array($value[$nextOffset], [']', '}', ','], true))) { - throw new ParseException('Using the unquoted scalar value "!" is not supported. You must quote it.', self::$parsedLineNumber + 1, $value, self::$parsedFilename); - } - - // Is followed by a scalar and is a built-in tag - if ('' !== $tag && (!isset($value[$nextOffset]) || !\in_array($value[$nextOffset], ['[', '{'], true)) && ('!' === $tag[0] || \in_array($tag, ['str', 'php/const', 'php/enum', 'php/object'], true))) { - // Manage in {@link self::evaluateScalar()} - return null; - } - - $i = $nextOffset; - - // Built-in tags - if ('' !== $tag && '!' === $tag[0]) { - throw new ParseException(\sprintf('The built-in tag "!%s" is not implemented.', $tag), self::$parsedLineNumber + 1, $value, self::$parsedFilename); - } - - if ('' !== $tag && !isset($value[$i])) { - throw new ParseException(\sprintf('Missing value for tag "%s".', $tag), self::$parsedLineNumber + 1, $value, self::$parsedFilename); - } - - if ('' === $tag || Yaml::PARSE_CUSTOM_TAGS & $flags) { - return $tag; - } - - throw new ParseException(\sprintf('Tags support is not enabled. Enable the "Yaml::PARSE_CUSTOM_TAGS" flag to use "!%s".', $tag), self::$parsedLineNumber + 1, $value, self::$parsedFilename); - } - - public static function evaluateBinaryScalar(string $scalar): string - { - $parsedBinaryData = self::parseScalar(preg_replace('/\s/', '', $scalar)); - - if (0 !== (\strlen($parsedBinaryData) % 4)) { - throw new ParseException(\sprintf('The normalized base64 encoded data (data without whitespace characters) length must be a multiple of four (%d bytes given).', \strlen($parsedBinaryData)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); - } - - if (!Parser::preg_match('#^[A-Z0-9+/]+={0,2}$#i', $parsedBinaryData)) { - throw new ParseException(\sprintf('The base64 encoded data (%s) contains invalid characters.', $parsedBinaryData), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); - } - - return base64_decode($parsedBinaryData, true); - } - - private static function isBinaryString(string $value): bool - { - return !preg_match('//u', $value) || preg_match('/[^\x00\x07-\x0d\x1B\x20-\xff]/', $value); - } - - /** - * Gets a regex that matches a YAML date. - * - * @see http://www.yaml.org/spec/1.2/spec.html#id2761573 - */ - private static function getTimestampRegex(): string - { - return <<<EOF - ~^ - (?P<year>[0-9][0-9][0-9][0-9]) - -(?P<month>[0-9][0-9]?) - -(?P<day>[0-9][0-9]?) - (?:(?:[Tt]|[ \t]+) - (?P<hour>[0-9][0-9]?) - :(?P<minute>[0-9][0-9]) - :(?P<second>[0-9][0-9]) - (?:\.(?P<fraction>[0-9]*))? - (?:[ \t]*(?P<tz>Z|(?P<tz_sign>[-+])(?P<tz_hour>[0-9][0-9]?) - (?::(?P<tz_minute>[0-9][0-9]))?))?)? - $~x -EOF; - } - - /** - * Gets a regex that matches a YAML number in hexadecimal notation. - */ - private static function getHexRegex(): string - { - return '~^0x[0-9a-f_]++$~i'; - } -} diff --git a/vendor/symfony/yaml/LICENSE b/vendor/symfony/yaml/LICENSE deleted file mode 100644 index 0138f8f..0000000 --- a/vendor/symfony/yaml/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2004-present Fabien Potencier - -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/symfony/yaml/Parser.php b/vendor/symfony/yaml/Parser.php deleted file mode 100644 index 266b89e..0000000 --- a/vendor/symfony/yaml/Parser.php +++ /dev/null @@ -1,1260 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Yaml; - -use Symfony\Component\Yaml\Exception\ParseException; -use Symfony\Component\Yaml\Tag\TaggedValue; - -/** - * Parser parses YAML strings to convert them to PHP arrays. - * - * @author Fabien Potencier <fabien@symfony.com> - * - * @final - */ -class Parser -{ - public const TAG_PATTERN = '(?P<tag>![\w!.\/:-]+)'; - public const BLOCK_SCALAR_HEADER_PATTERN = '(?P<separator>\||>)(?P<modifiers>\+|\-|\d+|\+\d+|\-\d+|\d+\+|\d+\-)?(?P<comments> +#.*)?'; - public const REFERENCE_PATTERN = '#^&(?P<ref>[^ ]++) *+(?P<value>.*)#u'; - - private ?string $filename = null; - private int $offset = 0; - private int $numberOfParsedLines = 0; - private ?int $totalNumberOfLines = null; - private array $lines = []; - private int $currentLineNb = -1; - private string $currentLine = ''; - private array $refs = []; - private array $skippedLineNumbers = []; - private array $locallySkippedLineNumbers = []; - private array $refsBeingParsed = []; - - /** - * Parses a YAML file into a PHP value. - * - * @param string $filename The path to the YAML file to be parsed - * @param int-mask-of<Yaml::PARSE_*> $flags A bit field of Yaml::PARSE_* constants to customize the YAML parser behavior - * - * @throws ParseException If the file could not be read or the YAML is not valid - */ - public function parseFile(string $filename, int $flags = 0): mixed - { - if (!is_file($filename)) { - throw new ParseException(\sprintf('File "%s" does not exist.', $filename)); - } - - if (!is_readable($filename)) { - throw new ParseException(\sprintf('File "%s" cannot be read.', $filename)); - } - - $this->filename = $filename; - - try { - return $this->parse(file_get_contents($filename), $flags); - } finally { - $this->filename = null; - } - } - - /** - * Parses a YAML string to a PHP value. - * - * @param string $value A YAML string - * @param int-mask-of<Yaml::PARSE_*> $flags A bit field of Yaml::PARSE_* constants to customize the YAML parser behavior - * - * @throws ParseException If the YAML is not valid - */ - public function parse(string $value, int $flags = 0): mixed - { - if (false === preg_match('//u', $value)) { - throw new ParseException('The YAML value does not appear to be valid UTF-8.', -1, null, $this->filename); - } - - $this->refs = []; - - try { - $data = $this->doParse($value, $flags); - } finally { - $this->refsBeingParsed = []; - $this->offset = 0; - $this->lines = []; - $this->currentLine = ''; - $this->numberOfParsedLines = 0; - $this->refs = []; - $this->skippedLineNumbers = []; - $this->locallySkippedLineNumbers = []; - $this->totalNumberOfLines = null; - } - - return $data; - } - - private function doParse(string $value, int $flags): mixed - { - $this->currentLineNb = -1; - $this->currentLine = ''; - $value = $this->cleanup($value); - $this->lines = explode("\n", $value); - $this->numberOfParsedLines = \count($this->lines); - $this->locallySkippedLineNumbers = []; - $this->totalNumberOfLines ??= $this->numberOfParsedLines; - - if (!$this->moveToNextLine()) { - return null; - } - - $data = []; - $context = null; - $allowOverwrite = false; - - while ($this->isCurrentLineEmpty()) { - if (!$this->moveToNextLine()) { - return null; - } - } - - // Resolves the tag and returns if end of the document - if (null !== ($tag = $this->getLineTag($this->currentLine, $flags, false)) && !$this->moveToNextLine()) { - return new TaggedValue($tag, ''); - } - - do { - if ($this->isCurrentLineEmpty()) { - continue; - } - - // tab? - if ("\t" === $this->currentLine[0]) { - throw new ParseException('A YAML file cannot contain tabs as indentation.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); - } - - Inline::initialize($flags, $this->getRealCurrentLineNb(), $this->filename); - - $isRef = $mergeNode = false; - if ('-' === $this->currentLine[0] && self::preg_match('#^\-((?P<leadspaces>\s+)(?P<value>.+))?$#u', rtrim($this->currentLine), $values)) { - if ($context && 'mapping' == $context) { - throw new ParseException('You cannot define a sequence item when in a mapping.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); - } - $context = 'sequence'; - - if (isset($values['value']) && '&' === $values['value'][0] && self::preg_match(self::REFERENCE_PATTERN, $values['value'], $matches)) { - $isRef = $matches['ref']; - $this->refsBeingParsed[] = $isRef; - $values['value'] = $matches['value']; - } - - if (isset($values['value'][1]) && '?' === $values['value'][0] && ' ' === $values['value'][1]) { - throw new ParseException('Complex mappings are not supported.', $this->getRealCurrentLineNb() + 1, $this->currentLine); - } - - // array - if (isset($values['value']) && str_starts_with(ltrim($values['value'], ' '), '-')) { - // Inline first child - $currentLineNumber = $this->getRealCurrentLineNb(); - - $sequenceIndentation = \strlen($values['leadspaces']) + 1; - $sequenceYaml = substr($this->currentLine, $sequenceIndentation); - $sequenceYaml .= "\n".$this->getNextEmbedBlock($sequenceIndentation, true); - - $data[] = $this->parseBlock($currentLineNumber, rtrim($sequenceYaml), $flags); - } elseif (!isset($values['value']) || '' == trim($values['value'], ' ') || str_starts_with(ltrim($values['value'], ' '), '#')) { - $data[] = $this->parseBlock($this->getRealCurrentLineNb() + 1, $this->getNextEmbedBlock(null, true) ?? '', $flags); - } elseif (null !== $subTag = $this->getLineTag(ltrim($values['value'], ' '), $flags)) { - $data[] = new TaggedValue( - $subTag, - $this->parseBlock($this->getRealCurrentLineNb() + 1, $this->getNextEmbedBlock(null, true), $flags) - ); - } else { - if ( - isset($values['leadspaces']) - && ( - '!' === $values['value'][0] - || self::preg_match('#^(?P<key>'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\{\[].*?) *\:(\s+(?P<value>.+?))?\s*$#u', $this->trimTag($values['value']), $matches) - ) - ) { - $block = $values['value']; - if ($this->isNextLineIndented() || isset($matches['value']) && '>-' === $matches['value']) { - $block .= "\n".$this->getNextEmbedBlock($this->getCurrentLineIndentation() + \strlen($values['leadspaces']) + 1); - } - - $data[] = $this->parseBlock($this->getRealCurrentLineNb(), $block, $flags); - } else { - $data[] = $this->parseValue($values['value'], $flags, $context); - } - } - if ($isRef) { - $this->refs[$isRef] = end($data); - array_pop($this->refsBeingParsed); - } - } elseif ( - self::preg_match('#^(?P<key>(?:![^\s]++\s++)?(?:'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\[\{!].*?)) *\:(( |\t)++(?P<value>.+))?$#u', rtrim($this->currentLine), $values) - && (!str_contains($values['key'], ' #') || \in_array($values['key'][0], ['"', "'"])) - ) { - if ($context && 'sequence' == $context) { - throw new ParseException('You cannot define a mapping item when in a sequence.', $this->currentLineNb + 1, $this->currentLine, $this->filename); - } - $context = 'mapping'; - - try { - $key = Inline::parseScalar($values['key']); - } catch (ParseException $e) { - $e->setParsedLine($this->getRealCurrentLineNb() + 1); - $e->setSnippet($this->currentLine); - - throw $e; - } - - if (!\is_string($key) && !\is_int($key)) { - throw new ParseException((is_numeric($key) ? 'Numeric' : 'Non-string').' keys are not supported. Quote your evaluable mapping keys instead.', $this->getRealCurrentLineNb() + 1, $this->currentLine); - } - - // Convert float keys to strings, to avoid being converted to integers by PHP - if (\is_float($key)) { - $key = (string) $key; - } - - if ('<<' === $key && (!isset($values['value']) || '&' !== $values['value'][0] || !self::preg_match('#^&(?P<ref>[^ ]+)#u', $values['value'], $refMatches))) { - $mergeNode = true; - $allowOverwrite = true; - if (isset($values['value'][0]) && '*' === $values['value'][0]) { - $refName = substr(rtrim($values['value']), 1); - if (!\array_key_exists($refName, $this->refs)) { - if (false !== $pos = array_search($refName, $this->refsBeingParsed, true)) { - throw new ParseException(\sprintf('Circular reference [%s] detected for reference "%s".', implode(', ', array_merge(\array_slice($this->refsBeingParsed, $pos), [$refName])), $refName), $this->currentLineNb + 1, $this->currentLine, $this->filename); - } - - throw new ParseException(\sprintf('Reference "%s" does not exist.', $refName), $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); - } - - $refValue = $this->refs[$refName]; - - if (Yaml::PARSE_OBJECT_FOR_MAP & $flags && $refValue instanceof \stdClass) { - $refValue = (array) $refValue; - } - - if (!\is_array($refValue)) { - throw new ParseException('YAML merge keys used with a scalar value instead of an array.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); - } - - $data += $refValue; // array union - } else { - if (isset($values['value']) && '' !== $values['value']) { - $value = $values['value']; - } else { - $value = $this->getNextEmbedBlock(); - } - $parsed = $this->parseBlock($this->getRealCurrentLineNb() + 1, $value, $flags); - - if (Yaml::PARSE_OBJECT_FOR_MAP & $flags && $parsed instanceof \stdClass) { - $parsed = (array) $parsed; - } - - if (!\is_array($parsed)) { - throw new ParseException('YAML merge keys used with a scalar value instead of an array.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); - } - - if (isset($parsed[0])) { - // If the value associated with the merge key is a sequence, then this sequence is expected to contain mapping nodes - // and each of these nodes is merged in turn according to its order in the sequence. Keys in mapping nodes earlier - // in the sequence override keys specified in later mapping nodes. - foreach ($parsed as $parsedItem) { - if (Yaml::PARSE_OBJECT_FOR_MAP & $flags && $parsedItem instanceof \stdClass) { - $parsedItem = (array) $parsedItem; - } - - if (!\is_array($parsedItem)) { - throw new ParseException('Merge items must be arrays.', $this->getRealCurrentLineNb() + 1, $parsedItem, $this->filename); - } - - $data += $parsedItem; // array union - } - } else { - // If the value associated with the key is a single mapping node, each of its key/value pairs is inserted into the - // current mapping, unless the key already exists in it. - $data += $parsed; // array union - } - } - } elseif ('<<' !== $key && isset($values['value']) && '&' === $values['value'][0] && self::preg_match(self::REFERENCE_PATTERN, $values['value'], $matches)) { - $isRef = $matches['ref']; - $this->refsBeingParsed[] = $isRef; - $values['value'] = $matches['value']; - } - - $subTag = null; - if ($mergeNode) { - // Merge keys - } elseif (!isset($values['value']) || '' === $values['value'] || str_starts_with($values['value'], '#') || (null !== $subTag = $this->getLineTag($values['value'], $flags)) || '<<' === $key) { - // hash - // if next line is less indented or equal, then it means that the current value is null - if (!$this->isNextLineIndented() && !$this->isNextLineUnIndentedCollection()) { - // Spec: Keys MUST be unique; first one wins. - // But overwriting is allowed when a merge node is used in current block. - if ($allowOverwrite || !isset($data[$key])) { - if (!$allowOverwrite && \array_key_exists($key, $data)) { - trigger_deprecation('symfony/yaml', '7.2', 'Duplicate key "%s" detected on line %d whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated and will throw a ParseException in 8.0.', $key, $this->getRealCurrentLineNb() + 1); - } - - if (null !== $subTag) { - $data[$key] = new TaggedValue($subTag, ''); - } else { - $data[$key] = null; - } - } else { - throw new ParseException(\sprintf('Duplicate key "%s" detected.', $key), $this->getRealCurrentLineNb() + 1, $this->currentLine); - } - } else { - // remember the parsed line number here in case we need it to provide some contexts in error messages below - $realCurrentLineNbKey = $this->getRealCurrentLineNb(); - $value = $this->parseBlock($this->getRealCurrentLineNb() + 1, $this->getNextEmbedBlock(), $flags); - if ('<<' === $key) { - $this->refs[$refMatches['ref']] = $value; - - if (Yaml::PARSE_OBJECT_FOR_MAP & $flags && $value instanceof \stdClass) { - $value = (array) $value; - } - - $data += $value; - } elseif ($allowOverwrite || !isset($data[$key])) { - if (!$allowOverwrite && \array_key_exists($key, $data)) { - trigger_deprecation('symfony/yaml', '7.2', 'Duplicate key "%s" detected on line %d whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated and will throw a ParseException in 8.0.', $key, $this->getRealCurrentLineNb() + 1); - } - - // Spec: Keys MUST be unique; first one wins. - // But overwriting is allowed when a merge node is used in current block. - if (null !== $subTag) { - $data[$key] = new TaggedValue($subTag, $value); - } else { - $data[$key] = $value; - } - } else { - throw new ParseException(\sprintf('Duplicate key "%s" detected.', $key), $realCurrentLineNbKey + 1, $this->currentLine); - } - } - } else { - $value = $this->parseValue(rtrim($values['value']), $flags, $context); - // Spec: Keys MUST be unique; first one wins. - // But overwriting is allowed when a merge node is used in current block. - if ($allowOverwrite || !isset($data[$key])) { - if (!$allowOverwrite && \array_key_exists($key, $data)) { - trigger_deprecation('symfony/yaml', '7.2', 'Duplicate key "%s" detected on line %d whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated and will throw a ParseException in 8.0.', $key, $this->getRealCurrentLineNb() + 1); - } - - $data[$key] = $value; - } else { - throw new ParseException(\sprintf('Duplicate key "%s" detected.', $key), $this->getRealCurrentLineNb() + 1, $this->currentLine); - } - } - if ($isRef) { - $this->refs[$isRef] = $data[$key]; - array_pop($this->refsBeingParsed); - } - } elseif ('"' === $this->currentLine[0] || "'" === $this->currentLine[0]) { - if (null !== $context) { - throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); - } - - try { - return Inline::parse($this->lexInlineQuotedString(), $flags, $this->refs); - } catch (ParseException $e) { - $e->setParsedLine($this->getRealCurrentLineNb() + 1); - $e->setSnippet($this->currentLine); - - throw $e; - } - } elseif ('{' === $this->currentLine[0]) { - if (null !== $context) { - throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); - } - - try { - $parsedMapping = Inline::parse($this->lexInlineMapping(), $flags, $this->refs); - - while ($this->moveToNextLine()) { - if (!$this->isCurrentLineEmpty()) { - throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); - } - } - - return $parsedMapping; - } catch (ParseException $e) { - $e->setParsedLine($this->getRealCurrentLineNb() + 1); - $e->setSnippet($this->currentLine); - - throw $e; - } - } elseif ('[' === $this->currentLine[0]) { - if (null !== $context) { - throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); - } - - try { - $parsedSequence = Inline::parse($this->lexInlineSequence(), $flags, $this->refs); - - while ($this->moveToNextLine()) { - if (!$this->isCurrentLineEmpty()) { - throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); - } - } - - return $parsedSequence; - } catch (ParseException $e) { - $e->setParsedLine($this->getRealCurrentLineNb() + 1); - $e->setSnippet($this->currentLine); - - throw $e; - } - } else { - // multiple documents are not supported - if ('---' === $this->currentLine) { - throw new ParseException('Multiple documents are not supported.', $this->currentLineNb + 1, $this->currentLine, $this->filename); - } - - if (isset($this->currentLine[1]) && '?' === $this->currentLine[0] && ' ' === $this->currentLine[1]) { - throw new ParseException('Complex mappings are not supported.', $this->getRealCurrentLineNb() + 1, $this->currentLine); - } - - // 1-liner optionally followed by newline(s) - if (\is_string($value) && $this->lines[0] === trim($value)) { - try { - $value = Inline::parse($this->lines[0], $flags, $this->refs); - } catch (ParseException $e) { - $e->setParsedLine($this->getRealCurrentLineNb() + 1); - $e->setSnippet($this->currentLine); - - throw $e; - } - - return $value; - } - - // try to parse the value as a multi-line string as a last resort - if (0 === $this->currentLineNb) { - $previousLineWasNewline = false; - $previousLineWasTerminatedWithBackslash = false; - $value = ''; - - foreach ($this->lines as $line) { - $trimmedLine = trim($line); - if ('#' === ($trimmedLine[0] ?? '')) { - continue; - } - // If the indentation is not consistent at offset 0, it is to be considered as a ParseError - if (0 === $this->offset && isset($line[0]) && ' ' === $line[0]) { - throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); - } - - if (str_contains($line, ': ')) { - throw new ParseException('Mapping values are not allowed in multi-line blocks.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); - } - - if ('' === $trimmedLine) { - $value .= "\n"; - } elseif (!$previousLineWasNewline && !$previousLineWasTerminatedWithBackslash) { - $value .= ' '; - } - - if ('' !== $trimmedLine && str_ends_with($line, '\\')) { - $value .= ltrim(substr($line, 0, -1)); - } elseif ('' !== $trimmedLine) { - $value .= $trimmedLine; - } - - if ('' === $trimmedLine) { - $previousLineWasNewline = true; - $previousLineWasTerminatedWithBackslash = false; - } elseif (str_ends_with($line, '\\')) { - $previousLineWasNewline = false; - $previousLineWasTerminatedWithBackslash = true; - } else { - $previousLineWasNewline = false; - $previousLineWasTerminatedWithBackslash = false; - } - } - - try { - return Inline::parse(trim($value)); - } catch (ParseException) { - // fall-through to the ParseException thrown below - } - } - - throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); - } - } while ($this->moveToNextLine()); - - if (null !== $tag) { - $data = new TaggedValue($tag, $data); - } - - if (Yaml::PARSE_OBJECT_FOR_MAP & $flags && 'mapping' === $context && !\is_object($data)) { - $object = new \stdClass(); - - foreach ($data as $key => $value) { - $object->$key = $value; - } - - $data = $object; - } - - return $data ?: null; - } - - private function parseBlock(int $offset, string $yaml, int $flags): mixed - { - $skippedLineNumbers = $this->skippedLineNumbers; - - foreach ($this->locallySkippedLineNumbers as $lineNumber) { - if ($lineNumber < $offset) { - continue; - } - - $skippedLineNumbers[] = $lineNumber; - } - - $parser = new self(); - $parser->offset = $offset; - $parser->totalNumberOfLines = $this->totalNumberOfLines; - $parser->skippedLineNumbers = $skippedLineNumbers; - $parser->refs = &$this->refs; - $parser->refsBeingParsed = $this->refsBeingParsed; - - return $parser->doParse($yaml, $flags); - } - - /** - * Returns the current line number (takes the offset into account). - * - * @internal - */ - public function getRealCurrentLineNb(): int - { - $realCurrentLineNumber = $this->currentLineNb + $this->offset; - - foreach ($this->skippedLineNumbers as $skippedLineNumber) { - if ($skippedLineNumber > $realCurrentLineNumber) { - break; - } - - ++$realCurrentLineNumber; - } - - return $realCurrentLineNumber; - } - - private function getCurrentLineIndentation(): int - { - if (' ' !== ($this->currentLine[0] ?? '')) { - return 0; - } - - return \strlen($this->currentLine) - \strlen(ltrim($this->currentLine, ' ')); - } - - /** - * Returns the next embed block of YAML. - * - * @param int|null $indentation The indent level at which the block is to be read, or null for default - * @param bool $inSequence True if the enclosing data structure is a sequence - * - * @throws ParseException When indentation problem are detected - */ - private function getNextEmbedBlock(?int $indentation = null, bool $inSequence = false): string - { - $oldLineIndentation = $this->getCurrentLineIndentation(); - - if (!$this->moveToNextLine()) { - return ''; - } - - if (null === $indentation) { - $newIndent = null; - $movements = 0; - - do { - $EOF = false; - - // empty and comment-like lines do not influence the indentation depth - if ($this->isCurrentLineEmpty() || $this->isCurrentLineComment()) { - $EOF = !$this->moveToNextLine(); - - if (!$EOF) { - ++$movements; - } - } else { - $newIndent = $this->getCurrentLineIndentation(); - } - } while (!$EOF && null === $newIndent); - - for ($i = 0; $i < $movements; ++$i) { - $this->moveToPreviousLine(); - } - - $unindentedEmbedBlock = $this->isStringUnIndentedCollectionItem(); - - if (!$this->isCurrentLineEmpty() && 0 === $newIndent && !$unindentedEmbedBlock) { - throw new ParseException('Indentation problem.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); - } - } else { - $newIndent = $indentation; - } - - $data = []; - - if ($this->getCurrentLineIndentation() >= $newIndent) { - $data[] = substr($this->currentLine, $newIndent ?? 0); - } elseif ($this->isCurrentLineEmpty() || $this->isCurrentLineComment()) { - $data[] = $this->currentLine; - } else { - $this->moveToPreviousLine(); - - return ''; - } - - if ($inSequence && $oldLineIndentation === $newIndent && isset($data[0][0]) && '-' === $data[0][0]) { - // the previous line contained a dash but no item content, this line is a sequence item with the same indentation - // and therefore no nested list or mapping - $this->moveToPreviousLine(); - - return ''; - } - - $isItUnindentedCollection = $this->isStringUnIndentedCollectionItem(); - $isItComment = $this->isCurrentLineComment(); - - while ($this->moveToNextLine()) { - if ($isItComment && !$isItUnindentedCollection) { - $isItUnindentedCollection = $this->isStringUnIndentedCollectionItem(); - $isItComment = $this->isCurrentLineComment(); - } - - $indent = $this->getCurrentLineIndentation(); - - if ($isItUnindentedCollection && !$this->isCurrentLineEmpty() && !$this->isStringUnIndentedCollectionItem() && $newIndent === $indent) { - $this->moveToPreviousLine(); - break; - } - - if ($this->isCurrentLineBlank()) { - $data[] = substr($this->currentLine, $newIndent ?? 0); - continue; - } - - if ($indent >= $newIndent) { - $data[] = substr($this->currentLine, $newIndent ?? 0); - } elseif ($this->isCurrentLineComment()) { - $data[] = $this->currentLine; - } elseif (0 == $indent) { - $this->moveToPreviousLine(); - - break; - } else { - throw new ParseException('Indentation problem.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); - } - } - - return implode("\n", $data); - } - - private function hasMoreLines(): bool - { - return (\count($this->lines) - 1) > $this->currentLineNb; - } - - /** - * Moves the parser to the next line. - */ - private function moveToNextLine(): bool - { - if ($this->currentLineNb >= $this->numberOfParsedLines - 1) { - return false; - } - - $this->currentLine = $this->lines[++$this->currentLineNb]; - - return true; - } - - /** - * Moves the parser to the previous line. - */ - private function moveToPreviousLine(): bool - { - if ($this->currentLineNb < 1) { - return false; - } - - $this->currentLine = $this->lines[--$this->currentLineNb]; - - return true; - } - - /** - * Parses a YAML value. - * - * @param string $value A YAML value - * @param int $flags A bit field of Yaml::PARSE_* constants to customize the YAML parser behavior - * @param string $context The parser context (either sequence or mapping) - * - * @throws ParseException When reference does not exist - */ - private function parseValue(string $value, int $flags, string $context): mixed - { - if (str_starts_with($value, '*')) { - if (false !== $pos = strpos($value, '#')) { - $value = substr($value, 1, $pos - 2); - } else { - $value = substr($value, 1); - } - - if (!\array_key_exists($value, $this->refs)) { - if (false !== $pos = array_search($value, $this->refsBeingParsed, true)) { - throw new ParseException(\sprintf('Circular reference [%s] detected for reference "%s".', implode(', ', array_merge(\array_slice($this->refsBeingParsed, $pos), [$value])), $value), $this->currentLineNb + 1, $this->currentLine, $this->filename); - } - - throw new ParseException(\sprintf('Reference "%s" does not exist.', $value), $this->currentLineNb + 1, $this->currentLine, $this->filename); - } - - return $this->refs[$value]; - } - - if (\in_array($value[0], ['!', '|', '>'], true) && self::preg_match('/^(?:'.self::TAG_PATTERN.' +)?'.self::BLOCK_SCALAR_HEADER_PATTERN.'$/', $value, $matches)) { - $modifiers = $matches['modifiers'] ?? ''; - - $data = $this->parseBlockScalar($matches['separator'], preg_replace('#\d+#', '', $modifiers), abs((int) $modifiers)); - - if ('' !== $matches['tag'] && '!' !== $matches['tag']) { - if ('!!binary' === $matches['tag']) { - return Inline::evaluateBinaryScalar($data); - } - - return new TaggedValue(substr($matches['tag'], 1), $data); - } - - return $data; - } - - try { - if ('' !== $value && '{' === $value[0]) { - $cursor = \strlen(rtrim($this->currentLine)) - \strlen(rtrim($value)); - - return Inline::parse($this->lexInlineMapping($cursor), $flags, $this->refs); - } elseif ('' !== $value && '[' === $value[0]) { - $cursor = \strlen(rtrim($this->currentLine)) - \strlen(rtrim($value)); - - return Inline::parse($this->lexInlineSequence($cursor), $flags, $this->refs); - } - - switch ($value[0] ?? '') { - case '"': - case "'": - $cursor = \strlen(rtrim($this->currentLine)) - \strlen(rtrim($value)); - $parsedValue = Inline::parse($this->lexInlineQuotedString($cursor), $flags, $this->refs); - - if (isset($this->currentLine[$cursor]) && preg_replace('/\s*(#.*)?$/A', '', substr($this->currentLine, $cursor))) { - throw new ParseException(\sprintf('Unexpected characters near "%s".', substr($this->currentLine, $cursor))); - } - - return $parsedValue; - default: - $lines = []; - - while ($this->moveToNextLine()) { - // unquoted strings end before the first unindented line - if (0 === $this->getCurrentLineIndentation()) { - $this->moveToPreviousLine(); - - break; - } - - $lines[] = trim($this->currentLine); - } - - for ($i = 0, $linesCount = \count($lines), $previousLineBlank = false; $i < $linesCount; ++$i) { - if ('' === $lines[$i]) { - $value .= "\n"; - $previousLineBlank = true; - } elseif ($previousLineBlank) { - $value .= $lines[$i]; - $previousLineBlank = false; - } else { - $value .= ' '.$lines[$i]; - $previousLineBlank = false; - } - } - - Inline::$parsedLineNumber = $this->getRealCurrentLineNb(); - - $parsedValue = Inline::parse($value, $flags, $this->refs); - - if ('mapping' === $context && \is_string($parsedValue) && '"' !== $value[0] && "'" !== $value[0] && '[' !== $value[0] && '{' !== $value[0] && '!' !== $value[0] && str_contains($parsedValue, ': ')) { - throw new ParseException('A colon cannot be used in an unquoted mapping value.', $this->getRealCurrentLineNb() + 1, $value, $this->filename); - } - - return $parsedValue; - } - } catch (ParseException $e) { - $e->setParsedLine($this->getRealCurrentLineNb() + 1); - $e->setSnippet($this->currentLine); - - throw $e; - } - } - - /** - * Parses a block scalar. - * - * @param string $style The style indicator that was used to begin this block scalar (| or >) - * @param string $chomping The chomping indicator that was used to begin this block scalar (+ or -) - * @param int $indentation The indentation indicator that was used to begin this block scalar - */ - private function parseBlockScalar(string $style, string $chomping = '', int $indentation = 0): string - { - $notEOF = $this->moveToNextLine(); - if (!$notEOF) { - return ''; - } - - $isCurrentLineBlank = $this->isCurrentLineBlank(); - $blockLines = []; - - // leading blank lines are consumed before determining indentation - while ($notEOF && $isCurrentLineBlank) { - // newline only if not EOF - if ($notEOF = $this->moveToNextLine()) { - $blockLines[] = ''; - $isCurrentLineBlank = $this->isCurrentLineBlank(); - } - } - - // determine indentation if not specified - if (0 === $indentation) { - $currentLineLength = \strlen($this->currentLine); - - for ($i = 0; $i < $currentLineLength && ' ' === $this->currentLine[$i]; ++$i) { - ++$indentation; - } - } - - if ($indentation > 0) { - $pattern = \sprintf('/^ {%d}(.*)$/', $indentation); - - while ( - $notEOF && ( - $isCurrentLineBlank - || self::preg_match($pattern, $this->currentLine, $matches) - ) - ) { - if ($isCurrentLineBlank && \strlen($this->currentLine) > $indentation) { - $blockLines[] = substr($this->currentLine, $indentation); - } elseif ($isCurrentLineBlank) { - $blockLines[] = ''; - } else { - $blockLines[] = $matches[1]; - } - - // newline only if not EOF - if ($notEOF = $this->moveToNextLine()) { - $isCurrentLineBlank = $this->isCurrentLineBlank(); - } - } - } elseif ($notEOF) { - $blockLines[] = ''; - } - - if ($notEOF) { - $blockLines[] = ''; - $this->moveToPreviousLine(); - } elseif (!$this->isCurrentLineLastLineInDocument()) { - $blockLines[] = ''; - } - - // folded style - if ('>' === $style) { - $text = ''; - $previousLineIndented = false; - $previousLineBlank = false; - - for ($i = 0, $blockLinesCount = \count($blockLines); $i < $blockLinesCount; ++$i) { - if ('' === $blockLines[$i]) { - $text .= "\n"; - $previousLineIndented = false; - $previousLineBlank = true; - } elseif (' ' === $blockLines[$i][0]) { - $text .= "\n".$blockLines[$i]; - $previousLineIndented = true; - $previousLineBlank = false; - } elseif ($previousLineIndented) { - $text .= "\n".$blockLines[$i]; - $previousLineIndented = false; - $previousLineBlank = false; - } elseif ($previousLineBlank || 0 === $i) { - $text .= $blockLines[$i]; - $previousLineIndented = false; - $previousLineBlank = false; - } else { - $text .= ' '.$blockLines[$i]; - $previousLineIndented = false; - $previousLineBlank = false; - } - } - } else { - $text = implode("\n", $blockLines); - } - - // deal with trailing newlines - if ('' === $chomping) { - $text = preg_replace('/\n+$/', "\n", $text); - } elseif ('-' === $chomping) { - $text = preg_replace('/\n+$/', '', $text); - } - - return $text; - } - - /** - * Returns true if the next line is indented. - */ - private function isNextLineIndented(): bool - { - $currentIndentation = $this->getCurrentLineIndentation(); - $movements = 0; - - do { - $EOF = !$this->moveToNextLine(); - - if (!$EOF) { - ++$movements; - } - } while (!$EOF && ($this->isCurrentLineEmpty() || $this->isCurrentLineComment())); - - if ($EOF) { - for ($i = 0; $i < $movements; ++$i) { - $this->moveToPreviousLine(); - } - - return false; - } - - $ret = $this->getCurrentLineIndentation() > $currentIndentation; - - for ($i = 0; $i < $movements; ++$i) { - $this->moveToPreviousLine(); - } - - return $ret; - } - - private function isCurrentLineEmpty(): bool - { - return $this->isCurrentLineBlank() || $this->isCurrentLineComment(); - } - - private function isCurrentLineBlank(): bool - { - return '' === $this->currentLine || '' === trim($this->currentLine, ' '); - } - - private function isCurrentLineComment(): bool - { - // checking explicitly the first char of the trim is faster than loops or strpos - $ltrimmedLine = '' !== $this->currentLine && ' ' === $this->currentLine[0] ? ltrim($this->currentLine, ' ') : $this->currentLine; - - return '' !== $ltrimmedLine && '#' === $ltrimmedLine[0]; - } - - private function isCurrentLineLastLineInDocument(): bool - { - return ($this->offset + $this->currentLineNb) >= ($this->totalNumberOfLines - 1); - } - - private function cleanup(string $value): string - { - $value = str_replace(["\r\n", "\r"], "\n", $value); - - // strip YAML header - $count = 0; - $value = preg_replace('#^\%YAML[: ][\d\.]+.*\n#u', '', $value, -1, $count); - $this->offset += $count; - - // remove leading comments - $trimmedValue = preg_replace('#^(\#.*?\n)+#s', '', $value, -1, $count); - if (1 === $count) { - // items have been removed, update the offset - $this->offset += substr_count($value, "\n") - substr_count($trimmedValue, "\n"); - $value = $trimmedValue; - } - - // remove start of the document marker (---) - $trimmedValue = preg_replace('#^\-\-\-.*?\n#s', '', $value, -1, $count); - if (1 === $count) { - // items have been removed, update the offset - $this->offset += substr_count($value, "\n") - substr_count($trimmedValue, "\n"); - $value = $trimmedValue; - - // remove end of the document marker (...) - $value = preg_replace('#\.\.\.\s*$#', '', $value); - } - - return $value; - } - - private function isNextLineUnIndentedCollection(): bool - { - $currentIndentation = $this->getCurrentLineIndentation(); - $movements = 0; - - do { - $EOF = !$this->moveToNextLine(); - - if (!$EOF) { - ++$movements; - } - } while (!$EOF && ($this->isCurrentLineEmpty() || $this->isCurrentLineComment())); - - if ($EOF) { - return false; - } - - $ret = $this->getCurrentLineIndentation() === $currentIndentation && $this->isStringUnIndentedCollectionItem(); - - for ($i = 0; $i < $movements; ++$i) { - $this->moveToPreviousLine(); - } - - return $ret; - } - - private function isStringUnIndentedCollectionItem(): bool - { - return '-' === rtrim($this->currentLine) || str_starts_with($this->currentLine, '- '); - } - - /** - * A local wrapper for "preg_match" which will throw a ParseException if there - * is an internal error in the PCRE engine. - * - * This avoids us needing to check for "false" every time PCRE is used - * in the YAML engine - * - * @throws ParseException on a PCRE internal error - * - * @internal - */ - public static function preg_match(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0): int - { - if (false === $ret = preg_match($pattern, $subject, $matches, $flags, $offset)) { - throw new ParseException(preg_last_error_msg()); - } - - return $ret; - } - - /** - * Trim the tag on top of the value. - * - * Prevent values such as "!foo {quz: bar}" to be considered as - * a mapping block. - */ - private function trimTag(string $value): string - { - if ('!' === $value[0]) { - return ltrim(substr($value, 1, strcspn($value, " \r\n", 1)), ' '); - } - - return $value; - } - - private function getLineTag(string $value, int $flags, bool $nextLineCheck = true): ?string - { - if ('' === $value || '!' !== $value[0] || 1 !== self::preg_match('/^'.self::TAG_PATTERN.' *( +#.*)?$/', $value, $matches)) { - return null; - } - - if ($nextLineCheck && !$this->isNextLineIndented()) { - return null; - } - - $tag = substr($matches['tag'], 1); - - // Built-in tags - if ($tag && '!' === $tag[0]) { - throw new ParseException(\sprintf('The built-in tag "!%s" is not implemented.', $tag), $this->getRealCurrentLineNb() + 1, $value, $this->filename); - } - - if (Yaml::PARSE_CUSTOM_TAGS & $flags) { - return $tag; - } - - throw new ParseException(\sprintf('Tags support is not enabled. You must use the flag "Yaml::PARSE_CUSTOM_TAGS" to use "%s".', $matches['tag']), $this->getRealCurrentLineNb() + 1, $value, $this->filename); - } - - private function lexInlineQuotedString(int &$cursor = 0): string - { - $quotation = $this->currentLine[$cursor]; - $value = $quotation; - ++$cursor; - - $previousLineWasNewline = true; - $previousLineWasTerminatedWithBackslash = false; - $lineNumber = 0; - - do { - if (++$lineNumber > 1) { - $cursor += strspn($this->currentLine, ' ', $cursor); - } - - if ($this->isCurrentLineBlank()) { - $value .= "\n"; - } elseif (!$previousLineWasNewline && !$previousLineWasTerminatedWithBackslash) { - $value .= ' '; - } - - for (; \strlen($this->currentLine) > $cursor; ++$cursor) { - switch ($this->currentLine[$cursor]) { - case '\\': - if ("'" === $quotation) { - $value .= '\\'; - } elseif (isset($this->currentLine[++$cursor])) { - $value .= '\\'.$this->currentLine[$cursor]; - } - - break; - case $quotation: - ++$cursor; - - if ("'" === $quotation && isset($this->currentLine[$cursor]) && "'" === $this->currentLine[$cursor]) { - $value .= "''"; - break; - } - - return $value.$quotation; - default: - $value .= $this->currentLine[$cursor]; - } - } - - if ($this->isCurrentLineBlank()) { - $previousLineWasNewline = true; - $previousLineWasTerminatedWithBackslash = false; - } elseif ('\\' === $this->currentLine[-1]) { - $previousLineWasNewline = false; - $previousLineWasTerminatedWithBackslash = true; - } else { - $previousLineWasNewline = false; - $previousLineWasTerminatedWithBackslash = false; - } - - if ($this->hasMoreLines()) { - $cursor = 0; - } - } while ($this->moveToNextLine()); - - throw new ParseException('Malformed inline YAML string.'); - } - - private function lexUnquotedString(int &$cursor): string - { - $offset = $cursor; - $cursor += strcspn($this->currentLine, '[]{},:', $cursor); - - if ($cursor === $offset) { - throw new ParseException('Malformed unquoted YAML string.'); - } - - return substr($this->currentLine, $offset, $cursor - $offset); - } - - private function lexInlineMapping(int &$cursor = 0, bool $consumeUntilEol = true): string - { - return $this->lexInlineStructure($cursor, '}', $consumeUntilEol); - } - - private function lexInlineSequence(int &$cursor = 0, bool $consumeUntilEol = true): string - { - return $this->lexInlineStructure($cursor, ']', $consumeUntilEol); - } - - private function lexInlineStructure(int &$cursor, string $closingTag, bool $consumeUntilEol = true): string - { - $value = $this->currentLine[$cursor]; - ++$cursor; - - do { - $this->consumeWhitespaces($cursor); - - while (isset($this->currentLine[$cursor])) { - switch ($this->currentLine[$cursor]) { - case '"': - case "'": - $value .= $this->lexInlineQuotedString($cursor); - break; - case ':': - case ',': - $value .= $this->currentLine[$cursor]; - ++$cursor; - break; - case '{': - $value .= $this->lexInlineMapping($cursor, false); - break; - case '[': - $value .= $this->lexInlineSequence($cursor, false); - break; - case $closingTag: - $value .= $this->currentLine[$cursor]; - ++$cursor; - - if ($consumeUntilEol && isset($this->currentLine[$cursor]) && ($whitespaces = strspn($this->currentLine, ' ', $cursor) + $cursor) < strlen($this->currentLine) && '#' !== $this->currentLine[$whitespaces]) { - throw new ParseException(sprintf('Unexpected token "%s".', trim(substr($this->currentLine, $cursor)))); - } - - return $value; - case '#': - break 2; - default: - $value .= $this->lexUnquotedString($cursor); - } - - if ($this->consumeWhitespaces($cursor)) { - $value .= ' '; - } - } - - if ($this->hasMoreLines()) { - $cursor = 0; - } - } while ($this->moveToNextLine()); - - throw new ParseException('Malformed inline YAML string.'); - } - - private function consumeWhitespaces(int &$cursor): bool - { - $whitespacesConsumed = 0; - - do { - $whitespaceOnlyTokenLength = strspn($this->currentLine, ' ', $cursor); - $whitespacesConsumed += $whitespaceOnlyTokenLength; - $cursor += $whitespaceOnlyTokenLength; - - if (isset($this->currentLine[$cursor])) { - return 0 < $whitespacesConsumed; - } - - if ($this->hasMoreLines()) { - $cursor = 0; - } - } while ($this->moveToNextLine()); - - return 0 < $whitespacesConsumed; - } -} diff --git a/vendor/symfony/yaml/README.md b/vendor/symfony/yaml/README.md deleted file mode 100644 index ac25024..0000000 --- a/vendor/symfony/yaml/README.md +++ /dev/null @@ -1,13 +0,0 @@ -Yaml Component -============== - -The Yaml component loads and dumps YAML files. - -Resources ---------- - - * [Documentation](https://symfony.com/doc/current/components/yaml.html) - * [Contributing](https://symfony.com/doc/current/contributing/index.html) - * [Report issues](https://github.com/symfony/symfony/issues) and - [send Pull Requests](https://github.com/symfony/symfony/pulls) - in the [main Symfony repository](https://github.com/symfony/symfony) diff --git a/vendor/symfony/yaml/Resources/bin/yaml-lint b/vendor/symfony/yaml/Resources/bin/yaml-lint deleted file mode 100755 index 143869e..0000000 --- a/vendor/symfony/yaml/Resources/bin/yaml-lint +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env php -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -if ('cli' !== \PHP_SAPI) { - throw new Exception('This script must be run from the command line.'); -} - -/** - * Runs the Yaml lint command. - * - * @author Jan Schädlich <jan.schaedlich@sensiolabs.de> - */ - -use Symfony\Component\Console\Application; -use Symfony\Component\Yaml\Command\LintCommand; - -function includeIfExists(string $file): bool -{ - return file_exists($file) && include $file; -} - -if ( - !includeIfExists(__DIR__ . '/../../../../autoload.php') && - !includeIfExists(__DIR__ . '/../../vendor/autoload.php') && - !includeIfExists(__DIR__ . '/../../../../../../vendor/autoload.php') -) { - fwrite(STDERR, 'Install dependencies using Composer.'.PHP_EOL); - exit(1); -} - -if (!class_exists(Application::class)) { - fwrite(STDERR, 'You need the "symfony/console" component in order to run the Yaml linter.'.PHP_EOL); - exit(1); -} - -(new Application())->add($command = new LintCommand()) - ->getApplication() - ->setDefaultCommand($command->getName(), true) - ->run() -; diff --git a/vendor/symfony/yaml/Tag/TaggedValue.php b/vendor/symfony/yaml/Tag/TaggedValue.php deleted file mode 100644 index 9d29193..0000000 --- a/vendor/symfony/yaml/Tag/TaggedValue.php +++ /dev/null @@ -1,35 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Yaml\Tag; - -/** - * @author Nicolas Grekas <p@tchwork.com> - * @author Guilhem N. <egetick@gmail.com> - */ -final class TaggedValue -{ - public function __construct( - private string $tag, - private mixed $value, - ) { - } - - public function getTag(): string - { - return $this->tag; - } - - public function getValue(): mixed - { - return $this->value; - } -} diff --git a/vendor/symfony/yaml/Unescaper.php b/vendor/symfony/yaml/Unescaper.php deleted file mode 100644 index 1df0cf2..0000000 --- a/vendor/symfony/yaml/Unescaper.php +++ /dev/null @@ -1,108 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Yaml; - -use Symfony\Component\Yaml\Exception\ParseException; - -/** - * Unescaper encapsulates unescaping rules for single and double-quoted - * YAML strings. - * - * @author Matthew Lewinski <matthew@lewinski.org> - * - * @internal - */ -class Unescaper -{ - /** - * Regex fragment that matches an escaped character in a double quoted string. - */ - public const REGEX_ESCAPED_CHARACTER = '\\\\(x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8}|.)'; - - /** - * Unescapes a single quoted string. - * - * @param string $value A single quoted string - */ - public function unescapeSingleQuotedString(string $value): string - { - return str_replace('\'\'', '\'', $value); - } - - /** - * Unescapes a double quoted string. - * - * @param string $value A double quoted string - */ - public function unescapeDoubleQuotedString(string $value): string - { - $callback = fn ($match) => $this->unescapeCharacter($match[0]); - - // evaluate the string - return preg_replace_callback('/'.self::REGEX_ESCAPED_CHARACTER.'/u', $callback, $value); - } - - /** - * Unescapes a character that was found in a double-quoted string. - * - * @param string $value An escaped character - */ - private function unescapeCharacter(string $value): string - { - return match ($value[1]) { - '0' => "\x0", - 'a' => "\x7", - 'b' => "\x8", - 't' => "\t", - "\t" => "\t", - 'n' => "\n", - 'v' => "\xB", - 'f' => "\xC", - 'r' => "\r", - 'e' => "\x1B", - ' ' => ' ', - '"' => '"', - '/' => '/', - '\\' => '\\', - // U+0085 NEXT LINE - 'N' => "\xC2\x85", - // U+00A0 NO-BREAK SPACE - '_' => "\xC2\xA0", - // U+2028 LINE SEPARATOR - 'L' => "\xE2\x80\xA8", - // U+2029 PARAGRAPH SEPARATOR - 'P' => "\xE2\x80\xA9", - 'x' => self::utf8chr(hexdec(substr($value, 2, 2))), - 'u' => self::utf8chr(hexdec(substr($value, 2, 4))), - 'U' => self::utf8chr(hexdec(substr($value, 2, 8))), - default => throw new ParseException(\sprintf('Found unknown escape character "%s".', $value)), - }; - } - - /** - * Get the UTF-8 character for the given code point. - */ - private static function utf8chr(int $c): string - { - if (0x80 > $c %= 0x200000) { - return \chr($c); - } - if (0x800 > $c) { - return \chr(0xC0 | $c >> 6).\chr(0x80 | $c & 0x3F); - } - if (0x10000 > $c) { - return \chr(0xE0 | $c >> 12).\chr(0x80 | $c >> 6 & 0x3F).\chr(0x80 | $c & 0x3F); - } - - return \chr(0xF0 | $c >> 18).\chr(0x80 | $c >> 12 & 0x3F).\chr(0x80 | $c >> 6 & 0x3F).\chr(0x80 | $c & 0x3F); - } -} diff --git a/vendor/symfony/yaml/Yaml.php b/vendor/symfony/yaml/Yaml.php deleted file mode 100644 index 36b4519..0000000 --- a/vendor/symfony/yaml/Yaml.php +++ /dev/null @@ -1,97 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Yaml; - -use Symfony\Component\Yaml\Exception\ParseException; - -/** - * Yaml offers convenience methods to load and dump YAML. - * - * @author Fabien Potencier <fabien@symfony.com> - * - * @final - */ -class Yaml -{ - public const DUMP_OBJECT = 1; - public const PARSE_EXCEPTION_ON_INVALID_TYPE = 2; - public const PARSE_OBJECT = 4; - public const PARSE_OBJECT_FOR_MAP = 8; - public const DUMP_EXCEPTION_ON_INVALID_TYPE = 16; - public const PARSE_DATETIME = 32; - public const DUMP_OBJECT_AS_MAP = 64; - public const DUMP_MULTI_LINE_LITERAL_BLOCK = 128; - public const PARSE_CONSTANT = 256; - public const PARSE_CUSTOM_TAGS = 512; - public const DUMP_EMPTY_ARRAY_AS_SEQUENCE = 1024; - public const DUMP_NULL_AS_TILDE = 2048; - public const DUMP_NUMERIC_KEY_AS_STRING = 4096; - - /** - * Parses a YAML file into a PHP value. - * - * Usage: - * - * $array = Yaml::parseFile('config.yml'); - * print_r($array); - * - * @param string $filename The path to the YAML file to be parsed - * @param int-mask-of<self::PARSE_*> $flags A bit field of PARSE_* constants to customize the YAML parser behavior - * - * @throws ParseException If the file could not be read or the YAML is not valid - */ - public static function parseFile(string $filename, int $flags = 0): mixed - { - $yaml = new Parser(); - - return $yaml->parseFile($filename, $flags); - } - - /** - * Parses YAML into a PHP value. - * - * Usage: - * <code> - * $array = Yaml::parse(file_get_contents('config.yml')); - * print_r($array); - * </code> - * - * @param string $input A string containing YAML - * @param int-mask-of<self::PARSE_*> $flags A bit field of PARSE_* constants to customize the YAML parser behavior - * - * @throws ParseException If the YAML is not valid - */ - public static function parse(string $input, int $flags = 0): mixed - { - $yaml = new Parser(); - - return $yaml->parse($input, $flags); - } - - /** - * Dumps a PHP value to a YAML string. - * - * The dump method, when supplied with an array, will do its best - * to convert the array into friendly YAML. - * - * @param mixed $input The PHP value - * @param int $inline The level where you switch to inline YAML - * @param int $indent The amount of spaces to use for indentation of nested nodes - * @param int-mask-of<self::DUMP_*> $flags A bit field of DUMP_* constants to customize the dumped YAML string - */ - public static function dump(mixed $input, int $inline = 2, int $indent = 4, int $flags = 0): string - { - $yaml = new Dumper($indent); - - return $yaml->dump($input, $inline, 0, $flags); - } -} diff --git a/vendor/symfony/yaml/composer.json b/vendor/symfony/yaml/composer.json deleted file mode 100644 index 2ceac94..0000000 --- a/vendor/symfony/yaml/composer.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "symfony/yaml", - "type": "library", - "description": "Loads and dumps YAML files", - "keywords": [], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=8.2", - "symfony/deprecation-contracts": "^2.5|^3.0", - "symfony/polyfill-ctype": "^1.8" - }, - "require-dev": { - "symfony/console": "^6.4|^7.0" - }, - "conflict": { - "symfony/console": "<6.4" - }, - "autoload": { - "psr-4": { "Symfony\\Component\\Yaml\\": "" }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "bin": [ - "Resources/bin/yaml-lint" - ], - "minimum-stability": "dev" -}