for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @author Flipbox Factory
* @copyright Copyright (c) 2017, Flipbox Digital
* @link https://github.com/flipbox/transform/releases/latest
* @license https://github.com/flipbox/transform/blob/master/LICENSE
*/
namespace Flipbox\Transform\Helpers;
use Flipbox\Transform\Transformers\TransformerInterface;
* @author Flipbox Factory <[email protected]>
* @since 1.0.0
class Transformer
{
* @param $item
* @return bool
public static function isCallable($item)
return (is_string($item) && function_exists($item)) || (is_object($item) && ($item instanceof \Closure));
}
* @param $transformer
public static function isTransformer($transformer)
return static::isCallable($transformer) || $transformer instanceof TransformerInterface;
public static function isTransformerClass($transformer)
return is_string($transformer) && is_subclass_of($transformer, TransformerInterface::class);
is_subclass_of
\Flipbox\Transform\Trans...sformerInterface::class
ReflectionClass::implementsInterface