Skip to content

Commit

Permalink
Use type AdsTxtLineInterface instead of AbstractAdsTxtLine as return …
Browse files Browse the repository at this point in the history
…type (#4)

* V3

* Set coding style

* Change type AdsTxtLineInterface to AbstractAdsTxtLine
  • Loading branch information
badraxas authored Jan 23, 2024
1 parent 000ea53 commit 37fb598
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
4 changes: 3 additions & 1 deletion src/Interfaces/ParserInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

namespace Badraxas\Adstxt\Interfaces;

use Badraxas\Adstxt\Lines\AbstractAdsTxtLine;

interface ParserInterface
{
public function parse(string $line): AdsTxtLineInterface;
public function parse(string $line): AbstractAdsTxtLine;
}
4 changes: 2 additions & 2 deletions src/Parsers/CommentParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace Badraxas\Adstxt\Parsers;

use Badraxas\Adstxt\Interfaces\AdsTxtLineInterface;
use Badraxas\Adstxt\Interfaces\ParserInterface;
use Badraxas\Adstxt\Lines\AbstractAdsTxtLine;
use Badraxas\Adstxt\Lines\Comment;

class CommentParser implements ParserInterface
{
public function parse(string $line): AdsTxtLineInterface
public function parse(string $line): AbstractAdsTxtLine
{
$raw = $line;
$line = trim(mb_strcut($line, 1));
Expand Down
4 changes: 2 additions & 2 deletions src/Parsers/InvalidParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

namespace Badraxas\Adstxt\Parsers;

use Badraxas\Adstxt\Interfaces\AdsTxtLineInterface;
use Badraxas\Adstxt\Interfaces\ParserInterface;
use Badraxas\Adstxt\Lines\AbstractAdsTxtLine;
use Badraxas\Adstxt\Lines\Comment;
use Badraxas\Adstxt\Lines\Invalid;

class InvalidParser implements ParserInterface
{
public function parse(string $line): AdsTxtLineInterface
public function parse(string $line): AbstractAdsTxtLine
{
$raw = $line;

Expand Down
5 changes: 3 additions & 2 deletions src/Parsers/RecordParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

namespace Badraxas\Adstxt\Parsers;

use Badraxas\Adstxt\Interfaces\AdsTxtLineInterface;
use Badraxas\Adstxt\Interfaces\ParserInterface;
use Badraxas\Adstxt\Lines\AbstractAdsTxtLine;
use Badraxas\Adstxt\Lines\Comment;
use Badraxas\Adstxt\Lines\Invalid;
use Badraxas\Adstxt\Lines\Record;

class RecordParser implements ParserInterface
{
public function parse(string $line): AdsTxtLineInterface
public function parse(string $line): AbstractAdsTxtLine
{
$raw = $line;
$comment = null;
Expand All @@ -23,6 +23,7 @@ public function parse(string $line): AdsTxtLineInterface
}

$exploded_line = explode(',', $line);
$exploded_line = array_map('trim', $exploded_line);

$fieldsCount = count($exploded_line);

Expand Down
4 changes: 2 additions & 2 deletions src/Parsers/VariableParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

namespace Badraxas\Adstxt\Parsers;

use Badraxas\Adstxt\Interfaces\AdsTxtLineInterface;
use Badraxas\Adstxt\Interfaces\ParserInterface;
use Badraxas\Adstxt\Lines\AbstractAdsTxtLine;
use Badraxas\Adstxt\Lines\Comment;
use Badraxas\Adstxt\Lines\Invalid;
use Badraxas\Adstxt\Lines\Variable;

class VariableParser implements ParserInterface
{
public function parse(string $line): AdsTxtLineInterface
public function parse(string $line): AbstractAdsTxtLine
{
$comment = null;

Expand Down

0 comments on commit 37fb598

Please sign in to comment.