Skip to content

Commit

Permalink
Removed phpdoc helpers as the functionality has been moved to the con…
Browse files Browse the repository at this point in the history
…sole
  • Loading branch information
SonOfHarris committed Jun 7, 2023
1 parent 27b2d76 commit 0d0b556
Showing 1 changed file with 0 additions and 60 deletions.
60 changes: 0 additions & 60 deletions src/Schema/ResourceInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -430,64 +430,4 @@ public function route($id = null, $relation = null)
}
return null;
}

/**
* Returns the PHPDoc tags for the model based on the field,
* join and assocation definitions.
*
* @return string[]
*/
public function getModelPhpDoc()
{
$lines = [];
$schema = $this->getWrapper()->schema;

foreach ($this->fields as $name => $type) {
$dataType = $schema->dataType($type);
$lines[] = '@property ' . $dataType->phpType() . ' $' . $this->attributeName($name);
}

if (count($this->joins) > 0) {
$lines[] = '';
foreach ($this->joins as $name => $class) {
$lines[] = '@property ' . $class . ' $' . $this->attributeName($name);
}
}

if (count($this->assocs) > 0) {
$lines[] = '';
foreach ($this->assocs as $name => $class) {
$lines[] = '@property ' . $class . ' $' . $this->attributeName($name);
}
}

return $lines;
}

/**
* Returns the PHPDoc tags for the wrapper class.
*
* @return string[]
*/
public function getWrapperPhpDoc()
{
$lines = [];
$modelClass = str_replace('CommunityDS\Deputy\Api\\', '', $this->modelClass);
if ($this->endpoints === true) {
$lines[] = '@method ' . $modelClass . ' create' . $this->getSingularName() . '()';
$lines[] = '@method ' . $modelClass . ' delete' . $this->getSingularName() . '($id)';
$lines[] = '@method ' . $modelClass . ' get' . $this->getSingularName() . '($id)';
if ($this->getSingularName() != $this->getPluralName()) {
$lines[] = '@method ' . $modelClass . '[] get' . $this->getPluralName() . '()';
}
$lines[] = '@method Query find' . $this->getPluralName() . '()';
} elseif (is_array($this->endpoints)) {
foreach ($this->endpoints as $method => $uri) {
if ($method == 'id') {
$lines[] = '@method ' . $modelClass . ' get' . $this->getSingularName() . '($id)';
}
}
}
return $lines;
}
}

0 comments on commit 0d0b556

Please sign in to comment.