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 Tests; | |
use Illuminate\Database\Eloquent\Model; | |
use PHPUnit\Framework\Constraint\Constraint; | |
/** | |
* Constraint that asserts that the Collection it is applied to contains | |
* a given value. |
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
# app/Providers/AppServiceProvider.php | |
<?php | |
namespace App\Providers; | |
use Illuminate\Support\Carbon; | |
use Illuminate\Support\ServiceProvider; | |
class AppServiceProvider extends ServiceProvider |
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 Amp\ByteStream; | |
use Amp\Promise; | |
class OutputBuffer implements OutputStream, Promise { | |
private $contents; | |
/** @var \Throwable Used to fail future writes on failure. */ |
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 | |
use Illuminate\Support\Collection; | |
/** | |
* Invoke the method each (nested) item of the collection, returning the result of each invoked method. | |
* | |
* @var string $method The method or the path of the method separated with @. | |
* @var mixed $arguments,... Any optional arguments to pass to the invoked method. | |
* @return static |
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 Color | |
{ | |
/** | |
* Convert a hex color to RGB. | |
* | |
* @param string $hex #BADA55 | |
* @return array{int,int,int} [186, 218, 85] | |
*/ |
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 curry(callable $function) | |
{ | |
$args = array_slice(func_get_args(), 1); | |
return function() use ($function, $args) { | |
return call_user_func_array($function, array_merge($args, func_get_args())); | |
}; | |
} |