PHP Class Wallabag\ImportBundle\Import\AbstractImport

Inheritance: implements Wallabag\ImportBundle\Import\ImportInterface
Show file Open project: wallabag/wallabag

Protected Properties

Property Type Description
$contentProxy
$em
$importedEntries
$logger
$markAsRead
$producer
$queuedEntries
$skippedEntries
$user

Public Methods

Method Description
__construct ( EntityManager $em, ContentProxy $contentProxy )
getMarkAsRead ( ) Get whether articles must be all marked as read.
getSummary ( )
parseEntry ( array $importedEntry ) : Entry Parse one entry.
setLogger ( Psr\Log\LoggerInterface $logger )
setMarkAsRead ( boolean $markAsRead ) Set whether articles must be all marked as read.
setProducer ( OldSound\RabbitMqBundle\RabbitMq\ProducerInterface $producer ) Set RabbitMQ/Redis Producer to send each entry to a queue.
setUser ( User $user ) Set current user.

Protected Methods

Method Description
fetchContent ( Entry $entry, string $url, array $content = [] ) : Entry Fetch content from the ContentProxy (using graby).
parseEntries ( $entries ) Parse and insert all given entries.
parseEntriesForProducer ( array $entries ) Parse entries and send them to the queue.
setEntryAsRead ( array $importedEntry ) : array Set current imported entry to archived / read.

Method Details

__construct() public method

public __construct ( EntityManager $em, ContentProxy $contentProxy )
$em Doctrine\ORM\EntityManager
$contentProxy Wallabag\CoreBundle\Helper\ContentProxy

fetchContent() protected method

If it fails return the given entry to be saved in all case (to avoid user to loose the content).
protected fetchContent ( Entry $entry, string $url, array $content = [] ) : Entry
$entry Wallabag\CoreBundle\Entity\Entry Entry to update
$url string Url to grab content for
$content array An array with AT LEAST keys title, html, url, language & content_type to skip the fetchContent from the url
return Wallabag\CoreBundle\Entity\Entry

getMarkAsRead() public method

Get whether articles must be all marked as read.
public getMarkAsRead ( )

getSummary() public method

public getSummary ( )

parseEntries() protected method

Parse and insert all given entries.
protected parseEntries ( $entries )
$entries

parseEntriesForProducer() protected method

It should just be a simple loop on all item, no call to the database should be done to speedup queuing. Faster parse entries for Producer. We don't care to make check at this time. They'll be done by the consumer.
protected parseEntriesForProducer ( array $entries )
$entries array

parseEntry() abstract public method

Parse one entry.
abstract public parseEntry ( array $importedEntry ) : Entry
$importedEntry array
return Wallabag\CoreBundle\Entity\Entry

setEntryAsRead() abstract protected method

Implementation is different accross all imports.
abstract protected setEntryAsRead ( array $importedEntry ) : array
$importedEntry array
return array

setLogger() public method

public setLogger ( Psr\Log\LoggerInterface $logger )
$logger Psr\Log\LoggerInterface

setMarkAsRead() public method

Set whether articles must be all marked as read.
public setMarkAsRead ( boolean $markAsRead )
$markAsRead boolean

setProducer() public method

This method should be called when user has enabled RabbitMQ.
public setProducer ( OldSound\RabbitMqBundle\RabbitMq\ProducerInterface $producer )
$producer OldSound\RabbitMqBundle\RabbitMq\ProducerInterface

setUser() public method

Could the current *connected* user or one retrieve by the consumer.
public setUser ( User $user )
$user Wallabag\UserBundle\Entity\User

Property Details

$contentProxy protected property

protected $contentProxy

$em protected property

protected $em

$importedEntries protected property

protected $importedEntries

$logger protected property

protected $logger

$markAsRead protected property

protected $markAsRead

$producer protected property

protected $producer

$queuedEntries protected property

protected $queuedEntries

$skippedEntries protected property

protected $skippedEntries

$user protected property

protected $user