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]);
}
}