public function getItemCategories(RdfResource $item)
    {
        $categories = [];
        foreach ($item->getTypes() as $class) {
            $eligibleProperties = $this->getElligibleProperties($class);
            $propertiesValues = $item->getPropertiesValues(array_keys($eligibleProperties));

            foreach ($propertiesValues as $propertyValues) {
                foreach ($propertyValues as $value) {
                    if ($value instanceof RdfResource) {
                        $sanitizedIdentifier = self::sanitizeCategoryName($value->getLabel());
                    } else {
                        $sanitizedIdentifier = self::sanitizeCategoryName((string)$value);
                    }
                    $categories[] = $sanitizedIdentifier;
                }
            }
        }

        return $categories;
    }
public function getItemCategories(RdfResource $item)
    {
        $categories = [];
        foreach ($item->getTypes() as $class) {
            $eligibleProperties = $this->getElligibleProperties($class);
            $propertiesValues = $item->getPropertiesValues(array_keys($eligibleProperties));

            foreach ($propertiesValues as $propertyValues) {
                foreach ($propertyValues as $value) {
                    if ($value instanceof RdfResource) {
                        $sanitizedIdentifier = self::sanitizeCategoryName($value->getLabel());
                    } else {
                        $sanitizedIdentifier = self::sanitizeCategoryName((string)$value);
                    }
                    $categories[] = $sanitizedIdentifier;
                }
            }
        }

        return $categories;
    }
public function getItemCategories ( RdfResource $ item ) { $ categories = [ ] ; foreach ( $ item -> getTypes ( ) as $ class ) { $ eligibleProperties = $ this -> getElligibleProperties ( $ class ) ; $ propertiesValues = $ item -> getPropertiesValues ( array_keys ( $ eligibleProperties ) ) ; foreach ( $ propertiesValues as $ propertyValues ) { foreach ( $ propertyValues as $ value ) { if ( $ value instanceof RdfResource ) { $ sanitizedIdentifier = self :: sanitizeCategoryName ( $ value -> getLabel ( ) ) ; } else { $ sanitizedIdentifier = self :: sanitizeCategoryName ( ( string ) $ value ) ; } $ categories [ ] = $ sanitizedIdentifier ; } } } return $ categories ; }
Get the categories of an item

@param RdfResource $item the item

@return string[] the list of categories
Get the categories of an item