-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from oliversarfas/master
Add CardMarket Data
- Loading branch information
Showing
8 changed files
with
750 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
|
||
} |
Oops, something went wrong.