View symfony-deserialize-json-to-dto.php
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 'vendor/autoload.php'; | |
use Symfony\Component\PropertyInfo\Extractor\ConstructorExtractor; | |
use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor; | |
use Symfony\Component\PropertyInfo\PropertyInfoExtractor; | |
use Symfony\Component\Serializer\Encoder\JsonEncoder; | |
use Symfony\Component\Serializer\Normalizer\ArrayDenormalizer; | |
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; |
View SafeCast.php
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 | |
final class SafeCast | |
{ | |
/** | |
* Converts the given variable to an integer. | |
* | |
* Allowed types are int, float and string. | |
* | |
* - int values are returned as is; |
View composer.json
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
{ | |
"require": { | |
"doctrine/orm": "^2.8", | |
"brick/geo": "^0.4.0" | |
} | |
} |
View generate-Psalm-CallMap.php
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 | |
// Configure here the classes to export. Example: | |
$classes = [ | |
'GEOSGeometry', | |
'GEOSWKBReader', | |
'GEOSWKBWriter', | |
'GEOSWKTReader', | |
'GEOSWKTWriter' | |
]; |
View tokenize-php-script.php
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 | |
/** | |
* Tokenizes a PHP script with token_get_all(), and outputs a readable representation. | |
* | |
* Usage: tokenize-php-script.php FILE.php | |
* | |
* Sample output: | |
* | |
* 1 T_OPEN_TAG <?php\n |
View getDominantColor.php
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 | |
/** | |
* Two methods to get the dominant color from an image. | |
* Useful to create placeholders while loading an image. | |
* | |
* Method 1 yields more bright colors than method 2. | |
*/ | |
/** |
View errorLevelToConstants.php
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 | |
/** | |
* Examples: | |
* | |
* errorLevelToConstants(E_WARNING) => ['E_WARNING', 'E_ALL'] | |
* errorLevelToConstants(3) => ['E_ERROR', 'E_WARNING', 'E_ALL'] | |
* | |
* @return string[] | |
*/ |
View ca.crt
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
-----BEGIN CERTIFICATE----- | |
MIIDdTCCAl2gAwIBAgIUN09wV0sbUhrzQ9WonV0xOabJqJ8wDQYJKoZIhvcNAQEL | |
BQAwSjELMAkGA1UEBhMCVVMxGDAWBgNVBAoMD19EZXZlbG9wbWVudCBDQTEhMB8G | |
A1UEAwwYRGV2ZWxvcG1lbnQgY2VydGlmaWNhdGVzMB4XDTIwMTAxNDE2MTA0NFoX | |
DTMwMTAxMjE2MTA0NFowSjELMAkGA1UEBhMCVVMxGDAWBgNVBAoMD19EZXZlbG9w | |
bWVudCBDQTEhMB8GA1UEAwwYRGV2ZWxvcG1lbnQgY2VydGlmaWNhdGVzMIIBIjAN | |
BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzpZt/KQzyM+eJW336oeZFb+wqrBQ | |
gcTPttoRIbaVKvxsGUiXcf1RaYrn9KLfNn3J6HGv6s1gO/sPooNch53dq8pkqPtZ | |
VQUn66A/0FIMvkBd0Y/zTb5n4eTFwJcrn1xhYiBEODkkr+4c6YAAzDGg2ngY6gay | |
0womr6C72NDOFQCXVewr+KkXi6DWqIF1cE4hBZ0i97ASMCkWGL/3+cotzmbdBkE1 |
View bootstrap.php
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); | |
error_reporting(E_ALL); | |
set_error_handler(function ($severity, $message, $file, $line) { | |
if ((error_reporting() & $level) === 0) { | |
return false; | |
} |
View dump.php
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 | |
/** | |
* Example valid with benmorel/smartdump~0.2.0 | |
* | |
* https://github.com/BenMorel/smartdump | |
*/ | |
use BenMorel\SmartDump\Configuration\DumpConfiguration; | |
use BenMorel\SmartDump\Configuration\TargetTable; |
NewerOlder