Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 148 | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 148 Revision 991
Zeile 14... Zeile 14...
14
 * file that was distributed with this source code.
14
 * file that was distributed with this source code.
15
 */
15
 */
Zeile 16... Zeile 16...
16
 
16
 
Zeile -... Zeile 17...
-
 
17
namespace League\CommonMark\Util;
17
namespace League\CommonMark\Util;
18
 
Zeile 18... Zeile 19...
18
 
19
use League\CommonMark\Exception\InvalidArgumentException;
19
use League\CommonMark\Extension\CommonMark\Node\Block\HtmlBlock;
20
use League\CommonMark\Extension\CommonMark\Node\Block\HtmlBlock;
20
 
21
 
Zeile 159... Zeile 160...
159
     *
160
     *
160
     * @psalm-param HtmlBlock::TYPE_* $type
161
     * @psalm-param HtmlBlock::TYPE_* $type
161
     *
162
     *
162
     * @phpstan-param HtmlBlock::TYPE_* $type
163
     * @phpstan-param HtmlBlock::TYPE_* $type
163
     *
164
     *
164
     * @throws \InvalidArgumentException if an invalid type is given
165
     * @throws InvalidArgumentException if an invalid type is given
165
     *
166
     *
166
     * @psalm-pure
167
     * @psalm-pure
167
     */
168
     */
168
    public static function getHtmlBlockOpenRegex(int $type): string
169
    public static function getHtmlBlockOpenRegex(int $type): string
169
    {
170
    {
Zeile 181... Zeile 182...
181
            case HtmlBlock::TYPE_6_BLOCK_ELEMENT:
182
            case HtmlBlock::TYPE_6_BLOCK_ELEMENT:
182
                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';
183
                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';
183
            case HtmlBlock::TYPE_7_MISC_ELEMENT:
184
            case HtmlBlock::TYPE_7_MISC_ELEMENT:
184
                return '/^(?:' . self::PARTIAL_OPENTAG . '|' . self::PARTIAL_CLOSETAG . ')\\s*$/i';
185
                return '/^(?:' . self::PARTIAL_OPENTAG . '|' . self::PARTIAL_CLOSETAG . ')\\s*$/i';
185
            default:
186
            default:
186
                throw new \InvalidArgumentException('Invalid HTML block type');
187
                throw new InvalidArgumentException('Invalid HTML block type');
187
        }
188
        }
188
    }
189
    }
Zeile 189... Zeile 190...
189
 
190
 
190
    /**
191
    /**
Zeile 194... Zeile 195...
194
     *
195
     *
195
     * @psalm-param HtmlBlock::TYPE_* $type
196
     * @psalm-param HtmlBlock::TYPE_* $type
196
     *
197
     *
197
     * @phpstan-param HtmlBlock::TYPE_* $type
198
     * @phpstan-param HtmlBlock::TYPE_* $type
198
     *
199
     *
199
     * @throws \InvalidArgumentException if an invalid type is given
200
     * @throws InvalidArgumentException if an invalid type is given
200
     *
201
     *
201
     * @psalm-pure
202
     * @psalm-pure
202
     */
203
     */
203
    public static function getHtmlBlockCloseRegex(int $type): string
204
    public static function getHtmlBlockCloseRegex(int $type): string
204
    {
205
    {
Zeile 212... Zeile 213...
212
            case HtmlBlock::TYPE_4:
213
            case HtmlBlock::TYPE_4:
213
                return '/>/';
214
                return '/>/';
214
            case HtmlBlock::TYPE_5_CDATA:
215
            case HtmlBlock::TYPE_5_CDATA:
215
                return '/\]\]>/';
216
                return '/\]\]>/';
216
            default:
217
            default:
217
                throw new \InvalidArgumentException('Invalid HTML block type');
218
                throw new InvalidArgumentException('Invalid HTML block type');
218
        }
219
        }
219
    }
220
    }
Zeile 220... Zeile 221...
220
 
221
 
221
    /**
222
    /**