HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/rentman.komma.pro/app/Komma/StarComposer.php
<?php

namespace Komma;


class StarComposer
{

    public $rating = 9;


    public function compose($view)
    {

        if(\Config::get('business.capterra')!= null){
            $this->rating = intval(\Config::get('business.capterra'));
        }

        $stars = '';
        $halfStarPossible = $this->rating / 2 != floor($this->rating / 2);

        $amountStars = 1;
        while ($amountStars <= 5)
        {
            if($amountStars <= ($this->rating / 2))
            {
                $stars .= '<span class="active star" ></span >';
            }
            elseif($halfStarPossible){
                $stars .= '<span class="half star"><div class="inner"></div ></span>';
                $halfStarPossible = false;
            }
            else{
                $stars .= '<span class="inactive star"></span>';
            }
            $amountStars++;
        }

        $view->with(['rating' => $this->rating,'stars'=> $stars]);
    }
}