-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Реализована фильтрация вывода каталога в зависимости от типа автомобиля.
- Loading branch information
Showing
9 changed files
with
88 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
namespace NS\TecDocSite\Common; | ||
|
||
use NS\ABCPApi\Common\CarType; | ||
|
||
/** | ||
* Класс содержит вспомогательные функции. | ||
* | ||
* Class Helper | ||
* @package NS\TecDocSite\Common | ||
*/ | ||
class Helper | ||
{ | ||
/** | ||
* Содержит допустимые типы автомобилей. | ||
* | ||
* @var int[] | ||
*/ | ||
public static $availableCarTypes = [ | ||
CarType::ALL, | ||
CarType::CARS, | ||
CarType::TRUCKS, | ||
CarType::LIGHT_TRUCKS, | ||
]; | ||
|
||
/** | ||
* Возвращает тип автомобиля в зависимости от переданных GET параметров. | ||
* | ||
* @return int | ||
*/ | ||
public static function getCarId() | ||
{ | ||
return isset($_GET['carType']) && in_array($_GET['carType'], | ||
self::$availableCarTypes) ? (int)$_GET['carType'] : 0; | ||
} | ||
|
||
/** | ||
* Возвращает текст для использования в ссылка для типа автомобиля в зависимости от переданных GET параметров. | ||
* | ||
* @return string | ||
*/ | ||
public static function getCarIdUrl() | ||
{ | ||
return isset($_GET['carType']) && in_array($_GET['carType'], | ||
self::$availableCarTypes) ? "&carType={$_GET['carType']}" : ''; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters