Spatie\BladeJavaScript\Exceptions\Untransformable::noTransformerFound PHP Method

noTransformerFound() public static method

public static noTransformerFound ( mixed $value ) : static
$value mixed
return static
    public static function noTransformerFound($value)
    {
        return new static("There is no transformer to transform {$value} to JavaScript.");
    }

Usage Example

 /**
  * @param mixed $value
  *
  * @return \Spatie\BladeJavaScript\Transformers\Transformer
  *
  * @throws \Spatie\BladeJavaScript\Exceptions\Untransformable
  */
 public function getTransformer($value) : Transformer
 {
     foreach ($this->getAllTransformers() as $transformer) {
         if ($transformer->canTransform($value)) {
             return $transformer;
         }
     }
     throw Untransformable::noTransformerFound($value);
 }