diff --git a/src/Extensions/DefaultTermsDataExtension.php b/src/Extensions/DefaultTermsDataExtension.php index b16e7a9..c5f17f6 100644 --- a/src/Extensions/DefaultTermsDataExtension.php +++ b/src/Extensions/DefaultTermsDataExtension.php @@ -23,7 +23,6 @@ * ]; * * The terms are added by their full-path-like url slugs. - * */ class DefaultTermsDataExtension extends DataExtension { diff --git a/src/Models/ConceptClass.php b/src/Models/ConceptClass.php index f95615f..5bc15a1 100644 --- a/src/Models/ConceptClass.php +++ b/src/Models/ConceptClass.php @@ -156,7 +156,7 @@ public function canDelete($member = null): bool */ protected function getDefaultConceptClasses(): array { - return $this->config()->get('default_concept_classes') ? : []; + return $this->config()->get('default_concept_classes') ?: []; } diff --git a/src/Models/TaxonomyTerm.php b/src/Models/TaxonomyTerm.php index 67dec6d..99e0f70 100644 --- a/src/Models/TaxonomyTerm.php +++ b/src/Models/TaxonomyTerm.php @@ -63,14 +63,14 @@ class TaxonomyTerm extends BaseTerm ]; private static $has_many = [ - 'Children' => self::class . '.Parent', - 'Terms' => self::class . '.Type', + 'Children' => self::class . '.Parent', + 'Terms' => self::class . '.Type', // inverse relation of Tags to the ManyManyThrough joining object: DataObjectTaxonomyTerm 'DataObjectTaxonomyTerms' => DataObjectTaxonomyTerm::class, 'EquivalentAltTerms' => EquivalentTerm::class, 'LanguageAltTerms' => LanguageTerm::class, // inverse relation of AssociatedTerms to the ManyManyThrough joining object: AssociativeRelation - 'AssociativeRelations' => AssociativeRelation::class, + 'AssociativeRelations' => AssociativeRelation::class, ]; private static $has_one = [ @@ -499,7 +499,7 @@ public function getCMSFields() $associatedGridConfig->addComponent($editableColumns = new GridFieldEditableColumns()); $editableColumns->setDisplayFields( [ - 'ComponentAssociativeRelationTypeID' => [ + 'ComponentAssociativeRelationTypeID' => [ 'callback' => function ($record, $col, $grid) { return DropdownField::create( $col, @@ -507,7 +507,7 @@ public function getCMSFields() AssociativeRelationType::get()->map(), )->setEmptyString('--- select an associative type ---'); }, - 'title' => 'Associative type', + 'title' => 'Associative type', ], 'ComponentAssociativeIsInverseRelation' => [ 'callback' => function ($record, $col, $grid) { @@ -516,16 +516,17 @@ public function getCMSFields() 'Inverse relation (right to left)?', ); }, - 'title' => 'Inverse relation (right to left)?', + 'title' => 'Inverse relation (right to left)?', ], - 'getNameAsTag' => 'Associated taxonomy term', + 'getNameAsTag' => 'Associated taxonomy term', ] ); } else { $fields->removeFieldFromTab('Root.AssociatedTerms', 'AssociatedTerms'); $noTypesOfAssociationDefined = 'Please define at least one associative relation type first.'; - $fields->addFieldToTab('Root.AssociatedTerms', + $fields->addFieldToTab( + 'Root.AssociatedTerms', LiteralField::create( 'NoTypesOfAssociationDefined', '

' . $noTypesOfAssociationDefined . '

' @@ -750,7 +751,7 @@ public function getTermHierarchy(string $separator = ' ▸ ', callable $termsDec return sprintf('%s', $term->Name); }; - $termsDecorator = $termsDecorator ? : $plaintextDecorator; + $termsDecorator = $termsDecorator ?: $plaintextDecorator; // hierarchy parts that will be joined together with the levels separator, decorated via a callback if defined $parts = array_map($termsDecorator, array_reverse($this->getAncestors()->toArray())); @@ -927,8 +928,8 @@ public function getAllRequiredTypesNames(string $delimiter = '
'): DBHTMLTe * * The list is grouped by the alt term class, such as (e.g. EquivalentAltTerm, LanguageAltTerm etc.) * - * @return array * @throws \ReflectionException + * @return array */ public function getAllAlternativeTermsGroupedByType(): array { @@ -938,7 +939,6 @@ public function getAllAlternativeTermsGroupedByType(): array // find the first has_one field as each alternative term needs a reverse relation to this class foreach (Config::inst()->get($altTermClass, 'has_one') as $field => $taxonomyTermClass) { - if (is_a($taxonomyTermClass, self::class, true)) { if (!array_key_exists($altTermClass, $groups)) { $groups[$altTermClass] = []; @@ -1040,8 +1040,8 @@ public function getAllAlternativeTerms(): SS_List * Get a list of lists of alternative terms associated to this term for a term rich-info overview * * @param string $delimiter - * @return DBHTMLText * @throws \ReflectionException + * @return DBHTMLText */ public function getAllAlternativeTermsNames(string $delimiter = '
'): DBHTMLText { @@ -1281,8 +1281,8 @@ private static function getManyManyThroughMappingClasses() /** * Get a list of all objects tagged with this taxonomy term * - * @return ArrayList * @throws \ReflectionException + * @return ArrayList */ public function getTaggedDataObjects(): ArrayList { @@ -1317,7 +1317,7 @@ public function getTaggedDataObjects(): ArrayList foreach ($mmtMaps as $mmtMap) { $owner = $item->{$mmtMap['ownerAccessor']}(); if ($owner && $owner->exists() && $owner->ClassName === $mmtMap['ownerClass']) { - $fieldName = $mmtMap['relation']; + $fieldName = $mmtMap['relation']; $relationName = 'many_many_through'; break; @@ -1325,8 +1325,8 @@ public function getTaggedDataObjects(): ArrayList $owner = null; } } else { - $owner = $item; - $fieldName = $field; + $owner = $item; + $fieldName = $field; $relationName = $relation; }