Skip to content

Commit

Permalink
Merge pull request #12 from oliversarfas/master
Browse files Browse the repository at this point in the history
Add CardMarket Data
  • Loading branch information
mmonkey authored Aug 10, 2021
2 parents 5ac3dbf + 95e6179 commit ef64074
Show file tree
Hide file tree
Showing 8 changed files with 750 additions and 1 deletion.
21 changes: 21 additions & 0 deletions src/Models/Card.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ class Card extends Model
*/
private $tcgplayer;

/**
* @var CardMarket|null
*/
private $cardmarket;

/**
* @return string
*/
Expand Down Expand Up @@ -535,4 +540,20 @@ public function setTcgplayer(?TCGPlayer $tcgplayer)
$this->tcgplayer = $tcgplayer;
}

/**
* @return CardMarket|null
*/
public function getCardmarket(): ?CardMarket
{
return $this->cardmarket;
}

/**
* @param CardMarket|null $cardMarket
*/
public function setCardmarket(?CardMarket $cardMarket): void
{
$this->cardmarket = $cardMarket;
}

}
102 changes: 102 additions & 0 deletions src/Models/CardMarket.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<?php

namespace Pokemon\Models;

/**
* Class CardMarket
*
* @package Pokemon\Models
*/
class CardMarket extends Model
{

/**
* @var string
*/
private $url;

/**
* @var string|null
*/
private $updatedAt;

/**
* @var CardMarketPrices|null
*/
private $prices;

/**
* @return string|null
*/
public function getUrl(): ?string
{
return $this->url;
}

/**
* @param string|null $url
*/
public function setUrl(?string $url)
{
$this->url = $url;
}

/**
* @return string|null
*/
public function getUpdatedAt(): ?string
{
return $this->updatedAt;
}

/**
* @param string|null $updatedAt
*/
public function setUpdatedAt(?string $updatedAt)
{
$this->updatedAt = $updatedAt;
}

/**
* @return CardMarketPrices|null
*/
public function getPrices(): ?CardMarketPrices
{
return $this->prices;
}

/**
* @param CardMarketPrices|null $prices
*/
public function setPrices(?CardMarketPrices $prices)
{
$this->prices= $prices;
}

/**
* @param string $attribute
* @param mixed $value
*
* @return mixed|Model
*/
protected function parse($attribute, $value)
{
if (is_object($value)) {
switch ($attribute) {
case 'prices':
$class = '\\Pokemon\\Models\\CardMarketPrices';
break;
}

if (class_exists($class)) {
/** @var Model $model */
$model = new $class;
$model->fill($value);
$value = $model;
}
}

return $value;
}

}
Loading

0 comments on commit ef64074

Please sign in to comment.