Skip to content
Snippets Groups Projects
Commit c1883879 authored by megachriz's avatar megachriz Committed by Megachriz
Browse files

Issue #2342143 by MegaChriz: Fixed most coding standard issues in files in the includes folder.

parent 9489d88e
No related branches found
No related tags found
No related merge requests found
<?php
/**
* @file
* Contains FeedsAccountSwitcher class.
*/
/**
* An implementation of FeedsAccountSwitcherInterface.
*
......
<?php
/**
* @file
* Contains FeedsAccountSwitcherInterface interface.
*/
/**
* Defines an interface for a service for safe account switching.
*/
......
......@@ -12,9 +12,10 @@ class FeedsNotExistingException extends Exception {
}
/**
* Base class for configurable classes. Captures configuration handling, form
* handling and distinguishes between in-memory configuration and persistent
* configuration.
* Base class for configurable classes.
*
* Captures configuration handling, form handling and distinguishes between
* in-memory configuration and persistent configuration.
*
* Due to the magic method __get(), protected properties from this class and
* from classes that extend this class will be publicly readable (but not
......@@ -30,27 +31,26 @@ abstract class FeedsConfigurable {
protected $config;
/**
* A unique identifier for the configuration.
* An unique identifier for the configuration.
*
* @var string
*/
protected $id;
/*
CTools export type of this object.
@todo Should live in FeedsImporter. Not all child classes
of FeedsConfigurable are exportable. Same goes for $disabled.
Export type can be one of
FEEDS_EXPORT_NONE - the configurable only exists in memory
EXPORT_IN_DATABASE - the configurable is defined in the database.
EXPORT_IN_CODE - the configurable is defined in code.
EXPORT_IN_CODE | EXPORT_IN_DATABASE - the configurable is defined in code, but
overridden in the database.*/
/**
* CTools export type of this object.
*
* Export type can be one of:
* - FEEDS_EXPORT_NONE - the configurable only exists in memory.
* - EXPORT_IN_DATABASE - the configurable is defined in the database.
* - EXPORT_IN_CODE - the configurable is defined in code.
* - EXPORT_IN_CODE | EXPORT_IN_DATABASE - the configurable is defined in
* code, but overridden in the database.
*
* @var int
*
* @todo Should live in FeedsImporter. Not all child classes
* of FeedsConfigurable are exportable. Same goes for $disabled.
*/
protected $export_type;
......@@ -69,9 +69,13 @@ abstract class FeedsConfigurable {
* @param string $class
* The name of a subclass of FeedsConfigurable.
* @param string $id
* The ID of this configuration object.
*
* @return FeedsConfigurable
* @throws \Exception
* An instance of this class.
*
* @throws InvalidArgumentException
* When an empty configuration identifier is passed.
*
* @see feeds_importer()
* @see feeds_plugin()
......@@ -94,6 +98,7 @@ abstract class FeedsConfigurable {
* Constructor, set id and load default configuration.
*
* @param string $id
* The ID of this configuration object.
*/
protected function __construct($id) {
// Set this object's id.
......@@ -108,10 +113,6 @@ abstract class FeedsConfigurable {
/**
* Override magic method __isset(). This is needed due to overriding __get().
*
* @param string $name
*
* @return bool
*/
public function __isset($name) {
return isset($this->$name) ? TRUE : FALSE;
......@@ -140,12 +141,15 @@ abstract class FeedsConfigurable {
}
/**
* Determine whether this object is persistent and enabled. I. e. it is
* defined either in code or in the database and it is enabled.
* Determines whether this object is persistent and enabled.
*
* This means that it exists either in code or in the database and it is
* enabled.
*
* @return $this
*
* @throws FeedsNotExistingException
* When the object is not persistent or is not enabled.
*/
public function existing() {
if (!$this->doesExist()) {
......@@ -158,15 +162,17 @@ abstract class FeedsConfigurable {
}
/**
* Save a configuration. Concrete extending classes must implement a save
* operation.
* Saves a configuration.
*
* Concrete extending classes must implement a save operation.
*/
public abstract function save();
abstract public function save();
/**
* Copy a configuration.
*
* @param FeedsConfigurable $configurable
* The FeedsConfigurable instance to take the configuration from.
*/
public function copy(FeedsConfigurable $configurable) {
$this->setConfig($configurable->config);
......@@ -180,7 +186,7 @@ abstract class FeedsConfigurable {
* by the keys returned by configDefaults() and populated with default
* values that are not included in $config.
*/
public function setConfig($config) {
public function setConfig(array $config) {
$defaults = $this->configDefaults();
$this->config = array_intersect_key($config, $defaults) + $defaults;
}
......@@ -192,7 +198,7 @@ abstract class FeedsConfigurable {
* Array containing configuration information. Will be filtered by the keys
* returned by configDefaults().
*/
public function addConfig($config) {
public function addConfig(array $config) {
$this->config = is_array($this->config) ? array_merge($this->config, $config) : $config;
$default_keys = $this->configDefaults();
$this->config = array_intersect_key($this->config, $default_keys);
......@@ -217,9 +223,10 @@ abstract class FeedsConfigurable {
/**
* Implements getConfig().
*
* Return configuration array, ensure that all default values are present.
* Returns configuration array, ensure that all default values are present.
*
* @return array
* The configuration for this object.
*/
public function getConfig() {
$defaults = $this->configDefaults();
......@@ -261,15 +268,18 @@ abstract class FeedsConfigurable {
}
/**
* Return configuration form for this object. The keys of the configuration
* form must match the keys of the array returned by configDefaults().
* Returns configuration form for this object.
*
* The keys of the configuration form must match the keys of the array
* returned by configDefaults().
*
* @param array $form_state
* The current state of the form.
*
* @return array
* FormAPI style form definition.
*/
public function configForm(&$form_state) {
public function configForm(array &$form_state) {
return array();
}
......@@ -278,18 +288,19 @@ abstract class FeedsConfigurable {
*
* Set errors with form_set_error().
*
* @param $values
* @param array $values
* An array that contains the values entered by the user through configForm.
*/
public function configFormValidate(&$values) {
public function configFormValidate(array &$values) {
}
/**
* Submission handler for configForm().
*
* @param array $values
* An array that contains the values entered by the user through configForm.
*/
public function configFormSubmit(&$values) {
public function configFormSubmit(array &$values) {
$this->addConfig($values);
$this->save();
drupal_set_message(t('Your changes have been saved.'));
......@@ -309,28 +320,35 @@ abstract class FeedsConfigurable {
}
/**
* Config form wrapper. Use to render the configuration form of
* a FeedsConfigurable object.
* FeedsConfigurable config form wrapper.
*
* Used to render the configuration form of a FeedsConfigurable object.
*
* @param FeedsConfigurable $configurable
* The FeedsConfigurable instance for which a configuration form must be
* rendered.
* @param string $form_method
* The form method that should be rendered.
*
* @return array|null
* Config form array if available. NULL otherwise.
*/
function feeds_get_form($configurable, $form_method) {
function feeds_get_form(FeedsConfigurable $configurable, $form_method) {
if (method_exists($configurable, $form_method)) {
return drupal_get_form(get_class($configurable) . '_feeds_form', $configurable, $form_method);
}
}
/**
* Config form callback. Don't call directly, but use
* Form constructor for a Feeds configuration form.
*
* Don't call directly, but use
* feeds_get_form($configurable, 'method') instead.
*
* @param array $form
* The form.
* @param array $form_state
* The current state of the form.
* @param FeedsConfigurable $configurable
* The object to perform the save() operation on.
* @param string $form_method
......@@ -339,7 +357,7 @@ function feeds_get_form($configurable, $form_method) {
* @return array
* Form array.
*/
function feeds_form($form, &$form_state, $configurable, $form_method) {
function feeds_form(array $form, array &$form_state, FeedsConfigurable $configurable, $form_method) {
$form = $configurable->$form_method($form_state);
$form['#configurable'] = $configurable;
$form['#feeds_form_method'] = $form_method;
......@@ -354,10 +372,9 @@ function feeds_form($form, &$form_state, $configurable, $form_method) {
}
/**
* Validation handler for feeds_form().
* Form validation handler for feeds_form().
*
* @param array $form
* @param array $form_state
* @see feeds_form()
*/
function feeds_form_validate($form, &$form_state) {
_feeds_form_helper($form, $form_state, 'Validate');
......@@ -366,8 +383,7 @@ function feeds_form_validate($form, &$form_state) {
/**
* Submit handler for feeds_form().
*
* @param array $form
* @param array $form_state
* @see feeds_form()
*/
function feeds_form_submit($form, &$form_state) {
_feeds_form_helper($form, $form_state, 'Submit');
......@@ -376,13 +392,18 @@ function feeds_form_submit($form, &$form_state) {
/**
* Helper for Feeds validate and submit callbacks.
*
* @todo This is all terrible. Remove.
*
* @param array $form
* The form.
* @param array $form_state
* The current state of the form.
* @param string $action
* The action to perform on the form, for example:
* - Validate;
* - Submit.
*
* @todo This is all terrible. Remove.
*/
function _feeds_form_helper($form, &$form_state, $action) {
function _feeds_form_helper(array $form, array &$form_state, $action) {
$method = $form['#feeds_form_method'] . $action;
$class = get_class($form['#configurable']);
$id = $form['#configurable']->id;
......
......@@ -9,6 +9,7 @@
* Class of a cached item.
*/
class FeedsHTTPCacheItem {
/**
* The cache bin to save the data to.
*
......@@ -18,6 +19,8 @@ class FeedsHTTPCacheItem {
/**
* The cache ID.
*
* @var string
*/
protected $cid;
......
......@@ -6,6 +6,8 @@
*/
/**
* Class for a Feeds importer.
*
* A FeedsImporter object describes how an external source should be fetched,
* parsed and processed. Feeds can manage an arbitrary amount of importers.
*
......@@ -24,21 +26,30 @@
*/
class FeedsImporter extends FeedsConfigurable {
// Every feed has a fetcher, a parser and a processor.
// These variable names match the possible return values of
// FeedsPlugin::typeOf().
/**
* Every feed has a fetcher, a parser and a processor.
*
* These variable names match the possible return values of
* FeedsPlugin::typeOf().
*/
/**
* The selected fetcher for this importer.
*
* @var FeedsFetcher|null
*/
protected $fetcher;
/**
* The selected parser for this importer.
*
* @var FeedsParser|null
*/
protected $parser;
/**
* The selected processor for this importer.
*
* @var FeedsProcessor|null
*/
protected $processor;
......@@ -51,10 +62,10 @@ class FeedsImporter extends FeedsConfigurable {
protected $plugin_types = array('fetcher', 'parser', 'processor');
/**
* Instantiate class variables, initialize and configure
* plugins.
* Instantiate class variables, initialize and configure plugins.
*
* @param string $id
* The importer ID.
*/
protected function __construct($id) {
parent::__construct($id);
......@@ -75,8 +86,7 @@ class FeedsImporter extends FeedsConfigurable {
}
/**
* Report how many items *should* be created on one page load by this
* importer.
* Reports how many items *should* be created on one request by this importer.
*
* Note:
*
......@@ -85,7 +95,7 @@ class FeedsImporter extends FeedsConfigurable {
* number of items that can be created on one page load is actually without
* limit.
*
* @return
* @return int
* A positive number defining the number of items that can be created on
* one page load. 0 if this number is unlimited.
*/
......@@ -148,8 +158,8 @@ class FeedsImporter extends FeedsConfigurable {
/**
* Set plugin.
*
* @param $plugin_key
* A fetcher, parser or processor plugin.
* @param string $plugin_key
* The name of a fetcher, parser or processor plugin.
*
* @todo Error handling, handle setting to the same plugin.
*/
......@@ -296,13 +306,15 @@ class FeedsImporter extends FeedsConfigurable {
}
/**
* Override parent::configForm().
* Overrides parent::configForm().
*
* @param array $form_state
* The current state of the form.
*
* @return array
* The form definition.
*/
public function configForm(&$form_state) {
public function configForm(array &$form_state) {
$config = $this->getConfig();
$form = array();
$form['name'] = array(
......@@ -323,14 +335,25 @@ class FeedsImporter extends FeedsConfigurable {
$form['content_type'] = array(
'#type' => 'select',
'#title' => t('Attach to content type'),
'#description' => t('If "Use standalone form" is selected a source is imported by using a form under !import_form.
If a content type is selected a source is imported by creating a node of that content type.',
array('!import_form' => l(url('import', array('absolute' => TRUE)), 'import', array('attributes' => array('target' => '_new'))))),
'#description' => '<p>' . t('If "Use standalone form" is selected, a source is imported by using a form under !import_form. If a content type is selected, a source is imported by creating a node of that content type.', array(
'!import_form' => l(url('import', array('absolute' => TRUE)), 'import', array('attributes' => array('target' => '_new'))),
)) . '</p>',
'#options' => array('' => t('Use standalone form')) + $node_types,
'#default_value' => $config['content_type'],
);
$cron_required = ' ' . l(t('Requires cron to be configured.'), 'http://drupal.org/cron', array('attributes' => array('target' => '_new')));
$period = drupal_map_assoc(array(900, 1800, 3600, 10800, 21600, 43200, 86400, 259200, 604800, 2419200), 'format_interval');
$period = drupal_map_assoc(array(
900,
1800,
3600,
10800,
21600,
43200,
86400,
259200,
604800,
2419200,
), 'format_interval');
foreach ($period as &$p) {
$p = t('Every !p', array('!p' => $p));
}
......@@ -361,11 +384,14 @@ class FeedsImporter extends FeedsConfigurable {
}
/**
* Overrides parent::configFormSubmit().
*
* Reschedule if import period changes.
*
* @param array $values
* An array that contains the values entered by the user through configForm.
*/
public function configFormSubmit(&$values) {
public function configFormSubmit(array &$values) {
if ($this->config['import_period'] != $values['import_period']) {
feeds_reschedule($this->id);
}
......@@ -386,11 +412,13 @@ class FeedsImporter extends FeedsConfigurable {
}
/**
* Helper, see FeedsDataProcessor class.
* Formats a time interval.
*
* @param int $timestamp
* The length of the interval in seconds.
*
* @return null|string
* @return string
* A translated string representation of the interval.
*/
function feeds_format_expire($timestamp) {
if ($timestamp == FEEDS_EXPIRE_NEVER) {
......
......@@ -2,7 +2,7 @@
/**
* @file
* Definition of FeedsSourceInterface and FeedsSource class.
* Definition of FeedsSourceInterface, FeedsState and FeedsSource class.
*/
/**
......@@ -21,19 +21,20 @@ define('FEEDS_PROCESS_CLEAR', 'process_clear');
define('FEEDS_PROCESS_EXPIRE', 'process_expire');
/**
* Declares an interface for a class that defines default values and form
* descriptions for a FeedSource.
* Defines an interface for a feed source.
*/
interface FeedsSourceInterface {
/**
* Returns if a plugin handles source specific configuration.
*
* Crutch: for ease of use, we implement FeedsSourceInterface for every
* plugin, but then we need to have a handle which plugin actually implements
* a source.
* source configuration.
*
* @see FeedsPlugin class.
* @see FeedsPlugin
*
* @return
* @return bool
* TRUE if a plugin handles source specific configuration, FALSE otherwise.
*/
public function hasSourceConfig();
......@@ -44,8 +45,9 @@ interface FeedsSourceInterface {
public function sourceDefaults();
/**
* Return a Form API form array that defines a form configuring values. Keys
* correspond to the keys of the return value of sourceDefaults().
* Returns a Form API form array that defines a form configuring values.
*
* Keys correspond to the keys of the return value of sourceDefaults().
*/
public function sourceForm($source_config);
......@@ -70,19 +72,28 @@ interface FeedsSourceInterface {
* Status of an import or clearing operation on a source.
*/
class FeedsState {
/**
* Floating point number denoting the progress made. 0.0 meaning no progress
* 1.0 = FEEDS_BATCH_COMPLETE meaning finished.
* Floating point number denoting the progress made.
*
* 0.0 meaning no progress.
* 1.0 = FEEDS_BATCH_COMPLETE, meaning finished.
*
* @var float
*/
public $progress;
/**
* Used as a pointer to store where left off. Must be serializable.
*
* @var mixed
*/
public $pointer;
/**
* Natural numbers denoting more details about the progress being made.
*
* @var int
*/
public $total;
public $created;
......@@ -95,6 +106,8 @@ class FeedsState {
/**
* IDs of entities to be removed.
*
* @var array
*/
public $removeList;
......@@ -103,14 +116,15 @@ class FeedsState {
*/
public function __construct() {
$this->progress = FEEDS_BATCH_COMPLETE;
$this->total =
$this->created =
$this->updated =
$this->deleted =
$this->unpublished =
$this->blocked =
$this->skipped =
$this->failed = 0;
$this->total
= $this->created
= $this->updated
= $this->deleted
= $this->unpublished
= $this->blocked
= $this->skipped
= $this->failed
= 0;
}
/**
......@@ -125,9 +139,9 @@ class FeedsState {
* - $progress is larger than $total
* - $progress approximates $total so that $finished rounds to 1.0
*
* @param $total
* @param int $total
* A natural number that is the total to be worked off.
* @param $progress
* @param int $progress
* A natural number that is the progress made on $total.
*/
public function progress($total, $progress) {
......@@ -148,6 +162,8 @@ class FeedsState {
}
/**
* Holds the source of a feed to import.
*
* This class encapsulates a source of a feed. It stores where the feed can be
* found and how to import it.
*
......@@ -172,9 +188,14 @@ class FeedsState {
*/
class FeedsSource extends FeedsConfigurable {
// Contains the node id of the feed this source info object is attached to.
// Equals 0 if not attached to any node - i. e. if used on a
// standalone import form within Feeds or by other API users.
/**
* Contains the node id of the feed this source info object is attached to.
*
* Equals 0 if not attached to any node - for example when used on a
* standalone import form within Feeds or by other API users.
*
* @var int
*/
protected $feed_nid;
/**
......@@ -185,26 +206,48 @@ class FeedsSource extends FeedsConfigurable {
protected $importer;
/**
* A FeedsSourceState object holding the current import/clearing state of this
* source.
*
* Array keys are stages, such as FEEDS_START or FEEDS_PARSE.
* Array values can be FeedsState objects, or integer timestamps, or possibly
* something else.
* Holds the current state of an import, clear or expire task.
*
* @todo Clarify the role of this variable.
* Array keys can be:
* - FEEDS_START
* Timestamp of when a task has started.
* - FEEDS_FETCH
* A FeedsState object holding the state of the fetch stage, used during
* imports.
* - FEEDS_PARSE
* A FeedsState object holding the state of the parse stage, used during
* imports.
* - FEEDS_PROCESS
* A FeedsState object holding the state of the process stage, used during
* imports.
* - FEEDS_PROCESS_CLEAR
* A FeedsState object holding the state of the clear task.
* - FEEDS_PROCESS_EXPIRE
* A FeedsState object holding the state of the expire task.
*
* @var FeedsState[]|array|null
*/
protected $state;
// Fetcher result, used to cache fetcher result when batching.
/**
* Fetcher result, used to cache fetcher result when batching.
*
* @var FeedsFetcherResult
*/
protected $fetcher_result;
// Timestamp when this source was imported the last time.
/**
* Timestamp of when this source was imported the last time.
*
* @var int
*/
protected $imported;
// Holds an exception object in case an exception occurs during importing.
/**
* Holds an exception object in case an exception occurs during importing.
*
* @var Exception|null
*/
protected $exception;
/**
......@@ -215,8 +258,9 @@ class FeedsSource extends FeedsConfigurable {
protected $accountSwitcher;
/**
* Instantiate a unique object per class/id/feed_nid. Don't use
* directly, use feeds_source() instead.
* Instantiates an unique FeedsSource per class, importer ID and Feed node ID.
*
* Don't use this method directly, use feeds_source() instead.
*
* @param string $importer_id
* The machine name of the importer.
......@@ -243,7 +287,8 @@ class FeedsSource extends FeedsConfigurable {
* @param string $importer_id
* The machine name of the importer.
* @param int $feed_nid
* The node id of a feed node if the source is attached to a feed node.
* The feed node ID for this Feeds source. This should be '0' if the
* importer is not attached to a content type.
* @param FeedsAccountSwitcherInterface $account_switcher
* The account switcher to use to be able to perform actions as a different
* user.
......@@ -262,9 +307,10 @@ class FeedsSource extends FeedsConfigurable {
}
/**
* Returns the FeedsImporter object that this source is expected to be used with.
* Returns the FeedsImporter object for this source.
*
* @return FeedsImporter
* The importer associated with this Feeds source.
*/
public function importer() {
return $this->importer;
......@@ -274,10 +320,10 @@ class FeedsSource extends FeedsConfigurable {
* Preview = fetch and parse a feed.
*
* @return FeedsParserResult
* FeedsParserResult object.
* A FeedsParserResult instance.
*
* @throws Exception
* Throws Exception if an error occurs when fetching or parsing.
* If an error occurs when fetching or parsing.
*/
public function preview() {
$result = $this->importer->fetcher->fetch($this);
......@@ -350,7 +396,7 @@ class FeedsSource extends FeedsConfigurable {
* Schedule periodic or background import tasks.
*
* @param bool $force
* (optional) force scheduling to happen.
* (optional) If true, forces the scheduling to happen.
* Defaults to true.
*/
public function scheduleImport($force = TRUE) {
......@@ -393,7 +439,7 @@ class FeedsSource extends FeedsConfigurable {
* Schedule background expire tasks.
*
* @param bool $force
* (optional) force scheduling to happen.
* (optional) If true, forces the scheduling to happen.
* Defaults to true.
*/
public function scheduleExpire($force = TRUE) {
......@@ -446,12 +492,12 @@ class FeedsSource extends FeedsConfigurable {
* This method only executes the current batch chunk, then returns. If you are
* looking to import an entire source, use FeedsSource::startImport() instead.
*
* @return
* @return float
* FEEDS_BATCH_COMPLETE if the import process finished. A decimal between
* 0.0 and 0.9 periodic if import is still in progress.
*
* @throws
* Throws Exception if an error occurs when importing.
* @throws Exception
* In case an error occurs when importing.
*/
public function import() {
$this->acquireLock();
......@@ -580,12 +626,12 @@ class FeedsSource extends FeedsConfigurable {
* looking to delete all items of a source, use FeedsSource::startClear()
* instead.
*
* @return
* @return float
* FEEDS_BATCH_COMPLETE if the clearing process finished. A decimal between
* 0.0 and 0.9 periodic if clearing is still in progress.
*
* @throws
* Throws Exception if an error occurs when clearing.
* @throws Exception
* In case an error occurs when clearing.
*/
public function clear() {
$this->acquireLock();
......@@ -676,9 +722,7 @@ class FeedsSource extends FeedsConfigurable {
/**
* Return a state object for a given stage. Lazy instantiates new states.
*
* @todo Rename getConfigFor() accordingly to config().
*
* @param $stage
* @param string $stage
* One of FEEDS_FETCH, FEEDS_PARSE, FEEDS_PROCESS or FEEDS_PROCESS_CLEAR.
*
* @return FeedsState|mixed
......@@ -687,7 +731,6 @@ class FeedsSource extends FeedsConfigurable {
* polluted with e.g. integer timestamps.
*
* @see FeedsSource::$state
* @todo Clarify the role of $this->state.
*/
public function state($stage) {
if (!is_array($this->state)) {
......@@ -784,11 +827,11 @@ class FeedsSource extends FeedsConfigurable {
}
// Special case for PostgreSQL: if using that database type, we cannot
// search in the data column of the queue table, because the Drupal database
// layer adds '::text' to bytea columns, which results into the data column
// becoming unreadable in conditions. So instead, we check for the first 10
// records in the queue to see if the given importer ID + feed NID is
// amongst them.
// search in the data column of the queue table, because the Drupal
// database layer adds '::text' to bytea columns, which results into the
// data column becoming unreadable in conditions. So instead, we check for
// the first 10 records in the queue to see if the given importer ID +
// feed NID is amongst them.
if (Database::getConnection()->databaseType() == 'pgsql') {
$items = db_query("SELECT data, created FROM {queue} WHERE name = :name AND expire = 0 LIMIT 10", array(
':name' => 'feeds_source_import',
......@@ -932,7 +975,11 @@ class FeedsSource extends FeedsConfigurable {
* @todo Patch CTools to move constants from export.inc to ctools.module.
*/
public function load() {
if ($record = db_query("SELECT imported, config, state, fetcher_result FROM {feeds_source} WHERE id = :id AND feed_nid = :nid", array(':id' => $this->id, ':nid' => $this->feed_nid))->fetchObject()) {
$record = db_query("SELECT imported, config, state, fetcher_result FROM {feeds_source} WHERE id = :id AND feed_nid = :nid", array(
':id' => $this->id,
':nid' => $this->feed_nid,
))->fetchObject();
if ($record) {
// While FeedsSource cannot be exported, we still use CTool's export.inc
// export definitions.
ctools_include('export');
......@@ -952,8 +999,7 @@ class FeedsSource extends FeedsConfigurable {
}
/**
* Delete configuration. Removes configuration information
* from database, does not delete configuration itself.
* Removes the feed source from the database.
*/
public function delete() {
// Alert implementers of FeedsSourceInterface to the fact that we're
......@@ -1044,11 +1090,8 @@ class FeedsSource extends FeedsConfigurable {
* An object that is an implementer of FeedsSourceInterface.
* @param array $config
* The configuration for $client.
*
* @return array
* An array stored for $client.
*/
public function setConfigFor(FeedsSourceInterface $client, $config) {
public function setConfigFor(FeedsSourceInterface $client, array $config) {
$this->config[get_class($client)] = $config;
}
......@@ -1056,6 +1099,7 @@ class FeedsSource extends FeedsConfigurable {
* Return defaults for feed configuration.
*
* @return array
* The default feed configuration, keyed per Feeds plugin.
*/
public function configDefaults() {
// Collect information from plugins.
......@@ -1107,11 +1151,11 @@ class FeedsSource extends FeedsConfigurable {
/**
* Background job helper. Starts a background job using the Drupal queue.
*
* @see FeedsSource::startImport()
* @see FeedsSource::startClear()
*
* @param string $method
* Method to execute on importer; one of 'import' or 'clear'.
*
* @see FeedsSource::startImport()
* @see FeedsSource::startClear()
*/
protected function startBackgroundJob($method) {
$job = array(
......@@ -1144,14 +1188,14 @@ class FeedsSource extends FeedsConfigurable {
/**
* Batch API helper. Starts a Batch API job.
*
* @param string $title
* Title to show to user when executing batch.
* @param string $method
* Method to execute on importer; one of 'import' or 'clear'.
*
* @see FeedsSource::startImport()
* @see FeedsSource::startClear()
* @see feeds_batch()
*
* @param $title
* Title to show to user when executing batch.
* @param $method
* Method to execute on importer; one of 'import' or 'clear'.
*/
protected function startBatchAPIJob($title, $method) {
$batch = array(
......@@ -1190,8 +1234,11 @@ class FeedsSource extends FeedsConfigurable {
}
/**
* Switches to the owner of the feed or user 1 if the importer is not attached
* to a content type.
* Switches account to the feed owner or user 1.
*
* To the feed owner is switched if the importer is attached to a content
* type. When using the standalone form, there is no feed owner, so then a
* switch to user 1 happens instead.
*/
protected function switchAccount() {
// Use author of feed node.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment