Skip to content

Commit

Permalink
PHPDoc and $child->canShow Method again
Browse files Browse the repository at this point in the history
  • Loading branch information
bmarwell committed Sep 4, 2015
1 parent 594c208 commit a16a231
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/JsonLD/JsonLD.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
abstract class JsonLD
{

/**
* Creates a JsonLD-Objekt with type set to $jsonldtype.
* @param String $jsonldtype
* @param bool|FALSE $addContext
*/
function __construct($jsonldtype, $addContext = FALSE)
{
Log::addDebugLog("creating JsonLD-object");
Expand All @@ -29,7 +34,6 @@ function __construct($jsonldtype, $addContext = FALSE)
$id = "@id";

if ($addContext === true) {
Log::addDebugLog("adding context…");
$this->$context = "http://schema.org";
}

Expand Down
2 changes: 1 addition & 1 deletion src/JsonLD/JsonLDTools.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ public static function addChildrenFromRecord($person, $record)
}

foreach ($children as $child) {
if (!($child->canShowName())) {
if (!$child->canShow()) {
continue;
}
$childPerson = new Person();
Expand Down
38 changes: 36 additions & 2 deletions src/JsonLD/Person.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@

namespace bmarwell\WebtreesModules\jsonld;

use Fisharebest\Webtrees\Log;
use Fisharebest\Webtrees\Place;

/**
* Person for serializing into json-ld. Vars have name from schema.org.
*/
class Person extends JsonLD
{
/**
* @var
*/
public $name;

/**
Expand All @@ -38,6 +40,10 @@ class Person extends JsonLD
* @var String the last name or family name.
*/
public $familyName;
/**
* Date of Birth in ISO.
* @var String $birthDate;
*/
public $birthDate;

/**
Expand All @@ -58,10 +64,27 @@ class Person extends JsonLD
*/
public $deathDate;

/**
* E-Mail adress as string.
* @var String $email
*/
public $email;
/**
* @var String $url
*/
public $url;
/**
* @var array $address
*/
public $address = array();
/**
* U or M or F.
* @var string Gender
*/
public $gender = "U";
/**
* @var array
*/
public $parents = array();

/**
Expand All @@ -75,22 +98,33 @@ class Person extends JsonLD
*/
public $image;

/**
* @param bool|FALSE $addContext
*/
function __construct($addContext = FALSE)
{
Log::addDebugLog("creating person, context is $addContext");
parent::__construct("Person", $addContext);
}

/**
* @param Person $address
*/
function addAddress($address)
{
array_push($this->address, $address);
}

/**
* @param Person $parent
*/
function addParent($parent)
{
array_push($this->parents, $parent);
}

/**
* @param Person $child
*/
function addChild($child)
{
array_push($this->children, $child);
Expand Down
4 changes: 4 additions & 0 deletions src/JsonLD/jsonld_Place.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ class jsonld_Place extends JsonLD
*/
public $address;

/**
* Construct using context?
* @param bool|FALSE $addContext
*/
function __construct($addContext = FALSE)
{
parent::__construct("Place", $addContext);
Expand Down

0 comments on commit a16a231

Please sign in to comment.