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 | |
$functions = [ | |
'array_flip & isset' => function (array $haystack, array $needles) { | |
$haystackFlip = array_flip($haystack); | |
foreach ($needles as $key => $needle) { | |
if (!isset($haystackFlip[$needle])) { | |
unset($needles[$key]); | |
} | |
} |
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 | |
define('FILTER_MATCH_EXACT', 1 << 0); | |
define('FILTER_MATCH_LOOSE', 1 << 1); | |
define('FILTER_INVERT', 1 << 2); | |
function filter(mixed $specimen, int $flags = FILTER_MATCH_EXACT): Closure | |
{ | |
// Unset FILTER_MATCH_EXACT if FILTER_MATCH_LOOSE is set. | |
if ($flags & FILTER_MATCH_LOOSE) { |
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 Cache | |
{ | |
public function has(string $id): bool | |
{ | |
} | |
public function get(string $id): array | |
{ |
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 | |
// Library Code | |
class Browser | |
{ | |
public function createPage(): Page | |
{ | |
return new Page(); | |
} | |
} |
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 | |
declare(strict_types=1); | |
function assertConstantOfClass(string $class, $constantValue): void | |
{ | |
$reflection = new ReflectionClass($class); | |
$constants = $reflection->getConstants(); | |
foreach ($constants as $value) { | |
if ($value === $constantValue) { |
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 Magic | |
{ | |
public function add() | |
{ | |
$args = func_get_args(); | |
$count = count($args); | |
$methods = []; |
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 | |
$functions = [ | |
'usort (from stackoverflow)' => function (array $input, array $order): array { | |
usort( | |
$input, | |
function ($a, $b) use ($order) { | |
$pos_a = array_search($a['id'], $order); | |
$pos_b = array_search($b['id'], $order); | |
return $pos_a - $pos_b; |
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 | |
use Symfony\Component\Console\Command\Command; | |
use Symfony\Component\Console\Helper\ProgressBar; | |
use Symfony\Component\Console\Input\InputInterface; | |
use Symfony\Component\Console\Output\ConsoleOutput; | |
use Symfony\Component\Console\Output\OutputInterface; | |
use TYPO3\CMS\Core\Database\ConnectionPool; | |
use TYPO3\CMS\Core\Utility\GeneralUtility; |
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
SELECT * | |
FROM tt_content | |
WHERE `CType` = 'list' | |
AND `list_type` = 'news_pi1' | |
AND ExtractValue(`pi_flexform`, | |
'/T3FlexForms/data/sheet[@index="sDEF"]/language[@index="lDEF"]/field[@index="switchableControllerActions"]/value[@index="vDEF"]/text()') | |
IN ("News->list;News->detail", "News->list;News->detail"); |
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
HOST=local.project.com |