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 FactoryA implements FactoryInterface { | |
public function __construct( | |
private readonly ARepository $aRepository, | |
private readonly ExtractorFactory $extractorFactory | |
) { } | |
public static function getType(): ObjectType { |
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
import Data.List.Split(splitOn) | |
isWin :: [[Maybe Integer]] -> Bool | |
isWin xs = any isWin1 [xs, revertMatrix xs []] where | |
revertMatrix [] newMat = newMat | |
revertMatrix xs newMat = revertMatrix (filter (\y -> length y > 0) (map tail xs)) (newMat ++ [map head xs]) | |
isWin1 [] = False |
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 | |
function sumStrings($a, $b) { | |
$intMaxLength = strlen((string)PHP_INT_MAX) - 2; | |
$aArr = str_split(strrev($a), ($intMaxLength)); | |
$bArr = str_split(strrev($b), $intMaxLength); | |
$add = 0; | |
$res = []; | |
$aArrLength = (count($aArr)); | |
foreach ($aArr as $k => $block) { | |
$i = (int)(strrev($block)) + (int)strrev($bArr[$k] ?? '0') + $add; |
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
class Number { | |
private $precision; | |
private $int; | |
public function __construct($number) | |
{ | |
$this->precision = (int)$this->getPrecision($number); | |
$this->int = pow(10, $this->precision) * $number; | |
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 Trans { | |
private $word; | |
public function __construct(string $word) { | |
$this->word = $word; | |
} | |
public function __invoke(array $replaces) { | |
return str_replace(array_keys($replaces), array_values($replaces), $this->word); |
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 | |
$url1 = 'https://vk.com/t_baks'; | |
$url2 = 'https://vk.com/mih_in'; | |
$content = preg_replace("(\n)", "", file_get_contents($url1)); | |
$content2 = preg_replace("(\n)", "", file_get_contents($url2)); | |
preg_match_all("#<head>(.*)<\/head>#i", $content, $head); | |
preg_match_all("#<head>(.*)<\/head>#i", $content2, $head2); | |
$match = explode('<',$head[1][0]); | |
$match2 = explode('<',$head2[1][0]); | |
$headLayout = array_intersect($match, $match2); |
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 | |
namespace Library\Mongo; | |
abstract class AbstractEntity | |
{ | |
private $fields = array(); | |
private $_id; | |
/** | |
* @var $mongoCollection /MongoCollection |
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 | |
require_once __DIR__ . '/../vendor/autoload.php'; | |
require_once __DIR__ . '/config/constant.php'; | |
function requireAllConfigFilesFrom($dir) | |
{ | |
foreach (new DirectoryIterator($dir) as $fileInfo) { | |
if ($fileInfo->isDot()) { | |
continue; |