Code Duplication    Length = 18-18 lines in 2 locations

src/Sioen/JsonToHtml/IngredientsConverter.php 1 location

@@ 5-22 (lines=18) @@
2
3
namespace Sioen\JsonToHtml;
4
5
final class IngredientsConverter implements Converter
6
{
7
    public function toHtml(array $data)
8
    {
9
        $html = '<p><strong>Ingredients</strong></p>';
10
        $html .= '<ul>';
11
        foreach ($data['listItems'] as $listItem) {
12
            $html .= '<li itemprop="recipeIngredient">'.$listItem['content'].'</li>';
13
        }
14
        $html .= '</ul>';
15
        return $html;
16
    }
17
18
    public function matches($type)
19
    {
20
        return $type === 'ingredients';
21
    }
22
}
23

src/Sioen/JsonToHtml/MethodConverter.php 1 location

@@ 5-22 (lines=18) @@
2
3
namespace Sioen\JsonToHtml;
4
5
final class MethodConverter implements Converter
6
{
7
    public function toHtml(array $data)
8
    {
9
        $html = '<p itemprop="recipeInstructions"><strong>How to Mix</strong></p>';
10
        $html .= '<ul>';
11
        foreach ($data['listItems'] as $listItem) {
12
            $html .= '<li>'.$listItem['content'].'</li>';
13
        }
14
        $html .= '</ul>';
15
        return $html;
16
    }
17
18
    public function matches($type)
19
    {
20
        return $type === 'method';
21
    }
22
}
23