diff --git a/src/ActivityStreams/Link.php b/src/ActivityStreams/Link.php index fddae71ab..b5c249e0d 100644 --- a/src/ActivityStreams/Link.php +++ b/src/ActivityStreams/Link.php @@ -2,7 +2,9 @@ namespace Code\ActivityStreams; -class Link +use Code\Lib\BaseObject; + +class Link extends BaseObject { public $type; public $href; @@ -15,24 +17,6 @@ class Link public $preview; - public function __construct($input = null, $strict = false) - { - if (isset($input)) { - if (is_string($input)) { - $this->string = $input; - } - elseif(is_array($input)) { - foreach ($input as $key => $value) { - $key = ($key === '@context') ? 'ldcontext' : $key; - if ($strict && !property_exists($this, $key)) { - throw new UnhandledElementException("Unhandled element: $key"); - } - $this->{$key} = $value; - } - } - } - return $this; - } /** * @return mixed @@ -52,8 +36,6 @@ class Link return $this; } - - /** * @return mixed */ @@ -198,25 +180,4 @@ class Link return $this; } - public function toArray() - { - if ($this->string) { - return $this->string; - } - $returnValue = []; - foreach ((array) $this as $key => $value) { - if (isset($value)) { - $key = ($key === 'ldcontext') ? '@context' : $key; - if ($value instanceof ASObject || $value instanceof Link) { - $returnValue[$key] = $value->toArray(); - } - else { - $returnValue[$key] = $value; - } - } - } - return $returnValue; - } - - }