Skip to content

Commit

Permalink
add new json objects, value formatters, removed unused methodes, changed
Browse files Browse the repository at this point in the history
type hintings #1756
  • Loading branch information
nadar committed Jan 23, 2018
1 parent 26ae091 commit 19bb2de
Show file tree
Hide file tree
Showing 52 changed files with 1,215 additions and 1,254 deletions.
22 changes: 22 additions & 0 deletions core/web/jsonld/AggregateRating.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace luya\web\jsonld;

/**
* http://schema.org/AggregateRating
*
* @author Basil Suter <basil@nadar.io>
* @since 1.0.3
*/
class AggregateRating extends BaseThing implements AggregateRatingInterface
{
use AggregateRatingTrait;

/**
* @inheritdoc
*/
public function typeDefintion()
{
return 'AggregateRating';
}
}
13 changes: 13 additions & 0 deletions core/web/jsonld/AggregateRatingInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace luya\web\jsonld;

/**
* http://schema.org/AggregateRating
*
* @author Basil Suter <basil@nadar.io>
* @since 1.0.3
*/
interface AggregateRatingInterface extends RatingInterface
{
}
14 changes: 14 additions & 0 deletions core/web/jsonld/AggregateRatingTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace luya\web\jsonld;

/**
* http://schema.org/AggregateRating
*
* @author Basil Suter <basil@nadar.io>
* @since 1.0.3
*/
trait AggregateRatingTrait
{
use RatingTrait;
}
9 changes: 0 additions & 9 deletions core/web/jsonld/ArticleInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,6 @@ public function getPagination();
*/
public function setPagination($pagination);

/**
* @return SpeakableSpecification|URL
*/
public function getSpeakable();

/**
* @param SpeakableSpecification|URL $speakable
*/
public function setSpeakable($speakable);

/**
* @return int
Expand Down
39 changes: 0 additions & 39 deletions core/web/jsonld/ArticleTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,45 +125,6 @@ public function setPagination($pagination)
return $this;
}

private $_speakable;

/**
* @return SpeakableSpecification|URL
*/
public function getSpeakable()
{
return $this->_speakable;
}

/**
* Indicates sections of a Web page that are particularly 'speakable' in the sense of being highlighted as being
* especially appropriate for text-to-speech conversion. Other sections of a page may also be usefully spoken in
* particular circumstances; the 'speakable' property serves to indicate the parts most likely
* to be generally useful for speech.
*
* The speakable property can be repeated an arbitrary number of times,
* with three kinds of possible 'content-locator' values:
*
* 1.) id-value URL references - uses id-value of an element in the page being annotated. The simplest use
* of speakable has (potentially relative) URL values, referencing identified sections of the document concerned.
*
* 2.) CSS Selectors - addresses content in the annotated page, eg. via class attribute. Use the cssSelector property.
*
* 3.) XPaths - addresses content via XPaths (assuming an XML view of the content). Use the xpath property.
*
* For more sophisticated markup of speakable sections beyond simple ID references, either CSS selectors
* or XPath expressions to pick out document section(s) as speakable. For this we define a supporting type,
* SpeakableSpecification which is defined to be a possible value of the speakable property.
*
* @param SpeakableSpecification|URL $speakable
* @return Article|ArticleTrait
*/
public function setSpeakable($speakable)
{
$this->_speakable = $speakable;
return $this;
}

private $_wordCount;

/**
Expand Down
19 changes: 19 additions & 0 deletions core/web/jsonld/BaseValue.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace luya\web\jsonld;

/**
* Represents any value object.
*
* Value objects are used to formate the value of a property.
*
* @author Basil Suter <basil@nadar.io>
* @since 1.0.3
*/
abstract class BaseValue
{
/**
* Get the value to assign from BaseValue.
*/
abstract public function getValue();
}
22 changes: 22 additions & 0 deletions core/web/jsonld/Comment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace luya\web\jsonld;

/**
* http://schema.org/Comment
*
* @author Basil Suter <basil@nadar.io>
* @since 1.0.3
*/
class Comment extends BaseThing implements CommentInterface
{
use CommentTrait;

/**
* @inheritdoc
*/
public function typeDefintion()
{
return 'Comment';
}
}
13 changes: 13 additions & 0 deletions core/web/jsonld/CommentInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace luya\web\jsonld;

/**
* http://schema.org/Comment
*
* @author Basil Suter <basil@nadar.io>
* @since 1.0.3
*/
interface CommentInterface extends CreativeWorkInterface
{
}
14 changes: 14 additions & 0 deletions core/web/jsonld/CommentTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace luya\web\jsonld;

/**
* http://schema.org/Comment
*
* @author Basil Suter <basil@nadar.io>
* @since 1.0.3
*/
trait CommentTrait
{
use CreativeWorkTrait;
}
22 changes: 22 additions & 0 deletions core/web/jsonld/ContactPoint.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace luya\web\jsonld;

/**
* http://schema.org/Comment
*
* @author nadar
*
*/
class ContactPoint extends BaseThing implements ContactPointInterface
{
use ContactPointTrait;

/**
* @inheritdoc
*/
public function typeDefintion()
{
return 'ContactPoint';
}
}
14 changes: 14 additions & 0 deletions core/web/jsonld/ContactPointInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace luya\web\jsonld;

interface ContactPointInterface extends ThingInterface
{
public function setEmail($email);

public function getEmail();

public function setTelephone($telephone);

public function getTelephone();
}
36 changes: 36 additions & 0 deletions core/web/jsonld/ContactPointTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace luya\web\jsonld;

trait ContactPointTrait
{
use ThingTrait;

private $_email;

public function setEmail($email)
{
$this->_email = $email;

return $this;
}

public function getEmail()
{
return $this->_email;
}

private $_telephone;

public function setTelephone($telephone)
{
$this->_telephone = $telephone;

return $this;
}

public function getTelephone()
{
return $this->_telephone;
}
}
22 changes: 22 additions & 0 deletions core/web/jsonld/Country.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace luya\web\jsonld;

/**
* http://schema.org/Country
*
* @author Basil Suter <basil@nadar.io>
* @since 1.0.3
*/
class Country extends BaseThing implements CountryInterface
{
use CountryTrait;

/**
* @inheritdoc
*/
public function typeDefintion()
{
return 'Country';
}
}
13 changes: 13 additions & 0 deletions core/web/jsonld/CountryInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace luya\web\jsonld;

/**
* http://schema.org/Country
*
* @author Basil Suter <basil@nadar.io>
* @since 1.0.3
*/
interface CountryInterface extends PlaceInterface
{
}
14 changes: 14 additions & 0 deletions core/web/jsonld/CountryTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace luya\web\jsonld;

/**
* http://schema.org/Country
*
* @author Basil Suter <basil@nadar.io>
* @since 1.0.3
*/
trait CountryTrait
{
use PlaceTrait;
}
Loading

0 comments on commit 19bb2de

Please sign in to comment.