Skip to content

Commit

Permalink
Rename "jsonPointer" to "reference" to better describe what it actual is
Browse files Browse the repository at this point in the history
  • Loading branch information
shauno committed Apr 3, 2018
1 parent 3959d05 commit cc5e4b3
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
4 changes: 3 additions & 1 deletion src/ErrorCatalog.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function addItem(ErrorCatalogItem $error)

/**
* @param $name
* @return ErrorCatalogItem
* @return ErrorCatalogItem|null
*/
public function getItem($name)
{
Expand All @@ -51,5 +51,7 @@ public function getItem($name)
return $error;
}
}

return null;
}
}
4 changes: 2 additions & 2 deletions src/ErrorCatalogItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ public function getIssueById($id)
return $return;
}

public function getIssueByJsonPointer($jsonPointer)
public function getIssueByReference($reference)
{
$return = [];
foreach ($this->issues as $issue) {
if ($issue->getJsonPointer() == $jsonPointer) {
if ($issue->getReference() == $reference) {
$return[] = $issue;
}
}
Expand Down
27 changes: 21 additions & 6 deletions src/ErrorSpecIssue.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,47 @@ class ErrorSpecIssue
protected $id;

/**
* @var string The JSON pointer to identify the issue
* @var string A reference to identify the issue by. Can be used to retrieve the issue but normally not shown in the catalog
*/
protected $jsonPointer;
protected $reference;

/**
* @var string $issue Use String Formatter syntax to format the issue as a parameterized string. Localize the string.
*/
protected $issue;

public function __construct($id, $jsonPointer, $issue)
/**
* ErrorSpecIssue constructor.
* @param string $id
* @param string $reference
* @param string $issue
*/
public function __construct($id, $reference, $issue)
{
$this->id = $id;
$this->jsonPointer = $jsonPointer;
$this->reference = $reference;
$this->issue = $issue;
}

/**
* @return string
*/
public function getId()
{
return $this->id;
}

public function getJsonPointer()
/**
* @return string
*/
public function getReference()
{
return $this->jsonPointer;
return $this->reference;
}

/**
* @return string
*/
public function getIssue()
{
return $this->issue;
Expand Down

0 comments on commit cc5e4b3

Please sign in to comment.