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
THE WORKS OF | |
HERMAN MELVILLE | |
STANDARD EDITION | |
VOLUME | |
VII | |
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); | |
namespace CompanyTest\Domain; | |
use PHPUnit\Framework\TestCase; | |
final class MyBusinessLogicTest extends TestCase | |
{ |
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); | |
namespace Company\Domain; | |
final class MyBusinessLogic | |
{ | |
private DependencyInterface $dependencyInterface; | |
private ConcreteDependency $concrete; | |
public function __construct( |
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); | |
use PHPUnit\Framework\TestCase; | |
interface Logger { | |
public function log(string $message): void; | |
} | |
final class LoggerSpy implements Logger { | |
public array $messages = []; |
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); | |
# https://stackoverflow.com/a/61230034/3454593 | |
// Usage example: | |
$cacheManager = new CachedRemoteSiteManager( | |
new class implements CacheNormalizer { | |
public function normalize(string $text): string { | |
return substr($text, 17, 2); | |
} | |
}, |
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); | |
# https://stackoverflow.com/a/58767497/3454593 | |
// Usage example: | |
$postWithImage = new PostWithImage( | |
$chaptersUrlApi = 'https://httpbin.org/get', | |
$imagesUrlApi = 'https://httpbin.org/get?{$key}={$value}' | |
); | |
foreach ($postWithImage->generate(20) as $post) { |
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); | |
final class EdiFileGenerator | |
{ | |
private const MESSAGE_TEMPLATE = <<<STR | |
UNH+%d+IFTMIN:S:93A:UN:PN001' | |
BGM+340+0035800000000819%d+9' | |
DTM+10:20191002:102' | |
TSR+19+A2' | |
CNT+7:0.1:KGM' |
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 gen() | |
{ | |
yield 1; | |
yield 2; | |
yield from gen2(); | |
} | |
function gen2() | |
{ |
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 | |
$gen = (function() { | |
yield 1; | |
yield 2; | |
return 3; | |
})(); | |
foreach ($gen as $val) { | |
echo $val, ' '; | |
} |