File tree Expand file tree Collapse file tree 4 files changed +14
-19
lines changed
lib/internal/Magento/Framework/App Expand file tree Collapse file tree 4 files changed +14
-19
lines changed Original file line number Diff line number Diff line change 99use Magento \Framework \App \Rss \DataProviderInterface ;
1010use Magento \Framework \Serialize \SerializerInterface ;
1111use Magento \Framework \App \FeedFactoryInterface ;
12+ use Magento \Framework \App \FeedInterface ;
1213
1314/**
1415 * Provides functionality to work with RSS feeds
@@ -101,13 +102,7 @@ public function setDataProvider(DataProviderInterface $dataProvider)
101102 */
102103 public function createRssXml ()
103104 {
104- $ feed = $ this ->feedFactory ->create (
105- $ this ->getFeeds (),
106- \Magento \Framework \App \FeedFactoryInterface::DEFAULT_FORMAT
107- );
108-
109- return $ feed ->getFormatedContentAs (
110- \Magento \Framework \App \FeedInterface::DEFAULT_FORMAT
111- );
105+ $ feed = $ this ->feedFactory ->create ($ this ->getFeeds (), FeedFactoryInterface::DEFAULT_FORMAT );
106+ return $ feed ->getFormattedContentAs (FeedInterface::DEFAULT_FORMAT );
112107 }
113108}
Original file line number Diff line number Diff line change @@ -152,7 +152,7 @@ public function testCreateRssXml()
152152 $ dataProvider ->expects ($ this ->any ())->method ('getRssData ' )->will ($ this ->returnValue ($ this ->feedData ));
153153
154154 $ this ->feedMock ->expects ($ this ->once ())
155- ->method ('getFormatedContentAs ' )
155+ ->method ('getFormattedContentAs ' )
156156 ->with (\Magento \Framework \App \FeedInterface::DEFAULT_FORMAT )
157157 ->will ($ this ->returnValue ($ this ->feedXml ));
158158
Original file line number Diff line number Diff line change 55 */
66namespace Magento \Framework \App ;
77
8- use \Magento \Framework \App \FeedInterface ;
8+ use Magento \Framework \Phrase ;
9+ use Magento \Framework \Exception \InputException ;
910
1011class Feed implements \Magento \Framework \App \FeedInterface
1112{
@@ -25,17 +26,17 @@ public function __construct(\Zend_Feed_Abstract $feed)
2526 /**
2627 * Get the xml from Zend_Feed_Abstract object
2728 *
29+ * @param string $format
2830 * @return string
31+ * @throws InputException
2932 */
30- public function getFormatedContentAs (
31- $ format = FeedInterface::DEFAULT_FORMAT
32- ) {
33+ public function getFormattedContentAs (string $ format = FeedInterface::DEFAULT_FORMAT ): string
34+ {
3335 if ($ format === FeedInterface::DEFAULT_FORMAT ) {
3436 return $ this ->feed ->saveXml ();
3537 }
36- throw new \Magento \Framework \Exception \RuntimeException (
37- __ ('Given feed format is not supported ' ),
38- $ e
38+ throw new InputException (
39+ new Phrase ('Given feed format is not supported ' )
3940 );
4041 }
4142}
Original file line number Diff line number Diff line change @@ -10,9 +10,8 @@ interface FeedInterface
1010 const DEFAULT_FORMAT = 'xml ' ;
1111
1212 /**
13+ * @param string $format
1314 * @return string
1415 */
15- public function getFormatedContentAs (
16- $ format = self ::DEFAULT_FORMAT
17- );
16+ public function getFormattedContentAs (string $ format = self ::DEFAULT_FORMAT ): string ;
1817}
You can’t perform that action at this time.
0 commit comments