This file contains hidden or 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 | |
interface ComparativeFood | |
{ | |
public static function isApplicable(Food $food) | |
} | |
class Food {} | |
abstract class MarketFood implements ComparativeFood | |
{ | |
public function __construct(Food $food, Envirorment $env) | |
{} |
This file contains hidden or 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 | |
use Behat\MinkExtension\Context\MinkContext; | |
use Behat\Behat\Context\Context; | |
use Behat\Behat\Context\SnippetAcceptingContext; | |
use Behat\Gherkin\Node\PyStringNode; | |
use Behat\Gherkin\Node\TableNode; | |
/** | |
* Defines application features from the specific context. |
This file contains hidden or 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 | |
public function testGetFiles() | |
{ | |
$method = self::getMethod('getFiles'); | |
$command = new ImportLogsCommand(); | |
$files = $method->invokeArgs($command, [realpath(__DIR__.'/../..')]); | |
$this->assertContains(realpath(__DIR__.'/ImportLogsCommandTest.php'), $files); | |
$this->assertContains(realpath(__DIR__.'/../../AppBundle.php'), $files); | |
} |
This file contains hidden or 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 | |
/** | |
* @param $dir | |
* @param array $files | |
* @return array | |
*/ | |
protected function getFiles($dir, array &$files = []) | |
{ | |
foreach (scandir($dir) as $file) { | |
if (in_array($file, [".", ".."])) { |
This file contains hidden or 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
function pager(val) { | |
var pager = document.getElementById("log_search_type_limit"), | |
perpage = pager.options[pager.selectedIndex].value, | |
url = replaceQueryParam('limit', perpage, window.location.search); | |
window.location = window.location.pathname + url; | |
} | |
function replaceQueryParam(param, newval, search) { | |
var regex = new RegExp("([?;&])" + param + "[^&;]*[;&]?"); | |
var query = search.replace(regex, "$1").replace(/&$/, ''); |
This file contains hidden or 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
{% set limit = app.request.query.get('limit')|default(10) %} | |
<select class="form-control" onchange="pager()" id="perPageSelector"> | |
<option {% if limit == 10 %}selected{% endif %} value="10">10</option> | |
<option {% if limit == 25 %}selected{% endif %} value="25">25</option> | |
<option {% if limit == 50 %}selected{% endif %} value="50">50</option> | |
<option {% if limit == 100 %}selected{% endif %} value="100">100</option> | |
</select> |
This file contains hidden or 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 | |
$app->register(new Silex\Provider\TranslationServiceProvider(), [ | |
'locale_fallbacks' => ['en', 'uk', 'ru'], | |
]); | |
$app->before(function() use ($app) { | |
$locales = $app['translator']->getFallbackLocales(); | |
$prefLocales = array_reduce(explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']), function ($res, $el) { list($l, $q) = array_merge(explode(';q=', $el), [1]); $res[$l] = (float) $q; return $res; }, []); | |
asort($prefLocales); |
This file contains hidden or 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 | |
$prefLocales = array_reduce( | |
explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']), | |
function ($res, $el) { | |
list($l, $q) = array_merge(explode(';q=', $el), [1]); | |
$res[$l] = (float) $q; | |
return $res; | |
}, []); | |
arsort($prefLocales); |