-
-
Notifications
You must be signed in to change notification settings - Fork 22
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 #13 from freearhey/dev
Upgrade to v3.2.0
- Loading branch information
Showing
14 changed files
with
345 additions
and
154 deletions.
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
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
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,41 @@ | ||
<?php | ||
|
||
namespace Wikidata; | ||
|
||
class Qualifier | ||
{ | ||
/** | ||
* @var string Qualifier Id | ||
*/ | ||
public $id; | ||
|
||
/** | ||
* @var string Qualifier label | ||
*/ | ||
public $label; | ||
|
||
/** | ||
* @var string Qualifier value | ||
*/ | ||
public $value; | ||
|
||
/** | ||
* @param array $data | ||
*/ | ||
public function __construct($data) | ||
{ | ||
$this->parseData($data); | ||
} | ||
|
||
/** | ||
* Parse input data | ||
* | ||
* @param array $data | ||
*/ | ||
private function parseData($data) | ||
{ | ||
$this->id = get_id($data['qualifier']); | ||
$this->label = $data['qualifierLabel']; | ||
$this->value = $data['qualifierValueLabel']; | ||
} | ||
} |
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,49 @@ | ||
<?php | ||
|
||
namespace Wikidata; | ||
|
||
use Wikidata\Qualifier; | ||
|
||
class Value | ||
{ | ||
/** | ||
* @var string Value Id | ||
*/ | ||
public $id; | ||
|
||
/** | ||
* @var string Value label | ||
*/ | ||
public $label; | ||
|
||
/** | ||
* @var \Illuminate\Support\Collection Collection of value qualifiers | ||
*/ | ||
public $qualifiers; | ||
|
||
/** | ||
* @param array $data | ||
*/ | ||
public function __construct($data) | ||
{ | ||
$this->parseData($data); | ||
} | ||
|
||
/** | ||
* Parse input data | ||
* | ||
* @param array $data | ||
*/ | ||
private function parseData($data) | ||
{ | ||
$this->id = get_id($data[0]['propertyValue']); | ||
$this->label = $data[0]['propertyValueLabel']; | ||
$this->qualifiers = collect($data)->map(function($item) { | ||
if($item['qualifier']) { | ||
return new Qualifier($item); | ||
} | ||
|
||
return null; | ||
})->filter(); | ||
} | ||
} |
Oops, something went wrong.