mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
Add traits to provide common block implementations
This commit is contained in:
parent
74a855946d
commit
3094329950
15
src/Components/Blocks/BlockAcquisition.php
Normal file
15
src/Components/Blocks/BlockAcquisition.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Erusev\Parsedown\Components\Blocks;
|
||||
|
||||
trait BlockAcquisition
|
||||
{
|
||||
/** @var bool */
|
||||
private $acquired = false;
|
||||
|
||||
/** @return bool */
|
||||
public function acquiredPrevious()
|
||||
{
|
||||
return $this->acquired;
|
||||
}
|
||||
}
|
28
src/Components/Blocks/ContinuableBlockDefaultInterrupt.php
Normal file
28
src/Components/Blocks/ContinuableBlockDefaultInterrupt.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Erusev\Parsedown\Components\Blocks;
|
||||
|
||||
trait ContinuableBlockDefaultInterrupt
|
||||
{
|
||||
/** @var bool */
|
||||
private $interrupted = false;
|
||||
|
||||
/**
|
||||
* @param bool $isInterrupted
|
||||
*/
|
||||
public function interrupted($isInterrupted)
|
||||
{
|
||||
$New = clone($this);
|
||||
$New->interrupted = $isInterrupted;
|
||||
|
||||
return $New;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isInterrupted()
|
||||
{
|
||||
return $this->interrupted;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user