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
| (ns phel-exercises\exercise\count-words) | |
| (defn- fill-keys | |
| "Exchanges all keys with their associated values in an array." | |
| [xs v] | |
| (-> (to-php-array xs) | |
| (php/array_fill_keys v) | |
| (php-array-to-table))) | |
| ###################### |
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
| pushedrev=$1 | |
| basename=${2:-develop} | |
| if ! baserev="$(git rev-parse --verify refs/heads/"$basename" 2>/dev/null)"; then | |
| echo "'$basename' is missing, call for help!" | |
| exit 1 | |
| fi | |
| parents_of_commits_beyond_base="$( | |
| git rev-list --pretty=tformat:%P "$pushedrev" --not "$baserev" | |
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
| THE WORKS OF | |
| HERMAN MELVILLE | |
| STANDARD EDITION | |
| VOLUME | |
| VII | |
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 | |
| declare(strict_types=1); | |
| namespace CompanyTest\Domain; | |
| use PHPUnit\Framework\TestCase; | |
| final class MyBusinessLogicTest extends TestCase | |
| { |
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 declare(strict_types=1); | |
| namespace Company\Domain; | |
| final class MyBusinessLogic | |
| { | |
| private DependencyInterface $dependencyInterface; | |
| private ConcreteDependency $concrete; | |
| public function __construct( |
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 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 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 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 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 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 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 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' |