mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
Add convenience instance-based initialisers
This commit is contained in:
parent
dbc0efeec0
commit
4dee1e9a55
@ -34,6 +34,12 @@
|
||||
<referencedMethod name="Erusev\Parsedown\Configurables\Breaks::enabled" />
|
||||
<referencedMethod name="Erusev\Parsedown\State::mergingWith" />
|
||||
<referencedMethod name="Erusev\Parsedown\Html\Sanitisation\Escaper::htmlElementValue" />
|
||||
<referencedMethod name="Erusev\Parsedown\Configurables\InlineTypes::addingHighPrecedence" />
|
||||
<referencedMethod name="Erusev\Parsedown\Configurables\InlineTypes::addingLowPrecedence" />
|
||||
<referencedMethod name="Erusev\Parsedown\Configurables\BlockTypes::addingMarkedHighPrecedence" />
|
||||
<referencedMethod name="Erusev\Parsedown\Configurables\BlockTypes::addingMarkedLowPrecedence" />
|
||||
<referencedMethod name="Erusev\Parsedown\Configurables\BlockTypes::addingUnmarkedHighPrecedence" />
|
||||
<referencedMethod name="Erusev\Parsedown\Configurables\BlockTypes::addingUnmarkedLowPrecedence" />
|
||||
</errorLevel>
|
||||
</PossiblyUnusedMethod>
|
||||
</issueHandlers>
|
||||
|
@ -90,6 +90,32 @@ final class BlockTypes implements Configurable
|
||||
return new self($blockTypes, $this->unmarkedBlockTypes);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $marker
|
||||
* @param array<int, class-string<Block>> $newBlockTypes
|
||||
* @return self
|
||||
*/
|
||||
public function addingMarkedHighPrecedence($marker, array $newBlockTypes)
|
||||
{
|
||||
return $this->settingMarked(
|
||||
$marker,
|
||||
\array_merge($newBlockTypes, $this->blockTypes[$marker])
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $marker
|
||||
* @param array<int, class-string<Block>> $newBlockTypes
|
||||
* @return self
|
||||
*/
|
||||
public function addingMarkedLowPrecedence($marker, array $newBlockTypes)
|
||||
{
|
||||
return $this->settingMarked(
|
||||
$marker,
|
||||
\array_merge($this->blockTypes[$marker], $newBlockTypes)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<int, class-string<Block>> $newUnmarkedBlockTypes
|
||||
* @return self
|
||||
@ -99,6 +125,28 @@ final class BlockTypes implements Configurable
|
||||
return new self($this->blockTypes, $newUnmarkedBlockTypes);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<int, class-string<Block>> $newBlockTypes
|
||||
* @return self
|
||||
*/
|
||||
public function addingUnmarkedHighPrecedence(array $newBlockTypes)
|
||||
{
|
||||
return $this->settingUnmarked(
|
||||
\array_merge($newBlockTypes, $this->unmarkedBlockTypes)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<int, class-string<Block>> $newBlockTypes
|
||||
* @return self
|
||||
*/
|
||||
public function addingUnmarkedLowPrecedence(array $newBlockTypes)
|
||||
{
|
||||
return $this->settingUnmarked(
|
||||
\array_merge($this->unmarkedBlockTypes, $newBlockTypes)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<int, class-string<Block>> $removeBlockTypes
|
||||
* @return self
|
||||
|
@ -59,6 +59,45 @@ final class InlineTypes implements Configurable
|
||||
return new self(self::$defaultInlineTypes);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $marker
|
||||
* @param array<int, class-string<Inline>> $newInlineTypes
|
||||
* @return self
|
||||
*/
|
||||
public function setting($marker, array $newInlineTypes)
|
||||
{
|
||||
$inlineTypes = $this->inlineTypes;
|
||||
$inlineTypes[$marker] = $newInlineTypes;
|
||||
|
||||
return new self($inlineTypes);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $marker
|
||||
* @param array<int, class-string<Inline>> $newInlineTypes
|
||||
* @return self
|
||||
*/
|
||||
public function addingHighPrecedence($marker, array $newInlineTypes)
|
||||
{
|
||||
return $this->setting(
|
||||
$marker,
|
||||
\array_merge($newInlineTypes, $this->inlineTypes[$marker])
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $marker
|
||||
* @param array<int, class-string<Inline>> $newInlineTypes
|
||||
* @return self
|
||||
*/
|
||||
public function addingLowPrecedence($marker, array $newInlineTypes)
|
||||
{
|
||||
return $this->setting(
|
||||
$marker,
|
||||
\array_merge($this->inlineTypes[$marker], $newInlineTypes)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<int, class-string<Inline>> $removeInlineTypes
|
||||
* @return self
|
||||
|
Loading…
Reference in New Issue
Block a user