Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00%
1 / 1
100.00%
4 / 4
CRAP
100.00%
11 / 11
StripTagsProcessor
100.00%
1 / 1
100.00%
4 / 4
5
100.00%
11 / 11
 setAllowedTagsForContent($allowedTags)
100.00%
1 / 1
1
100.00%
2 / 2
 setAllowedTagsForIntro($allowedTags)
100.00%
1 / 1
1
100.00%
2 / 2
 process(array $items)
100.00%
1 / 1
2
100.00%
4 / 4
 doClean(Item $item)
100.00%
1 / 1
1
100.00%
3 / 3
<?php
/**
* This file is part of the planetubuntu package.
*
* (c) Daniel González <daniel@desarrolla2.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace FastFeed\Processor;
use FastFeed\Item;
/**
* StripTagsProcessor
*/
class StripTagsProcessor implements ProcessorInterface
{
/**
* @var
*/
protected $allowedTags = array('content', 'intro');
/**
* @param mixed $allowedTags
*/
public function setAllowedTagsForContent($allowedTags)
{
$this->allowedTags['content'] = $allowedTags;
}
/**
* @param mixed $allowedTags
*/
public function setAllowedTagsForIntro($allowedTags)
{
$this->allowedTags['intro'] = $allowedTags;
}
/**
* Execute processor
*
* @param array $items
*
* @return array $items
*/
public function process(array $items)
{
foreach ($items as $key => $item) {
$items[$key] = $this->doClean($item);
}
return $items;
}
/**
* @param Item $item
*
* @return Item
*/
protected function doClean(Item $item)
{
$item->setIntro(strip_tags($item->getIntro(), $this->allowedTags['intro']));
$item->setContent(strip_tags($item->getContent(), $this->allowedTags['content']));
return $item;
}
}