mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-28 04:30:08 +02:00
Fixed code style.
This commit is contained in:
parent
2853e471c4
commit
d0b1024d80
212 changed files with 495 additions and 1005 deletions
|
@ -69,10 +69,10 @@ class NodesListBuilder
|
|||
* Gets a flattened hierachical tree. Useful for generating option lists.
|
||||
* In difference to the Repository Function, the results here are cached.
|
||||
*
|
||||
* @param string $class_name The class name of the entity you want to retrieve.
|
||||
* @param string $class_name the class name of the entity you want to retrieve
|
||||
* @param AbstractStructuralDBElement|null $parent This entity will be used as root element. Set to null, to use global root
|
||||
*
|
||||
* @return AbstractStructuralDBElement[] A flattened list containing the tree elements.
|
||||
* @return AbstractStructuralDBElement[] a flattened list containing the tree elements
|
||||
*/
|
||||
public function typeToNodesList(string $class_name, ?AbstractStructuralDBElement $parent = null): array
|
||||
{
|
||||
|
|
|
@ -94,7 +94,7 @@ class ToolsTreeBuilder
|
|||
* Generates the tree for the tools menu.
|
||||
* The result is cached.
|
||||
*
|
||||
* @return TreeViewNode[] The array containing all Nodes for the tools menu.
|
||||
* @return TreeViewNode[] the array containing all Nodes for the tools menu
|
||||
*/
|
||||
public function getTree(): array
|
||||
{
|
||||
|
@ -264,8 +264,6 @@ class ToolsTreeBuilder
|
|||
|
||||
/**
|
||||
* This function creates the tree entries for the "system" node of the tools tree.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getSystemNodes(): array
|
||||
{
|
||||
|
|
|
@ -82,7 +82,7 @@ class TreeViewGenerator
|
|||
* Set to empty string, to disable href field.
|
||||
* @param AbstractDBElement|null $selectedElement The element that should be selected. If set to null, no element will be selected.
|
||||
*
|
||||
* @return TreeViewNode[] An array of TreeViewNode[] elements of the root elements.
|
||||
* @return TreeViewNode[] an array of TreeViewNode[] elements of the root elements
|
||||
*/
|
||||
public function getTreeView(string $class, ?AbstractStructuralDBElement $parent = null, string $href_type = 'list_parts', ?AbstractDBElement $selectedElement = null): array
|
||||
{
|
||||
|
@ -114,11 +114,11 @@ class TreeViewGenerator
|
|||
$item->setSelected(true);
|
||||
}
|
||||
|
||||
if (! empty($item->getNodes())) {
|
||||
if (!empty($item->getNodes())) {
|
||||
$item->addTag((string) \count($item->getNodes()));
|
||||
}
|
||||
|
||||
if (! empty($href_type) && null !== $item->getId()) {
|
||||
if (!empty($href_type) && null !== $item->getId()) {
|
||||
$entity = $this->em->getPartialReference($class, $item->getId());
|
||||
$item->setHref($this->urlGenerator->getURL($entity, $href_type));
|
||||
}
|
||||
|
@ -138,16 +138,16 @@ class TreeViewGenerator
|
|||
* The treeview is generic, that means the href are null and ID values are set.
|
||||
*
|
||||
* @param string $class The class for which the tree should be generated
|
||||
* @param AbstractStructuralDBElement|null $parent The parent the root elements should have.
|
||||
* @param AbstractStructuralDBElement|null $parent the parent the root elements should have
|
||||
*
|
||||
* @return TreeViewNode[]
|
||||
*/
|
||||
public function getGenericTree(string $class, ?AbstractStructuralDBElement $parent = null): array
|
||||
{
|
||||
if (! is_a($class, AbstractNamedDBElement::class, true)) {
|
||||
if (!is_a($class, AbstractNamedDBElement::class, true)) {
|
||||
throw new \InvalidArgumentException('$class must be a class string that implements StructuralDBElement or NamedDBElement!');
|
||||
}
|
||||
if (null !== $parent && ! is_a($parent, $class)) {
|
||||
if (null !== $parent && !is_a($parent, $class)) {
|
||||
throw new \InvalidArgumentException('$parent must be of the type $class!');
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue