Skip to content

Commit

Permalink
Merge branch 'feature/recursive-bug'
Browse files Browse the repository at this point in the history
  • Loading branch information
reganlawton committed Sep 16, 2019
2 parents 64807e3 + 5ddc974 commit 8815797
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/models/OembedModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,17 @@ public function rules()
];
}

public function parseArray($arr)
{
if (is_array($arr) && !empty($arr['url'])) {
if(is_array($arr['url'])) {
return $this->parseArray($arr['url']);
}
return $arr['url'];
}
return null;
}

public function getUrl()
{
$value = $this->url;
Expand All @@ -79,22 +90,11 @@ public function getUrl()
}

if(is_array($value)) {
if (isset($value['url'])) {
if(is_array($value['url'])) {
if(is_array($value['url']['url'])) {
if(is_array($value['url']['url']['url'])) {
return $value['url']['url']['url']['url'];
}
return $value['url']['url']['url'];
}
return $value['url']['url'];
}
return $value['url'];
}
return null;
$value = $this->parseArray($value);
}

return $value ? $value : null;
$this->url = $value ? $value : null;
return $this->url;
}

/**
Expand Down

0 comments on commit 8815797

Please sign in to comment.