mcred/FeedMeNow-PHP

View on GitHub
src/FeedMeNow/Mapper/Provider.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php
namespace FeedMeNow\Mapper;

use FeedMeNow\Model\Restaurant;

class ProviderMapper
{
    private $data;

    public function __construct(array $data)
    {
        $this->data = $data;
    }

    public static function create(array $data)
    {
        $return = [];
        foreach ($data['results'] as $item) {
            $return[] = Restaurant::create($item);
        }
        return new self($return);
    }

    public function getData()
    {
        return $this->data;
    }
}