Documentation

Article
in package

Article entity representing an RSS feed item (feed_links table).

Articles are individual items fetched from RSS feeds. They can be imported as texts for reading practice.

Tags
category

Lwt

author

HugoFara hugo.farajallah@protonmail.com

license

Unlicense http://unlicense.org/

link
https://hugofara.github.io/lwt/docs/php/
since
3.0.0

Table of Contents

Constants

STATUS_ARCHIVED  = 'archived'
STATUS_ERROR  = 'error'
STATUS_IMPORTED  = 'imported'
STATUS_NEW  = 'new'
Article status constants.

Properties

$audio  : string
$date  : string
$description  : string
$feedId  : int
$id  : int|null
$link  : string
$text  : string
$title  : string

Methods

audio()  : string
cleanLink()  : string
Get the clean link (without error marker).
create()  : self
Create a new article from RSS feed item.
date()  : string
description()  : string
determineStatus()  : string
Determine article status based on associated text/archived data.
feedId()  : int
fromDbRecord()  : self
Load from a database record.
hasAudio()  : bool
Check if this article has audio attached.
hasError()  : bool
Check if this article has an error (unloadable).
hasText()  : bool
Check if this article has extracted text.
id()  : int|null
isNew()  : bool
Check if this is a new (unsaved) article.
link()  : string
markAsError()  : void
Mark article as error by prefixing link with space.
resetError()  : void
Reset error status by trimming the link.
text()  : string
title()  : string
updateText()  : void
Update the extracted text content.
__construct()  : mixed
Private constructor - use factory methods instead.
truncate()  : string
Truncate string to max length.

Constants

STATUS_ARCHIVED

public mixed STATUS_ARCHIVED = 'archived'

STATUS_ERROR

public mixed STATUS_ERROR = 'error'

STATUS_IMPORTED

public mixed STATUS_IMPORTED = 'imported'

STATUS_NEW

Article status constants.

public mixed STATUS_NEW = 'new'

Properties

$description

private string $description

Methods

audio()

public audio() : string
Return values
string

Get the clean link (without error marker).

public cleanLink() : string
Return values
string

create()

Create a new article from RSS feed item.

public static create(int $feedId, string $title, string $link[, string $description = '' ][, string $date = '' ][, string $audio = '' ][, string $text = '' ]) : self
Parameters
$feedId : int

Feed ID this article belongs to

$title : string

Article title

$link : string

Article URL

$description : string = ''

Article description/summary

$date : string = ''

Publication date (MySQL datetime format)

$audio : string = ''

Audio URL (for podcasts)

$text : string = ''

Extracted article text

Return values
self

date()

public date() : string
Return values
string

description()

public description() : string
Return values
string

determineStatus()

Determine article status based on associated text/archived data.

public determineStatus(int|null $textId, int|null $archivedId) : string
Parameters
$textId : int|null

Associated text ID (from LEFT JOIN)

$archivedId : int|null

Associated archived text ID (from LEFT JOIN)

Return values
string

One of STATUS_* constants

feedId()

public feedId() : int
Return values
int

fromDbRecord()

Load from a database record.

public static fromDbRecord(array<string, mixed> $record) : self
Parameters
$record : array<string, mixed>

Database record

Return values
self

hasAudio()

Check if this article has audio attached.

public hasAudio() : bool
Return values
bool

hasError()

Check if this article has an error (unloadable).

public hasError() : bool
Return values
bool

hasText()

Check if this article has extracted text.

public hasText() : bool
Return values
bool

id()

public id() : int|null
Return values
int|null

isNew()

Check if this is a new (unsaved) article.

public isNew() : bool
Return values
bool
public link() : string
Return values
string

markAsError()

Mark article as error by prefixing link with space.

public markAsError() : void

This is a legacy pattern - articles with space-prefixed links are considered "unloadable" and won't be re-fetched.

resetError()

Reset error status by trimming the link.

public resetError() : void

text()

public text() : string
Return values
string

title()

public title() : string
Return values
string

updateText()

Update the extracted text content.

public updateText(string $text) : void
Parameters
$text : string

New text content

__construct()

Private constructor - use factory methods instead.

private __construct(int|null $id, int $feedId, string $title, string $link, string $description, string $date, string $audio, string $text) : mixed
Parameters
$id : int|null
$feedId : int
$title : string
$link : string
$description : string
$date : string
$audio : string
$text : string

truncate()

Truncate string to max length.

private static truncate(string $value, int $maxLength) : string
Parameters
$value : string

String to truncate

$maxLength : int

Maximum length

Return values
string

        
On this page

Search results