for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* XMPP Library
*
* Copyright (C) 2016, Some right reserved.
* @author Kacper "Kadet" Donat <[email protected]>
* Contact with author:
* Xmpp: [email protected]
* E-mail: [email protected]
* From Kadet with love.
*/
namespace Kadet\Xmpp\Utils\helper;
use Kadet\Xmpp\Utils\Dumper;
* Returns exception friendly type of value.
* @param $value
* @return string
function typeof($value) : string
{
if(is_object($value)) {
return "object of type ".get_class($value);
} elseif(is_resource($value)) {
return get_resource_type($value).' resource';
} else {
return gettype($value);
}
function partial(callable $callable, $argument, int $position = 0) : callable
return function(...$arguments) use ($callable, $argument, $position) {
$arguments = array_merge(
array_slice($arguments, 0, $position),
[ $argument ],
array_slice($arguments, $position)
);
return $callable(...$arguments);
};
function dd($value)
echo Dumper::get()->dump($value).PHP_EOL.PHP_EOL;
function format($string, array $arguments = [])
return str_replace(array_map(function($e) { return "{{$e}}"; }, array_keys($arguments)), $arguments, $string);