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 | |
public function testInterval() | |
{ | |
$date = new DateTime('+1 month'); | |
$date->add(\DateInterval::createFromDateString('3 months')); | |
// Tested on 2016-08-31 | |
// Failed asserting that two DateTime objects are equal. |
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 | |
// singleton | |
class FooApiClient | |
{ | |
private function __construct(); | |
public static function getInstance(): FooApiClient; | |
public function getBar(): Bar; |
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 | |
// warstwa aplikacji – tutaj udostępniamy co aplikacja może zrobić | |
namespace CalculatorCompany\CalculatorProject\Application; | |
class AddNumbersUseCase | |
{ | |
public function handle($firstNumber, $secondNumber) | |
{ | |
$result = $this->calculator->add($firstNumber, $secondNumber); |
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
.PostSummary__header > h1 > a:visited, /* articles feed */ | |
article[itemtype="http://schema.org/blogPost"] a:visited, /* article content */ | |
.entry-content a:visited { /* comments */ | |
color: #76B; /* kinda violet, feel free to change it */ | |
} |
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 | |
/** | |
* Simpler version of | |
* https://github.com/dddinphp/repository-examples/blob/master/src/Infrastructure/Persistence/Doctrine/DoctrinePostRepository.php#L64 | |
* | |
* Thanks to using inheritance. | |
*/ | |
namespace Infrastructure\Persistence\Doctrine; |
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 BasicStuff | |
{ | |
public function foo() | |
{ | |
/* does basic stuff */ | |
} | |
} |
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 | |
$client = new GuzzleHttp\Client(); | |
$response = $client->request('POST', 'http://localhost:8000/hello/world', [ | |
'form_params' => [ | |
'name' => 'Norbert', | |
], | |
'timeout' => 30, | |
]); |
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
<!DOCTYPE html> | |
<html> | |
<body> | |
<script async src="test.js"></script> | |
<script> | |
helloFromTestJs('ok'); | |
</script> | |
</body> | |
</html> |
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 ShowBlogPostsController | |
{ | |
/** | |
* @param ShowBlogPostUseCase | |
**/ | |
private $useCase; | |
/** |
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 AppBundle\Form\DataTransformer; | |
use AppBundle\Entity\Entity; | |
use AppBundle\Entity\EntityRepository; | |
use Symfony\Component\Form\DataTransformerInterface; | |
use Symfony\Component\Form\Exception\TransformationFailedException; | |
class EntitiesToIdsDataTransformer implements DataTransformerInterface |