mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-28 12:40:08 +02:00
Fixed code style.
This commit is contained in:
parent
1aed1d1d26
commit
9a7223a301
142 changed files with 534 additions and 716 deletions
|
@ -38,9 +38,9 @@ class BBCodeToMarkdownConverter
|
|||
* Converts the given BBCode to markdown.
|
||||
* BBCode tags that does not have a markdown aequivalent are outputed as HTML tags.
|
||||
*
|
||||
* @param $bbcode string The Markdown that should be converted.
|
||||
* @param $bbcode string The Markdown that should be converted
|
||||
*
|
||||
* @return string The markdown version of the text.
|
||||
* @return string the markdown version of the text
|
||||
*/
|
||||
public function convert(string $bbcode): string
|
||||
{
|
||||
|
|
|
@ -21,10 +21,8 @@
|
|||
|
||||
namespace App\Helpers\Trees;
|
||||
|
||||
|
||||
use App\Entity\Base\StructuralDBElement;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use RecursiveIterator;
|
||||
|
||||
class StructuralDBElementIterator extends \ArrayIterator implements \RecursiveIterator
|
||||
{
|
||||
|
@ -37,22 +35,24 @@ class StructuralDBElementIterator extends \ArrayIterator implements \RecursiveIt
|
|||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function hasChildren()
|
||||
{
|
||||
/** @var StructuralDBElement $element */
|
||||
$element = $this->current();
|
||||
|
||||
return !empty($element->getSubelements());
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getChildren()
|
||||
{
|
||||
/** @var StructuralDBElement $element */
|
||||
$element = $this->current();
|
||||
return new StructuralDBElementIterator($element->getSubelements()->toArray());
|
||||
|
||||
return new self($element->getSubelements()->toArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,11 +21,6 @@
|
|||
|
||||
namespace App\Helpers\Trees;
|
||||
|
||||
use App\Entity\Base\DBElement;
|
||||
use App\Entity\Base\NamedDBElement;
|
||||
use App\Entity\Base\StructuralDBElement;
|
||||
use App\Helpers\Trees\TreeViewNodeState;
|
||||
|
||||
/**
|
||||
* This class represents a node for the bootstrap treeview node.
|
||||
* When you serialize an array of these objects to JSON, you can use the serialized data in data for the treeview.
|
||||
|
@ -63,9 +58,10 @@ class TreeViewNode implements \JsonSerializable
|
|||
/**
|
||||
* Return the ID of the entity associated with this node.
|
||||
* Null if this node is not connected with an entity.
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getId() : ?int
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
@ -73,12 +69,13 @@ class TreeViewNode implements \JsonSerializable
|
|||
/**
|
||||
* Sets the ID of the entity associated with this node.
|
||||
* Null if this node is not connected with an entity.
|
||||
* @param int|null $id
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setId(?int $id): self
|
||||
{
|
||||
$this->id = $id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -208,27 +205,27 @@ class TreeViewNode implements \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function jsonSerialize()
|
||||
{
|
||||
$ret = [
|
||||
'text' => $this->text
|
||||
'text' => $this->text,
|
||||
];
|
||||
|
||||
if($this->href !== null) {
|
||||
if (null !== $this->href) {
|
||||
$ret['href'] = $this->href;
|
||||
}
|
||||
|
||||
if($this->tags !== null) {
|
||||
if (null !== $this->tags) {
|
||||
$ret['tags'] = $this->tags;
|
||||
}
|
||||
|
||||
if($this->nodes !== null) {
|
||||
if (null !== $this->nodes) {
|
||||
$ret['nodes'] = $this->nodes;
|
||||
}
|
||||
|
||||
if($this->state !== null) {
|
||||
if (null !== $this->state) {
|
||||
$ret['state'] = $this->state;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,11 +21,8 @@
|
|||
|
||||
namespace App\Helpers\Trees;
|
||||
|
||||
use App\Helpers\Trees\TreeViewNode;
|
||||
|
||||
class TreeViewNodeIterator extends \ArrayIterator implements \RecursiveIterator
|
||||
{
|
||||
|
||||
/**
|
||||
* @param $nodes TreeViewNode[]
|
||||
*/
|
||||
|
@ -35,22 +32,24 @@ class TreeViewNodeIterator extends \ArrayIterator implements \RecursiveIterator
|
|||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function hasChildren()
|
||||
{
|
||||
/** @var TreeViewNode $element */
|
||||
$element = $this->current();
|
||||
|
||||
return !empty($element->getNodes());
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getChildren()
|
||||
{
|
||||
/** @var TreeViewNode $element */
|
||||
$element = $this->current();
|
||||
return new TreeViewNodeIterator($element->getNodes());
|
||||
|
||||
return new self($element->getNodes());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,20 +75,20 @@ class TreeViewNodeState implements \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function jsonSerialize()
|
||||
{
|
||||
$ret = [];
|
||||
if ($this->selected !== null) {
|
||||
if (null !== $this->selected) {
|
||||
$ret['selected'] = $this->selected;
|
||||
}
|
||||
|
||||
if($this->disabled !== null) {
|
||||
if (null !== $this->disabled) {
|
||||
$ret['disabled'] = $this->disabled;
|
||||
}
|
||||
|
||||
if($this->expanded !== null) {
|
||||
if (null !== $this->expanded) {
|
||||
$ret['expanded'] = $this->expanded;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue