<?php
namespace App\Twig;
use App\Services\Core\Bank;
use App\Services\Core\Core;
use App\Services\Core\Users;
use App\Services\House;
use App\Services\Messages;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;
use Twig\TwigFunction;
class HousesExtension extends AbstractExtension
{
public function __construct(Core $coreService,
Users $userService,
\App\Services\Menu\Core $coreMenu,
Bank $bank,
House $house,
Messages $message
) {
$this->core = $coreService;
$this->users = $userService;
$this->coreMenu = $coreMenu;
$this->bank = $bank;
$this->house = $house;
$this->message = $message;
}
public function getFunctions(): array
{
return [
new TwigFunction('getHousesUserAgency', [$this, 'getHousesUserAgency']),
new TwigFunction('getHousesHouseFavoris', [$this, 'getHousesHouseFavoris']),
new TwigFunction('getHousesHouseCandidatures', [$this, 'getHousesHouseCandidatures']),
new TwigFunction('getHousesFirstPhoto', [$this, 'getHousesFirstPhoto']),
new TwigFunction('getHousesAgencyHousesCount', [$this, 'getHousesAgencyHousesCount']),
new TwigFunction('getHousesLinks', [$this, 'getHousesLinks']),
new TwigFunction('getHousesMenu', [$this, 'getHousesMenu']),
new TwigFunction('getHousesMenuLinks', [$this, 'getHousesMenuLinks']),
new TwigFunction('getHousesExternalUrl', [$this, 'getHousesExternalUrl']),
new TwigFunction('getHousesMenuHeaderLinks', [$this, 'getHousesMenuHeaderLinks']),
new TwigFunction('getSyndicatsPropertyLots', [$this, 'getSyndicatsPropertyLots']),
];
}
public function getFilters()
{
return [
new TwigFilter('clean_n', [$this, 'clean_n']),
];
}
public function getSyndicatsPropertyLots($syndicatPropertyID)
{
return $this->house->getSyndicatsPropertyLots($syndicatPropertyID);
}
public function getHousesExternalUrl($url)
{
return $this->house->externalUrl($url);
}
public function getHousesMenuLinks($menuFooter)
{
return $this->house->getMenuLinks($menuFooter);
}
public function getHousesLinks($agency = null)
{
return $this->house->getLinks($agency);
}
public function getHousesMenu($agency = null)
{
return $this->house->getMenu($agency);
}
public function getHousesMenuHeaderLinks($agency = null,$name)
{
return $this->house->getMenuHeaderLinks($agency,$name);
}
public function getHousesAgencyHousesCount($agencyID)
{
return $this->house->countOnline($agencyID);
}
public function getHousesFirstPhoto($houseID)
{
return $this->house->getFirstPhoto($houseID);
}
public function getHousesHouseFavoris($houseID,$userID)
{
return $this->house->favoris($houseID,$userID);
}
public function getHousesHouseCandidatures($houseID,$userID)
{
return $this->house->candidatures($houseID,$userID);
}
public function getHousesUserAgency($userID)
{
return $this->house->getUserAgency($userID);
}
}