public function count_favourites_by_type(string $component, string $itemtype, \context $context = null) {
        $criteria = [
            'userid' => $this->userid,
            'component' => $component,
            'itemtype' => $itemtype
        ];

        if ($context) {
            $criteria['contextid'] = $context->id;
        }

        return $this->repo->count_by($criteria);
    }
public function count_favourites_by_type(string $component, string $itemtype, \context $context = null) {
        $criteria = [
            'userid' => $this->userid,
            'component' => $component,
            'itemtype' => $itemtype
        ];

        if ($context) {
            $criteria['contextid'] = $context->id;
        }

        return $this->repo->count_by($criteria);
    }
public function count_favourites_by_type ( string $ component , string $ itemtype , \ context $ context = null ) { $ criteria = [ 'userid' => $ this -> userid , 'component' => $ component , 'itemtype' => $ itemtype ] ; if ( $ context ) { $ criteria [ 'contextid' ] = $ context -> id ; } return $ this -> repo -> count_by ( $ criteria ) ; }
Count the favourite by item type.

@param string $component the frankenstyle component name.
@param string $itemtype the type of the favourited item.
@param \context|null $context the context of the item which was favourited.
@return int
Count the favourite by item type .