Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
69 lines (59 sloc) 1.39 KB
<?php
namespace Kunnu\Dropbox\Models;
class SearchResult extends BaseModel
{
/**
* Indicates what type of match was found for the result
*
* @var string
*/
protected $matchType = null;
/**
* File\Folder Metadata
*
* @var \Kunnu\Dropbox\Models\FileMetadata|\Kunnu\Dropbox\Models\FolderMetadata
*/
protected $metadata;
/**
* Create a new SearchResult instance
*
* @param array $data
*/
public function __construct(array $data)
{
parent::__construct($data);
$matchType = $this->getDataProperty('match_type');
$this->matchType = isset($matchType['.tag']) ? $matchType['.tag'] : null;
$this->setMetadata();
}
/**
* Set Metadata
*
* @return void
*/
protected function setMetadata()
{
$metadata = $this->getDataProperty('metadata');
if (is_array($metadata)) {
$this->metadata = ModelFactory::make($metadata);
}
}
/**
* Indicates what type of match was found for the result
*
* @return bool
*/
public function getMatchType()
{
return $this->matchType;
}
/**
* Get the Search Result Metadata
*
* @return \Kunnu\Dropbox\Models\FileMetadata|\Kunnu\Dropbox\Models\FolderMetadata
*/
public function getMetadata()
{
return $this->metadata;
}
}
You can’t perform that action at this time.