Skip to content

Instantly share code, notes, and snippets.

@BerezhniyDmitro
Created February 19, 2019 11:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BerezhniyDmitro/97027d4512974803fcc8872d3176ff36 to your computer and use it in GitHub Desktop.
Save BerezhniyDmitro/97027d4512974803fcc8872d3176ff36 to your computer and use it in GitHub Desktop.
<?php
namespace App\Models\ServiceOffer\DTO;
/**
* Class ServiceOfferDTO обьект DTO
*/
class ServiceOfferDTO implements IServiceOfferDTO
{
/**
* @var string
*/
private $url;
/**
* @var string
*/
private $title;
/**
* @var string
*/
private $text;
/**
* ServiceOfferDTO constructor.
*
* @param array $data
*/
private function __construct(array $data)
{
$this->url = $data['url'];
$this->title = $data['url'];
$this->text = $data['url'];
}
/**
* Создаем ДТО с массива данных
*
* @param array $data
* @return ServiceOfferDTO
*/
public static function createFromPostData(array $data)
{
return new self($data);
}
/**
* @return string
*/
public function getText()
{
return $this->text;
}
/**
* @return string
*/
public function getUrl()
{
return $this->url;
}
/**
* @return string
*/
public function getTitle()
{
return $this->title;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment