Created
July 22, 2016 09:09
-
-
Save DeRain/9c9c3ec50e7fdc0ff8e3d8171951bcd6 to your computer and use it in GitHub Desktop.
Test task initial code
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
<?php | |
/** | |
* Class Item | |
*/ | |
class Item | |
{ | |
/** | |
* @return array | |
*/ | |
public static function getAll() | |
{ | |
return [ | |
[ | |
'name' => 'Apple', | |
'price' => 100.2, | |
], | |
[ | |
'name' => 'Asus', | |
'price' => 20.45, | |
], | |
[ | |
'name' => 'Acer', | |
'price' => 10.40, | |
], | |
[ | |
'name' => 'Dell', | |
'price' => 79.2, | |
], | |
[ | |
'name' => 'Xiaomi', | |
'price' => 89.0, | |
], | |
[ | |
'name' => 'MSI', | |
'price' => 45.742, | |
], | |
[ | |
'name' => 'HP', | |
'price' => 84.5, | |
], | |
[ | |
'name' => 'Sony', | |
'price' => 10, | |
], | |
]; | |
} | |
} | |
/** | |
* Class ItemController | |
* | |
* @link site.com | |
*/ | |
class ItemController | |
{ | |
/** | |
* @param string $itemName | |
* @return null | |
* | |
* @link site.com/get-price | |
*/ | |
public function actionGetPrice($itemName) | |
{ | |
return null; | |
} | |
/** | |
* @param string $sortDirection ASC|DESC | |
* @return null | |
* | |
* @link site.com/sort-by-price | |
*/ | |
public function actionSortByPrice($sortDirection = 'DESC') | |
{ | |
return null; | |
} | |
/** | |
* @param string $priceFrom | |
* @param string $priceTo | |
* @return null | |
* | |
* @link site.com/filter-by-price | |
*/ | |
public function actionFilterByPrice($priceFrom, $priceTo) | |
{ | |
return null; | |
} | |
} | |
?> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Prices</title> | |
</head> | |
<body> | |
<div class="container"> | |
<div class="price-selector"> | |
<label for="items">Price</label> | |
<select name="items" id="items"> | |
<option value="Apple">Apple</option> | |
<option value="Asus">Asus</option> | |
<option value="Acer"></option> | |
<option value="Dell"></option> | |
<option value="Xiaomi"></option> | |
<option value="MSI">MSI</option> | |
<option value="HP">HP</option> | |
<option value="Sony">Sony</option> | |
</select> | |
</div> | |
</div> | |
</body> | |
</html> | |
<script> | |
//Any preferred library - jQuery, Angular, etc. | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment