Permalink
Browse files

Change coding style to PSR-2

This closes #1.
  • Loading branch information...
1 parent 60e5c5a commit 8d0013a24be1bd48e421f679085ee967386e83ef @lanthaler committed Dec 13, 2012
View
@@ -49,7 +49,6 @@ class Document
*/
private $blankNodeCounter = 0;
-
/**
* Parses a JSON-LD document and returns it as a {@link Document}.
*
@@ -70,7 +69,7 @@ class Document
* - <em>base</em> The base IRI of the input document.
*
* @param string|array|object $document The JSON-LD document to process.
- * @param null|array|object $options Options to configure the processing.
+ * @param null|array|object $options Options to configure the processing.
*
* @return Document The parsed JSON-LD document.
*
@@ -102,20 +101,17 @@ public function __construct($baseIri = null)
* that node will be returned instead of creating a new one.
*
* @param null|string $id The ID of the node.
+ *
* @return Node The newly created node.
*/
public function createNode($id = null)
{
- if (!is_string($id) || ('_:' === substr($id, 0, 2)))
- {
+ if (!is_string($id) || ('_:' === substr($id, 0, 2))) {
$id = $this->createBlankNodeId();
$abs_id = $id;
- }
- else
- {
+ } else {
$id = (string) $this->baseIri->resolve($id);
- if (isset($this->nodes[$id]))
- {
+ if (isset($this->nodes[$id])) {
return $this->nodes[$id];
}
}
@@ -133,15 +129,13 @@ public function createNode($id = null)
*/
public function remove(Node $node)
{
- if ($node->getDocument() === $this)
- {
+ if ($node->getDocument() === $this) {
$node->removeFromDocument();
}
$id = $node->getId();
- if (!$node->isBlankNode())
- {
+ if (!$node->isBlankNode()) {
$id = (string) $this->baseIri->resolve($id);
}
@@ -168,8 +162,7 @@ public function getNodes()
*/
public function getNode($id)
{
- if (!((strlen($id) >= 2) && ('_:' === substr($id, 0, 2))))
- {
+ if (!((strlen($id) >= 2) && ('_:' === substr($id, 0, 2)))) {
$id = (string) $this->baseIri->resolve($id);
}
@@ -188,10 +181,8 @@ public function getNode($id)
*/
public function getNodesByType($type)
{
- if (is_string($type))
- {
- if (null === ($type = $this->getNode($type)))
- {
+ if (is_string($type)) {
+ if (null === ($type = $this->getNode($type))) {
return array();
}
}
@@ -207,27 +198,24 @@ public function getNodesByType($type)
* will always return false except a node instance
* which is part of the document will be passed
* instead of a string.
+ *
* @return bool Returns true if the document contains a node with the
* specified ID; false otherwise.
*/
public function contains($id)
{
$node = $id;
- if ($node instanceof Node)
- {
+ if ($node instanceof Node) {
$id = $node->getId();
}
- if ((null === $id) || !is_string($id))
- {
+ if ((null === $id) || !is_string($id)) {
return false;
}
- if ((strlen($id) >= 2) && ('_:' === substr($id, 0, 2)))
- {
- if (isset($this->nodes[$id]) && ($node === $this->nodes[$id]))
- {
+ if ((strlen($id) >= 2) && ('_:' === substr($id, 0, 2))) {
+ if (isset($this->nodes[$id]) && ($node === $this->nodes[$id])) {
return true;
}
@@ -11,7 +11,6 @@
use ML\JsonLD\Quad;
-
/**
* Exception that is thrown when an invalid quad is detected.
*
@@ -26,7 +25,6 @@ class InvalidQuadException extends \RuntimeException
*/
private $quad;
-
/**
* Constructor.
*
@@ -30,7 +30,6 @@ class ParseException extends \RuntimeException
*/
private $rawMessage;
-
/**
* Constructor.
*
@@ -11,7 +11,6 @@
use ML\JsonLD\JsonLD;
-
/**
* Exception class thrown when an error occurs during processing.
*
@@ -40,7 +39,6 @@ class ProcessException extends \RuntimeException
*/
private $rawMessage;
-
/**
* Constructor.
*
@@ -11,7 +11,6 @@
use ML\JsonLD\JsonLD;
-
/**
* Exception class thrown when a JSON-LD syntax error is detected.
*
@@ -40,7 +39,6 @@ class SyntaxException extends \RuntimeException
*/
private $rawMessage;
-
/**
* Constructor.
*
Oops, something went wrong.

0 comments on commit 8d0013a

Please sign in to comment.