Skip to content

Commit

Permalink
Rename Parsers/Parser to HashParser
Browse files Browse the repository at this point in the history
  • Loading branch information
danon committed Nov 22, 2023
1 parent e12cbb6 commit b78b843
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 18 deletions.
2 changes: 1 addition & 1 deletion app/Services/Parser/Parsers/Censore.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use TRegx\SafeRegex\Exception\PregException;
use TRegx\SafeRegex\preg;

class Censore extends Parser implements ParserInterface
class Censore extends HashParser implements ParserInterface
{
public function __construct(private WordRepository $word)
{
Expand Down
2 changes: 1 addition & 1 deletion app/Services/Parser/Parsers/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use TRegx\CleanRegex\Pattern;

class Context extends Parser implements ParserInterface
class Context extends HashParser implements ParserInterface
{
const HEADLINE_REGEXP = '<h([1-6])>(.*?)</h\1>';

Expand Down
2 changes: 1 addition & 1 deletion app/Services/Parser/Parsers/Emphasis.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Coyote\Repositories\Contracts\UserRepositoryInterface as UserRepository;
use Collective\Html\HtmlBuilder;

class Emphasis extends Parser implements ParserInterface
class Emphasis extends HashParser implements ParserInterface
{
const COLOR = '#B60016';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
<?php

namespace Coyote\Services\Parser\Parsers;

abstract class Parser
abstract class HashParser
{
/**
* @var array
*/
protected $hash = [];
protected array $hash = [];

/**
* @param string $text
Expand Down Expand Up @@ -101,13 +97,7 @@ private function hashElement($text, $element, $inline = false)
return $text;
}

/**
* @param string $text
* @param int $start
* @param int $end
* @return string
*/
protected function hashPart(string $text, int $start, int $end)
protected function hashPart(string $text, int $start, int $end): string
{
$uniqId = uniqid('', true);
$length = $end - $start;
Expand Down
2 changes: 1 addition & 1 deletion app/Services/Parser/Parsers/Latex.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Coyote\Services\Parser\Parsers;

class Latex extends Parser implements ParserInterface
class Latex extends HashParser implements ParserInterface
{
public function parse(string $text): string
{
Expand Down
2 changes: 1 addition & 1 deletion app/Services/Parser/Parsers/Smilies.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/**
* Class Smilies
*/
class Smilies extends Parser implements ParserInterface
class Smilies extends HashParser implements ParserInterface
{
private $smilies = [
':)' => 'smile.gif',
Expand Down

0 comments on commit b78b843

Please sign in to comment.