protected function checkCompletedAchievements($owner): int
    {
        $achievements = $this->storage->getAchievementsWithProgressFor($owner, $this->achievementsToCheck);
        $this->achievementsToCheck = [];

        if (!$achievements || !count($achievements)) {
            return 0;
        }

        $completedAchievements = array_filter($achievements, function (Achievement $achievement) {
            return !$achievement->completed() && $this->isCompletedAchievement($achievement);
        });

        if (count($completedAchievements) > 0) {
            $this->storage->setAchievementsCompleted($owner, $completedAchievements);
        }

        return count($completedAchievements);
    }
protected function checkCompletedAchievements($owner): int
    {
        $achievements = $this->storage->getAchievementsWithProgressFor($owner, $this->achievementsToCheck);
        $this->achievementsToCheck = [];

        if (!$achievements || !count($achievements)) {
            return 0;
        }

        $completedAchievements = array_filter($achievements, function (Achievement $achievement) {
            return !$achievement->completed() && $this->isCompletedAchievement($achievement);
        });

        if (count($completedAchievements) > 0) {
            $this->storage->setAchievementsCompleted($owner, $completedAchievements);
        }

        return count($completedAchievements);
    }
protected function checkCompletedAchievements ( $ owner ) : int { $ achievements = $ this -> storage -> getAchievementsWithProgressFor ( $ owner , $ this -> achievementsToCheck ) ; $ this -> achievementsToCheck = [ ] ; if ( ! $ achievements || ! count ( $ achievements ) ) { return 0 ; } $ completedAchievements = array_filter ( $ achievements , function ( Achievement $ achievement ) { return ! $ achievement -> completed ( ) && $ this -> isCompletedAchievement ( $ achievement ) ; } ) ; if ( count ( $ completedAchievements ) > 0 ) { $ this -> storage -> setAchievementsCompleted ( $ owner , $ completedAchievements ) ; } return count ( $ completedAchievements ) ; }
Checks all saved achievements for completeness state.

Returns number of completed achievements.

@param mixed $owner

@return int
Checks all saved achievements for completeness state .