aboutsummaryrefslogtreecommitdiff
path: root/lib/models/resources/ResourceCategory.class.php
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+github@gmail.com>2023-05-08 17:08:52 +0200
committerJan-Hendrik Willms <tleilax+github@gmail.com>2023-05-08 17:08:52 +0200
commita1fda2758e9c241ac3eb980ac8716dfedbe9dd3c (patch)
tree2190f0478fb153efdb8ba48ebb574c7691f4f351 /lib/models/resources/ResourceCategory.class.php
parent244d00ed91ad2b4b83e902a45cd6def3d7bc7e86 (diff)
let phpcsfixer fix errors according to @PSR12 rules on lib/modelsphpcsfixer
Diffstat (limited to 'lib/models/resources/ResourceCategory.class.php')
-rw-r--r--lib/models/resources/ResourceCategory.class.php26
1 files changed, 11 insertions, 15 deletions
diff --git a/lib/models/resources/ResourceCategory.class.php b/lib/models/resources/ResourceCategory.class.php
index 9738cbc..e1b90ba 100644
--- a/lib/models/resources/ResourceCategory.class.php
+++ b/lib/models/resources/ResourceCategory.class.php
@@ -292,8 +292,7 @@ class ResourceCategory extends SimpleORMap
$requestable = false,
$protected = false,
$write_permission_level = 'autor'
- )
- {
+ ) {
if (!$name) {
throw new ResourcePropertyException(
_('Es wurde kein Name für die Eigenschaft angegeben!')
@@ -424,8 +423,7 @@ class ResourceCategory extends SimpleORMap
$parent_id = '',
$properties = [],
$ignore_invalid = false
- )
- {
+ ) {
if (($this->class_name != 'Resource') and
!is_subclass_of($this->class_name, 'Resource')) {
//Invalid resource category specification:
@@ -440,7 +438,7 @@ class ResourceCategory extends SimpleORMap
);
}
- $resource = new $this->class_name;
+ $resource = new $this->class_name();
$resource->parent_id = $parent_id;
$resource->category_id = $this->id;
$resource->name = $name;
@@ -484,8 +482,7 @@ class ResourceCategory extends SimpleORMap
*/
protected function setPropertyDefaultState(
ResourcePropertyDefinition $definition
- )
- {
+ ) {
switch ($definition->type) {
case 'bool':
return false;
@@ -614,8 +611,7 @@ class ResourceCategory extends SimpleORMap
ResourceRequest $request,
$name,
$state = null
- )
- {
+ ) {
if ($request->category_id != $this->id) {
throw new InvalidResourceCategoryException(
sprintf(
@@ -710,7 +706,7 @@ class ResourceCategory extends SimpleORMap
{
if ($type) {
return ResourceCategoryProperty::countBySql(
- 'INNER JOIN resource_property_definitions
+ 'INNER JOIN resource_property_definitions
USING (property_id)
WHERE
name = :name
@@ -718,25 +714,25 @@ class ResourceCategory extends SimpleORMap
type = :type
AND
category_id = :category_id',
- [
+ [
'name' => $name,
'type' => $type,
'category_id' => $this->id
]
- ) > 0;
+ ) > 0;
} else {
return ResourceCategoryProperty::countBySql(
- 'INNER JOIN resource_property_definitions
+ 'INNER JOIN resource_property_definitions
USING (property_id)
WHERE
name = :name
AND
category_id = :category_id',
- [
+ [
'name' => $name,
'category_id' => $this->id
]
- ) > 0;
+ ) > 0;
}
}