Skip to content

Commit

Permalink
Fix typo
Browse files Browse the repository at this point in the history
This was revealed by PHPStan.
  • Loading branch information
jtojnar committed Aug 15, 2023
1 parent 8de3474 commit f502060
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@ private function makeChannels()
$out .= "</rdf:Seq>" . PHP_EOL . "</items>" . PHP_EOL . "</channel>" . PHP_EOL;

// An image has its own element after the channel elements.
if (array_key_exists('image', $this->data))
if (array_key_exists('Image', $this->data))
$out .= $this->makeNode('image', $this->data['Image'], array('rdf:about' => $this->data['Image']['url']));
} else if ($this->version == Feed::ATOM) {
// ATOM feeds have a unique feed ID. Use the title channel element as key.
Expand Down
15 changes: 11 additions & 4 deletions Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,35 @@
* @package UniversalFeedWriter
* @author Anis uddin Ahmad <[email protected]>
* @link http://www.ajaxray.com/projects/rss
* @phpstan-type Element array{name: string, content: string, attributes: array<string, string>}
*/
class Item
{
/**
* Collection of feed item elements
*
* @var array<string, Element>
*/
private $elements = array();

/**
* Contains the format of this feed.
*
* @var Feed::RSS1|Feed::RSS2|Feed::ATOM
*/
private $version;

/**
* Is used as a suffix when multiple elements have the same name.
*
* @var int
**/
private $_cpt = 0;

/**
* Constructor
*
* @param string $version constant (RSS1/RSS2/ATOM) RSS2 is default.
* @param Feed::RSS1|Feed::RSS2|Feed::ATOM $version constant (RSS1/RSS2/ATOM) RSS2 is default.
*/
public function __construct($version = Feed::RSS2)
{
Expand All @@ -77,7 +84,7 @@ private function cpt()
* @access public
* @param string $elementName The tag name of an element
* @param string $content The content of tag
* @param array $attributes Attributes (if any) in 'attrName' => 'attrValue' format
* @param array<string, string> $attributes Attributes (if any) in 'attrName' => 'attrValue' format
* @param boolean $overwrite Specifies if an already existing element is overwritten.
* @param boolean $allowMultiple Specifies if multiple elements of the same name are allowed.
* @return self
Expand Down Expand Up @@ -113,7 +120,7 @@ public function addElement($elementName, $content, array $attributes = null, $ov
* Elements which have attributes cannot be added by this method
*
* @access public
* @param array array of elements in 'tagName' => 'tagContent' format.
* @param array<string, string> array of elements in 'tagName' => 'tagContent' format.
* @return self
*/
public function addElementArray(array $elementArray)
Expand All @@ -129,7 +136,7 @@ public function addElementArray(array $elementArray)
* Return the collection of elements in this feed item
*
* @access public
* @return array All elements of this item.
* @return array<string, Element> All elements of this item.
* @throws InvalidOperationException on ATOM feeds if either a content or link element is missing.
* @throws InvalidOperationException on RSS1 feeds if a title or link element is missing.
*/
Expand Down

0 comments on commit f502060

Please sign in to comment.